H5DataTypes/src/CameraFrameFexConfigV1.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: CameraFrameFexConfigV1.cpp 6826 2013-09-24 21:08:01Z salnikov@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class CameraFrameFexConfigV1...
00007 //
00008 // Author List:
00009 //      Andrei Salnikov
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "H5DataTypes/CameraFrameFexConfigV1.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 
00022 //-------------------------------
00023 // Collaborating Class Headers --
00024 //-------------------------------
00025 #include "hdf5pp/CompoundType.h"
00026 #include "hdf5pp/EnumType.h"
00027 #include "hdf5pp/TypeTraits.h"
00028 #include "H5DataTypes/CameraFrameCoordV1.h"
00029 #include "H5DataTypes/H5DataUtils.h"
00030 
00031 //-----------------------------------------------------------------------
00032 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
00033 //-----------------------------------------------------------------------
00034 
00035 //              ----------------------------------------
00036 //              -- Public Function Member Definitions --
00037 //              ----------------------------------------
00038 
00039 namespace H5DataTypes {
00040 
00041 CameraFrameFexConfigV1::CameraFrameFexConfigV1 (const Pds::Camera::FrameFexConfigV1& config)
00042   : forwarding(config.forwarding())
00043   , forward_prescale(config.forward_prescale())
00044   , processing(config.processing())
00045   , roiBegin(config.roiBegin())
00046   , roiEnd(config.roiEnd())
00047   , threshold(config.threshold())
00048   , number_of_masked_pixels(config.number_of_masked_pixels())
00049 {
00050 }
00051 
00052 hdf5pp::Type
00053 CameraFrameFexConfigV1::stored_type()
00054 {
00055   return native_type() ;
00056 }
00057 
00058 hdf5pp::Type
00059 CameraFrameFexConfigV1::native_type()
00060 {
00061   hdf5pp::EnumType<uint32_t> forwardingEnum = hdf5pp::EnumType<uint32_t>::enumType() ;
00062   forwardingEnum.insert ( "NoFrame", Pds::Camera::FrameFexConfigV1::NoFrame ) ;
00063   forwardingEnum.insert ( "FullFrame", Pds::Camera::FrameFexConfigV1::FullFrame ) ;
00064   forwardingEnum.insert ( "RegionOfInterest", Pds::Camera::FrameFexConfigV1::RegionOfInterest ) ;
00065 
00066   hdf5pp::EnumType<uint32_t> processingEnum = hdf5pp::EnumType<uint32_t>::enumType() ;
00067   processingEnum.insert ( "NoProcessing", Pds::Camera::FrameFexConfigV1::NoProcessing ) ;
00068   processingEnum.insert ( "GssFullFrame", Pds::Camera::FrameFexConfigV1::GssFullFrame ) ;
00069   processingEnum.insert ( "GssRegionOfInterest", Pds::Camera::FrameFexConfigV1::GssRegionOfInterest ) ;
00070   processingEnum.insert ( "GssThreshold", Pds::Camera::FrameFexConfigV1::GssThreshold ) ;
00071 
00072   hdf5pp::Type coordType = hdf5pp::TypeTraits<CameraFrameCoordV1>::native_type() ;
00073 
00074   hdf5pp::CompoundType confType = hdf5pp::CompoundType::compoundType<CameraFrameFexConfigV1>() ;
00075   confType.insert( "forwarding", offsetof(CameraFrameFexConfigV1, forwarding), forwardingEnum ) ;
00076   confType.insert_native<uint32_t>( "forward_prescale", offsetof(CameraFrameFexConfigV1, forward_prescale) ) ;
00077   confType.insert( "processing", offsetof(CameraFrameFexConfigV1, processing), processingEnum ) ;
00078   confType.insert( "roiBegin", offsetof(CameraFrameFexConfigV1, roiBegin), coordType ) ;
00079   confType.insert( "roiEnd", offsetof(CameraFrameFexConfigV1, roiEnd), coordType ) ;
00080   confType.insert_native<uint32_t>( "threshold", offsetof(CameraFrameFexConfigV1, threshold) ) ;
00081   confType.insert_native<uint32_t>( "number_of_masked_pixels", offsetof(CameraFrameFexConfigV1, number_of_masked_pixels) ) ;
00082 
00083   return confType ;
00084 }
00085 
00086 void
00087 CameraFrameFexConfigV1::store( const Pds::Camera::FrameFexConfigV1& config, hdf5pp::Group grp )
00088 {
00089   // make scalar data set for main object
00090   CameraFrameFexConfigV1 data ( config ) ;
00091   storeDataObject ( data, "config", grp ) ;
00092 
00093   // make array data set for masked pixels
00094   const ndarray<const Pds::Camera::FrameCoord, 1>& masked_pixel_coordinates = config.masked_pixel_coordinates();
00095   storeCameraFrameCoordV1 ( masked_pixel_coordinates.size(), masked_pixel_coordinates.data(), grp, "masked_pixel_coordinates" ) ;
00096 }
00097 
00098 } // namespace H5DataTypes

Generated on 19 Dec 2016 for PSDMSoftware by  doxygen 1.4.7