MAK Legion 1.1 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
Legion::ControlManager Class Reference

The control manager is responsible for creating and adding controls to the simulation database. More...

+ Collaboration diagram for Legion::ControlManager:

Classes

struct  CallbackData
 

Public Member Functions

template<typename CONTROL_TYPE >
CONTROL_TYPE createControl ()
 create an control of a given type. The type must be registered with the control manager prior to creating it. More...
 
virtual ControlManagerHandle handle () const
 
virtual UInt32 addControl (const ControlInstance &iControl)
 Adds a control to distribute to the control manager. This control must have been created by createControl(). More...
 
virtual ControlId registerControl (const ControlDescriptor &reg)
 Register control type so as to be able to access controls (add/peek/get) More...
 
virtual ParameterId parameterId (ControlId controlId, const std::string &parameterName)
 Look up the parameter ID of a parameter of a control. More...
 
template<typename CONTROL_TYPE >
UInt32 addControlCallback (Callback< void(Span< CONTROL_TYPE > &)> cb)
 Adds a callback function for an interested control type. More...
 
template<typename CONTROL_TYPE >
bool removeControlCallback (UInt32 handle)
 Remove a callback using the handle that was returned when it the callback was added. More...
 
template<typename CONTROL_TYPE >
const std::vector< CONTROL_TYPE > getControls ()
 Get controls for this frame/next frames. More...
 
template<typename CONTROL_TYPE >
const std::vector< CONTROL_TYPE > peekControls ()
 Peek controls for this frame/next frames. More...
 
virtual void addInterest (const ControlId controlId)
 
virtual void removeInterest (const ControlId controlId)
 

Protected Member Functions

 ControlManager (ControlManagerHandle handle)
 Constructor. More...
 
virtual ~ControlManager ()
 Destructor. More...
 

Static Protected Member Functions

static void callback (void *usr, ControlHandle *controls, UInt32 count)
 

Protected Attributes

UInt32 myNextCallbackHandle
 
std::vector< CallbackData * > myCallbackData
 
ControlManagerHandle myHandle
 

Friends

class SimulationDatabase
 

Detailed Description

The control manager is responsible for creating and adding controls to the simulation database.

The control manager is used to register new controls, create controls, add them to the database, and dispatch controls to application code that registered callbacks. The user can get the control manager from the Simulation Database.

Constructor & Destructor Documentation

Legion::ControlManager::ControlManager ( ControlManagerHandle  handle)
protected

Constructor.

virtual Legion::ControlManager::~ControlManager ( )
protectedvirtual

Destructor.

Member Function Documentation

virtual UInt32 Legion::ControlManager::addControl ( const ControlInstance iControl)
virtual

Adds a control to distribute to the control manager. This control must have been created by createControl().

template<typename CONTROL_TYPE >
UInt32 Legion::ControlManager::addControlCallback ( Callback< void(Span< CONTROL_TYPE > &)>  cb)

Adds a callback function for an interested control type.

So it can be notified whenever the type of controls are received This returns a handle for the callback, which is used to unregister the callback.

References callback(), Legion::ControlManager::CallbackData::convertAndExecute, Legion::ControlManager::CallbackData::handle, legion_controlManager_addCallback(), myCallbackData, and myHandle.

Referenced by Clutter::SimEngine::SimEngine().

virtual void Legion::ControlManager::addInterest ( const ControlId  controlId)
virtual
static void Legion::ControlManager::callback ( void *  usr,
ControlHandle controls,
UInt32  count 
)
staticprotected
template<typename CONTROL_TYPE >
CONTROL_TYPE Legion::ControlManager::createControl ( )

create an control of a given type. The type must be registered with the control manager prior to creating it.

References handle(), legion_controlManager_createControl(), and myHandle.

template<typename CONTROL_TYPE >
const std::vector< CONTROL_TYPE > Legion::ControlManager::getControls ( )

Get controls for this frame/next frames.

References legion_controlManager_getControls(), and myHandle.

virtual ControlManagerHandle Legion::ControlManager::handle ( ) const
virtual

Referenced by createControl().

virtual ParameterId Legion::ControlManager::parameterId ( ControlId  controlId,
const std::string &  parameterName 
)
virtual

Look up the parameter ID of a parameter of a control.

template<typename CONTROL_TYPE >
const std::vector< CONTROL_TYPE > Legion::ControlManager::peekControls ( )

Peek controls for this frame/next frames.

References legion_controlManager_peekControls(), and myHandle.

virtual ControlId Legion::ControlManager::registerControl ( const ControlDescriptor reg)
virtual

Register control type so as to be able to access controls (add/peek/get)

template<typename CONTROL_TYPE >
bool Legion::ControlManager::removeControlCallback ( UInt32  handle)

Remove a callback using the handle that was returned when it the callback was added.

This removes the interest of type of controls.

References callback(), legion_controlManager_removeCallback(), myCallbackData, and myHandle.

Referenced by Clutter::SimEngine::~SimEngine().

virtual void Legion::ControlManager::removeInterest ( const ControlId  controlId)
virtual

Friends And Related Function Documentation

friend class SimulationDatabase
friend

Member Data Documentation

std::vector<CallbackData*> Legion::ControlManager::myCallbackData
protected
ControlManagerHandle Legion::ControlManager::myHandle
protected
UInt32 Legion::ControlManager::myNextCallbackHandle
protected

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

Document ID: Generated on Wed May 26 15:17:05 EDT 2021 from SVN revision 229676
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)