Graphitti
A toolkit/software architecture to ease creating high-performance neural network simulators
Loading...
Searching...
No Matches
EventBuffer Class Reference
Inheritance diagram for EventBuffer:
Collaboration diagram for EventBuffer:

Public Member Functions

 EventBuffer (int maxEvents=0)
 
int getNumElementsInEpoch () const
 
virtual void resize (int maxEvents) override
 
uint64_t operator[] (int i) const
 
template<class Archive >
void serialize (Archive &archive)
 Cereal serialization method.
 
Recorder Interface

virtual methods in RecordableBase for use by Recorder classes

virtual variantTypes getElement (int index) const override
 Get the value of the recordable variable at the specified index.
 
virtual int getNumElements () const override
 Get the number of elements that needs to be recorded.
 
virtual void setDataType () override
 Return the runtime data type info of unit64_t.
 
virtual const string & getDataType () const override
 Get the basic data type of the recordable variable.
 
virtual void startNewEpoch () override
 
Vertex and Edge Interface

EventBuffer interface for use by the Vertex and Edge classes

void clear ()
 
void insertEvent (uint64_t timeStep)
 
uint64_t getPastEvent (int offset) const
 
- Public Member Functions inherited from RecordableVector< uint64_t >
 RecordableVector ()
 Constructor.
 
uint64_t & operator[] (int index)
 Overload the operator to set the value at a specific index.
 
const std::vector< uint64_t > & getVector () const
 Method to retrieve the underlying std::vector<T>
 
void serialize (Archive &archive)
 Cereal serialization method.
 
- Public Member Functions inherited from RecordableBase
template<class Archive >
void serialize (Archive &archive)
 Cereal serialization method.
 

Friends

class AllIFNeurons
 
class AllSpikingNeurons
 

Additional Inherited Members

- Protected Member Functions inherited from RecordableBase
 RecordableBase ()=default
 prevents any code outside this class from creating a RecordableBase object
 
- Protected Attributes inherited from RecordableVector< uint64_t >
vector< uint64_t > dataSeries_
 Holds the event time steps.
 
- Protected Attributes inherited from RecordableBase
std::string basicDataType_
 the basic data type in the recorded variable
 

Detailed Description

Definition at line 31 of file EventBuffer.h.

Constructor & Destructor Documentation

◆ EventBuffer()

EventBuffer::EventBuffer ( int maxEvents = 0)

Create EventBuffer that is sized appropriately

Create and size the buffer so that it can hold a set number of events. Once an EventBuffer is created with a nonzero size, it should not be resized (generally, doing that will cause a major bug in the simulator). Note that the buffer size will be set to maxEvents+1, to distinguish between an empty and a full buffer.

Parameters
maxEventsDefaults to zero; otherwise, buffer size is set

Definition at line 16 of file EventBuffer.cpp.

Member Function Documentation

◆ clear()

void EventBuffer::clear ( )

Reset member variables consistent with an empty buffer

Definition at line 63 of file EventBuffer.cpp.

◆ getDataType()

const string & EventBuffer::getDataType ( ) const
overridevirtual

Get the basic data type of the recordable variable.

Reimplemented from RecordableVector< uint64_t >.

Definition at line 39 of file EventBuffer.cpp.

◆ getElement()

variantTypes EventBuffer::getElement ( int index) const
overridevirtual

Get the value of the recordable variable at the specified index.

Set up a string representing the basic data type Get the value of the recordable variable at the specified index.

Parameters
indexThe index of the recorded value to retrieve.
Returns
A variant representing the recorded value (uint64_t, double, or string).
Parameters
indexThe index of the recorded value to retrieve.
Returns
A variant representing the recorded value (uint64_t, double, or string).

Reimplemented from RecordableVector< uint64_t >.

Definition at line 33 of file EventBuffer.cpp.

◆ getNumElements()

int EventBuffer::getNumElements ( ) const
overridevirtual

Get the number of elements that needs to be recorded.

Reimplemented from RecordableVector< uint64_t >.

Definition at line 49 of file EventBuffer.cpp.

◆ getNumElementsInEpoch()

int EventBuffer::getNumElementsInEpoch ( ) const

Get number of events in the current/preceding epoch

Getting the number of events in the current epoch (or, in between epochs, the number of events in the preceding epoch) is not the same as the number of events in the buffer, because the buffer retains events from the previous epoch, too.

Definition at line 44 of file EventBuffer.cpp.

◆ getPastEvent()

uint64_t EventBuffer::getPastEvent ( int offset) const

Get an event from a time in the past

Get the time step for an event in the past. An offset of -1 means the last event placed in the buffer; -2 means two events ago.

Parameters
offsetHow many events ago. Must be negative. If that event isn't in the buffer, or if the buffer is empty, returns ULONG_MAX.

Definition at line 94 of file EventBuffer.cpp.

◆ insertEvent()

void EventBuffer::insertEvent ( uint64_t timeStep)

Insert an event time step

Insert an event time step into the buffer (i.e., enqueue it in the circular array implementation of the queue).

Precondition
The buffer is not full
Parameters
timeStepValue to store in buffer

Definition at line 83 of file EventBuffer.cpp.

◆ operator[]()

uint64_t EventBuffer::operator[] ( int i) const

Access event from current epoch

Access an element of the buffer as though it is an array or vector with element 0 being the first event in the epoch (element numElementsInEpoch_ - 1 would be the last element in the epoch).

Parameters
ielement number

Definition at line 71 of file EventBuffer.cpp.

◆ resize()

void EventBuffer::resize ( int maxEvents)
overridevirtual

Resize event buffer

Note that the buffer size will be set to maxEvents+1, to distinguish between an empty and a full buffer.

Precondition
current buffer must be empty
Parameters
maxEventsBuffer size

Reimplemented from RecordableVector< uint64_t >.

Definition at line 54 of file EventBuffer.cpp.

◆ serialize()

template<class Archive >
void EventBuffer::serialize ( Archive & archive)

Cereal serialization method.

Definition at line 157 of file EventBuffer.h.

◆ setDataType()

void EventBuffer::setDataType ( )
overridevirtual

Return the runtime data type info of unit64_t.

Reimplemented from RecordableVector< uint64_t >.

Definition at line 25 of file EventBuffer.cpp.

◆ startNewEpoch()

void EventBuffer::startNewEpoch ( )
overridevirtual

Start a new epoch

Resets the internal variables associated with tracking the events in a epoch. Note that this doesn't affect the contents of the buffer; it just resets things so that the epoch start is the index of the next event to be enqueued and that the number of events in the epoch is 0.

Reimplemented from RecordableVector< uint64_t >.

Definition at line 76 of file EventBuffer.cpp.

Friends And Related Symbol Documentation

◆ AllIFNeurons

friend class AllIFNeurons
friend

Definition at line 32 of file EventBuffer.h.

◆ AllSpikingNeurons

friend class AllSpikingNeurons
friend

Definition at line 33 of file EventBuffer.h.


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