Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Member Functions | Static Public Attributes | List of all members
om::engine::base::EngineContext Class Reference

A collection of EngineSystem objects that operate on a set of abstract entities and their components. More...

#include <omEngineContext.h>

Inheritance diagram for om::engine::base::EngineContext:
om::engine::DefaultEngineContext

Public Member Functions

 EngineContext ()
 Create a new empty engine context with no systems, entities, or components. More...
 
virtual ~EngineContext ()
 Destroy an engine context, releasing all internally allocated data. More...
 
virtual void update (const Time &dt)
 Update the state of all systems in this engine for the specified time interval. More...
 
template<typename T >
Bool addComponent (T *component, ResourceID *componentID=((void *) 0))
 Add a component of a concete template type to the engine. More...
 
Bool addComponent (const ResourceType &type, void *componentData)
 Add an opaque component of the specified type to the engine. More...
 
Bool addComponent (const OpaqueResource &component)
 Add an opaque component to the engine. More...
 
template<typename T >
Bool removeComponent (T *component)
 Remove the specified component of the template type from the engine. More...
 
Bool removeComponent (const OpaqueResource &component)
 Remove an opaque component from the engine. More...
 
Bool removeComponent (const ResourceType &type, void *componentData)
 Remove an opaque component of the specified type from the engine. More...
 
void clearComponents ()
 Remove all components from the engine. More...
 
Size getComponentTypeCount () const
 Return the number of different component types that this engine context is processing. More...
 
template<typename T >
ComponentSet< T > newComponentType ()
 Return a pointer to the component manager for components with the specified type in this engine. More...
 
template<typename T >
ComponentSet< T > getComponentType () const
 Return a pointer to the component manager for components with the specified type in this engine. More...
 
Bool addConnection (const Connection *connection)
 Add a data flow connection to this engine so that it is processed during simulation updates. More...
 
Bool removeConnection (const Connection *connection)
 Remove a data flow connection from this engine so that it is no longer processed. More...
 
void clearConnections ()
 Clear all connections from this engine context. More...
 
Size getSystemCount () const
 Return the number of systems there are in this engine context. More...
 
EngineSystemgetSystem (Index systemIndex) const
 Return a pointer to the system in this engine context at the specified index. More...
 
Bool addSystem (EngineSystem *system)
 Add a system to this engine context. More...
 
Bool removeSystem (const EngineSystem *system)
 Remove the system in this engine with the given pointer. More...
 
void clearSystems ()
 Remove all systems from this engine. More...
 
Size getEventTypeCount () const
 Return the number of different event types that this engine context is processing. More...
 
template<typename ValueType >
EventManager< ValueType > * newEventType (const EventType &eventType)
 Return a pointer to the event manager for events with the specified type in this engine. More...
 
template<typename ValueType >
EventManager< ValueType > * getEventType (const EventType &eventType)
 Return a pointer to the event manager for events with the specified type in this engine. More...
 
template<typename ValueType >
const EventManager< ValueType > * getEventType (const EventType &eventType) const
 Return a const pointer to the event manager for events with the specified type in this engine. More...
 
template<typename ValueType >
Bool addEvent (const EventType &eventType, const Event< ValueType > &newEvent)
 Post a new event to the engine context. More...
 
template<typename ValueType >
Bool addEvent (const EventType &eventType, const ValueType &value, const OpaqueResource &target=OpaqueResource(), const OpaqueResource &sender=OpaqueResource(), const EngineSystem *systemSender=((void *) 0))
 Post a new event to the engine context with the specified type, value, and other parameters. More...
 
template<typename ValueType >
Bool addEvent (const EventType &eventType, const ValueType &value, const OpaqueResource &target, const OpaqueResource &sender, const EngineSystem *systemSender, const Time &eventTime)
 Post a new event to the engine context with the specified type, value, and other parameters. More...
 
void clearEventTypes ()
 Clear the managers for every type of event that this engine was previously handling. More...
 
const TimegetTime () const
 Return the current reference wall-clock time of the engine context. More...
 
void setTime (const Time &newTime)
 Set the current reference wall-clock time of the engine context. More...
 

Static Public Attributes

static const EventType ADD_COMPONENT_EVENT
 A static event type object that represents a add component event type. More...
 
static const EventType REMOVE_COMPONENT_EVENT
 A static event type object that represents a remove component event type. More...
 

Detailed Description

A collection of EngineSystem objects that operate on a set of abstract entities and their components.

Constructor & Destructor Documentation

om::engine::base::EngineContext::EngineContext ( )

Create a new empty engine context with no systems, entities, or components.

virtual om::engine::base::EngineContext::~EngineContext ( )
virtual

Destroy an engine context, releasing all internally allocated data.

Member Function Documentation

virtual void om::engine::base::EngineContext::update ( const Time dt)
virtual

Update the state of all systems in this engine for the specified time interval.

template<typename T >
Bool om::engine::base::EngineContext::addComponent ( T *  component,
ResourceID componentID = ((void *)0) 
)
inline

Add a component of a concete template type to the engine.

The method returns whether or not the component was able to be added.

Bool om::engine::base::EngineContext::addComponent ( const ResourceType type,
void *  componentData 
)

Add an opaque component of the specified type to the engine.

The method returns whether or not the component was able to be added.

Bool om::engine::base::EngineContext::addComponent ( const OpaqueResource component)

Add an opaque component to the engine.

The method returns whether or not the component was able to be added.

template<typename T >
Bool om::engine::base::EngineContext::removeComponent ( T *  component)
inline

Remove the specified component of the template type from the engine.

The method returns whether or not the component was able to be removed from the engine.

Bool om::engine::base::EngineContext::removeComponent ( const OpaqueResource component)

Remove an opaque component from the engine.

The method returns whether or not the component was able to be removed.

Bool om::engine::base::EngineContext::removeComponent ( const ResourceType type,
void *  componentData 
)

Remove an opaque component of the specified type from the engine.

The method returns whether or not the component was able to be removed.

void om::engine::base::EngineContext::clearComponents ( )

Remove all components from the engine.

Size om::engine::base::EngineContext::getComponentTypeCount ( ) const
inline

Return the number of different component types that this engine context is processing.

template<typename T >
ComponentSet<T> om::engine::base::EngineContext::newComponentType ( )
inline

Return a pointer to the component manager for components with the specified type in this engine.

If there is no type manager for that templated parameter type, a new one is created.

template<typename T >
ComponentSet<T> om::engine::base::EngineContext::getComponentType ( ) const
inline

Return a pointer to the component manager for components with the specified type in this engine.

If there is a manager for the templated component type in this engine, a pointer to it is returned. Otherwise, a NULL pointer is returned indicating there is no manager for that type.

Bool om::engine::base::EngineContext::addConnection ( const Connection connection)

Add a data flow connection to this engine so that it is processed during simulation updates.

Bool om::engine::base::EngineContext::removeConnection ( const Connection connection)

Remove a data flow connection from this engine so that it is no longer processed.

void om::engine::base::EngineContext::clearConnections ( )

Clear all connections from this engine context.

Size om::engine::base::EngineContext::getSystemCount ( ) const
inline

Return the number of systems there are in this engine context.

EngineSystem* om::engine::base::EngineContext::getSystem ( Index  systemIndex) const
inline

Return a pointer to the system in this engine context at the specified index.

Bool om::engine::base::EngineContext::addSystem ( EngineSystem system)

Add a system to this engine context.

The method returns whether or not the given system was able to be added to the engine. The method can fail if the system pointer is NULL.

Bool om::engine::base::EngineContext::removeSystem ( const EngineSystem system)

Remove the system in this engine with the given pointer.

The method returns whether or not the system was able to be removed.

void om::engine::base::EngineContext::clearSystems ( )

Remove all systems from this engine.

The entities in the engine are unaffected.

Size om::engine::base::EngineContext::getEventTypeCount ( ) const
inline

Return the number of different event types that this engine context is processing.

template<typename ValueType >
EventManager<ValueType>* om::engine::base::EngineContext::newEventType ( const EventType eventType)
inline

Return a pointer to the event manager for events with the specified type in this engine.

If there is a manager for the event type and templated value type in this engine, a pointer to it is returned. Otherwise, a new empty event manager is created and a pointer to it returned.

template<typename ValueType >
EventManager<ValueType>* om::engine::base::EngineContext::getEventType ( const EventType eventType)
inline

Return a pointer to the event manager for events with the specified type in this engine.

If there is a manager for the event type and templated value type in this engine, a pointer to it is returned. Otherwise, a NULL pointer is returned indicating there is no manager for that type.

template<typename ValueType >
const EventManager<ValueType>* om::engine::base::EngineContext::getEventType ( const EventType eventType) const
inline

Return a const pointer to the event manager for events with the specified type in this engine.

If there is a manager for the event type and templated value type in this engine, a pointer to it is returned. Otherwise, a NULL pointer is returned indicating there is no manager for that type.

template<typename ValueType >
Bool om::engine::base::EngineContext::addEvent ( const EventType eventType,
const Event< ValueType > &  newEvent 
)
inline

Post a new event to the engine context.

template<typename ValueType >
Bool om::engine::base::EngineContext::addEvent ( const EventType eventType,
const ValueType &  value,
const OpaqueResource target = OpaqueResource(),
const OpaqueResource sender = OpaqueResource(),
const EngineSystem systemSender = ((void *)0) 
)
inline

Post a new event to the engine context with the specified type, value, and other parameters.

template<typename ValueType >
Bool om::engine::base::EngineContext::addEvent ( const EventType eventType,
const ValueType &  value,
const OpaqueResource target,
const OpaqueResource sender,
const EngineSystem systemSender,
const Time eventTime 
)
inline

Post a new event to the engine context with the specified type, value, and other parameters.

void om::engine::base::EngineContext::clearEventTypes ( )

Clear the managers for every type of event that this engine was previously handling.

const Time& om::engine::base::EngineContext::getTime ( ) const
inline

Return the current reference wall-clock time of the engine context.

This is the reference time that all engine timing is done relative to. It is originally initialized to the current time via Time::getCurrent() when the engine is first started. Each call to update() advances the time by the specified delta.

void om::engine::base::EngineContext::setTime ( const Time newTime)
inline

Set the current reference wall-clock time of the engine context.

This is the reference time that all engine timing is done relative to. Each call to update() advances the time by the specified delta.

Member Data Documentation

const EventType om::engine::base::EngineContext::ADD_COMPONENT_EVENT
static

A static event type object that represents a add component event type.

const EventType om::engine::base::EngineContext::REMOVE_COMPONENT_EVENT
static

A static event type object that represents a remove component event type.


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