v2.0.0
Loading...
Searching...
No Matches
event.h
Go to the documentation of this file.
1//=============================================================================================================
35
36#ifndef EVENT_EVENTSINTERNAL_H
37#define EVENT_EVENTSINTERNAL_H
38
39//=============================================================================================================
40// INCLUDES
41//=============================================================================================================
42
43#include "events_global.h"
44#include "eventgroup.h"
45
46//=============================================================================================================
47// STD INCLUDES
48//=============================================================================================================
49
50#include <string>
51
52//=============================================================================================================
53// NAMESPACE EVENTSLIB
54//=============================================================================================================
55
56namespace EVENTSLIB {
57
58//=============================================================================================================
59// EVENTSINTERNAL FORWARD DECLARATIONS
60//=============================================================================================================
61
62namespace EVENTSINTERNAL {
63 class EventINT;
64}
65
66//=============================================================================================================
74{
75 //=========================================================================================================
79 Event();
80
81 //=========================================================================================================
89 Event(const idNum id,const int sample, const idNum groupId);
90
91 //=========================================================================================================
98
100 int sample;
102};
103
104namespace EVENTSINTERNAL {
105// The fact that we go with int for sample is a fundamental limitation of this
106// whole architecture. With a Fs = 1kHz, we could have a maximum of aprox. 25 days.
107// Yes not a big limitation... if we keep using 1kHz...
108// If we were to go for long longs for sample... with that same 1kHz, we could go
109// recording, single file... for about 300 million years. That's that...
110// at some point we can substitute int and idNum with std::int64_t. That will take that limitation away.
111// I don't see how I should ever think of this again.
120{
121public:
122 //=========================================================================================================
128 EventINT(idNum id);
129
130 //=========================================================================================================
138 EventINT(idNum id, int iSample, idNum groupId);
139
140 //=========================================================================================================
146 EventINT(const EventINT& rhs);
147
148 //=========================================================================================================
154 EventINT(EventINT&& other);
155
156 //=========================================================================================================
162 static inline EventINT fromSample(int iSample);
163
164 //=========================================================================================================
170 int getSample() const;
171
172 //=========================================================================================================
178 void setSample(int iSample);
179
180 //=========================================================================================================
186 idNum getGroupId() const;
187
188 //=========================================================================================================
194 void setGroupId(idNum iGroup);
195
196 //=========================================================================================================
202 idNum getId() const;
203
204 //=========================================================================================================
210 std::string getDescription() const;
211
212 //=========================================================================================================
218 void setDescription(const std::string& description);
219
220 //=========================================================================================================
226 void setDescription(std::string&& description);
227
228 //=========================================================================================================
236 bool operator<(const EventINT& rhs) const;
237
238 //=========================================================================================================
246 bool operator==(const EventINT& rhs) const;
247
248 //=========================================================================================================
256 EventINT operator=(const EventINT& rhs);
257
258private:
259 idNum m_iId;
260 int m_iSample;
261 idNum m_iGroup;
262 std::string m_sDescription;
263};
264
265//=========================================================================================================
274{
275 return EventINT(0, sample, 0);
276}
277
278}//namespace EVENTSINTERNAL
279}//namespace EVENTSLIB
280
281//=========================================================================================================
282
286namespace std {
287template<>
288struct hash<EVENTSLIB::EVENTSINTERNAL::EventINT>
289{
290 size_t operator()(const EVENTSLIB::EVENTSINTERNAL::EventINT& rhs) const
291 {
292 return hash<int>()(rhs.getId());
293 }
294};
295
296}
297
298#endif // EVENT_H
299
EventGroup declaration.
unsigned int idNum
Definition eventgroup.h:51
event library export/import macros.
#define EVENTS_EXPORT
Event annotation management (creation, grouping, shared-memory transport).
Definition event.h:56
idNum groupId
Definition event.h:101
Internal event representation with sample position, group link, and unique ID used by EventManager.
Definition event.h:120
static EventINT fromSample(int iSample)
Definition event.h:273
void setDescription(const std::string &description)
void setDescription(std::string &&description)
bool operator<(const EventINT &rhs) const
Definition event.cpp:160
void setGroupId(idNum iGroup)
Definition event.cpp:139
std::string getDescription() const
Definition event.cpp:153
EventINT operator=(const EventINT &rhs)
Definition event.cpp:172
bool operator==(const EventINT &rhs) const
Definition event.cpp:167