![]() |
MAK Legion API Documentation
|
The SimulationDatabase stores all data for the simulation. It also owns the event, control, and view managers. More...
Collaboration diagram for Legion::SimulationDatabase:Public Member Functions | |
| SimulationDatabase (const Configuration &config) | |
| constructor More... | |
| virtual | ~SimulationDatabase () |
| destructor More... | |
| virtual DatabaseHandle | handle () const |
| Returns the handle to the internal representation of this object. More... | |
| virtual void | beginFrame (double time) |
| BeginFrame tells the database that a new frame of simulation has started and allows for synchronization and updating of internal data structures. More... | |
| virtual void | endFrame () |
| EndFrame tells the database that a frame of simulation has completed and allows for synchronization and updating of internal data structures. More... | |
| virtual bool | inFrame () const |
| Users can check if the database is between an begin and end frame call. More... | |
| virtual UInt64 | currentFrame () const |
| Gets the current frame number. More... | |
| virtual double | simTime () const |
| gets the current simulation time More... | |
| virtual UInt32 | clientId () const |
| Get the current client ID of this database if the simulation is distributed over a network. More... | |
| virtual bool | addBeginFrameCallback (BeginFrameCb bfcb) |
| Register and unregister callbacks for beginning of frame. More... | |
| virtual bool | removeBeginFrameCallback (BeginFrameCb bfcb) |
| virtual bool | addEndFrameCallback (EndFrameCb efd) |
| Register and unregister callbacks for end of frame. More... | |
| virtual bool | removeEndFrameCallback (EndFrameCb efd) |
| virtual AttributeSetId | registerAttributeSet (const AttributeSetDescriptor &descriptor) |
| Register a new type of attribute set with the database for storage. More... | |
| virtual AttributeId | registerAttribute (UInt32 setId, const AttributeDescriptor &descriptor) |
| Register a new type of attribute with an existing attribute set for storage. More... | |
| virtual AttributeSetId | findAttributeSetId (const std::string &name) |
| Find the attribute set id from the set name. More... | |
| virtual AttributeIndex | findAttributeIndex (UInt32 setId, const std::string &name) |
| Find the application specific attribute index of an attribute from its name. More... | |
| virtual AttributeIndex | findAttributeIndex (UInt32 setId, UInt32 attrId) |
| Find the application specific attribute index of an attribute from its ID. More... | |
| template<typename OBJECT_TYPE > | |
| OBJECT_TYPE | createInstance () |
| Create an instance of registered legion object the OBJECT_TYPE class must have a static function type() that returns a AttributeSetId for the instance you want to create. More... | |
| virtual InstanceHandle | findInstance (GlobalIdentifier globalId) |
| Find the internal instance handle of a simulation object from its globalID. More... | |
| virtual void | destroyInstance (const WriteStateInstance &instance) |
| Destroy an instance that was created in this database. More... | |
| virtual ClientIdentifier | getClientId (InstanceHandle instance) |
| Get the client ID of owner of the given instance handle. More... | |
| virtual GlobalIdentifier | findGlobalId (InstanceHandle handle) |
| Find the global ID from the internal instance handle of a simulation object. More... | |
| virtual Bool | reserve (AttributeSetId type, UInt32 count) |
| Reserve enough space for count instances of a given attribute set. More... | |
| virtual UInt32 | capacity (AttributeSetId type) |
| Returns the capacity for a given attribute set. More... | |
| virtual EventManager & | eventManager () |
| Get the Event Manager for the database. More... | |
| virtual ControlManager & | controlManager () |
| Get the Control Manager for the database. More... | |
| virtual ViewManager & | viewManager () |
| Get the View Manager for the database. More... | |
Static Protected Member Functions | |
| static void | beginFrameCallback (void *usr, double simTime) |
| static void | endFrameCallback (void *usr) |
Protected Attributes | |
| DatabaseHandle | myHandle |
| EventManager * | myEventManager |
| ControlManager * | myControlManager |
| ViewManager * | myViewManager |
| std::vector< BeginFrameCb > | myBeginFrameCallbacks |
| std::vector< EndFrameCb > | myEndFrameCallbacks |
The SimulationDatabase stores all data for the simulation. It also owns the event, control, and view managers.
| Legion::SimulationDatabase::SimulationDatabase | ( | const Configuration & | config | ) |
constructor
| virtual Legion::SimulationDatabase::~SimulationDatabase | ( | ) |
destructor
|
virtual |
Register and unregister callbacks for beginning of frame.
|
virtual |
Register and unregister callbacks for end of frame.
|
virtual |
BeginFrame tells the database that a new frame of simulation has started and allows for synchronization and updating of internal data structures.
The user needs to provide the current simulation time to the database.
Referenced by Clutter::SimEngine::finish(), and main().
|
staticprotected |
|
virtual |
Returns the capacity for a given attribute set.
Includes empty space and instantiated instances.
|
virtual |
Get the current client ID of this database if the simulation is distributed over a network.
|
virtual |
Get the Control Manager for the database.
| OBJECT_TYPE Legion::SimulationDatabase::createInstance | ( | ) |
Create an instance of registered legion object the OBJECT_TYPE class must have a static function type() that returns a AttributeSetId for the instance you want to create.
OBJECT_TYPE needs to derive from WriteStateInstance.
References legion_db_createInstance().
Referenced by Clutter::SimEngine::addEmbarkation(), createEntity(), DtVehicleSim::DtVehicleSim(), DtVehicleSim::enableEmissions(), DtVehicleSim::init(), Clutter::SimEngine::init(), and main().
|
virtual |
Gets the current frame number.
|
virtual |
Destroy an instance that was created in this database.
Referenced by destroyEntity(), DtVehicleSim::disableEmissions(), Clutter::SimEngine::finish(), and DtVehicleSim::~DtVehicleSim().
|
virtual |
EndFrame tells the database that a frame of simulation has completed and allows for synchronization and updating of internal data structures.
Referenced by Clutter::SimEngine::finish(), and main().
|
staticprotected |
|
virtual |
Get the Event Manager for the database.
Referenced by DtVehicleSim::detonateMunition(), DtVehicleSim::DtVehicleSim(), DtVehicleSim::fireMunition(), main(), registerCustomEvent(), and DtVehicleSim::~DtVehicleSim().
|
virtual |
Find the application specific attribute index of an attribute from its name.
Referenced by registerCustomAttributeSet().
|
virtual |
Find the application specific attribute index of an attribute from its ID.
|
virtual |
Find the attribute set id from the set name.
Referenced by Clutter::SimEngine::extendEntityAttributes(), and RegisterCustomEntityAttributes().
|
virtual |
Find the global ID from the internal instance handle of a simulation object.
If the Attribute Set of the ID is not registered or the instance is not known, this function will return 0.
|
virtual |
Find the internal instance handle of a simulation object from its globalID.
If the Attribute Set of the instance is not registered or the instance is not known, this function will return 0.
Referenced by processOwnershipAcquired().
|
virtual |
Get the client ID of owner of the given instance handle.
|
inlinevirtual |
Returns the handle to the internal representation of this object.
|
virtual |
Users can check if the database is between an begin and end frame call.
Several operations can only happen between begin/end frame calls such as creating or destroying instances, and creating and sending events, and controls
|
virtual |
Register a new type of attribute with an existing attribute set for storage.
Referenced by Clutter::SimEngine::extendEntityAttributes(), and RegisterCustomEntityAttributes().
|
virtual |
Register a new type of attribute set with the database for storage.
Referenced by registerCustomAttributeSet().
|
virtual |
|
virtual |
|
virtual |
Reserve enough space for count instances of a given attribute set.
Referenced by Clutter::SimEngine::init(), and Clutter::SimEngine::SimEngine().
|
virtual |
gets the current simulation time
Referenced by DtVehicleSim::fireMunition(), DtVehicleSim::moveArtParts(), DtVehicleSim::munitionTick(), and DtVehicleSim::reactToDamage().
|
virtual |
Get the View Manager for the database.
Referenced by DtVehicleSim::DtVehicleSim(), f18ShutDownHandler(), listenShutDownHandler(), main(), Clutter::SimEngine::SimEngine(), and DtVehicleSim::~DtVehicleSim().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |