/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Event/eformat/eformat-00-00-04/eformat/SubDetectorFragment.h

Go to the documentation of this file.
00001 //Dear emacs, this is -*- c++ -*-
00002 
00014 #ifndef EFORMAT_SUBDETECTORFRAGMENT_H
00015 #define EFORMAT_SUBDETECTORFRAGMENT_H
00016 
00017 #include "eformat/Header.h"
00018 #include "eformat/HeaderMarker.h"
00019 #include "eformat/ROSFragment.h"
00020 #include "eformat/SizeCheckIssue.h"
00021 
00022 namespace eformat {
00023 
00028   template <class TPointer>
00029   class SubDetectorFragment : public eformat::Header<TPointer> {
00030 
00031   public: //interface
00032 
00039     SubDetectorFragment (const TPointer& it);
00040 
00044     SubDetectorFragment () : Header<TPointer>(), m_start() {}
00045 
00051     SubDetectorFragment (const SubDetectorFragment& other) 
00052       : Header<TPointer>(other), m_start(other.m_start) {}
00053 
00057     virtual ~SubDetectorFragment() {}
00058 
00064     SubDetectorFragment& operator= (const SubDetectorFragment& other) 
00065     { Header<TPointer>::operator=(other); m_start=other.m_start; return *this; }
00066 
00072     SubDetectorFragment& assign (const TPointer& it);
00073 
00077     virtual bool check () const;
00078 
00082     bool check_tree () const;
00083 
00084   private: //static stuff
00085 
00086     static const uint32_t NSPECIFIC;
00087 
00088   private: //representation
00089 
00090     TPointer m_start; 
00091 
00092   };
00093 
00094 }
00095 
00096 template <class TPointer> 
00097 const uint32_t eformat::SubDetectorFragment<TPointer>::NSPECIFIC = 0;
00098 
00099 template <class TPointer>
00100 eformat::SubDetectorFragment<TPointer>::SubDetectorFragment 
00101 (const TPointer& it)
00102   : eformat::Header<TPointer>(it, eformat::SUB_DETECTOR),
00103     m_start()
00104 {
00105   specific_header(m_start);
00106 }
00107 
00108 template <class TPointer> eformat::SubDetectorFragment<TPointer>& 
00109 eformat::SubDetectorFragment<TPointer>::assign (const TPointer& it)
00110 {
00111   ERS_DEBUG_3("Re-building SubDetectorFragment from pointer");
00112   eformat::Header<TPointer>::assign(it, eformat::SUB_DETECTOR);
00113   specific_header(m_start);
00114   ERS_DEBUG_1("Initialized header with source identifier = %s",
00115               eformat::helper::SourceIdentifier(source_id()).human().c_str());
00116   return *this;
00117 }
00118 
00119 template <class TPointer>
00120 bool eformat::SubDetectorFragment<TPointer>::check () const
00121 {
00122   ERS_DEBUG_2("Checking for consistency of SubDetectorFragment");
00123   eformat::Header<TPointer>::check(); //< first do a generic check
00124   if (this->nspecific() != NSPECIFIC) {
00125     throw EFORMAT_SIZE_CHECK(NSPECIFIC, this->nspecific());
00126   }
00127   return true;
00128 }
00129 
00130 template <class TPointer>
00131 bool eformat::SubDetectorFragment<TPointer>::check_tree () const
00132 {
00133   ERS_DEBUG_2("Checking recursively for consistency of SubDetectorFragment");
00134   check(); // check myself
00135   uint32_t total = this->nchildren();
00136   for (size_t i=0; i<total; ++i) {
00137     TPointer fp;
00138     child(fp, i);
00139     eformat::ROSFragment<TPointer> f(fp);
00140     f.check_tree();
00141   }
00142   return true;
00143 }
00144 
00145 #endif /* EFORMAT_SUBDETECTORFRAGMENT_H */

Generated on Tue Nov 29 22:58:25 2016 for BOSS_7.0.2 by  doxygen 1.4.7