H5DataTypes/src/UsdUsbConfigV1.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: UsdUsbConfigV1.cpp 6826 2013-09-24 21:08:01Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class UsdUsbConfigV1...
00007 //
00008 // Author List:
00009 //      Andrei Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "H5DataTypes/UsdUsbConfigV1.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 #include "H5DataTypes/H5DataUtils.h"
00026 #include "hdf5pp/EnumType.h"
00027 #include "hdf5pp/CompoundType.h"
00028 #include "hdf5pp/TypeTraits.h"
00029 
00030 //-----------------------------------------------------------------------
00031 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00032 //-----------------------------------------------------------------------
00033 
00034 //              ----------------------------------------
00035 //              -- Public Function Member Definitions --
00036 //              ----------------------------------------
00037 
00038 namespace H5DataTypes {
00039 
00040 //----------------
00041 // Constructors --
00042 //----------------
00043 UsdUsbConfigV1::UsdUsbConfigV1 ( const XtcType& data )
00044 {
00045   const ndarray<const uint32_t, 1>& in_counting_mode = data.counting_mode();
00046   std::copy(in_counting_mode.begin(), in_counting_mode.end(), counting_mode);
00047 
00048   const ndarray<const uint32_t, 1>& in_quadrature_mode = data.quadrature_mode();
00049   std::copy(in_quadrature_mode.begin(), in_quadrature_mode.end(), quadrature_mode);
00050 }
00051 
00052 hdf5pp::Type
00053 UsdUsbConfigV1::stored_type()
00054 {
00055   return native_type() ;
00056 }
00057 
00058 hdf5pp::Type
00059 UsdUsbConfigV1::native_type()
00060 {
00061   hdf5pp::EnumType<uint32_t> countModeEnumType = hdf5pp::EnumType<uint32_t>::enumType() ;
00062   countModeEnumType.insert ( "WRAP_FULL", Pds::UsdUsb::ConfigV1::WRAP_FULL ) ;
00063   countModeEnumType.insert ( "LIMIT", Pds::UsdUsb::ConfigV1::LIMIT ) ;
00064   countModeEnumType.insert ( "HALT", Pds::UsdUsb::ConfigV1::HALT ) ;
00065   countModeEnumType.insert ( "WRAP_PRESET", Pds::UsdUsb::ConfigV1::WRAP_PRESET ) ;
00066 
00067   hdf5pp::EnumType<uint32_t> quadModeEnumType = hdf5pp::EnumType<uint32_t>::enumType() ;
00068   quadModeEnumType.insert ( "CLOCK_DIR", Pds::UsdUsb::ConfigV1::CLOCK_DIR ) ;
00069   quadModeEnumType.insert ( "X1", Pds::UsdUsb::ConfigV1::X1 ) ;
00070   quadModeEnumType.insert ( "X2", Pds::UsdUsb::ConfigV1::X2 ) ;
00071   quadModeEnumType.insert ( "X4", Pds::UsdUsb::ConfigV1::X4 ) ;
00072 
00073   hdf5pp::CompoundType type = hdf5pp::CompoundType::compoundType<UsdUsbConfigV1>() ;
00074   type.insert( "counting_mode", offsetof(UsdUsbConfigV1, counting_mode), countModeEnumType, NCHANNELS ) ;
00075   type.insert( "quadrature_mode", offsetof(UsdUsbConfigV1, quadrature_mode), quadModeEnumType, NCHANNELS ) ;
00076 
00077   return type;
00078 }
00079 
00080 void
00081 UsdUsbConfigV1::store( const XtcType& config, hdf5pp::Group grp )
00082 {
00083   // make scalar data set for main object
00084   UsdUsbConfigV1 data ( config ) ;
00085   storeDataObject ( data, "config", grp ) ;
00086 }
00087 
00088 } // namespace H5DataTypes

Generated on 19 Dec 2016 for PSDMSoftware by  doxygen 1.4.7