00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "H5DataTypes/ImpElementV1.h"
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "hdf5pp/CompoundType.h"
00026 #include "hdf5pp/ArrayType.h"
00027 #include "hdf5pp/TypeTraits.h"
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 namespace H5DataTypes {
00038
00039 ImpSample::ImpSample ( const XtcType& data )
00040 {
00041 const ndarray<const uint16_t, 1>& channels = data.channels();
00042 std::copy(channels.begin(), channels.end(), this->channels);
00043 }
00044
00045 hdf5pp::Type
00046 ImpSample::stored_type()
00047 {
00048 return native_type() ;
00049 }
00050
00051 hdf5pp::Type
00052 ImpSample::native_type()
00053 {
00054 typedef ImpSample DsType;
00055 hdf5pp::CompoundType type = hdf5pp::CompoundType::compoundType<DsType>();
00056 hsize_t _array_type_channels_shape[] = { 4 };
00057 hdf5pp::ArrayType _array_type_channels = hdf5pp::ArrayType::arrayType(hdf5pp::TypeTraits<uint16_t>::native_type(), 1, _array_type_channels_shape);
00058 type.insert("channels", offsetof(DsType, channels), _array_type_channels);
00059 return type;
00060 }
00061
00062
00063
00064
00065 ImpLaneStatus::ImpLaneStatus ( const XtcType& data )
00066 : linkErrCount(data.linkErrCount())
00067 , linkDownCount(data.linkDownCount())
00068 , cellErrCount(data.cellErrCount())
00069 , rxCount(data.rxCount())
00070 , locLinked(data.locLinked())
00071 , remLinked(data.remLinked())
00072 , zeros(data.zeros())
00073 , powersOkay(data.powersOkay())
00074 {
00075 }
00076
00077 hdf5pp::Type
00078 ImpLaneStatus::stored_type()
00079 {
00080 return native_type() ;
00081 }
00082
00083 hdf5pp::Type
00084 ImpLaneStatus::native_type()
00085 {
00086 typedef ImpLaneStatus DsType;
00087 hdf5pp::CompoundType type = hdf5pp::CompoundType::compoundType<DsType>();
00088 type.insert("linkErrCount", offsetof(DsType, linkErrCount), hdf5pp::TypeTraits<uint8_t>::native_type());
00089 type.insert("linkDownCount", offsetof(DsType, linkDownCount), hdf5pp::TypeTraits<uint8_t>::native_type());
00090 type.insert("cellErrCount", offsetof(DsType, cellErrCount), hdf5pp::TypeTraits<uint8_t>::native_type());
00091 type.insert("rxCount", offsetof(DsType, rxCount), hdf5pp::TypeTraits<uint8_t>::native_type());
00092 type.insert("locLinked", offsetof(DsType, locLinked), hdf5pp::TypeTraits<uint8_t>::native_type());
00093 type.insert("remLinked", offsetof(DsType, remLinked), hdf5pp::TypeTraits<uint8_t>::native_type());
00094 type.insert("zeros", offsetof(DsType, zeros), hdf5pp::TypeTraits<uint16_t>::native_type());
00095 type.insert("powersOkay", offsetof(DsType, powersOkay), hdf5pp::TypeTraits<uint8_t>::native_type());
00096 return type;
00097 }
00098
00099
00100
00101
00102 ImpElementV1::ImpElementV1 ( const XtcType& data )
00103 : vc(data.vc())
00104 , lane(data.lane())
00105 , frameNumber(data.frameNumber())
00106 , range(data.range())
00107 , laneStatus(data.laneStatus())
00108 {
00109 }
00110
00111 hdf5pp::Type
00112 ImpElementV1::stored_type()
00113 {
00114 return native_type() ;
00115 }
00116
00117 hdf5pp::Type
00118 ImpElementV1::native_type()
00119 {
00120 typedef ImpElementV1 DsType;
00121 hdf5pp::CompoundType type = hdf5pp::CompoundType::compoundType<DsType>();
00122 type.insert("vc", offsetof(DsType, vc), hdf5pp::TypeTraits<uint8_t>::native_type());
00123 type.insert("lane", offsetof(DsType, lane), hdf5pp::TypeTraits<uint8_t>::native_type());
00124 type.insert("frameNumber", offsetof(DsType, frameNumber), hdf5pp::TypeTraits<uint32_t>::native_type());
00125 type.insert("range", offsetof(DsType, range), hdf5pp::TypeTraits<uint32_t>::native_type());
00126 type.insert("laneStatus", offsetof(DsType, laneStatus), hdf5pp::TypeTraits<ImpLaneStatus>::native_type());
00127 return type;
00128 }
00129
00130 hdf5pp::Type
00131 ImpElementV1::stored_data_type(uint32_t nSamples)
00132 {
00133 hdf5pp::Type baseType = hdf5pp::TypeTraits<ImpSample>::native_type() ;
00134
00135 hsize_t dims[] = { nSamples } ;
00136 return hdf5pp::ArrayType::arrayType ( baseType, 1, dims );
00137 }
00138
00139 }