Graphitti
A toolkit/software architecture to ease creating high-performance neural network simulators
Loading...
Searching...
No Matches
InputManager< T > Class Template Reference

Public Types

enum  PropertyType {
  INTEGER , UINT64 , LONG , FLOAT ,
  DOUBLE , STRING
}
 
using EventMemberPtr = boost::variant<int T::*, uint64_t T::*, long T::*, float T::*, double T::*, string T::*>
 
using VertexId_t = int
 
using EventMap_t = map<VertexId_t, queue<T>>
 

Public Member Functions

 InputManager ()
 Constructor.
 
void setInputFilePath (const string &inputFilePath)
 Sets the path to the input file.
 
void readInputs ()
 Read a list of events from an input file and load them into a map, organized per vertex ID.
 
CircularBuffer< T > & getEvents (const VertexId_t &vertexId, uint64_t firstStep, uint64_t lastStep, CircularBuffer< T > &buffer)
 Inserts into a the CircularBuffer output parameter the list of events that occur between firstStep (inclusive) and lastStep (exclusive) in the given vertexId.
 
int getClockTickSize ()
 Retrieves the clock tick size as defined in the input file.
 
string getClockTickUnit ()
 Retrieve the clock tick unit as defined in the input file.
 
queueFront (const VertexId_t &vertexId)
 Peeks into the event at the front of the vertex queue.
 
bool queuePop (const VertexId_t &vertexId)
 Removes the event at the front of the vertex queue.
 
bool queueEmpty (const VertexId_t &vertexId)
 True if the event queue for the given vertex is empty, false otherwise.
 
bool registerProperty (const string &propName, EventMemberPtr property)
 Registers a property with the given name and a pointer to a member of the Event class. The pointer to member is stored in a boost::variant type that is later used to assign the input event data to the correct member variable.
 

Detailed Description

template<typename T>
class InputManager< T >

Definition at line 52 of file InputManager.h.

Member Typedef Documentation

◆ EventMap_t

template<typename T >
using InputManager< T >::EventMap_t = map<VertexId_t, queue<T>>

Definition at line 65 of file InputManager.h.

◆ EventMemberPtr

template<typename T >
using InputManager< T >::EventMemberPtr = boost::variant<int T::*, uint64_t T::*, long T::*, float T::*, double T::*, string T::*>

Definition at line 60 of file InputManager.h.

◆ VertexId_t

template<typename T >
using InputManager< T >::VertexId_t = int

Definition at line 64 of file InputManager.h.

Member Enumeration Documentation

◆ PropertyType

template<typename T >
enum InputManager::PropertyType

Definition at line 61 of file InputManager.h.

Constructor & Destructor Documentation

◆ InputManager()

template<typename T >
InputManager< T >::InputManager ( )
inline

Constructor.

Definition at line 68 of file InputManager.h.

Member Function Documentation

◆ getClockTickSize()

template<typename T >
int InputManager< T >::getClockTickSize ( )
inline

Retrieves the clock tick size as defined in the input file.

Returns
The user defined clock tick size

Definition at line 178 of file InputManager.h.

◆ getClockTickUnit()

template<typename T >
string InputManager< T >::getClockTickUnit ( )
inline

Retrieve the clock tick unit as defined in the input file.

Returns
The user defined clock tick unit

Definition at line 185 of file InputManager.h.

◆ getEvents()

template<typename T >
CircularBuffer< T > & InputManager< T >::getEvents ( const VertexId_t & vertexId,
uint64_t firstStep,
uint64_t lastStep,
CircularBuffer< T > & buffer )
inline

Inserts into a the CircularBuffer output parameter the list of events that occur between firstStep (inclusive) and lastStep (exclusive) in the given vertexId.

Parameters
vertexIdThe ID of the vertex where the events occur
firstStepThe first time step (inclusive) for the occurrence of the events
lastStepThe last time step (exclusive) for the occurrence of the events
bufferThe CircularBuffer where input events will be inserted
Returns
A reference to the CircularBuffer containing the list of events between firstStep and lastStep for the given vertexId

Definition at line 161 of file InputManager.h.

◆ queueEmpty()

template<typename T >
bool InputManager< T >::queueEmpty ( const VertexId_t & vertexId)
inline

True if the event queue for the given vertex is empty, false otherwise.

Parameters
vertexIdThe vertexId
Returns
True if the event queue is empty, false otherwise

Definition at line 216 of file InputManager.h.

◆ queueFront()

template<typename T >
T InputManager< T >::queueFront ( const VertexId_t & vertexId)
inline

Peeks into the event at the front of the vertex queue.

Parameters
vertexIdThe ID of the vertex
Exceptions
out_of_range,ifvertexId is not found in the map
Returns
The event at the front of the given vertex queue

Definition at line 194 of file InputManager.h.

◆ queuePop()

template<typename T >
bool InputManager< T >::queuePop ( const VertexId_t & vertexId)
inline

Removes the event at the front of the vertex queue.

Parameters
vertexIdThe ID of the vertex
Returns
true if the front of the queue was removed false otherwise. Returns false if there are no events for the given vertex

Definition at line 203 of file InputManager.h.

◆ readInputs()

template<typename T >
void InputManager< T >::readInputs ( )
inline

Read a list of events from an input file and load them into a map, organized per vertex ID.

Definition at line 90 of file InputManager.h.

◆ registerProperty()

template<typename T >
bool InputManager< T >::registerProperty ( const string & propName,
EventMemberPtr property )
inline

Registers a property with the given name and a pointer to a member of the Event class. The pointer to member is stored in a boost::variant type that is later used to assign the input event data to the correct member variable.

Parameters
propNameThe name of the property as defined in the input file
propertyThe pointer to member variable where the property should be stored
Returns
True if the property was successfully registered, false otherwise

Definition at line 232 of file InputManager.h.

◆ setInputFilePath()

template<typename T >
void InputManager< T >::setInputFilePath ( const string & inputFilePath)
inline

Sets the path to the input file.

Parameters
inputFilePathThe path to the input file

Definition at line 78 of file InputManager.h.


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