DataRecord

DataRecordType

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
#ifndef DataFormats_RPCDigi_DataRecord_H
#define DataFormats_RPCDigi_DataRecord_H

#include <string>
#include <bitset>
#include <sstream>
#include <cstdint>

namespace rpcrawtodigi {
  class DataRecord {
  public:
    typedef uint16_t Data;
    enum DataRecordType {
      None = 0,
      StartOfBXData = 1,
      StartOfTbLinkInputNumberData = 2,
      ChamberData = 3,
      Empty = 4,
      RDDM = 5,
      SDDM = 6,
      RCDM = 7,
      RDM = 8,
      UndefinedType = 9
    };

  public:
    explicit DataRecord(const Data& data = None) : theData(data) {}

    virtual ~DataRecord() {}

    const Data& data() const { return theData; }

    DataRecordType type() const;

    static std::string name(const DataRecordType& code);

    std::string print() const {
      std::ostringstream str;
      str << std::bitset<16>(theData);
      return str.str();
    }

    static std::string print(const DataRecord& record);

  protected:
    Data theData;
  };
}  // namespace rpcrawtodigi
#endif