Accessories
Arduino for motors and lights library.
AccessoriesEventStack Class Reference

#include "AccessoriesEventStack.hpp"

Public Member Functions

void PushEvent (unsigned long inId, ACCESSORIES_EVENT_TYPE inType, int inData)
 
void GetEvent (unsigned long *inpId, ACCESSORIES_EVENT_TYPE *inpType, int *inpData)
 
byte GetFreeEventIndex ()
 

Static Public Attributes

static AccessoriesEventStack EventsStack
 

Detailed Description

The event stack is a small location for a few events ready to be send to the caller. This is a barely a list. The defined events are always from index 0 to the last defined. Each PushEvent will be push the new one at the end of the list. Each GetEvent will always returns the first element of the list at index 0. If index 0 has its id at UNDEFINED_ID, so the list is empty... With this structure, this is a FIFO stack.

Function call 0 1 2
empty list undefundefundef
PushEvent A A undefundef
PushEvent B A B undef
GetEvent B undefundef

Definition at line 27 of file AccessoriesEventStack.hpp.

Member Function Documentation

void AccessoriesEventStack::GetEvent ( unsigned long *  inpId,
ACCESSORIES_EVENT_TYPE *  inpType,
int *  inpData 
)

Gets an event from the stack.

Parameters
inpIdaddress to fill with the id of the event or UNDEFINED_ID if no event is available.
inpTypeaddress to fill with the type
inpDataaddress to fill with the associated data
Remarks
A previous call to GetPendingEventIndex() will give the first available event index.

Definition at line 41 of file AccessoriesEventStack.cpp.

byte AccessoriesEventStack::GetFreeEventIndex ( )

Gets the first free event index in the stack.

Returns
index of the first free event in the list.

Definition at line 32 of file AccessoriesEventStack.cpp.

void AccessoriesEventStack::PushEvent ( unsigned long  inId,
ACCESSORIES_EVENT_TYPE  inType,
int  inData 
)

Add a new event to the stack.

Parameters
inIdid of the event
inTypetype
inDataassociated data

Definition at line 16 of file AccessoriesEventStack.cpp.

Member Data Documentation

AccessoriesEventStack AccessoriesEventStack::EventsStack
static

Stack of events itself.

Definition at line 44 of file AccessoriesEventStack.hpp.


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