engine-mk1
Public Member Functions | Protected Attributes | List of all members
rz::core::System Class Referenceabstract

The abstract base class for a System. More...

#include <System.hpp>

Collaboration diagram for rz::core::System:
[legend]

Public Member Functions

virtual rz::taskscheduler::Task update (EntityMap &entities, double delta)=0
 Generates a TaskGraph used to update all relevant Component objects. More...
 
virtual ComponentHandle createComponent (ComponentType type, std::shared_ptr< void > tuplePtr)=0
 Creates a new Component in the ObjectPool. More...
 
virtual bool removeComponent (ComponentHandle ch)=0
 Removes a Component from the ObjectPool. More...
 
template<class T , typename... Args>
Handle emplaceObject (Args...args)
 Calls emplace on the member ObjectPool with the given arguments. More...
 
template<class T >
T * getObject (Handle handle)
 Calls get on the member ObjectPool with the given arguments. More...
 
template<class T >
void removeObject (Handle handle)
 Calls erase on the member ObjectPool with the given arguments. More...
 
void registerHandler (rz::eventstream::EventType type, rz::eventstream::EventHandler handler)
 Calls registerHandler on the member EventStream with the given arguments. More...
 
void extendHandler (rz::eventstream::EventType type, rz::eventstream::EventHandler handler)
 Calls extendHandler on the member EventStream with the given arguments. More...
 
void processEvents ()
 Calls processEvents on the member EventStream. More...
 
void pushEvents (const std::vector< rz::eventstream::Event > &events, rz::eventstream::StreamType streamType)
 Calls pushEvents on the member EventStream. More...
 
std::vector< rz::eventstream::EventpopEvents (rz::eventstream::StreamType streamType)
 Calls popEvents on the member EventStream. More...
 
double getInterval () noexcept
 Gets the set interval (in ms) between updates for this System. More...
 
double getTaskGraph () noexcept
 Gets the current TaskGraph of this System. More...
 
void setTaskScheduler (std::shared_ptr< rz::taskscheduler::TaskScheduler > taskScheduler)
 Sets the TaskScheduler used by this System. More...
 
rz::taskscheduler::TaskSchedulergetTaskScheduler ()
 Gets a reference to the TaskScheduler used by this System. More...
 
void setParentTask (rz::taskscheduler::Task parentTask)
 Sets the parent Task of this System. More...
 
rz::taskscheduler::TaskgetParentTask ()
 Gets the parent Task of this System. More...
 

Protected Attributes

UUID64 _id
 The unique id of this system. More...
 
rz::objectpool::ObjectPool _pool
 The ObjectPool used to manage the memory of this System. More...
 
double _interval
 The max interval (in seconds) between updates for this System. More...
 
rz::eventstream::EventStream _eventStream
 The EventStream belonging to this System. More...
 
std::set< ComponentType, ComponentTypeCmp_componentTypes
 The set of ComponentTypes supported by this System. More...
 
std::shared_ptr< rz::taskscheduler::TaskScheduler_taskScheduler
 
rz::taskscheduler::Task _parentTask
 
EntityMap _entities
 

Detailed Description

The abstract base class for a System.

Member Function Documentation

virtual ComponentHandle rz::core::System::createComponent ( ComponentType  type,
std::shared_ptr< void >  tuplePtr 
)
pure virtual

Creates a new Component in the ObjectPool.

template<class T , typename... Args>
Handle rz::core::System::emplaceObject ( Args...  args)
inline

Calls emplace on the member ObjectPool with the given arguments.

void System::extendHandler ( rz::eventstream::EventType  type,
rz::eventstream::EventHandler  handler 
)

Calls extendHandler on the member EventStream with the given arguments.

double rz::core::System::getInterval ( )
inlinenoexcept

Gets the set interval (in ms) between updates for this System.

template<class T >
T* rz::core::System::getObject ( Handle  handle)
inline

Calls get on the member ObjectPool with the given arguments.

rz::taskscheduler::Task& rz::core::System::getParentTask ( )
inline

Gets the parent Task of this System.

double rz::core::System::getTaskGraph ( )
inlinenoexcept

Gets the current TaskGraph of this System.

rz::taskscheduler::TaskScheduler& rz::core::System::getTaskScheduler ( )
inline

Gets a reference to the TaskScheduler used by this System.

std::vector< Event > System::popEvents ( rz::eventstream::StreamType  streamType)

Calls popEvents on the member EventStream.

void System::processEvents ( )

Calls processEvents on the member EventStream.

void System::pushEvents ( const std::vector< rz::eventstream::Event > &  events,
rz::eventstream::StreamType  streamType 
)

Calls pushEvents on the member EventStream.

void System::registerHandler ( rz::eventstream::EventType  type,
rz::eventstream::EventHandler  handler 
)

Calls registerHandler on the member EventStream with the given arguments.

virtual bool rz::core::System::removeComponent ( ComponentHandle  ch)
pure virtual

Removes a Component from the ObjectPool.

template<class T >
void rz::core::System::removeObject ( Handle  handle)
inline

Calls erase on the member ObjectPool with the given arguments.

void rz::core::System::setParentTask ( rz::taskscheduler::Task  parentTask)
inline

Sets the parent Task of this System.

void rz::core::System::setTaskScheduler ( std::shared_ptr< rz::taskscheduler::TaskScheduler taskScheduler)
inline

Sets the TaskScheduler used by this System.

virtual rz::taskscheduler::Task rz::core::System::update ( EntityMap &  entities,
double  delta 
)
pure virtual

Generates a TaskGraph used to update all relevant Component objects.

Parameters
entitiesA vector of all Entity objects to access relevant Component objects from.
deltaThe time
Returns
Returns the TaskGraph needed to run update logic for the Component objects.

Member Data Documentation

std::set<ComponentType, ComponentTypeCmp> rz::core::System::_componentTypes
protected

The set of ComponentTypes supported by this System.

rz::eventstream::EventStream rz::core::System::_eventStream
protected

The EventStream belonging to this System.

UUID64 rz::core::System::_id
protected

The unique id of this system.

double rz::core::System::_interval
protected

The max interval (in seconds) between updates for this System.

rz::objectpool::ObjectPool rz::core::System::_pool
protected

The ObjectPool used to manage the memory of this System.


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