Monarch  v3.8.2
Project 8 Data File Format Library
M2Header.hh
Go to the documentation of this file.
1 #ifndef MONARCHHEADER_HH_
2 #define MONARCHHEADER_HH_
3 
4 #include "M2Types.hh"
5 
6 #include <string>
7 
8 namespace Protobuf
9 {
10  class MonarchHeader;
11 }
12 
13 namespace monarch2
14 {
15 
16  class M2Header
17  {
18  private:
19  mutable Protobuf::MonarchHeader* fProtobufHeader;
20 
21  public:
22  M2Header();
23  ~M2Header();
24 
25  M2Header( const M2Header& ) = delete;
26  M2Header& operator=( const M2Header& ) = delete;
27 
28  //size of monarch header in bytes (fixed by .proto definition)
29  int ByteSize() const;
30 
31  //marshal a MonarchHeader to an array of data
32  bool MarshalToArray( void* anArray, int aSize ) const;
33  bool MarshalToStream( std::ostream* aStream ) const;
34 
35  //demarshal a MonarchHeader object from an array of data
36  bool DemarshalFromArray( void* anArray, int aSize ) const;
37  bool DemarshalFromStream( std::istream* aStream ) const;
38 
39  //access methods
40 
41  // Required in protobuf header
42 
43  void SetFilename( const std::string& aFilename );
44  const std::string& GetFilename() const;
45 
46  // Acquisition mode: how many channels?
47  void SetAcquisitionMode( AcquisitionModeType aMode );
48  AcquisitionModeType GetAcquisitionMode() const;
49 
50  // Acquisition rate in MHz
51  void SetAcquisitionRate( double aRate );
52  double GetAcquisitionRate() const;
53 
54  // Run duration in ms
55  void SetRunDuration( unsigned int aDuration );
56  unsigned int GetRunDuration() const;
57 
58  // Record size in samples
59  void SetRecordSize( unsigned int aSize );
60  unsigned int GetRecordSize() const;
61 
62 
63  // Optional in protobuf header
64 
65  void SetTimestamp( const std::string& aTimestamp );
66  const std::string& GetTimestamp() const;
67 
68  void SetDescription( const std::string& aDescription );
69  const std::string& GetDescription() const;
70 
71  void SetRunType( RunType aRunType );
72  RunType GetRunType() const;
73 
74  void SetRunSource( RunSourceType aRunSource );
75  RunSourceType GetRunSource() const;
76 
77  void SetFormatMode( FormatModeType aFormatMode );
78  FormatModeType GetFormatMode() const;
79 
80  void SetDataTypeSize( unsigned aSize );
81  unsigned GetDataTypeSize() const;
82 
83  void SetBitDepth( unsigned aBitDepth );
84  unsigned GetBitDepth() const;
85 
86  void SetVoltageMin( double aVoltage );
87  double GetVoltageMin() const;
88 
89  void SetVoltageRange( double aVoltage );
90  double GetVoltageRange() const;
91 
92  };
93 
94 }
95 
96 // Pretty printing method
97 std::ostream& operator<<( std::ostream& out, const monarch2::M2Header& hdr );
98 
99 #endif
Protobuf::MonarchHeader * fProtobufHeader
Definition: M2Header.hh:19
uint32_t AcquisitionModeType
Definition: M2Types.hh:38
uint32_t FormatModeType
Definition: M2Types.hh:51
std::ostream & operator<<(std::ostream &out, const monarch2::M2Header &hdr)
Definition: M2Header.cc:272
uint32_t RunSourceType
Definition: M2Types.hh:47
uint32_t RunType
Definition: M2Types.hh:42