MNE-CPP 0.1.9
A Framework for Electrophysiology
Loading...
Searching...
No Matches
event.h
Go to the documentation of this file.
1//=============================================================================================================
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//=============================================================================================================
72{
73 //=========================================================================================================
77 Event();
78
79 //=========================================================================================================
87 Event(const idNum id,const int sample, const idNum groupId);
88
89 //=========================================================================================================
96
97 idNum id;
98 int sample;
99 idNum groupId;
100};
101
102namespace EVENTSINTERNAL {
103// The fact that we go with int for sample is a fundamental limitation of this
104// whole architecture. With a Fs = 1kHz, we could have a maximum of aprox. 25 days.
105// Yes not a big limitation... if we keep using 1kHz...
106// If we were to go for long longs for sample... with that same 1kHz, we could go
107// recording, single file... for about 300 million years. That's that...
108// at some point we can substitute int and idNum with std::int64_t. That will take that limitation away.
109// I don't see how I should ever think of this again.
116{
117public:
118 //=========================================================================================================
124 EventINT(idNum id);
125
126 //=========================================================================================================
134 EventINT(idNum id, int iSample, idNum groupId);
135
136 //=========================================================================================================
142 EventINT(const EventINT& rhs);
143
144 //=========================================================================================================
150 EventINT(EventINT&& other);
151
152 //=========================================================================================================
158 static inline EventINT fromSample(int iSample);
159
160 //=========================================================================================================
166 int getSample() const;
167
168 //=========================================================================================================
174 void setSample(int iSample);
175
176 //=========================================================================================================
182 idNum getGroupId() const;
183
184 //=========================================================================================================
190 void setGroupId(idNum iGroup);
191
192 //=========================================================================================================
198 idNum getId() const;
199
200 //=========================================================================================================
206 std::string getDescription() const;
207
208 //=========================================================================================================
214 void setDescription(const std::string& description);
215
216 //=========================================================================================================
222 void setDescription(std::string&& description);
223
224 //=========================================================================================================
232 bool operator<(const EventINT& rhs) const;
233
234 //=========================================================================================================
242 bool operator==(const EventINT& rhs) const;
243
244 //=========================================================================================================
252 EventINT operator=(const EventINT& rhs);
253
254private:
255 idNum m_iId;
256 int m_iSample;
257 idNum m_iGroup;
258 std::string m_sDescription;
259};
260
261//=========================================================================================================
270{
271 return EventINT(0, sample, 0);
272}
273
274}//namespace EVENTSINTERNAL
275}//namespace EVENTSLIB
276
277//=========================================================================================================
278
282namespace std {
283template<>
284struct hash<EVENTSLIB::EVENTSINTERNAL::EventINT>
285{
286 size_t operator()(const EVENTSLIB::EVENTSINTERNAL::EventINT& rhs) const
287 {
288 return hash<int>()(rhs.getId());
289 }
290};
291
292}
293
294#endif // EVENT_H
295
EventGroup declaration.
event library export/import macros.
#define EVENTS_EXPORT
Definition event.h:282
idNum groupId
Definition event.h:99
static EventINT fromSample(int iSample)
Definition event.h:269
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