VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions
DtOccupancyDirectorController Class Reference

DtOccupancyDirectorController allocates reserved embarkation slots and determines which (if any) objects can be embarked on an object. More...

Inheritance diagram for DtOccupancyDirectorController:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtOccupancyDirectorController (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
virtual ~DtOccupancyDirectorController ()
 destructor
virtual bool init ()
 Initializes any state that is needed.
virtual DtString type () const
 Returns a string identifies the class type of component.
virtual void processRequestEmbarkationInformation (DtSimMessage *msg)

Static Public Member Functions

static DtSimComponentcreator (const DtString &name, DtVrfObject *owner, DtSimManager *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 (const DtString&,DtVrfObject*,DtSimManager*,
static void requestEmbarkationInformationCallback (DtSimMessage *msg, void *usr)

Protected Member Functions

virtual void registerTaskMsgCallbacks ()
 Override for interest in both disembark all tasks.
virtual void tick ()
 Ticks and performs current state.
virtual bool createPSR ()
 Creates myProcessState data member, and adds it to our process state repository manager.
virtual void giveUpSlot (int iSlot, const DtString &name)
 Gives up the slot (if reserved) for the specified entity.
virtual
DtEmbarkationSlotInformation 
embarkationSlotEntryFor (const DtString &) const
 Returns a slot information structure for given entity.
virtual
DtEmbarkationSlotInformation 
disembarkationInformationFor (const DtString &, int &iResult) const
 Returns slot that the entity that is currently in has, and whether or not it can disembark.
virtual int disembarkationResult (const DtEmbarkationSlotInformation &) const
 Returns the status of a potential disembark (can or cannot). Default can always disembark.
virtual bool reserveSlot (const DtEmbarkationSlotInformation &entry, const DtString &name)
 Reserves the slot so it cannot be used by any other entity.
virtual void sendSlotInformationTo (const DtString &name, const DtEmbarkationSlotInformation &entry, int, int reqId=0xFFFFFFFF)
 Sends a response back to the requestor with the entry information.
virtual void processDeleteVrfObjectCallback (DtVrfObject *obj)
virtual void processDisembarkAllTask (DtSimMessage *msg)
 The disembarkAll task will issue a disembark task to all items that are embarked on this object.
virtual bool objectDisembarked (const DtString &objectName)
virtual void disembarkNextObject ()
 Sends a task to the first object on the embarked objects list (from the state repository), and sets that object's name to the PSR.
virtual void sendTask (const DtSimTask &task, const DtString &objectName)
 Sends the specified task to the named object.
virtual void processDisembarkObjectCallback (DtSimMessage *msg)
 Processes DtIfDisembarkObject if address to this object and it is a disembarkAll type message.
virtual DtVector disembarkedPositionFor (const DtString &entityName, const DtEmbarkationSlotInformation &) const
 When disembarking, this will return the final disembark spot for the specified entity.
virtual bool nextEntityCanDisembark (const DtVrfObject *curEntity) const
 Returns true if the entity that is currently disembarking, it's bounding volume is not occluding the next entitiest to disembark disembarkation point.
virtual bool isValidForDisembarkLayout (const DtVrfObject *) const
 Return true if this entity kind (or type) can be part of disembarkation layour.
virtual bool createCollisionDetector ()
 Override to provide a new collision detector implementation.
virtual void setObstructionIDsInCollisionDetector ()
 Currently sets up to avoid entity kinds 1 - 3.
virtual void setupSlots ()
 Sets up slot information for slots that are currently available by looking at the state repository to see what is currently reserved and removing any slots that are not available.
virtual void initializeSlotManager ()
 Initializes mySlotManager with slots found in the descriptor.
virtual void calculateDisembarkPositions (const std::list< DtString > &)
 Calls down to the slot manager to set up grid and spacing for disembarking objects.
virtual void generateListForDisembarkation (std::list< DtString > &list)
 Parse the embarked objects list to send disembark tasks only to top entities in hierarchies and avoid multimessaging for subordinates.
virtual void removeAllSubordinates (DtVrfObject *obj)
 Remove All subordinates of the given object and the object from the list in the state repository.

Static Protected Member Functions

static void deleteVrfObjectCallback (DtVrfObject *msg, void *usr)
 If an object is deleted and it is the object that has a slot reserved, give up the slot.
static void disembarkAllTaskCallback (DtSimMessage *msg, void *usr)
static void disembarkObjectCallback (DtSimMessage *msg, void *usr)
 Callback for responding to DtIfDisembarkObject messages.

Protected Attributes

DtVrfOccupancyDirectorPSRmyProcessState
 Container for state data associated with this component.
bool myFirstTick
const
DtOccupancyDirectorDescriptor
myOccupancyDirectorDescriptor
DtEmbarkationSlotManagermySlotManager
DtCollisionDetectormyCollisionDetector
std::set< DtStringmyObjectsToDisembark
 Variable to control which units were disembarked by a superior to avoid multi messages.

Private Member Functions

 DtOccupancyDirectorController ()
 default constructor; not implemented
 DtOccupancyDirectorController (const DtOccupancyDirectorController &orig)
 copy constructor; not implemented
const
DtOccupancyDirectorController
operator= (const DtOccupancyDirectorController &orig)
 assignment operator; not implemented

Detailed Description

DtOccupancyDirectorController allocates reserved embarkation slots and determines which (if any) objects can be embarked on an object.

Developer Description: This controller responds to messages of type DtIfRequestEmbarkationInformation. When a request is received, the controller looks to see if there are any slots available, and, if so, reserves it (if requested) and then returns a DtIfEmbarkationInformation structure with the reservation information. This controller is also responsible for disembarkation information and responds to those requests. If an entity cannot embark because the object does not support the requesting object type or because the slots are full, an information return structure is sent, but with the DtEmbarkCannotEmbark result status. It will accomplish this task through a series of message requests that are made of the controller (interface) and sends those interface messages back to the requestor.

Uses Descriptor Type: DtOccupancyDirectorDescriptor


Constructor & Destructor Documentation

DtOccupancyDirectorController::DtOccupancyDirectorController ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
)

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

destructor

default constructor; not implemented

copy constructor; not implemented


Member Function Documentation

Initializes any state that is needed.

Reimplemented from DtControllerComponent.

virtual DtString DtOccupancyDirectorController::type ( ) const [virtual]

Returns a string identifies the class type of component.

Type values are defined in compTypes.h. DtSimComponent creation functions are registered with the DtSimComponentFactory using the type values as the key.

Returns:
DtOccupancyDirectorControllerType

Implements DtTaskControllerComponent.

static DtSimComponent* DtOccupancyDirectorController::creator ( const DtString name,
DtVrfObject owner,
DtSimManager simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
) [static]

(const DtString&,DtVrfObject*,DtSimManager*,

Parameters:
nameReader writer name of this component.
ownerThe DtVrfObject that owns this component
simManagerThe simulation manager (provides access to terrain, message interface, simulation clock).
descThe component descriptor used to initialize this component.
parentRegistryPointer to the parent reader writer registry (the containing object that reads/writes this object).
(const DtString&,DtVrfObject*,DtSimManager*, DtComponentDescriptor*,DtReaderWriterRegistry* parentRegistry)

Returns:
New instance of this class.
virtual void DtOccupancyDirectorController::registerTaskMsgCallbacks ( ) [protected, virtual]

Override for interest in both disembark all tasks.

Reimplemented from DtTaskControllerComponent.

virtual void DtOccupancyDirectorController::tick ( ) [protected, virtual]

Ticks and performs current state.

Reimplemented from DtSimComponent.

virtual bool DtOccupancyDirectorController::createPSR ( ) [protected, virtual]

Creates myProcessState data member, and adds it to our process state repository manager.

Passes in the name and type specified in the component descriptor (if they exist) to the DtVrfProcessStateRepository::createRepository factory method. If name and/or type is not specified, uses the appropriate default strings defined in procSRTypes.h.

virtual void DtOccupancyDirectorController::giveUpSlot ( int  iSlot,
const DtString name 
) [protected, virtual]

Gives up the slot (if reserved) for the specified entity.

Returns a slot information structure for given entity.

virtual DtEmbarkationSlotInformation DtOccupancyDirectorController::disembarkationInformationFor ( const DtString ,
int &  iResult 
) const [protected, virtual]

Returns slot that the entity that is currently in has, and whether or not it can disembark.

virtual int DtOccupancyDirectorController::disembarkationResult ( const DtEmbarkationSlotInformation ) const [protected, virtual]

Returns the status of a potential disembark (can or cannot). Default can always disembark.

virtual bool DtOccupancyDirectorController::reserveSlot ( const DtEmbarkationSlotInformation entry,
const DtString name 
) [protected, virtual]

Reserves the slot so it cannot be used by any other entity.

If cannot reserve, returns false

virtual void DtOccupancyDirectorController::sendSlotInformationTo ( const DtString name,
const DtEmbarkationSlotInformation entry,
int  ,
int  reqId = 0xFFFFFFFF 
) [protected, virtual]

Sends a response back to the requestor with the entry information.

If entry is NULL, then no entry exists for the,

static void DtOccupancyDirectorController::deleteVrfObjectCallback ( DtVrfObject msg,
void *  usr 
) [static, protected]

If an object is deleted and it is the object that has a slot reserved, give up the slot.

virtual void DtOccupancyDirectorController::processDeleteVrfObjectCallback ( DtVrfObject obj) [protected, virtual]
virtual void DtOccupancyDirectorController::processDisembarkAllTask ( DtSimMessage msg) [protected, virtual]

The disembarkAll task will issue a disembark task to all items that are embarked on this object.

It will issue disembark tasks one at a time until all items are disembarked. When all items are disembarked, then it will consider the task complete

static void DtOccupancyDirectorController::disembarkAllTaskCallback ( DtSimMessage msg,
void *  usr 
) [static, protected]
virtual bool DtOccupancyDirectorController::objectDisembarked ( const DtString objectName) [protected, virtual]
Returns:
True if the named objects is no longer embarked on the host entity.
virtual void DtOccupancyDirectorController::disembarkNextObject ( ) [protected, virtual]

Sends a task to the first object on the embarked objects list (from the state repository), and sets that object's name to the PSR.

If there are no embarked objects, calls taskComplete().

virtual void DtOccupancyDirectorController::sendTask ( const DtSimTask task,
const DtString objectName 
) [protected, virtual]

Sends the specified task to the named object.

static void DtOccupancyDirectorController::disembarkObjectCallback ( DtSimMessage msg,
void *  usr 
) [static, protected]

Callback for responding to DtIfDisembarkObject messages.

Processes DtIfDisembarkObject if address to this object and it is a disembarkAll type message.

virtual DtVector DtOccupancyDirectorController::disembarkedPositionFor ( const DtString entityName,
const DtEmbarkationSlotInformation  
) const [protected, virtual]

When disembarking, this will return the final disembark spot for the specified entity.

This will be determined as follows:

  • If parent entity is moving above speed threshold, then each entities final resting spot will be at then end of the disembarkation route.
  • If parent entity is moving below speed threshold, then entities final resting spot will be laid out in a grid pattern, starting in the upper left of the grid and moving to the lower right.

In either case. each entity will wait to being disembarking until the entity before it is no longer occluding the disembark point

virtual bool DtOccupancyDirectorController::nextEntityCanDisembark ( const DtVrfObject curEntity) const [protected, virtual]

Returns true if the entity that is currently disembarking, it's bounding volume is not occluding the next entitiest to disembark disembarkation point.

virtual bool DtOccupancyDirectorController::isValidForDisembarkLayout ( const DtVrfObject ) const [protected, virtual]

Return true if this entity kind (or type) can be part of disembarkation layour.

Override to provide a new collision detector implementation.

Currently sets up to avoid entity kinds 1 - 3.

virtual void DtOccupancyDirectorController::setupSlots ( ) [protected, virtual]

Sets up slot information for slots that are currently available by looking at the state repository to see what is currently reserved and removing any slots that are not available.

Called every time a slot reservation changes and also upon initialization

virtual void DtOccupancyDirectorController::initializeSlotManager ( ) [protected, virtual]

Initializes mySlotManager with slots found in the descriptor.

Should only be called once and must be called before setupSlots()

virtual void DtOccupancyDirectorController::calculateDisembarkPositions ( const std::list< DtString > &  ) [protected, virtual]

Calls down to the slot manager to set up grid and spacing for disembarking objects.

Only valid for disembarkAll call

virtual void DtOccupancyDirectorController::generateListForDisembarkation ( std::list< DtString > &  list) [protected, virtual]

Parse the embarked objects list to send disembark tasks only to top entities in hierarchies and avoid multimessaging for subordinates.

virtual void DtOccupancyDirectorController::removeAllSubordinates ( DtVrfObject obj) [protected, virtual]

Remove All subordinates of the given object and the object from the list in the state repository.

const DtOccupancyDirectorController& DtOccupancyDirectorController::operator= ( const DtOccupancyDirectorController orig) [private]

assignment operator; not implemented


Member Data Documentation

Container for state data associated with this component.

This state is saved and restored as part of a scenario (or checkpoint).

Variable to control which units were disembarked by a superior to avoid multi messages.


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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)