VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
disaggregatedFormationController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 1999 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
12 
13 #pragma once
14 
18 #include <vlutil/vlConfig.h>
19 #include <vector>
20 
22 class DtSimMessage;
23 class DtFormationState;
26 class DtFormation;
28 class DtSetDataRequest;
29 class DtSetDataManager;
30 class DtFormationPSR;
35 
66 {
67 private:
74 
75 public:
76 
80  DtLocalObject* owner,
81  DtSimulationServices* simManager,
82  DtComponentDescriptor* desc = 0,
83  DtReaderWriterRegistry* parentRegistry = 0);
84 
86 
93  virtual bool init();
94 
97  virtual void tick();
98 
101  virtual const char* type() const;
102 
113  virtual void setRadio(DtSimRadio * radio);
114 
120  static void setFormationCallback(DtSimMessage * msg, void * usr);
121 
128  static void setFormationTypeCallback(DtSimMessage * msg, void * usr);
129 
135  static void setHeadingCallback(DtSimMessage * msg, void * usr);
136 
142  static void setLocationCallback(DtSimMessage * msg, void * usr);
143 
149  static void snapIntoFormationCallback(DtSimMessage * msg, void * usr);
150 
152  virtual void enable();
153 
155  virtual void disable();
156 
157 public:
158 
162  static DtSimComponent * creator(const DtString& name,
163  DtLocalObject* owner,
164  DtSimulationServices* simManager,
165  DtComponentDescriptor* desc = 0,
166  DtReaderWriterRegistry* parentRegistry = 0);
167 
168 protected:
170  virtual void checkForFormationStateUpdate();
171 
175  virtual bool formationUpdateIsNeeded() ;
176 
182  virtual void processSetFormation(DtSimMessage * msg);
183 
191  virtual void processSetFormationType(DtSimMessage * msg);
192 
198  virtual void processSetHeading(DtSimMessage * msg);
199 
205  virtual void processSetLocation(DtSimMessage * msg);
206 
211  virtual void processSnapIntoFormation(DtSimMessage * msg);
212 
221  virtual void processSubordinateAdded(const DtUUID& info);
222  virtual void processSubordinateRemoved(const DtUUID& info);
223  virtual void processDesignatorOrderChanged();
224 
243  virtual void snapIntoFormation(const DtString& formation,
244  const DtVector& location, double heading, bool applyHeading);
245 
261  virtual std::string getCurrentFormation(const DtOrganizedManagedObjectList& subordList,
262  DtFormation& formation);
263 
288  virtual std::vector<int> assignPromotionIdsToSubordinates(
289  std::vector<DtUUID>& subordinateList,
290  DtFormation& formation, const std::string formationName,
291  const bool doPromote = false);
292 
294  virtual std::vector<int> generateFormationIndices(
295  const DtOrganizedManagedObjectList& entityList);
296 
299  virtual int findPositionInVector(const std::vector<DtUUID> subordinateList,
300  const DtUUID& entityId) const;
301 
309  virtual void extendFormation(DtFormation& formation,
310  const std::string formationName, const int size);
311 
323  virtual void generateFormationAtPositionAndOrientation(const DtVector& geocentricOrigin,
324  const DtTaitBryan& geocentricOrientation, std::vector<DtVector> geocentricPositions,
325  DtFormation& formation);
326 
331  virtual void generateWorkingFormation(DtFormation& formation, const DtOrganizedManagedObjectList&);
332 
338  virtual void updateFormationState();
339 
344  virtual void sendRequestToSelf(const DtSetDataRequest& request) const;
345 
352  virtual void sendRequestToSubordinate(const DtSetDataRequest& request,
353  const DtUUID& subordinate) const;
354 
360  virtual bool createPSR();
361 
370  //virtual void processOnTaskNotifyCallback(const DtSimTask & task,
372 
373  static void requestAvailableFormationsCallback(const DtVrfObjectMessage* msg, void* usr);
374  virtual void processRequestAvailableFormations(const DtVrfObjectMessage* msg);
375 
378  virtual void addSetDataCallbacks();
379 
382  void removeSetDataCallbacks();
383 
384 protected:
385 
388 
392 
396 
400 
404 
408 
414 
417 
420 
421  boost::signals2::scoped_connection mySubordinateAddedConnection;
422  boost::signals2::scoped_connection mySubordinateRemovedConnection;
423  boost::signals2::scoped_connection myDesignatorOrderChangedCallback;
424  boost::signals2::scoped_connection myAdvanceFrameConnection;
425 
428 
434 };
435 
440 {
441 private:
448 
449 public:
450 
454  DtLocalObject* owner,
455  DtSimulationServices* simManager,
456  DtComponentDescriptor* desc = 0,
457  DtReaderWriterRegistry* parentRegistry = 0);
458 
460 
463  virtual const char* type() const;
464 
465 
468  virtual void addSetDataCallbacks();
469 
472  void removeSetDataCallbacks();
473 
477  static DtSimComponent * creator(const DtString& name,
478  DtLocalObject* owner,
479  DtSimulationServices* simManager,
480  DtComponentDescriptor* desc = 0,
481  DtReaderWriterRegistry* parentRegistry = 0);
482 };
UUID is a unique ID wrapper class.
Definition: rwUUID.h:226
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
Objects may contain a collection of other objects, such as overlays or pseudo-aggregate entities...
Definition: subordinateManager.h:43
const DtFormationControllerDescriptor * myFormationControllerDescriptor
Descriptor used to configure this component.
Definition: disaggregatedFormationController.h:387
Definition: organizationManagerNode.h:40
Definition: organizedManagedObjectList.h:17
Definition: formationState.h:41
const DtControllerComponent & operator=(const DtControllerComponent &orig)
assignment operator
Definition: simRadio.h:30
virtual void setRadio(DtSimRadio *radio)
virtual const char * type() const =0
This returns a string from compTypes.h, and identifies the type of component.
voidpf void uLong size
Definition: ioapi.h:39
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
DtFormationControllerDescriptor; descriptor for the DtDisaggregatedFormationController component...
Definition: formationControllerDescriptor.h:24
Definition: readerWriterRegistry.h:39
const DtAggregateObjectParameters * myAggregateParameters
Convenience pointer to the aggregate parameters for this entity.
Definition: disaggregatedFormationController.h:419
Instances of DtFormation are a list of DtFormationEntry objects which make up an aggregate formation...
Definition: formation.h:22
Class DtAggregateFormationController is a controller that manages the formation state for an aggregat...
Definition: disaggregatedFormationController.h:65
virtual void addSetDataCallbacks()
Add set data request callbacks. Set data request callbacks are added when component is first created...
virtual bool init()
Calls setRadio()
virtual void disable()
Is this component enabled or not. If enabled, component&#39;s tick function will be called, otherwise it will not. Default is true (enabled).
virtual const char * type() const
Returns a string identifies the class type of component. Type values are defined in compTypes...
DtAggregateLocalObjectFacade myAggregateLocalObjectFacade
Definition: disaggregatedFormationController.h:427
void removeSetDataCallbacks()
Callbacks are removed when component is disabled or destroyed. Non-virtual because it is called from ...
DtVrfAggregateStateRepository * myAggregateStateRepository
Pointer to aggregate&#39;s state repository, cached in this class for convenience.
Definition: disaggregatedFormationController.h:391
bool myFormationStateNeedsUpdate
Definition: disaggregatedFormationController.h:426
DtDisaggregatedFormationController & operator=(const DtDisaggregatedFormationController &orig)
assignment operator - not implemented
DtSetDataRequest is an abstract base class from which real setDataRequests can derive. It manages the read/write capability; derived classes need only use and register read/writatble data types for derived information.
Definition: setDataRequest.h:41
boost::signals2::scoped_connection myAdvanceFrameConnection
Definition: disaggregatedFormationController.h:424
boost::signals2::scoped_connection mySubordinateAddedConnection
Definition: disaggregatedFormationController.h:421
virtual void enable()
Is this component enabled or not. If enabled, component&#39;s tick function will be called, otherwise it will not. Default is true (enabled).
File: simMsg.h.
Definition: simMessage.h:35
boost::signals2::scoped_connection mySubordinateRemovedConnection
Definition: disaggregatedFormationController.h:422
virtual void tick()
This gives the thread of control to the component. The component is ticked once each simulation from ...
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
The base class for all messages to/from a specific DtVrfObject. Various subclasses of this class will...
Definition: vrfObjectMessage.h:30
boost::signals2::scoped_connection myDesignatorOrderChangedCallback
Definition: disaggregatedFormationController.h:423
End User Description: DtControllerComponent is the base class for all controllers components...
Definition: controllerComponent.h:31
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:89
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:70
DtFormationState * myFormationState
Pointer to aggregate&#39;s formation state repository, cached in this for convenience.
Definition: disaggregatedFormationController.h:395
bool myFormationCallbacksAreDisabled
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.
Definition: disaggregatedFormationController.h:413
This class manages the distribution of DtSetDataRequests within a single DtLocalObject. Components of the object, or other parts of the code, register interested in particular types of set data messages and when such a message is processed by the DtSetDataManager, each of the registered parties is notified.
Definition: setDataManager.h:48
std::string myInvalidFormationName
For debugging output. If the formation in the aggregateParameters isn&#39;t valid, print a warning; this ...
Definition: disaggregatedFormationController.h:433
bool myFirstTick
Flag used to indicate first non-zero dT() tick.
Definition: disaggregatedFormationController.h:416
DtCompatibilityRadio * myCommandChannelRadio
Pointer to aggregate&#39;s command radio, cached in this class for convenience.
Definition: disaggregatedFormationController.h:399
DtSetDataManager * mySetDataManager
Pointer to aggregate&#39;s DtSetDataManager, cached in this class for convenience.
Definition: disaggregatedFormationController.h:403
void processSetLocation(DtSetDataRequest *set, const DtVertexList &vertices, double position, DtMoveAlongRouteTimeEstimator *est)
Instances of DtManagedObjectList are created and maintained by a DtManagedObjectListManager. The lists contains a subset of the objects in DtSimObjectManager that meet the specified predicate. If specified at creation time, the list automatically updates itself periodically. The lists should be handled though shared pointers.
Definition: managedObjectList.h:45
Definition: vrfAggregateStateRepository.h:20
Contains the set of readable/writeable parameters associated with a pseudo-aggregate entities...
Definition: aggregateObjectParameters.h:29
DtCompatibilityRadio.
Definition: compatibilityRadio.h:30
class DtFormationPSR:
Definition: formationPSR.h:27
DtFormationPSR * myProcessState
Container for state data associated with this component. This state is saved and restored as part of ...
Definition: disaggregatedFormationController.h:407
A locally simulated VRF object. Holds all internal and external data for the object, and provides access to both the current frame and next frame state data for the object. All current frame data is read-only, and next-frame data can be written to. No thread safety guarantees are made on this object during the simulation frame and it should only be accessed by the thread that is simulating the object.
Definition: localObject.h:86
Specialized aggregate formation controller for convoys that will only register for the setting of loc...
Definition: disaggregatedFormationController.h:439

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)