MNE-CPP  0.1.9
A Framework for Electrophysiology
Public Member Functions | Friends | List of all members
EVENTSLIB::EventManager Class Reference

#include <eventmanager.h>

Public Member Functions

 EventManager ()
 
size_t getNumEvents () const
 
Event getEvent (idNum eventId) const
 
std::unique_ptr< std::vector< Event > > getEvents (const std::vector< idNum > eventIds) const
 
std::unique_ptr< std::vector< Event > > getAllEvents () const
 
std::unique_ptr< std::vector< Event > > getEventsInSample (int sample) const
 
std::unique_ptr< std::vector< Event > > getEventsBetween (int sampleStart, int sampleEnd) const
 
std::unique_ptr< std::vector< Event > > getEventsBetween (int sampleStart, int sampleEnd, idNum groupid) const
 
std::unique_ptr< std::vector< Event > > getEventsBetween (int sampleStart, int sampleEnd, const std::vector< idNum > &groupIdsList) const
 
std::unique_ptr< std::vector< Event > > getEventsInGroup (const idNum groupId) const
 
std::unique_ptr< std::vector< Event > > getEventsInGroups (const std::vector< idNum > &groupIdsList) const
 
Event addEvent (int sample)
 
Event addEvent (int sample, idNum groupId)
 
bool moveEvent (idNum eventId, int newSample)
 
bool deleteEvent (idNum eventId) noexcept
 
bool deleteEvents (const std::vector< idNum > &eventIds)
 
bool deleteEvents (std::unique_ptr< std::vector< Event > > eventIds)
 
bool deleteEventsInGroup (idNum groupId)
 
int getNumGroups () const
 
EventGroup getGroup (idNum groupId) const
 
std::unique_ptr< std::vector< EventGroup > > getAllGroups () const
 
std::unique_ptr< std::vector< EventGroup > > getGroups (const std::vector< idNum > &groupIds) const
 
EventGroup addGroup (const std::string &sGroupName)
 
EventGroup addGroup (const std::string &sGroupName, const RgbColor &color)
 
bool deleteGroup (const idNum groupId)
 
bool deleteGroups (const std::vector< idNum > &groupIds)
 
void renameGroup (const idNum groupId, const std::string &newName)
 
void setGroupColor (const idNum groupId, const RgbColor &color)
 
EventGroup mergeGroups (const std::vector< idNum > &groupIds, const std::string &newName)
 
EventGroup duplicateGroup (const idNum groupId, const std::string &newName)
 
bool addEventToGroup (const idNum eventId, const idNum groupId)
 
bool addEventsToGroup (const std::vector< idNum > &eventIds, const idNum groupId)
 
void initSharedMemory ()
 
void initSharedMemory (SharedMemoryMode mode)
 
void stopSharedMemory ()
 
bool isSharedMemoryInit ()
 

Friends

class EVENTSINTERNAL::EventSharedMemManager
 

Detailed Description

The EventManager class.

This class can be understood as an API, for the whole Event system, which is the Events library (EVENTSLIB namespace).

Definition at line 85 of file eventmanager.h.

Constructor & Destructor Documentation

◆ EventManager()

EventManager::EventManager ( )

EventManager constructor.

Definition at line 63 of file eventmanager.cpp.

Member Function Documentation

◆ addEvent() [1/2]

Event EventManager::addEvent ( int  sample)

Add an event at a specific sample. The event will be added to a "Default" group.

Parameters
[in]sampleThe sample at which the event should be added.
Returns
The event created. This variable hels in case the id of the newly created event is needed.

Definition at line 287 of file eventmanager.cpp.

◆ addEvent() [2/2]

Event EventManager::addEvent ( int  sample,
idNum  groupId 
)

Overriden function. Add event in a specific sample.

Parameters
[in]sampleThe sample at which the event should be created.
[in]groupIdThe id of the event group to which the event belongs to.
Returns
the newly created event.

Definition at line 270 of file eventmanager.cpp.

◆ addEventsToGroup()

bool EventManager::addEventsToGroup ( const std::vector< idNum > &  eventIds,
const idNum  groupId 
)

Add more than one event to a group.

Parameters
eventIdsThe identifiers for the events to add.
groupIdThe group to add the events to.
Returns
Boolean variable stating the success of the operation.

Definition at line 573 of file eventmanager.cpp.

◆ addEventToGroup()

bool EventManager::addEventToGroup ( const idNum  eventId,
const idNum  groupId 
)

Add one event to a group.

Parameters
eventIdIdentifier for the event.
groupIdGroup to add the event to.
Returns
Boolean stating if the operation was successful.

Definition at line 549 of file eventmanager.cpp.

◆ addGroup() [1/2]

EventGroup EventManager::addGroup ( const std::string &  sGroupName)

Add a new group of events.

Parameters
[in]sGroupNameThe group's name string.
Returns
The newly created event group.

Definition at line 440 of file eventmanager.cpp.

◆ addGroup() [2/2]

EventGroup EventManager::addGroup ( const std::string &  sGroupName,
const RgbColor color 
)

Add a new group of events, specifying its name and color. This is an overriden funcion.

Parameters
[in]sGroupNameThe name of the new group..
[in]colorThe color of the new group.
Returns
The event group created.

Definition at line 449 of file eventmanager.cpp.

◆ deleteEvent()

bool EventManager::deleteEvent ( idNum  eventId)
noexcept

Delete an event.

Parameters
eventIdThe id of the event to be deleted from the event system.
Returns
The deletion operation was successful.

Definition at line 312 of file eventmanager.cpp.

◆ deleteEvents() [1/2]

bool EventManager::deleteEvents ( const std::vector< idNum > &  eventIds)

This is an overriden function. Delete a set of events.

Parameters
[in]eventIdsThe ids of the events to be deleted.
Returns
The deletion of all the events was successful.

Definition at line 343 of file eventmanager.cpp.

◆ deleteEvents() [2/2]

bool EventManager::deleteEvents ( std::unique_ptr< std::vector< Event > >  eventIds)

deleteEvents Delete a set of events.

Parameters
[in]eventIdsA pointer to a vector with the events to be deleted.
Returns
All the deletion operations where successful.

Definition at line 355 of file eventmanager.cpp.

◆ deleteEventsInGroup()

bool EventManager::deleteEventsInGroup ( idNum  groupId)

Delete all the events in a specific group.

Parameters
[in]groupIdThe id of the group who's events are to be deleted.
Returns
All the deletion operations where sucessful.

Definition at line 366 of file eventmanager.cpp.

◆ deleteGroup()

bool EventManager::deleteGroup ( const idNum  groupId)

Delete a group. If there are events in the group the group won't be deleted.

Parameters
[in]groupIdThe ids of the group events to be deleted.
Returns
A bool variable equals true if all the deletion operations are succesful.

Definition at line 458 of file eventmanager.cpp.

◆ deleteGroups()

bool EventManager::deleteGroups ( const std::vector< idNum > &  groupIds)

Delete all groups. If any of the groups has events in it, that group will not be deleted.

Parameters
[in]groupIds
Returns

Definition at line 481 of file eventmanager.cpp.

◆ duplicateGroup()

EventGroup EventManager::duplicateGroup ( const idNum  groupId,
const std::string &  newName 
)

Duplicate a specified group. All the events in the group will also be duplicated.

Parameters
groupId
newName
Returns
The actual new group created.

Definition at line 536 of file eventmanager.cpp.

◆ getAllEvents()

std::unique_ptr< std::vector< Event > > EventManager::getAllEvents ( ) const

Retrieve all the events in the system.

Returns
A pointer to a vector with all the events.

Definition at line 121 of file eventmanager.cpp.

◆ getAllGroups()

std::unique_ptr< std::vector< EventGroup > > EventManager::getAllGroups ( ) const

Retrieve all the groups declared in the event system.

Returns
A pointer to a vector containing all the event groups existing.

Definition at line 410 of file eventmanager.cpp.

◆ getEvent()

Event EventManager::getEvent ( idNum  eventId) const

Retrieve an event from its id.

Parameters
[in]eventIdEvent id.
Returns
The event.

Definition at line 76 of file eventmanager.cpp.

◆ getEvents()

std::unique_ptr< std::vector< Event > > EventManager::getEvents ( const std::vector< idNum >  eventIds) const

Retrieve a set of events, given their ids.

Parameters
[in]eventIdsThe ids of events to retrieve.
Returns
A pointer to a vector with all the events are kept.

Definition at line 105 of file eventmanager.cpp.

◆ getEventsBetween() [1/3]

std::unique_ptr< std::vector< Event > > EventManager::getEventsBetween ( int  sampleStart,
int  sampleEnd 
) const

getEventsBetween Get all the events ocurring between (inclusive) two given samples.

Parameters
[in]sampleStartFirst sample to look for events.
[in]sampleEndLast sample to look for events.
Returns
A pointer to a vector containing all the events in between the specified samples.

Definition at line 149 of file eventmanager.cpp.

◆ getEventsBetween() [2/3]

std::unique_ptr< std::vector< Event > > EventManager::getEventsBetween ( int  sampleStart,
int  sampleEnd,
const std::vector< idNum > &  groupIdsList 
) const

Overriden function to retrieve all the events in between (inclusive) two samples, however only the ones that belong to one of a given list of groups.

Parameters
[in]sampleStartFirst sample to look events for.
[in]sampleEndLast sample to look for events.
[in]groupidListThe list of groups to which the events have to belong.
Returns
A pointer to a vector containing all the events found.

Definition at line 188 of file eventmanager.cpp.

◆ getEventsBetween() [3/3]

std::unique_ptr< std::vector< Event > > EventManager::getEventsBetween ( int  sampleStart,
int  sampleEnd,
idNum  groupid 
) const

Overriden function to retrieve all the events in between (inclusive) two samples, however only the ones belonging to a specified group.

Parameters
[in]sampleStartFirst sample to look events for.
[in]sampleEndLast sample to look for events.
[in]groupidThe group to which the events have to belong.
Returns
A pointer to a vector containing all the events.

Definition at line 167 of file eventmanager.cpp.

◆ getEventsInGroup()

std::unique_ptr< std::vector< Event > > EventManager::getEventsInGroup ( const idNum  groupId) const

Retrieve all the events belonging to a specified group of events.

Parameters
[in]groupIdThe group of events.
Returns
A pointer to a vector containing all the events found.

Definition at line 212 of file eventmanager.cpp.

◆ getEventsInGroups()

std::unique_ptr< std::vector< Event > > EventManager::getEventsInGroups ( const std::vector< idNum > &  groupIdsList) const

Retrieve all the events belonging to a specified set of group of events.

Parameters
[in]groupIdsListThe set of group of events to which the events will belong to.
Returns
A pointer to a vector containing all the events found.

Definition at line 228 of file eventmanager.cpp.

◆ getEventsInSample()

std::unique_ptr< std::vector< Event > > EventManager::getEventsInSample ( int  sample) const

Get all the events declared in the given sample.

Parameters
[in]sampleThe sample from where to get the events from.
Returns
A pointer to a vector whith all the events ocurring in the specified sample.

Definition at line 133 of file eventmanager.cpp.

◆ getGroup()

EventGroup EventManager::getGroup ( idNum  groupId) const

Retrieve an event group.

Parameters
[in]groupIdThe id of the event group to be retrieved.
Returns
The event group.

Definition at line 396 of file eventmanager.cpp.

◆ getGroups()

std::unique_ptr< std::vector< EventGroup > > EventManager::getGroups ( const std::vector< idNum > &  groupIds) const

Get group events given their ids.

Parameters
[in]groupIdsA list of group eveent ids to be retrieved.
Returns
A pointer to a vector storing a list of event groups.

Definition at line 424 of file eventmanager.cpp.

◆ getNumEvents()

size_t EventManager::getNumEvents ( ) const

Retrive the number of events already stored in the Event system.

Returns
Number of events.

Definition at line 263 of file eventmanager.cpp.

◆ getNumGroups()

int EventManager::getNumGroups ( ) const

Retrieve the number of groups created in the event system.

Returns
An integer with the number of event groups.

Definition at line 389 of file eventmanager.cpp.

◆ initSharedMemory() [1/2]

void EventManager::initSharedMemory ( )

Initialize the shared memory mecanism. This mecanism allows for inter-process communication. Typically this would be with mne-scan.

Definition at line 585 of file eventmanager.cpp.

◆ initSharedMemory() [2/2]

void EventManager::initSharedMemory ( SharedMemoryMode  mode)

Initialize the shared memory space with an empty linked list.

Parameters
modeEnum stating the mode to use for in the shared memory.

Definition at line 594 of file eventmanager.cpp.

◆ isSharedMemoryInit()

bool EventManager::isSharedMemoryInit ( )

Getter to know if the shared memory mechanism has been initialized already.

Returns
Bool value stating if the shared memoy mechanism.

Definition at line 612 of file eventmanager.cpp.

◆ mergeGroups()

EventGroup EventManager::mergeGroups ( const std::vector< idNum > &  groupIds,
const std::string &  newName 
)

Merge two groups together into a diferent third group.

Parameters
groupIdsGroup Ids of the groups to merge.
newNameNew name to be applied.
Returns
The actual new group created from the merge.

Definition at line 515 of file eventmanager.cpp.

◆ moveEvent()

bool EventManager::moveEvent ( idNum  eventId,
int  newSample 
)

Move an event to a new sample. All other fields of the event will remain unaltered.

Parameters
[in]eventIdThe id of the event to be moved.
[in]newSampleThe new sample to which the event will be moved to.
Returns
The moving operation was done succesfully.

Definition at line 295 of file eventmanager.cpp.

◆ renameGroup()

void EventManager::renameGroup ( const idNum  groupId,
const std::string &  newName 
)

Change the name of the specified group (groupId).

Parameters
groupIdId of the group.
newNameNew string to use as the group name.

Definition at line 493 of file eventmanager.cpp.

◆ setGroupColor()

void EventManager::setGroupColor ( const idNum  groupId,
const RgbColor color 
)

Change the color of the group to a specified one.

Parameters
groupIdGroup identifier.
colorNew color for the group.

Definition at line 504 of file eventmanager.cpp.

◆ stopSharedMemory()

void EventManager::stopSharedMemory ( )

Disable the shared memory management.

Definition at line 603 of file eventmanager.cpp.


The documentation for this class was generated from the following files: