00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "H5DataTypes/PartitionConfigV1.h"
00017
00018
00019
00020
00021 #include <algorithm>
00022 #include <cstring>
00023
00024
00025
00026
00027 #include "H5DataTypes/H5DataUtils.h"
00028 #include "hdf5pp/CompoundType.h"
00029 #include "hdf5pp/TypeTraits.h"
00030
00031
00032
00033
00034
00035
00036
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
00099 PartitionConfigV1 data(config);
00100 storeDataObject ( data, "config", grp ) ;
00101
00102
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 }