00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "H5DataTypes/AliasConfigV1.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
00042 hdf5pp::Type
00043 AliasPdsSrc::stored_type()
00044 {
00045 return native_type() ;
00046 }
00047
00048 hdf5pp::Type
00049 AliasPdsSrc::native_type()
00050 {
00051 hdf5pp::CompoundType type = hdf5pp::CompoundType::compoundType<AliasPdsSrc>() ;
00052 type.insert_native<uint32_t>( "log", offsetof(AliasPdsSrc, log) ) ;
00053 type.insert_native<uint32_t>( "phy", offsetof(AliasPdsSrc, phy) ) ;
00054 return type;
00055 }
00056
00057
00058 AliasSrcAlias::AliasSrcAlias(const Pds::Alias::SrcAlias& srcAlias)
00059 : src(srcAlias.src())
00060 {
00061 std::fill_n(aliasName, int(AliasNameMax), '\0');
00062 std::strncpy(aliasName, srcAlias.aliasName(), AliasNameMax-1);
00063 }
00064
00065 hdf5pp::Type
00066 AliasSrcAlias::stored_type()
00067 {
00068 return native_type() ;
00069 }
00070
00071 hdf5pp::Type
00072 AliasSrcAlias::native_type()
00073 {
00074 hdf5pp::CompoundType type = hdf5pp::CompoundType::compoundType<AliasSrcAlias>() ;
00075 type.insert( "src", offsetof(AliasSrcAlias, src), AliasPdsSrc::native_type() ) ;
00076 type.insert_native<const char*>( "aliasName", offsetof(AliasSrcAlias, aliasName), AliasNameMax ) ;
00077 return type;
00078 }
00079
00080
00081 AliasConfigV1::AliasConfigV1(const XtcType& data)
00082 : numSrcAlias(data.numSrcAlias())
00083 {
00084 }
00085
00086 hdf5pp::Type
00087 AliasConfigV1::stored_type()
00088 {
00089 return native_type() ;
00090 }
00091
00092 hdf5pp::Type
00093 AliasConfigV1::native_type()
00094 {
00095 hdf5pp::CompoundType type = hdf5pp::CompoundType::compoundType<AliasConfigV1>() ;
00096 type.insert_native<uint32_t>( "numSrcAlias", offsetof(AliasConfigV1, numSrcAlias) ) ;
00097 return type;
00098 }
00099
00100 void
00101 AliasConfigV1::store(const XtcType& config, hdf5pp::Group grp)
00102 {
00103
00104 AliasConfigV1 data(config);
00105 storeDataObject ( data, "config", grp ) ;
00106
00107
00108 const ndarray<const Pds::Alias::SrcAlias, 1>& pdsdata = config.srcAlias();
00109 const uint32_t count = pdsdata.size();
00110 AliasSrcAlias adata[count];
00111 for ( uint32_t i = 0 ; i < count ; ++ i ) {
00112 adata[i] = AliasSrcAlias(pdsdata[i]);
00113 }
00114 storeDataObjects ( count, adata, "aliases", grp ) ;
00115 }
00116
00117 }