36 #ifndef EVENTMANAGER_EVENTS_H
37 #define EVENTMANAGER_EVENTS_H
51 enum SharedMemoryMode { READ, WRITE, READWRITE };
60 #include <unordered_map>
74 namespace EVENTSINTERNAL {
75 class EventSharedMemManager;
99 size_t getNumEvents()
const;
107 Event getEvent(idNum eventId)
const;
115 std::unique_ptr<std::vector<Event> > getEvents(
const std::vector<idNum> eventIds)
const ;
122 std::unique_ptr<std::vector<Event> > getAllEvents()
const ;
130 std::unique_ptr<std::vector<Event> > getEventsInSample(
int sample)
const ;
139 std::unique_ptr<std::vector<Event> > getEventsBetween(
int sampleStart,
int sampleEnd)
const ;
150 std::unique_ptr<std::vector<Event> > getEventsBetween(
int sampleStart,
int sampleEnd, idNum groupid)
const ;
161 std::unique_ptr<std::vector<Event> > getEventsBetween(
int sampleStart,
int sampleEnd,
const std::vector<idNum>& groupIdsList)
const ;
169 std::unique_ptr<std::vector<Event> > getEventsInGroup(
const idNum groupId)
const;
177 std::unique_ptr<std::vector<Event> > getEventsInGroups(
const std::vector<idNum>& groupIdsList)
const;
185 Event addEvent(
int sample);
194 Event addEvent(
int sample, idNum groupId);
203 bool moveEvent(idNum eventId,
int newSample);
211 bool deleteEvent(idNum eventId) noexcept;
219 bool deleteEvents(
const std::vector<idNum>& eventIds);
227 bool deleteEvents(std::unique_ptr<std::vector<Event> > eventIds);
235 bool deleteEventsInGroup(idNum groupId);
242 int getNumGroups()
const;
257 std::unique_ptr<std::vector<EventGroup> > getAllGroups()
const ;
265 std::unique_ptr<std::vector<EventGroup> > getGroups(
const std::vector<idNum>& groupIds)
const ;
273 EventGroup addGroup(
const std::string& sGroupName);
290 bool deleteGroup(
const idNum groupId);
298 bool deleteGroups(
const std::vector<idNum>& groupIds);
306 void renameGroup(
const idNum groupId,
const std::string& newName);
314 void setGroupColor(
const idNum groupId,
const RgbColor& color);
323 EventGroup mergeGroups(
const std::vector<idNum>& groupIds,
const std::string& newName);
332 EventGroup duplicateGroup(
const idNum groupId,
const std::string& newName);
341 bool addEventToGroup(
const idNum eventId,
const idNum groupId);
350 bool addEventsToGroup(
const std::vector<idNum>& eventIds,
const idNum groupId);
357 void initSharedMemory();
364 void initSharedMemory(SharedMemoryMode mode);
370 void stopSharedMemory();
377 bool isSharedMemoryInit();
385 idNum generateNewEventId();
392 idNum generateNewGroupId();
407 bool eraseEvent(idNum eventId);
415 std::multimap<int, EVENTSINTERNAL::EventINT>::const_iterator findEventINT(idNum
id)
const;
421 void createDefaultGroupIfNeeded();
423 std::multimap<int, EVENTSINTERNAL::EventINT> m_EventsListBySample;
424 std::unordered_map<idNum, int> m_MapIdToSample;
425 std::map<idNum, EVENTSINTERNAL::EventGroupINT> m_GroupsList;
428 std::unique_ptr<EVENTSINTERNAL::EventSharedMemManager> m_pSharedMemManager;
432 idNum m_iEventIdCounter;
433 idNum m_iGroupIdCounter;
434 bool m_bDefaultGroupNotCreated;
435 idNum m_DefaultGroupId;
446 return std::make_unique<std::vector<T> >();
456 auto v = std::make_unique<std::vector<T> >();