VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions
DtDisaggregatedFormationController Class Reference

Class DtAggregateFormationController is a controller that manages the formation state for an aggregate entity.

End User Description: The DtAggregateFormationController manages the state associated with an aggregate entity's formation. This includes determining who is eligible to participate in the formation, and who should be positioned relative to whom when participating in the formation.

It is intended to work in conjunction with the aggregate controllers that model the various movement behaviors (e.g. DtAggregateMoveAlongController, DtAggregatePatrolBetweenController). The DtAggregateFormationController sets formation state (keeping it up to date), and the movement controllers examine the formation state and use that information to execute movement in formation. The formation state is kept in the aggregateStateComponent (i.e. DtAggregateStateComponentData).

This controller may only be configured as a part of an entity that has a vrf-aggregate-state-repository.

Developer Description: The DtAggregateFormationController class handles all DtSetDataRequests that affect formation, including DtSetLocationRequests, DtSetHeadingRequests, and DtSnapIntoFormationRequests. It sets the state in the aggregate entity's DtFormationState object (owned by the DtVrfAggregateStateRepository class). Therefore it should only be configured as part of an aggregate entity that has a DtVrfAggregateStateRepository.

Uses Descriptor Type: DtFormationControllerDescriptor

Inheritance diagram for DtDisaggregatedFormationController:
Inheritance graph
[legend]

Public Member Functions

 DtDisaggregatedFormationController (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtDisaggregatedFormationController ()
 
virtual bool init ()
 
virtual void tick ()
 
virtual const chartype () const
 
virtual void setRadio (DtSimRadio *radio)
 
virtual void enable ()
 
virtual void disable ()
 
- Public Member Functions inherited from DtControllerComponent
 DtControllerComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simServices, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtControllerComponent ()
 
virtual bool postAddComponentsInit () override
 
virtual DtSimRadioradio ()
 
virtual void taskNotify (const DtSimTask &task)
 
virtual void clearTask ()
 
virtual void enableTaskTypes ()
 
virtual void enableScritedTask (const DtString &scriptId)
 
virtual void disableTaskTypes ()
 
- Public Member Functions inherited from DtSimComponent
 DtSimComponent (const DtString &name, DtLocalObject *owner, DtSimulationServices *simServices, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
virtual ~DtSimComponent ()
 
virtual void setParentSystem (DtComponentSystem *system)
 
DtComponentSystemparentSystem () const
 
virtual void registerAttributeFunctions ()
 
virtual void preFirstTickInit ()
 
virtual void postTick ()
 
virtual void setMinTickPeriod (double minTickPeriod, double minTickPeriodVariance)
 
virtual void setupFirstTickTime ()
 
virtual void setEntity (DtLocalObject *entity)
 
virtual DtSimComponentnextComponent ()
 
virtual DtSimComponentprevComponent ()
 
virtual void setListItem (DtListItem *item)
 
virtual DtListItem * listItem ()
 
virtual void putData (std::string &fp, int indentLevel=0)
 
virtual DtlObjPtr getData (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings)
 
virtual void addInputPort (DtInputPort *port)
 
virtual void removeInputPort (DtInputPort *port)
 
virtual DtInputPortlookupInputPort (const DtString &portName)
 
virtual DtList inputPortList () const
 
virtual void addOutputPort (DtOutputPort *port)
 
virtual void removeOutputPort (DtOutputPort *port)
 
virtual DtOutputPortlookupOutputPort (const DtString &portName)
 
virtual DtList outputPortList () const
 
virtual void addInputPortGroup (DtInputPortGroup *group)
 
virtual void removeInputPortGroup (DtInputPortGroup *group)
 
virtual DtInputPortGrouplookupInputPortGroup (const DtString &groupName)
 
virtual DtList inputPortGroupList () const
 
virtual void addOutputPortGroup (DtOutputPortGroup *group)
 
virtual void removeOutputPortGroup (DtOutputPortGroup *group)
 
virtual DtOutputPortGrouplookupOutputPortGroup (const DtString &groupName)
 
virtual DtList outputPortGroupList () const
 
virtual int priority () const
 
virtual void setPriority (int priority)
 
double dT () const
 
virtual void setDT (double deltaT)
 
virtual void setComponentDescriptor (DtComponentDescriptor *componentDescriptor)
 
virtual const
DtComponentDescriptor
componentDescriptor () const
 
virtual bool tickWhileDestroyed () const
 
DtVrfProcessStateRepositoryManagerpsrManager ()
 
virtual const DtSymbolStringcomponentFullName () const
 
DtPhysicalWorldphysicalWorld ()
 
const DtPhysicalWorldphysicalWorld () const
 
const DtAttachedTerrainterrainAttachedTo () const
 
DtLocalObjectentity ()
 
const DtLocalObjectentity () const
 
DtSimulationServicessimulationServices ()
 
const DtSimulationServicessimulationServices () const
 
const Coordinate_SystemcoordinateSystem () const
 
virtual void isClutterChanged ()
 
virtual bool taskVisualizationsActive () const
 
virtual bool taskVisualizationsEnabled () const
 
makVrf::DtTaskVisualizationMaptaskVisualizations ()
 
virtual bool isEnabled ()
 
virtual void setIsEnabled (bool yesNo)
 
virtual DtOutputStream & objectConsoleDebug (const DtString &channel="") const
 
virtual DtOutputStream & objectConsoleVerbose (const DtString &channel="") const
 
virtual DtOutputStream & objectConsoleInfo (const DtString &channel="") const
 
virtual DtOutputStream & objectConsoleWarn (const DtString &channel="") const
 
virtual DtOutputStream & objectConsoleError (const DtString &channel="") const
 
virtual int notifyLevel () const
 
virtual DtSimResourceManagerresourceManager ()
 
virtual const
DtSimResourceManager
resourceManager () const
 
VRF4API_METHOD const
DtSimulationServices
simManager () const
 
- Public Member Functions inherited from DtReaderWriter
 DtReaderWriter ()
 
 DtReaderWriter (const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL, bool readonly=false)
 
 DtReaderWriter (const DtSymbolString &name, DtReaderWriterRegistry *parentRegistry=NULL, bool readonly=false)
 
 DtReaderWriter (const DtString &name, const DtReaderWriter &orig, DtReaderWriterRegistry *parentRegistry=NULL)
 
 DtReaderWriter (const DtSymbolString &name, const DtReaderWriter &orig, DtReaderWriterRegistry *parentRegistry=NULL)
 
 DtReaderWriter (const DtReaderWriter &, DtReaderWriterRegistry *parentRegistry=NULL)
 
const DtReaderWriteroperator= (const DtReaderWriter &orig)
 
bool operator== (const DtReaderWriter &) const
 
bool operator!= (const DtReaderWriter &rhs)
 
virtual ~DtReaderWriter ()
 
virtual void putSelf (std::string &fp, int indentLevel=0, bool writeUnspecified=false, const DtFilename &path=DtFilename::nullFilename())
 
virtual void postPutSelf ()
 
virtual void prePutSelf ()
 
virtual void getSelf (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &variableBindings=nullVariableReference())
 
virtual void postGetSelf ()
 
virtual void preGetSelf ()
 
virtual void writeSelf (std::string &fp, int indentLevel=0, bool writeUnspecified=false, const DtFilename &path=DtFilename::nullFilename())
 
virtual DtSymbolString name () const
 
virtual void addAlias (const DtSymbolString &alias)
 
virtual void addAlias (const DtString &alias)
 
virtual bool hasAlias (const DtSymbolString &alias)
 
virtual const aliasContaineraliases () const
 
virtual void setReadonly (bool flag)
 
bool isReadonly () const
 
virtual void reset ()
 
virtual int alignment () const
 
virtual bool variableIsBound () const
 
virtual void unbindVariable ()
 
virtual void setName (const DtString &)
 
virtual const charreaderWriterType () const
 
virtual const charxmlType () const
 
virtual DtString prettyPrint () const
 
std::string debugText () const
 
virtual void bindVariables (DtVariableBindingsList variableBindings)
 
virtual std::list
< DtVariableNameType
unboundVariables () const
 
bool invalid () const
 
virtual bool hasChild (const DtReaderWriter *p) const
 
virtual bool hasVariableReference () const
 
virtual void bindLocalVariables (const DtVariableBindingsList &variableBindings)
 
virtual void recordUpdateTime () const
 
virtual bool changedSinceLastChecked ()
 
virtual bool peekChangedSinceLastChecked () const
 
virtual void setValueSpecified (bool specified, bool recurse=false)
 
virtual bool valueSpecified () const
 
virtual bool isVariableReference () const
 
virtual void setIsVariableReference (bool value)
 
virtual void clearAllVariableReferenceFlags ()
 
virtual DtSymbolString variableName () const
 
virtual void setVariableName (const DtSymbolString variableName)
 
virtual const DtReaderWriterdefaultRWValue () const
 
virtual DtReaderWriterdefaultRWValue ()
 
virtual void setDefaultRWValue (DtReaderWriter *)
 
virtual bool checkAndSetDefaultRWValue (DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &variableBindings=nullVariableReference())
 
const DtReaderWriterRegistryregistry () const
 
DtReaderWriterRegistryregistry ()
 
virtual DtPropertyInterfaceproperty ()
 
virtual const DtPropertyInterfaceproperty () const
 
virtual DtString toXml () const
 
virtual DtRwVariableBindingsgenerateVariableBindings () const
 
virtual bool toXml (const DtFilename &) const
 
virtual bool fromXml (const DtString &)
 
virtual bool fromXmlFile (const DtFilename &)
 
virtual void putSelf (DtEnvironmentSP, DtEnvValueSP parent) const
 
virtual void putData (DtEnvironmentSP, DtEnvValueSP value) const
 
virtual void putVariableReference (DtEnvironmentSP, DtEnvValueSP value) const
 
virtual void getSelf (const DtEnvironmentSP, const DtEnvValueSP root, const SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &bindings=DtVariableBindingsList())
 
virtual void getData (const DtEnvironmentSP, const DtEnvValueSP, const SearchPaths &searchPaths=SearchPaths(), const DtVariableBindingsList &bindings=DtVariableBindingsList())
 
virtual void unrecognizedItem (const DtEnvironmentSP env, const DtEnvValueSP root, const SearchPaths &searchPaths, const DtVariableBindingsList &varBindings)
 
virtual void getVariableReference (DtEnvironmentSP, DtEnvValueSP value)
 

Static Public Member Functions

static void setFormationCallback (DtSimMessage *msg, void *usr)
 
static void setFormationTypeCallback (DtSimMessage *msg, void *usr)
 
static void setHeadingCallback (DtSimMessage *msg, void *usr)
 
static void setLocationCallback (DtSimMessage *msg, void *usr)
 
static void snapIntoFormationCallback (DtSimMessage *msg, void *usr)
 
static DtSimComponentcreator (const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
- Static Public Member Functions inherited from DtSimComponent
static DtSimComponentFactoryfactory ()
 
static void setFactory (DtSimComponentFactory *factory)
 
static DtSimComponentcreateComponent (const DtString &name, const DtString &type, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentSystem *parentSystem, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
 
static void addSimComponentCreatorFcn (const DtString &type, DtSimComponentCreatorFcn fcn)
 
static VRF4API_METHOD
DtSimComponent
MarkThreadSafe (DtSimComponent *comp)
 
- Static Public Member Functions inherited from DtReaderWriter
static void putIndent (std::string &fp, int indentLevel)
 
static const
DtVariableBindingsList
nullVariableReference ()
 
static void setPostGetSelfCallback (DtGetSelfCallbackFcn fcn, void *usrData)
 
static void setPrePutSelfCallback (DtPutSelfCallbackFcn fcn, void *usrData)
 
static void setPutIndent (bool)
 
static bool putIndent ()
 
static const chartheXmlType ()
 
static const DtFilename & appPath ()
 
static void setFactoryCreatorFunction (DtReaderWriterFactoryCreatorFcn fcn)
 
static void createReaderWriterFactory ()
 
static void cleanupFactory ()
 
static DtReaderWriterFactoryfactory ()
 
static void setOutputStream (DtOutputStream *stream)
 
static DtOutputStream & outputStream ()
 
static DtReaderWritercreateFromXmlFile (const DtFilename &, bool createAsProperty=false)
 
static DtReaderWritercreateFromXml (const DtString &, bool createAsProperty=false)
 
static DtReaderWritercreateFromEnvironment (DtEnvironmentSP, bool createAsProperty=false)
 
static DtString getAttribute (DtEnvironmentSP env, const DtString &name, DtEnvValueSP root)
 

Protected Member Functions

virtual void checkForFormationStateUpdate ()
 
virtual bool formationUpdateIsNeeded ()
 
virtual void processSetFormation (DtSimMessage *msg)
 
virtual void processSetFormationType (DtSimMessage *msg)
 
virtual void processSetHeading (DtSimMessage *msg)
 
virtual void processSetLocation (DtSimMessage *msg)
 
virtual void processSnapIntoFormation (DtSimMessage *msg)
 
virtual void processSubordinateAdded (const DtUUID &info)
 
virtual void processSubordinateRemoved (const DtUUID &info)
 
virtual void processDesignatorOrderChanged ()
 
virtual void snapIntoFormation (const DtString &formation, const DtVector &location, double heading, bool applyHeading)
 
virtual std::string getCurrentFormation (const DtOrganizedManagedObjectList &subordList, DtFormation &formation)
 
virtual std::vector< intassignPromotionIdsToSubordinates (std::vector< DtUUID > &subordinateList, DtFormation &formation, const std::string formationName, const bool doPromote=false)
 
virtual std::vector< intgenerateFormationIndices (const DtOrganizedManagedObjectList &entityList)
 
virtual int findPositionInVector (const std::vector< DtUUID > subordinateList, const DtUUID &entityId) const
 
virtual void extendFormation (DtFormation &formation, const std::string formationName, const int size)
 
virtual void generateFormationAtPositionAndOrientation (const DtVector &geocentricOrigin, const DtTaitBryan &geocentricOrientation, std::vector< DtVector > geocentricPositions, DtFormation &formation)
 
virtual void generateWorkingFormation (DtFormation &formation, const DtOrganizedManagedObjectList &)
 
virtual void updateFormationState ()
 
virtual void sendRequestToSelf (const DtSetDataRequest &request) const
 
virtual void sendRequestToSubordinate (const DtSetDataRequest &request, const DtUUID &subordinate) const
 
virtual bool createPSR ()
 
virtual void processRequestAvailableFormations (const DtVrfObjectMessage *msg)
 
virtual void addSetDataCallbacks ()
 
void removeSetDataCallbacks ()
 
virtual void timedTick () override
 
- Protected Member Functions inherited from DtControllerComponent
 DtControllerComponent ()
 
 DtControllerComponent (const DtControllerComponent &orig)
 
const DtControllerComponentoperator= (const DtControllerComponent &orig)
 
virtual void onRestore ()
 
virtual void initializeTargetingControlTableFromDescriptor (const DtReaderWriter *)
 
virtual void sendCapableSetsAndTasks ()
 
- Protected Member Functions inherited from DtSimComponent
virtual void setupTimedTickLogic (double minTickPeriod, double minTickPeriodVariance)
 
virtual double computeCurrentTime ()
 
bool testInvariant () const
 
virtual bool createPortGroups ()
 
virtual bool createPorts ()
 
DtVrfProcessStateRepositorycreateComponentPsr (const DtString &defaultPsrType, const DtString &defaultPsrName, bool useDescriptorParams=true)
 
virtual void updateTaskVisualizations ()
 
virtual void destroyTaskVisualizations ()
 
virtual void destroyTaskVisualization (const DtString &name)
 
virtual
makVrf::DtPointTaskVisualizationPtr 
pointTaskVisualization (const DtString &name)
 
virtual
makVrf::DtLineTaskVisualizationPtr 
lineTaskVisualization (const DtString &name)
 
virtual
makVrf::DtAreaTaskVisualizationPtr 
areaTaskVisualization (const DtString &name)
 
virtual
makVrf::DtTextTaskVisualizationPtr 
textTaskVisualization (const DtString &name)
 
double calculateNextTaskVisTickTime () const
 
DtVrfObjectStateRepositorylocalStateRepository ()
 
const DtVrfObjectStateRepositorylocalStateRepository () const
 
DtPropertyInterfacecachedNextFrameStateProperty (DtPropertyInterface **prop, const DtString &propName)
 
template<typename ValType >
void setCachedNextFrameStatePropertyValue (DtPropertyInterface **prop, const DtString &propName, ValType value)
 
const DtPropertyInterfacecachedCurrentFrameStateProperty (const DtPropertyInterface **prop, const DtString &propName) const
 
template<typename ValType >
bool getCachedCurrentFrameStatePropertyValue (const DtPropertyInterface **prop, const DtString &propName, ValType &value) const
 
void addSimObjectPredicateCallback (DtSimObjectReference, DtVrfObjectPredicateCallbackFunction function, const DtVrfObjectPredicate &predicate, DtTime evaluationPeriod=0, void *userData=0)
 
void removeSimObjectPredicateCallback (const DtSimObject *, DtVrfObjectPredicateCallbackFunction function, const DtVrfObjectPredicate &predicate, DtTime evaluationPeriod=0, void *userData=0)
 
void invokeSimObjectPredicateCallbacks ()
 
virtual void clearPredicateCallbacks ()
 
- Protected Member Functions inherited from DtReaderWriter
virtual void bindToRwAsVariable (const DtReaderWriter *rw)
 

Static Protected Member Functions

static void requestAvailableFormationsCallback (const DtVrfObjectMessage *msg, void *usr)
 

Protected Attributes

const
DtFormationControllerDescriptor
myFormationControllerDescriptor
 
DtVrfAggregateStateRepositorymyAggregateStateRepository
 
DtFormationStatemyFormationState
 
DtCompatibilityRadiomyCommandChannelRadio
 
DtSetDataManagermySetDataManager
 
DtFormationPSRmyProcessState
 
bool myFormationCallbacksAreDisabled
 
bool myFirstTick
 
const DtAggregateObjectParametersmyAggregateParameters
 
boost::signals2::scoped_connection mySubordinateAddedConnection
 
boost::signals2::scoped_connection mySubordinateRemovedConnection
 
boost::signals2::scoped_connection myDesignatorOrderChangedCallback
 
boost::signals2::scoped_connection myAdvanceFrameConnection
 
bool myFormationStateNeedsUpdate
 
DtAggregateLocalObjectFacade myAggregateLocalObjectFacade
 
std::string myInvalidFormationName
 
bool myFirstTimedTick = true
 
- Protected Attributes inherited from DtControllerComponent
DtSimRadiomyRadio
 
bool myTaskTypesEnabled
 
bool myInitialized
 
- Protected Attributes inherited from DtSimComponent
DtLocalObjectmyEntity
 
DtComponentSystemmySystem
 
DtListItem * myListItem
 
DtInputPortMap myInputPortList
 
DtOutputPortMap myOutputPortList
 
DtInputPortGroupMap myInputPortGroupList
 
DtOutputPortGroupMap myOutputPortGroupList
 
int myPriority
 
double myLastTickSimTime
 
std::unique_ptr< DtTimedTickLogicmyTimedTickLogic
 
double myDT
 
bool myIsEnabled
 
bool myFirstTick
 
const DtComponentDescriptormyComponentDescriptor
 
std::list
< DtVrfProcessStateRepository * > 
myComponentPsrs
 
makVrf::DtTaskVisualizationMap myTaskVisualizations
 
double myNextTaskVisTickTime
 
DtSymbolString myFullComponentName
 
DtSimulationServicesmySimServices
 
DtPredicateCallbackManagermyPredicateCallbackManager
 
boost::signals2::scoped_connection myIsClutterChangedConnection
 
- Protected Attributes inherited from DtReaderWriter
const DtSymbolString myName
 
DtReaderWriterRegistry myRegistry
 
DtReaderWriterRegistrymyParentRegistry
 
bool myValueSpecified
 
bool myReadOnlyFlag
 
bool myIsVariableReference
 
DtSymbolString myVariableName
 
bool myVariableIsBound
 
DtReaderWritermyDefaultValue
 
aliasContainer myAliases
 
bool myInvalid
 
bool myChangedFlag
 

Private Member Functions

 DtDisaggregatedFormationController ()
 
 DtDisaggregatedFormationController (const DtDisaggregatedFormationController &orig)
 
DtDisaggregatedFormationControlleroperator= (const DtDisaggregatedFormationController &orig)
 

Additional Inherited Members

- Public Types inherited from DtReaderWriter
typedef std::vector
< DtSymbolString
aliasContainer
 
typedef std::vector
< DtSymbolString >::iterator 
aliasIter
 
typedef std::vector
< DtSymbolString >
::const_iterator 
aliasConstIter
 
typedef std::vector< DtFilename > SearchPaths
 
typedef std::pair
< DtSymbolString, DtString
DtVariableNameType
 
typedef DtReaderWriterFactory *(* DtReaderWriterFactoryCreatorFcn )()
 
- Protected Types inherited from DtSimComponent
typedef std::map< DtString,
DtInputPort * > 
DtInputPortMap
 
typedef std::map< DtString,
DtOutputPort * > 
DtOutputPortMap
 
typedef std::map< DtString,
DtInputPortGroup * > 
DtInputPortGroupMap
 
typedef std::map< DtString,
DtOutputPortGroup * > 
DtOutputPortGroupMap
 
- Static Protected Attributes inherited from DtSimComponent
static DtSimComponentFactorymyFactory
 
- Static Protected Attributes inherited from DtReaderWriter
static DtString theUnspecifiedValue
 
static DtGetSelfCallbackInfo thePostGetSelfCallback
 
static DtPutSelfCallbackInfo thePrePutSelfCallback
 
static const DtVariableBindingsList theEmptyVariableBindingsList
 
static bool theCreatorFcnSet
 
static DtReaderWriterFactorytheFactory
 
static
DtReaderWriterFactoryCreatorFcn 
theFactoryCreatorFcn
 
static bool thePutIndent
 
static DtOutputStream * theOutputStream
 

Constructor & Destructor Documentation

DtDisaggregatedFormationController::DtDisaggregatedFormationController ( )
private

Default constructor - not implemented.

DtDisaggregatedFormationController::DtDisaggregatedFormationController ( const DtDisaggregatedFormationController orig)
private

copy constructor - not implemented

DtDisaggregatedFormationController::DtDisaggregatedFormationController ( const DtString name,
DtLocalObject owner,
DtSimulationServices simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
)

Parameters
nameReader writer name of this component.
ownerThe DtLocalObject 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).
virtual DtDisaggregatedFormationController::~DtDisaggregatedFormationController ( )
virtual

Member Function Documentation

DtDisaggregatedFormationController& DtDisaggregatedFormationController::operator= ( const DtDisaggregatedFormationController orig)
private

assignment operator - not implemented

virtual bool DtDisaggregatedFormationController::init ( )
virtual

Initializes myCommandRadio and myAggregateStateRepository members. Must be called before any other member functions are called. Disables callbacks in formation state object (will be enabled after first nonzero tick).

Returns
True if component is completely successfully initialized, false if not.

Reimplemented from DtControllerComponent.

virtual void DtDisaggregatedFormationController::tick ( )
virtual

Calls formationUpdateIsNeeded(). If this returns true, calls updateFormation(). Enables callbacks in formation state object after first non-zero tick.

Reimplemented from DtSimComponent.

virtual const char* DtDisaggregatedFormationController::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. Warning: this function should always return the same pointer and it should be valid forever. This means the data should be static.

Returns
DtAggregateFormationControllerType

Implements DtControllerComponent.

Reimplemented in DtDisaggregatedConvoyFormationController.

virtual void DtDisaggregatedFormationController::setRadio ( DtSimRadio radio)
virtual

Overridden to register for following radio messages: DtSetFormationType DtSetLocationRequestType DtSnapIntoFormationRequestType.

Parameters
radioCaches a pointer to the aggregate's radio in myCommandChannelRadio. Dynamically casts it to type DtCompatibilityRadio. Aggregates must be configured with radios of this type in order to be able to issue tasks/set data requests to subordinates.

Reimplemented from DtControllerComponent.

static void DtDisaggregatedFormationController::setFormationCallback ( DtSimMessage msg,
void *  usr 
)
static

Callback for DtSetFormationRequest set data requests. Calls processSetFormation().

Parameters
msgMessage containing a DtSetFormationRequest.
usrPointer to an instance of this class.
static void DtDisaggregatedFormationController::setFormationTypeCallback ( DtSimMessage msg,
void *  usr 
)
static

Callback for DtSetFormationTyeRequest set data requests. Calls processSetFormationType(). This message sets a formation name without snapping the unit into the formation.

Parameters
msgMessage containing a DtSetFormationTypeRequest.
usrPointer to an instance of this class.
static void DtDisaggregatedFormationController::setHeadingCallback ( DtSimMessage msg,
void *  usr 
)
static

Callback for DtSetFormationRequest set data requests. Calls processSetHeading().

Parameters
msgMessage containing a DtSetHeadingRequest.
usrPointer to an instance of this class.
static void DtDisaggregatedFormationController::setLocationCallback ( DtSimMessage msg,
void *  usr 
)
static

Callback for DtSetLocationRequest set data requests. Calls processSetLocation().

Parameters
msgMessage containing a DtSetLocationRequest.
usrPointer to an instance of this class.
static void DtDisaggregatedFormationController::snapIntoFormationCallback ( DtSimMessage msg,
void *  usr 
)
static

Callback for DtSnapIntoFormationRequest set data requests. Calls snapIntoFormationCallback().

Parameters
msgMessage containing a DtSnapIntoFormationRequest.
usrPointer to an instance of this class.
virtual void DtDisaggregatedFormationController::enable ( )
virtual

Override to (re)add set data request callbacks.

Reimplemented from DtControllerComponent.

virtual void DtDisaggregatedFormationController::disable ( )
virtual

Override to remove set data request callbacks.

Reimplemented from DtSimComponent.

static DtSimComponent* DtDisaggregatedFormationController::creator ( const DtString name,
DtLocalObject owner,
DtSimulationServices simManager,
DtComponentDescriptor desc = 0,
DtReaderWriterRegistry parentRegistry = 0 
)
static

Parameters
nameReader writer name of this component.
ownerThe DtLocalObject 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).
Returns
New instance of this class.
virtual void DtDisaggregatedFormationController::checkForFormationStateUpdate ( )
protectedvirtual

Called after the first advance frame, if this is a disaggregated unit update the formation state.

virtual bool DtDisaggregatedFormationController::formationUpdateIsNeeded ( )
protectedvirtual

Walks list of subordinates in formation state. Calls DtFormationState::isAvailableForFormation() for each subordinate. If any subordinate fails this test, returns true, otherwise returns false.

virtual void DtDisaggregatedFormationController::processSetFormation ( DtSimMessage msg)
protectedvirtual

Handler for setFormationCallback(). If aggregate is currently tasked, calls updateFormationState(). Issues a DtSnapIntoFormationRequest to itself at the formation given in the incoming message.

Parameters
msgMessage containing a DtSetFormationRequest.
virtual void DtDisaggregatedFormationController::processSetFormationType ( DtSimMessage msg)
protectedvirtual

Handler for setFormationTypeCallback(). If aggregate is currently tasked, calls updateFormationState(). Will only set the formation name and then call updateFormationState() (again). Usually used in conjunction with a task that will move the aggregate into the requested formation (as opposed to snapping it into formation).

Parameters
msgMessage containing a DtSetFormationRequest.
virtual void DtDisaggregatedFormationController::processSetHeading ( DtSimMessage msg)
protectedvirtual

Handler for setHeadingCallback(). If aggregate is currently tasked, calls updateFormationState(). Issues a DtSnapIntoFormationRequest to itself at the heading given in the incoming message.

Parameters
msgMessage containing a DtSetHeadingRequest.
virtual void DtDisaggregatedFormationController::processSetLocation ( DtSimMessage msg)
protectedvirtual

Handler for setLocationCallback(). If aggregate is currently tasked, calls updateFormationState(). Issues a DtSnapIntoFormationRequest to itself at the heading given in the incoming message.

Parameters
msgMessage containing a DtSetHeadingRequest.
virtual void DtDisaggregatedFormationController::processSnapIntoFormation ( DtSimMessage msg)
protectedvirtual

Handler for snapIntoFormationCallback(). If aggregate is currently tasked, calls updateFormationState(). Then calls snapIntoFormation().

Parameters
msgMessage containing a DtSnapIntoFromationRequest.
virtual void DtDisaggregatedFormationController::processSubordinateAdded ( const DtUUID info)
protectedvirtual

Handler for subordinates changed callback. If formation is of type DtOtherAggregateFormation, changes it to DtWorkingFormation. Next, if formation is of type DtWorkingFormation, calls generateWorkingFormation() to create a formation given the current aggregate location, orientation, and subordinate positions. Finally, calls updateFormationState().

Parameters
entIdThe ID of the entity whose subordinates have changed (ID of the aggregate).
virtual void DtDisaggregatedFormationController::processSubordinateRemoved ( const DtUUID info)
protectedvirtual
virtual void DtDisaggregatedFormationController::processDesignatorOrderChanged ( )
protectedvirtual
virtual void DtDisaggregatedFormationController::snapIntoFormation ( const DtString formation,
const DtVector location,
double  heading,
bool  applyHeading 
)
protectedvirtual

Puts the aggregate into the given formation, at the given location and heading. Issues set data request messages to each subordinate in the aggregate. Computes the position for each subordinate needed to construct the formation at the given location and heading. For individual subordinates, issues DtSetLocationRequests and DtSetHeadingRequests at the computed location and given heading. If applyFormationToSubaggregates is true (recurse), then for aggregate subordinates, issues DtSnapIntoFormationRequests at the computed location and given heading, thereby recursively snapping the aggregate into formation. Otherwise (applyFormationToSubordinates is false, no recursion) issues DtSetLocationRequest and DtSetHeadingReuqest to aggregate subordinates in the same way as for individuals. This allows for mixed formation (don't recursively apply given formation to subordinate aggregates).

Parameters
formationType of formation to snap into.
locationLocal position aggregate where aggregate should position itself in formation.
headingHeading in radians at which aggregate should position itself in formation.
virtual std::string DtDisaggregatedFormationController::getCurrentFormation ( const DtOrganizedManagedObjectList subordList,
DtFormation formation 
)
protectedvirtual

Get current formation position and formation type. If aggregate has a nextFrameFormationName, then it gets that formation from aggregateParameters and returns it. Note that this will be the "regularized" name, i.e. lower case and with '_' characters. Otherwise, if the formationName is null or DtWorkingFormationString, it computes the workingFormation from the process state and returns DtWorkingFormationString. If the formation in the parameters is not valid (mal-formed) or missing, the DtWorkingFormationString is used. Sets myInvalidFormationName as a side effect.

Parameters
subordListList of subordinates that can be moved in formation. The positions of these objects are used to create the working formation if that is needed.
formationType of formation (see extendedAggregateEnums.h for list of available types).
virtual std::vector<int> DtDisaggregatedFormationController::assignPromotionIdsToSubordinates ( std::vector< DtUUID > &  subordinateList,
DtFormation formation,
const std::string  formationName,
const bool  doPromote = false 
)
protectedvirtual

Create a list of indices where each index corresponds to an entity in the subordinateList. Each index will indicate which promotion ID in the formation that entity should use.

Parameters
subordinateListVector of UUIDs for the subordinates in formation currently. In any order. ***If there is any error in assigning promotion IDs to subordinates, the subordinateList will be modified to omit that subordinate.***
formationThe formation the unit is currently (ordered to be) in. Provides the promotion IDs for each slot in the formation.
formationNameThe name of the formation. Not used in this implementation, but could be used in an overridden version of this function to provide more information about how to assign subordinates, especially if the unit is under strength.
promoteIf true, then the n entities will use formation positions corresponding to promotion IDs 0 to n-1. This is only meaningful if there are fewer subordinates than formation positions. The subordinates are all promoted to lower promotion IDs (not necessarily lower unit indices) to fill in gaps in the formation.
If promote is false, then each promotion ID will be the one for the formation entry (i.e., the DtFormationEntry in the DtFormation list) corresponding to the entity's position in the unit (i.e., designator value - 1). If the entityList is missing some subordinates because they are destroyed or independently tasked, then the promotion IDs produced may not include 0, and may not be consecutive.
virtual std::vector<int> DtDisaggregatedFormationController::generateFormationIndices ( const DtOrganizedManagedObjectList entityList)
protectedvirtual

TODO – delete.

virtual int DtDisaggregatedFormationController::findPositionInVector ( const std::vector< DtUUID subordinateList,
const DtUUID entityId 
) const
protectedvirtual

Helper function for generateFormationPositions().

Returns
The position of entityId in the vector subordinateList.
virtual void DtDisaggregatedFormationController::extendFormation ( DtFormation formation,
const std::string  formationName,
const int  size 
)
protectedvirtual

Extend the given formation to have the given number of slots. The implementation here just calls formation.createAndAddFormationEntry, but an overridden version of this could use the unit type and the given formation name to generate better positions.

Parameters
formationAn in-out parameter– the formation to be extended.
formationNameNot used in this implementation.
sizeThe total number of formation positions needed.
virtual void DtDisaggregatedFormationController::generateFormationAtPositionAndOrientation ( const DtVector geocentricOrigin,
const DtTaitBryan &  geocentricOrientation,
std::vector< DtVector geocentricPositions,
DtFormation formation 
)
protectedvirtual

Constructs an ad hoc formation (set of positional offsets of participants) based on current relative positioning of subordinates, at given location and orientation.

Parameters
geocentricOriginOrigin of coordinate system in geocentric coordinates, in which relative formation positions are computed from geocentric subordinate positions.
geocentricOrientationOrientation of coordinate system in geocentric coordinates, to be used to compute formation positions from subordinate positions.
formationconstructed from relative subordinate positions.
virtual void DtDisaggregatedFormationController::generateWorkingFormation ( DtFormation formation,
const DtOrganizedManagedObjectList  
)
protectedvirtual

Creates an ad hoc formation from the current eligible subordinates current positions relative to one another.

Parameters
formationThe generated formation.
virtual void DtDisaggregatedFormationController::updateFormationState ( )
protectedvirtual

Updates subordinate list using the DtFormationableSubordinatePredicate filter. Sets the "current working formation" (i.e., computed from current subordinate locations). Gets the current formation name in the aggregate state repository and computes a new formation state given the current subordinates and this formation.

virtual void DtDisaggregatedFormationController::sendRequestToSelf ( const DtSetDataRequest request) const
protectedvirtual

Send given request to ourself. Fills out data request message and sends it through the aggregate's radio.

Parameters
requestA set data request to be issued to ourself.
virtual void DtDisaggregatedFormationController::sendRequestToSubordinate ( const DtSetDataRequest request,
const DtUUID subordinate 
) const
protectedvirtual

Send given request to one of our subordinates. Fills out data request message and sends it to subordinate through our entity's radio.

Parameters
requestThe data request to send to the given subordinate.
subordinateObjectNameThe object name of the subordinate to be given the set data request.
virtual bool DtDisaggregatedFormationController::createPSR ( )
protectedvirtual

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.

static void DtDisaggregatedFormationController::requestAvailableFormationsCallback ( const DtVrfObjectMessage msg,
void *  usr 
)
staticprotected

const DtSimComponent &notifier);

virtual void DtDisaggregatedFormationController::processRequestAvailableFormations ( const DtVrfObjectMessage msg)
protectedvirtual
virtual void DtDisaggregatedFormationController::addSetDataCallbacks ( )
protectedvirtual

Add set data request callbacks. Set data request callbacks are added when component is first created, and whenever component is enabled.

Reimplemented in DtDisaggregatedConvoyFormationController.

void DtDisaggregatedFormationController::removeSetDataCallbacks ( )
protected

Callbacks are removed when component is disabled or destroyed. Non-virtual because it is called from the destructor.

virtual void DtDisaggregatedFormationController::timedTick ( )
overrideprotectedvirtual

This version of tick checks to see if the time to tick has arrived. It checks to see if myNextTickTime <= currentTime, where current time is either exerciseClock()->approximateElapsedRealTime() or exerciseClock()->simTime() depending on the tick-period-uses-real-time parameter. If true, it calls tick(), then calls postTick(), and then recalculates the next time to call timedTick() (myNextTickTime) by calling calculateNextTickTime().

Reimplemented from DtSimComponent.

Member Data Documentation

const DtFormationControllerDescriptor* DtDisaggregatedFormationController::myFormationControllerDescriptor
protected

Descriptor used to configure this component.

DtVrfAggregateStateRepository* DtDisaggregatedFormationController::myAggregateStateRepository
protected

Pointer to aggregate's state repository, cached in this class for convenience.

DtFormationState* DtDisaggregatedFormationController::myFormationState
protected

Pointer to aggregate's formation state repository, cached in this for convenience.

DtCompatibilityRadio* DtDisaggregatedFormationController::myCommandChannelRadio
protected

Pointer to aggregate's command radio, cached in this class for convenience.

DtSetDataManager* DtDisaggregatedFormationController::mySetDataManager
protected

Pointer to aggregate's DtSetDataManager, cached in this class for convenience.

DtFormationPSR* DtDisaggregatedFormationController::myProcessState
protected

Container for state data associated with this component. This state is saved and restored as part of a scenario (or checkpoint).

bool DtDisaggregatedFormationController::myFormationCallbacksAreDisabled
protected

Flag used to indicate if formation-related callbacks are disabled (not registered). These callbacks are disabled until the first tick. Flag is initially false, and then set to true in the first non-zero dt() tick.

bool DtDisaggregatedFormationController::myFirstTick
protected

Flag used to indicate first non-zero dT() tick.

const DtAggregateObjectParameters* DtDisaggregatedFormationController::myAggregateParameters
protected

Convenience pointer to the aggregate parameters for this entity.

boost::signals2::scoped_connection DtDisaggregatedFormationController::mySubordinateAddedConnection
protected
boost::signals2::scoped_connection DtDisaggregatedFormationController::mySubordinateRemovedConnection
protected
boost::signals2::scoped_connection DtDisaggregatedFormationController::myDesignatorOrderChangedCallback
protected
boost::signals2::scoped_connection DtDisaggregatedFormationController::myAdvanceFrameConnection
protected
bool DtDisaggregatedFormationController::myFormationStateNeedsUpdate
protected
DtAggregateLocalObjectFacade DtDisaggregatedFormationController::myAggregateLocalObjectFacade
protected
std::string DtDisaggregatedFormationController::myInvalidFormationName
protected

For debugging output. If the formation in the aggregateParameters isn't valid, print a warning; this is the name of the invalid formation. If null, the formation is valid.

bool DtDisaggregatedFormationController::myFirstTimedTick = true
protected

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

Document ID: Generated on Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)