eformat::FullEventFragment< TPointer > Class Template Reference

#include <FullEventFragment.h>

Inheritance diagram for eformat::FullEventFragment< TPointer >:

eformat::Header< TPointer > List of all members.

Public Member Functions

 FullEventFragment (const TPointer &it)
 FullEventFragment ()
 FullEventFragment (const FullEventFragment &other)
virtual ~FullEventFragment ()
FullEventFragmentoperator= (const FullEventFragment &other)
FullEventFragmentassign (const TPointer &it)
virtual bool check () const
bool check_tree () const
uint32_t time () const
uint32_t global_id () const
uint32_t run_no () const
uint32_t lvl1_id () const
uint32_t lvl1_trigger_type () const
uint32_t lvl2_trigger_info () const
uint32_t nevent_filter_info () const
void event_filter_info (TPointer &it) const
Headerassign (const TPointer &it, uint32_t match)
uint32_t marker () const
uint32_t fragment_size_word () const
uint32_t header_size_word () const
uint32_t version () const
uint32_t source_id () const
uint32_t nstatus () const
void start (TPointer &it) const
void payload (TPointer &it) const
void end (TPointer &it) const
uint32_t payload_size_word (void) const
void status (TPointer &it) const
uint32_t nspecific () const
void specific_header (TPointer &it) const
virtual uint32_t nchildren () const
virtual void child (TPointer &p, size_t n) const
virtual void child_check (TPointer &p, size_t n) const
virtual uint32_t children (TPointer *p, size_t max) const

Private Attributes

TPointer m_start
 my start word

Static Private Attributes

static const uint32_t NSPECIFIC = 10

Detailed Description

template<class TPointer>
class eformat::FullEventFragment< TPointer >

Describes how to access the contents of an event fragment, as prescribed by the event format note.

Definition at line 29 of file FullEventFragment.h.


Constructor & Destructor Documentation

template<class TPointer>
eformat::FullEventFragment< TPointer >::FullEventFragment ( const TPointer &  it  ) 

To build a fragment given the containing buffer. I need to know where the fragment starts in order to do that.

Parameters:
it The exact position where this fragment should start.

Definition at line 149 of file FullEventFragment.h.

References eformat::FullEventFragment< TPointer >::m_start, and eformat::Header< TPointer >::specific_header().

00150   : eformat::Header<TPointer>(it, eformat::FULL_EVENT),
00151     m_start()
00152 {
00153   specific_header(m_start);
00154 }

template<class TPointer>
eformat::FullEventFragment< TPointer >::FullEventFragment (  )  [inline]

Builds an empty, otherwise useless FullEventFragment

Definition at line 44 of file FullEventFragment.h.

00044 : Header<TPointer>(), m_start() {}

template<class TPointer>
eformat::FullEventFragment< TPointer >::FullEventFragment ( const FullEventFragment< TPointer > &  other  )  [inline]

Copy constructor

Parameters:
other The fragment to be copied

Definition at line 51 of file FullEventFragment.h.

00052       : Header<TPointer>(other), m_start(other.m_start) {}

template<class TPointer>
virtual eformat::FullEventFragment< TPointer >::~FullEventFragment (  )  [inline, virtual]

Destructor virtualisation

Definition at line 57 of file FullEventFragment.h.

00057 {}


Member Function Documentation

template<class TPointer>
eformat::Header< TPointer > & eformat::Header< TPointer >::assign ( const TPointer &  it,
uint32_t  match 
) [inherited]

Reassign this header

Parameters:
it The exact position where this header should start.
match The word that this header should match.

Definition at line 236 of file Header.h.

References EvtCyclic3::c_str(), EFORMAT_WRONG_MARKER, ERS_DEBUG_1, ERS_DEBUG_3, eformat::Header< TPointer >::m_start, and eformat::Header< TPointer >::marker().

Referenced by eformat::SubDetectorFragment< TPointer >::assign(), eformat::ROSFragment< TPointer >::assign(), eformat::ROBFragment< TPointer >::assign(), and eformat::FullEventFragment< TPointer >::assign().

00237 {
00238   ERS_DEBUG_3("Rebuilding header 0x%x from iterator", match);
00239   m_start = it;
00240   if (marker() != match) {
00241     throw EFORMAT_WRONG_MARKER(marker(), match);
00242   }
00243   ERS_DEBUG_1("Re-initialized header with source identifier = %s",
00244               eformat::helper::SourceIdentifier(match).human().c_str());
00245   return *this;
00246 }

template<class TPointer>
eformat::FullEventFragment< TPointer > & eformat::FullEventFragment< TPointer >::assign ( const TPointer &  it  ) 

Manual re-assignment

Parameters:
it The position pointing the first word of this fragment

Definition at line 157 of file FullEventFragment.h.

References eformat::Header< TPointer >::assign(), EvtCyclic3::c_str(), ERS_DEBUG_1, ERS_DEBUG_3, eformat::FULL_EVENT, eformat::FullEventFragment< TPointer >::m_start, eformat::Header< TPointer >::source_id(), and eformat::Header< TPointer >::specific_header().

Referenced by RawDataInputSvc::nextEvent().

00158 {
00159   ERS_DEBUG_3("Re-building FullEventFragment from pointer");
00160   eformat::Header<TPointer>::assign(it, eformat::FULL_EVENT);
00161   specific_header(m_start);
00162   ERS_DEBUG_1("Initialized header with source identifier = %s",
00163               eformat::helper::SourceIdentifier(source_id()).human().c_str());
00164   return *this;
00165 }

template<class TPointer>
bool eformat::FullEventFragment< TPointer >::check (  )  const [virtual]

Says if the the fragment is valid. This may throw exceptions.

Reimplemented from eformat::Header< TPointer >.

Definition at line 176 of file FullEventFragment.h.

References eformat::Header< TPointer >::check(), EFORMAT_SIZE_CHECK, ERS_DEBUG_2, and eformat::FullEventFragment< TPointer >::NSPECIFIC.

Referenced by eformat::FullEventFragment< TPointer >::check_tree(), MixerAlg::nextEvent(), and RawDataInputSvc::nextEvent().

00177 {
00178   ERS_DEBUG_2("Checking for consistency of FullEventFragment");
00179   eformat::Header<TPointer>::check(); //< first do a generic check
00180   if (this->nspecific() != NSPECIFIC) { 
00181     throw EFORMAT_SIZE_CHECK(NSPECIFIC, this->nspecific());
00182   }
00183   return true;
00184 }

template<class TPointer>
bool eformat::FullEventFragment< TPointer >::check_tree (  )  const

Says if the Fragment and all children are valid.

Definition at line 187 of file FullEventFragment.h.

References eformat::FullEventFragment< TPointer >::check(), eformat::SubDetectorFragment< TPointer >::check_tree(), eformat::Header< TPointer >::child(), ERS_DEBUG_2, genRecEmupikp::i, eformat::Header< TPointer >::nchildren(), and showlog::total.

Referenced by EFEventLoopMgr::executeEvent(), and RawDataOutputSvc::putEvent().

00188 {
00189   ERS_DEBUG_2("Checking recursively for consistency of FullEventFragment");
00190   check(); // check myself
00191   uint32_t total = this->nchildren();
00192   for (size_t i=0; i<total; ++i) {
00193     TPointer fp;
00194     child(fp, i);
00195     eformat::SubDetectorFragment<TPointer> f(fp);
00196     f.check_tree();
00197   }
00198   return true;
00199 }

template<class TPointer>
void eformat::Header< TPointer >::child ( TPointer &  p,
size_t  n 
) const [virtual, inherited]

Returns the nth child fragment. If the nth fragment doesn't exist, the behaviour is undefined.

Parameters:
p A preallocated pointer you should provide.
n The fragment position, starting at zero, of the child fragment you would like to get.

Definition at line 272 of file Header.h.

References EvtCyclic3::c_str(), ERS_DEBUG_2, ERS_DEBUG_3, genRecEmupikp::i, eformat::Header< TPointer >::marker(), eformat::marker2string(), next, eformat::Header< TPointer >::payload(), and eformat::Header< TPointer >::source_id().

Referenced by eformat::SubDetectorFragment< TPointer >::check_tree(), eformat::ROSFragment< TPointer >::check_tree(), eformat::FullEventFragment< TPointer >::check_tree(), and eformat::Header< TPointer >::child_check().

00273 {
00274   ERS_DEBUG_2("User asked for child %ud of fragment type %s [%s]", n,
00275               eformat::marker2string(marker()).c_str(),
00276               eformat::helper::SourceIdentifier(source_id()).human().c_str());
00277   TPointer next;
00278   payload(next);
00279   for (size_t i=0; i<n; ++i) next += next[1];
00280   ERS_DEBUG_3("Set user object");
00281   p = next;
00282 }

template<class TPointer>
void eformat::Header< TPointer >::child_check ( TPointer &  p,
size_t  n 
) const [virtual, inherited]

Returns the nth child fragment. If the nth fragment doesn't exist, an exception is thrown.

Warning:
Use this method with care, it is slower than the equivalent method that doesn't check.
Parameters:
p A preallocated pointer you should provide.
n The fragment position, starting at zero, of the child fragment you would like to get.

Definition at line 285 of file Header.h.

References eformat::Header< TPointer >::child(), EFORMAT_NO_SUCH_CHILD, eformat::Header< TPointer >::nchildren(), and showlog::total.

00286 {
00287   uint32_t total = nchildren();
00288   if (n >= total) throw EFORMAT_NO_SUCH_CHILD(n, total);
00289   child(p, n);
00290 }

template<class TPointer>
uint32_t eformat::Header< TPointer >::children ( TPointer *  p,
size_t  max 
) const [virtual, inherited]

Returns all the children of this fragment. The input to this method is a valid set of iterators to existing, pre-allocated pointers

Parameters:
p A pointer to a set of preallocated TPointer's to set to the position of the children of this fragment.
max The maximum number of children, p can point to.
Returns:
The number of children found on this fragment

Definition at line 293 of file Header.h.

References eformat::child_marker(), EFORMAT_WRONG_SIZE, ERS_DEBUG_2, eformat::find_fragments(), eformat::Header< TPointer >::fragment_size_word(), eformat::Header< TPointer >::marker(), eformat::Header< TPointer >::payload(), and eformat::Header< TPointer >::payload_size_word().

Referenced by components(), eformat::get_robs(), eformat::Header< TPointer >::nchildren(), and RawDataInputSvc::nextEvent().

00294 {
00295   ERS_DEBUG_2("Retrieving all children...");
00296   TPointer payload_start;
00297   payload(payload_start);
00298   try {
00299     return find_fragments(child_marker(static_cast<HeaderMarker>(marker())),
00300                           payload_start, payload_size_word(), p, max);
00301   }
00302   catch (WrongMarkerIssue& ex) {
00303     //This normally means the fragment size is wrong...
00304     throw EFORMAT_WRONG_SIZE(fragment_size_word());
00305   }
00306   return 0;
00307 }

template<class TPointer>
void eformat::Header< TPointer >::end ( TPointer &  it  )  const [inline, inherited]

Sets the pointer to one-past my end position

Parameters:
it The pointer to set

Definition at line 143 of file Header.h.

References eformat::Header< TPointer >::fragment_size_word(), and eformat::Header< TPointer >::m_start.

00144     { it = m_start; it += fragment_size_word(); }

template<class TPointer>
void eformat::FullEventFragment< TPointer >::event_filter_info ( TPointer &  it  )  const

Returns an iterator to the first of the (4) EF words

Parameters:
it An updateable iterator you should provide.

Definition at line 168 of file FullEventFragment.h.

References eformat::FullEventFragment< TPointer >::m_start.

Referenced by MixerAlg::nextEvent(), and RawDataInputSvc::nextEvent().

00170 {
00171   it = m_start;
00172   it += 6;
00173 }

template<class TPointer>
uint32_t eformat::Header< TPointer >::fragment_size_word (  )  const [inline, inherited]

Returns the size, in words, of the current fragment.

Definition at line 100 of file Header.h.

References eformat::Header< TPointer >::m_start.

Referenced by eformat::Header< TPointer >::children(), eformat::Header< TPointer >::end(), EFEventLoopMgr::executeEvent(), MixerAlg::nextEvent(), and eformat::Header< TPointer >::payload_size_word().

00100 { return m_start[1]; }

template<class TPointer>
uint32_t eformat::FullEventFragment< TPointer >::global_id (  )  const [inline]

Returns the global identifier

Definition at line 94 of file FullEventFragment.h.

References eformat::FullEventFragment< TPointer >::m_start.

Referenced by EFEventLoopMgr::executeEvent(), MixerAlg::nextEvent(), and RawDataInputSvc::nextEvent().

00095     { return m_start[1]; }

template<class TPointer>
uint32_t eformat::Header< TPointer >::header_size_word (  )  const [inline, inherited]

Returns the size, in words, of the current header. That does include the specific part of the header.

Definition at line 106 of file Header.h.

References eformat::Header< TPointer >::m_start.

Referenced by eformat::Header< TPointer >::check(), eformat::Header< TPointer >::payload(), and eformat::Header< TPointer >::payload_size_word().

00106 { return m_start[2]; }

template<class TPointer>
uint32_t eformat::FullEventFragment< TPointer >::lvl1_id (  )  const [inline]

Returns the lvl1 identifier

Definition at line 106 of file FullEventFragment.h.

References eformat::FullEventFragment< TPointer >::m_start.

00107     { return m_start[3]; }

template<class TPointer>
uint32_t eformat::FullEventFragment< TPointer >::lvl1_trigger_type (  )  const [inline]

Retursn the lvl1 trigger type

Definition at line 112 of file FullEventFragment.h.

References eformat::FullEventFragment< TPointer >::m_start.

00113     { return m_start[4]; }

template<class TPointer>
uint32_t eformat::FullEventFragment< TPointer >::lvl2_trigger_info (  )  const [inline]

Returns the lvl2 trigger info

Definition at line 118 of file FullEventFragment.h.

References eformat::FullEventFragment< TPointer >::m_start.

00119     { return m_start[5]; }

template<class TPointer>
uint32_t eformat::Header< TPointer >::marker (  )  const [inline, inherited]

Returns the fragment type.

Definition at line 95 of file Header.h.

References eformat::Header< TPointer >::m_start.

Referenced by eformat::Header< TPointer >::assign(), eformat::Header< TPointer >::check(), eformat::Header< TPointer >::child(), eformat::Header< TPointer >::children(), eformat::Header< TPointer >::Header(), and eformat::Header< TPointer >::nchildren().

00095 { return m_start[0]; }

template<class TPointer>
uint32_t eformat::Header< TPointer >::nchildren (  )  const [virtual, inherited]

Returns the number of children available.

Definition at line 263 of file Header.h.

References EvtCyclic3::c_str(), eformat::Header< TPointer >::children(), ERS_DEBUG_2, eformat::Header< TPointer >::marker(), eformat::marker2string(), and eformat::Header< TPointer >::source_id().

Referenced by eformat::SubDetectorFragment< TPointer >::check_tree(), eformat::ROSFragment< TPointer >::check_tree(), eformat::FullEventFragment< TPointer >::check_tree(), eformat::Header< TPointer >::child_check(), EFEventLoopMgr::executeEvent(), and MixerAlg::nextEvent().

00264 {
00265   ERS_DEBUG_2("User asked for number of children of fragment type %s [%s]",
00266               eformat::marker2string(marker()).c_str(),
00267               eformat::helper::SourceIdentifier(source_id()).human().c_str());
00268   return children(0,0);
00269 }

template<class TPointer>
uint32_t eformat::FullEventFragment< TPointer >::nevent_filter_info (  )  const [inline]

Returns the number of Event Filter words (constant = 4)

Definition at line 124 of file FullEventFragment.h.

00124 { return 4; }

template<class TPointer>
uint32_t eformat::Header< TPointer >::nspecific (  )  const [inline, inherited]

Returns the number of specific words available in the specific header part

Definition at line 164 of file Header.h.

References eformat::Header< TPointer >::m_start, and eformat::Header< TPointer >::nstatus().

Referenced by eformat::Header< TPointer >::check().

00164 { return m_start[6 + nstatus()]; }

template<class TPointer>
uint32_t eformat::Header< TPointer >::nstatus (  )  const [inline, inherited]

Returns the number of status words available

Definition at line 121 of file Header.h.

References eformat::Header< TPointer >::m_start.

Referenced by eformat::Header< TPointer >::check(), eformat::Header< TPointer >::nspecific(), and eformat::Header< TPointer >::specific_header().

00121 { return m_start[5]; }

template<class TPointer>
FullEventFragment& eformat::FullEventFragment< TPointer >::operator= ( const FullEventFragment< TPointer > &  other  )  [inline]

Copy operator

Parameters:
other The fragment to be copied

Definition at line 64 of file FullEventFragment.h.

References eformat::FullEventFragment< TPointer >::m_start, and EvtCyclic3::other().

00065     { Header<TPointer>::operator=(other); m_start=other.m_start; return *this; }

template<class TPointer>
void eformat::Header< TPointer >::payload ( TPointer &  it  )  const [inline, inherited]

Sets the pointer to where the payload starts

Parameters:
it The pointer to set

Definition at line 135 of file Header.h.

References eformat::Header< TPointer >::header_size_word(), and eformat::Header< TPointer >::m_start.

Referenced by eformat::Header< TPointer >::child(), and eformat::Header< TPointer >::children().

00136     { it = m_start; it+= header_size_word(); }

template<class TPointer>
uint32_t eformat::Header< TPointer >::payload_size_word ( void   )  const [inline, inherited]

Returns the payload size

Definition at line 149 of file Header.h.

References eformat::Header< TPointer >::fragment_size_word(), and eformat::Header< TPointer >::header_size_word().

Referenced by eformat::Header< TPointer >::children(), eformat::ROBFragment< TPointer >::rod_fragment_size_word(), eformat::ROBFragment< TPointer >::rod_ndata(), eformat::ROBFragment< TPointer >::rod_nstatus(), and eformat::ROBFragment< TPointer >::rod_status_position().

00150     { return fragment_size_word() - header_size_word(); }

template<class TPointer>
uint32_t eformat::FullEventFragment< TPointer >::run_no (  )  const [inline]

Returns the run number

Definition at line 100 of file FullEventFragment.h.

References eformat::FullEventFragment< TPointer >::m_start.

Referenced by EFEventLoopMgr::executeEvent(), MixerAlg::nextEvent(), and RawDataInputSvc::nextEvent().

00101     { return m_start[2]; }

template<class TPointer>
uint32_t eformat::Header< TPointer >::source_id (  )  const [inline, inherited]

Returns the full source identifier.

Definition at line 116 of file Header.h.

References eformat::Header< TPointer >::m_start.

Referenced by eformat::SubDetectorFragment< TPointer >::assign(), eformat::ROSFragment< TPointer >::assign(), eformat::ROBFragment< TPointer >::assign(), eformat::FullEventFragment< TPointer >::assign(), eformat::ROBFragment< TPointer >::check(), eformat::Header< TPointer >::check(), eformat::Header< TPointer >::child(), eformat::get_robs(), eformat::Header< TPointer >::nchildren(), and eformat::ROBFragment< TPointer >::ROBFragment().

00116 { return m_start[4]; }

template<class TPointer>
void eformat::Header< TPointer >::specific_header ( TPointer &  it  )  const [inline, inherited]

Returns an iterator to the start of the specific header part (this does not include the number of specific header fragments)

Parameters:
it An updateable iterator you should provide.

Definition at line 172 of file Header.h.

References eformat::Header< TPointer >::m_start, and eformat::Header< TPointer >::nstatus().

Referenced by eformat::SubDetectorFragment< TPointer >::assign(), eformat::ROSFragment< TPointer >::assign(), eformat::ROBFragment< TPointer >::assign(), eformat::FullEventFragment< TPointer >::assign(), eformat::FullEventFragment< TPointer >::FullEventFragment(), eformat::ROBFragment< TPointer >::ROBFragment(), eformat::ROSFragment< TPointer >::ROSFragment(), and eformat::SubDetectorFragment< TPointer >::SubDetectorFragment().

00173     { it = m_start; it += 7 + nstatus(); }

template<class TPointer>
void eformat::Header< TPointer >::start ( TPointer &  it  )  const [inline, inherited]

Sets the pointer to my start

Parameters:
it The pointer to set

Definition at line 128 of file Header.h.

References eformat::Header< TPointer >::m_start.

00128 { it = m_start; }

template<class TPointer>
void eformat::Header< TPointer >::status ( TPointer &  it  )  const [inline, inherited]

Returns the status words, as an iterator to the status words available.

Parameters:
it An updateable iterator you should provide.

Definition at line 157 of file Header.h.

References eformat::Header< TPointer >::m_start.

00157 { it = m_start; it += 6; }

template<class TPointer>
uint32_t eformat::FullEventFragment< TPointer >::time (  )  const [inline]

Returns the date, in seconds elapsed since the 1st. January, 1970. The timezone is fixed to UTC.

Definition at line 88 of file FullEventFragment.h.

References eformat::FullEventFragment< TPointer >::m_start.

Referenced by EFEventLoopMgr::executeEvent(), and RawDataInputSvc::nextEvent().

00089     { return m_start[0]; }

template<class TPointer>
uint32_t eformat::Header< TPointer >::version (  )  const [inline, inherited]

Returns the formatting version.

Definition at line 111 of file Header.h.

References eformat::Header< TPointer >::m_start.

Referenced by eformat::Header< TPointer >::check().

00111 { return m_start[3]; }


Member Data Documentation

template<class TPointer>
TPointer eformat::FullEventFragment< TPointer >::m_start [private]

my start word

Reimplemented from eformat::Header< TPointer >.

Definition at line 139 of file FullEventFragment.h.

Referenced by eformat::FullEventFragment< TPointer >::assign(), eformat::FullEventFragment< TPointer >::event_filter_info(), eformat::FullEventFragment< TPointer >::FullEventFragment(), eformat::FullEventFragment< TPointer >::global_id(), eformat::FullEventFragment< TPointer >::lvl1_id(), eformat::FullEventFragment< TPointer >::lvl1_trigger_type(), eformat::FullEventFragment< TPointer >::lvl2_trigger_info(), eformat::FullEventFragment< TPointer >::operator=(), eformat::FullEventFragment< TPointer >::run_no(), and eformat::FullEventFragment< TPointer >::time().

template<class TPointer>
const uint32_t eformat::FullEventFragment< TPointer >::NSPECIFIC = 10 [static, private]

Definition at line 135 of file FullEventFragment.h.

Referenced by eformat::FullEventFragment< TPointer >::check().


Generated on Tue Nov 29 23:36:28 2016 for BOSS_7.0.2 by  doxygen 1.4.7