H5DataTypes/src/PartitionConfigV1.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: PartitionConfigV1.cpp 7660 2014-02-13 00:21:14Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class PartitionConfigV1...
00007 //
00008 // Author List:
00009 //      Andy Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "H5DataTypes/PartitionConfigV1.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 #include <algorithm>
00022 #include <cstring>
00023 
00024 //-------------------------------
00025 // Collaborating Class Headers --
00026 //-------------------------------
00027 #include "H5DataTypes/H5DataUtils.h"
00028 #include "hdf5pp/CompoundType.h"
00029 #include "hdf5pp/TypeTraits.h"
00030 
00031 //-----------------------------------------------------------------------
00032 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00033 //-----------------------------------------------------------------------
00034 
00035 //              ----------------------------------------
00036 //              -- Public Function Member Definitions --
00037 //              ----------------------------------------
00038 
00039 namespace H5DataTypes {
00040 
00041 hdf5pp::Type
00042 PartitionPdsSrc::stored_type()
00043 {
00044   return native_type() ;
00045 }
00046 
00047 hdf5pp::Type
00048 PartitionPdsSrc::native_type()
00049 {
00050   hdf5pp::CompoundType type = hdf5pp::CompoundType::compoundType<PartitionPdsSrc>() ;
00051   type.insert_native<uint32_t>( "log", offsetof(PartitionPdsSrc, log) ) ;
00052   type.insert_native<uint32_t>( "phy", offsetof(PartitionPdsSrc, phy) ) ;
00053   return type;
00054 }
00055 
00056 
00057 
00058 hdf5pp::Type
00059 PartitionSource::stored_type()
00060 {
00061   return native_type() ;
00062 }
00063 
00064 hdf5pp::Type
00065 PartitionSource::native_type()
00066 {
00067   hdf5pp::CompoundType type = hdf5pp::CompoundType::compoundType<PartitionSource>() ;
00068   type.insert( "src", offsetof(PartitionSource, src), PartitionPdsSrc::native_type() ) ;
00069   type.insert_native<uint32_t>( "group", offsetof(PartitionSource, group) ) ;
00070   return type;
00071 }
00072 
00073 
00074 PartitionConfigV1::PartitionConfigV1(const XtcType& data)
00075   : bldMask(data.bldMask())
00076   , numSources(data.numSources())
00077 {
00078 }
00079 
00080 hdf5pp::Type
00081 PartitionConfigV1::stored_type()
00082 {
00083   return native_type() ;
00084 }
00085 
00086 hdf5pp::Type
00087 PartitionConfigV1::native_type()
00088 {
00089   hdf5pp::CompoundType type = hdf5pp::CompoundType::compoundType<PartitionConfigV1>() ;
00090   type.insert_native<uint64_t>( "bldMask", offsetof(PartitionConfigV1, bldMask) ) ;
00091   type.insert_native<uint32_t>( "numSources", offsetof(PartitionConfigV1, numSources) ) ;
00092   return type;
00093 }
00094 
00095 void
00096 PartitionConfigV1::store(const XtcType& config, hdf5pp::Group grp)
00097 {
00098   // make scalar data set for main object
00099   PartitionConfigV1 data(config);
00100   storeDataObject ( data, "config", grp ) ;
00101 
00102   // make array data set for subobject
00103   const ndarray<const Pds::Partition::Source, 1>& pdsdata = config.sources();
00104   const uint32_t count = pdsdata.size();
00105   PartitionSource adata[count];
00106   for ( uint32_t i = 0 ; i < count ; ++ i ) {
00107     adata[i] = PartitionSource(pdsdata[i]);
00108   }
00109   storeDataObjects ( count, adata, "sources", grp ) ;
00110 }
00111 
00112 } // namespace H5DataTypes

Generated on 19 Dec 2016 for PSDMSoftware by  doxygen 1.4.7