Monarch  v3.8.2
Project 8 Data File Format Library
M3Record.hh
Go to the documentation of this file.
1 /*
2  * M3Record.hh
3  *
4  * Created on: Dec 26, 2014
5  * Author: nsoblath
6  */
7 
8 #ifndef M3RECORD_HH_
9 #define M3RECORD_HH_
10 
11 #include "M3Exception.hh"
12 #include "M3MemberVariable.hh"
13 #include "M3Types.hh"
14 
15 namespace monarch3
16 {
36  {
37  public:
38  M3Record( unsigned aNBytes = 0 );
39  M3Record( RecordIdType* aRecPtr, TimeType* aTimePtr, byte_type* aDataPtr );
40  ~M3Record();
41 
42  M3Record( const M3Record& ) = delete;
43  M3Record& operator=( const M3Record& ) = delete;
44 
46  void Initialize();
48  void Initialize( unsigned aNBytes );
51  void Initialize( RecordIdType* aRecPtr, TimeType* aTimePtr, byte_type* aDataPtr );
52 
53  void ClearData();
54 
55  RecordIdType GetRecordId() const;
56  RecordIdType* GetRecordIdPtr() const;
57  void SetRecordId( RecordIdType aId );
58 
59  TimeType GetTime() const;
60  TimeType* GetTimePtr() const;
61  void SetTime( TimeType aTime );
62 
63  const byte_type* GetData() const;
64  byte_type* GetData();
65 
66  void UpdateDataPtr( const byte_type* aDataPtr ) const;
67  void UpdateDataPtr( byte_type* aDataPtr );
68 
69  M3MEMBERVARIABLE_NOSET( bool, OwnsData );
70 
71  private:
74 
75  mutable byte_type* fData;
76 
77  };
78 
80  {
81  return *fRecordId;
82  }
83 
85  {
86  return fRecordId;
87  }
88 
90  {
91  (*fRecordId) = aId;
92  return;
93  }
94 
95  inline TimeType M3Record::GetTime() const
96  {
97  return *fTime;
98  }
99 
101  {
102  return fTime;
103  }
104 
105  inline void M3Record::SetTime( TimeType aTime )
106  {
107  (*fTime) = aTime;
108  return;
109  }
110 
111  inline const byte_type* M3Record::GetData() const
112  {
113  return fData;
114  }
115 
117  {
118  return fData;
119  }
120 
121 }
122 
123 #endif /* M3RECORD_HH_ */
Contains the information that makes up a record.
Definition: M3Record.hh:35
byte_type * fData
Definition: M3Record.hh:75
uint8_t byte_type
Definition: M3Types.hh:22
TimeType * GetTimePtr() const
Definition: M3Record.hh:100
RecordIdType * fRecordId
Definition: M3Record.hh:72
void SetRecordId(RecordIdType aId)
Definition: M3Record.hh:89
RecordIdType GetRecordId() const
Definition: M3Record.hh:79
void SetTime(TimeType aTime)
Definition: M3Record.hh:105
uint64_t RecordIdType
Definition: M3Types.hh:25
const byte_type * GetData() const
Definition: M3Record.hh:111
uint64_t TimeType
Definition: M3Types.hh:26
RecordIdType * GetRecordIdPtr() const
Definition: M3Record.hh:84
#define M3MEMBERVARIABLE_NOSET
TimeType * fTime
Definition: M3Record.hh:73
TimeType GetTime() const
Definition: M3Record.hh:95
#define M3_API
Definition: M3Constants.hh:21