H5DataTypes/src/UsdUsbDataV1.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: UsdUsbDataV1.cpp 6826 2013-09-24 21:08:01Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class UsdUsbDataV1...
00007 //
00008 // Author List:
00009 //      Andrei Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "H5DataTypes/UsdUsbDataV1.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 #include <algorithm>
00022 
00023 //-------------------------------
00024 // Collaborating Class Headers --
00025 //-------------------------------
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 UsdUsbDataV1::UsdUsbDataV1 ( const XtcType& data )
00044   : timestamp(data.timestamp())
00045   , digital_in(data.digital_in())
00046 {
00047   const ndarray<const int32_t, 1>& nd_encoder_count = data.encoder_count();
00048   std::copy(nd_encoder_count.begin(), nd_encoder_count.end(), encoder_count);
00049 
00050   const ndarray<const uint16_t, 1>& nd_analog_in = data.analog_in();
00051   std::copy(nd_analog_in.begin(), nd_analog_in.end(), analog_in);
00052 
00053   const ndarray<const uint8_t, 1>& ndstatus = data.status();
00054   std::copy(ndstatus.begin(), ndstatus.end(), status);
00055 }
00056 
00057 hdf5pp::Type
00058 UsdUsbDataV1::stored_type()
00059 {
00060   return native_type() ;
00061 }
00062 
00063 hdf5pp::Type
00064 UsdUsbDataV1::native_type()
00065 {
00066   hdf5pp::CompoundType type = hdf5pp::CompoundType::compoundType<UsdUsbDataV1>() ;
00067   type.insert_native<int32_t>( "encoder_count", offsetof(UsdUsbDataV1, encoder_count), Encoder_Inputs ) ;
00068   type.insert_native<uint16_t>( "analog_in", offsetof(UsdUsbDataV1, analog_in), Analog_Inputs ) ;
00069   type.insert_native<uint32_t>( "timestamp", offsetof(UsdUsbDataV1, timestamp) ) ;
00070   type.insert_native<uint8_t>( "status", offsetof(UsdUsbDataV1, status), 4 ) ;
00071   type.insert_native<uint8_t>( "digital_in", offsetof(UsdUsbDataV1, digital_in) ) ;
00072 
00073   return type;
00074 }
00075 
00076 } // namespace H5DataTypes

Generated on 19 Dec 2016 for PSDMSoftware by  doxygen 1.4.7