GctBlockHeader

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
#ifndef GctBlockHeader_h_
#define GctBlockHeader_h_

/*!
* \class GctBlockHeader
* \brief Simple class for holding the basic attributes of an 32-bit block header.
* * 
* \author Robert Frazier
*/

// C++ headers
#include <ostream>
#include <cstdint>

class GctBlockHeader {
public:
  /* PUBLIC METHODS */

  /// Constructor. Don't use directly - use the generateBlockHeader() method in GctFormatTranslateBase-derived classes.
  /*! \param valid Flag if this is a known and valid header .*/
  GctBlockHeader(uint32_t blockId, uint32_t blockLength, uint32_t nSamples, uint32_t bxId, uint32_t eventId, bool valid);

  /// Destructor.
  ~GctBlockHeader() {}

  /// Get the block ID
  uint32_t blockId() const { return m_blockId; }

  /// Get the fundamental block length (for 1 time sample)
  uint32_t blockLength() const { return m_blockLength; }

  /// Get the number of time samples
  uint32_t nSamples() const { return m_nSamples; }

  /// Get the bunch crossing ID
  uint32_t bxId() const { return m_bxId; }

  /// Get the event ID
  uint32_t eventId() const { return m_eventId; }

  /// Returns true if it's valid block header - i.e. if the header is known and can be unpacked.
  bool valid() const { return m_valid; }

private:
  /* PRIVATE METHODS */

  /* PRIVATE MEMBER DATA */

  uint32_t m_blockId;  ///< The Block ID

  uint32_t m_blockLength;  ///< The fundamental block length (for 1 time sample)

  uint32_t m_nSamples;  ///< The number of time-samples

  uint32_t m_bxId;  ///< The bunch-crossing ID

  uint32_t m_eventId;  ///< The event ID

  bool m_valid;  ///< Is this a valid block header
};

#include <vector>
typedef std::vector<GctBlockHeader> GctBlockHeaderCollection;

std::ostream& operator<<(std::ostream& os, const GctBlockHeader& h);

#endif /* GctBlockHeader_h_ */