VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
launcherController.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
17 #include <boost/signals2.hpp>
18 #include <tbb/spin_mutex.h>
19 
20 class DtLauncherControllerDescriptor;
21 class DtStringOutputPort;
22 class DtVectorOutputPort;
23 
24 namespace makVrfEvents
25 {
26  class DtEvent;
27 }
28 
64 {
65 
66 public:
67 
70  DtLauncherController(const DtString& name,
71  DtLocalObject* owner,
72  DtSimulationServices* simManager,
73  DtComponentDescriptor* desc = 0,
74  DtReaderWriterRegistry* parentRegistry = 0);
75 
77  virtual ~DtLauncherController();
78 
79  virtual bool init();
80 
83  virtual const char* type() const;
84 
86  virtual void tick();
87 
90  virtual bool createMissileIdPort();
91  virtual bool createTargetPointPort();
92  virtual bool createTargetEntityIdPort();
93 
96  virtual void fire();
97 
104  virtual void missileDetonated(const makVrfEvents::DtDetonationEvent * detInter);
105 
109  virtual void detonationCallback(const makVrfEvents::DtEvent& e);
110 
119  virtual void disconnectMissileFromLauncher(const DtUUID& missId);
120 
122  virtual DtSimObjectReference mostRecentMissileFired();
123 
127  virtual bool missilePassedTarget(const DtMissileSimObjectFacade& lastMissile, double& distSquaredToTargetOut);
128 
129  virtual double abandonPassedMissileDistance();
130  virtual void setAbandonPassedMissileDistance(const double& distance);
131 
135  virtual void registerAttributeFunctions();
136 
140  static DtReaderWriter* provideLastMissileName(void* controller);
141 
145  static DtReaderWriter* provideMissilePassedTarget(void* controller);
146 
147 
151  static DtSimComponent * creator(const DtString& name,
152  DtLocalObject* owner,
153  DtSimulationServices* simManager,
154  DtComponentDescriptor* desc = 0,
155  DtReaderWriterRegistry* parentRegistry = 0);
156 
157 protected:
158 
160  virtual bool createPorts();
161 
163  virtual DtReaderWriter* processProvideLastMissileName();
164 
166  virtual DtReaderWriter* processProvideMissilePassedTarget();
167 
168  virtual void processObjectRemoved(const DtUUID& missileId);
169 
170  virtual void processDeleteObject(const DtUUID& missileId);
171 
172 protected:
174  virtual void preFirstTickInit();
175 
176 protected:
177 
180 
183 
186  orig);
187 
188 
189 protected:
190 
191  struct MissileInfo
192  {
193  MissileInfo() : uuid(DtUUID::nullUUID()), simObjectReference(DtSimObjectReference::nullReference()) {};
194  MissileInfo(const DtUUID& u, DtSimObjectReference r) : uuid(u), simObjectReference(r) {};
195  MissileInfo(const MissileInfo& orig) : uuid(orig.uuid), simObjectReference(orig.simObjectReference) {};
196 
197  MissileInfo& operator=(const MissileInfo& orig) { uuid = orig.uuid; simObjectReference = orig.simObjectReference; return *this; };
198 
199  DtUUID uuid;
201  };
202 
205 
212 
219 
226 
228 
233 
235 
236  typedef std::map<DtUUID, DtMissileSimObjectFacade*> MissileSimObjectFacadeMap;
238 
239  mutable tbb::spin_mutex myRemovedMissilesMutex;
240  std::vector<DtUUID> myRemovedMissiles;
241 
242  boost::signals2::scoped_connection myMissileRemovedFromActiveListConnection;
243 };
UUID is a unique ID wrapper class.
Definition: rwUUID.h:229
tbb::spin_mutex myRemovedMissilesMutex
Definition: launcherController.h:239
DtUUID uuid
Definition: launcherController.h:197
#define DT_DLL_vrfmodel
This file is used to determine how to build.
Definition: vrfmodelDefines.h:24
DtVectorOutputPort * myTargetPointPort
Output Port Name: target-point Output Port Description: Local position of the target. Output Port Range: Output Port Default Value: Output Group Parent: weapon-control.
Definition: launcherController.h:225
const DtWeaponController & operator=(const DtWeaponController &orig)
assignment operator; not implemented
Instances of DtStringOutputPort are output ports through which data producers can send a DtString obj...
Definition: stringIOPort.h:52
static DtSimComponent * creator(const DtString &name, DtLocalObject *owner, DtSimulationServices *simManager, DtComponentDescriptor *desc=0, DtReaderWriterRegistry *parentRegistry=0)
DtWeaponController is a controller that extends the DtBaseWeaponController with the ability to accept...
Definition: weaponController.h:55
The DtSimObjectReference is a shared pointer that can be used amongst many object for access to the u...
Definition: simObjectReference.h:26
bool myRegisteredRemovedCallback
Definition: launcherController.h:234
Definition: readerWriter.h:85
A readable, writable type whose name is the name of a component and that has a list of component name...
Definition: componentDescriptor.h:49
virtual void tick()
If the myWaitingForFire flag is set and the munition loader is still loaded, the weapon has not fired...
Definition: readerWriterRegistry.h:39
Definition: detonationEvent.h:20
virtual void preFirstTickInit()
Starts with weapon loaded, if the weapon has a full complement of ammunition.
DtStringOutputPort * myTargetEntityIdPort
Output Port Name: target-entity Output Port Description: Object id of the target. Output Port Range: ...
Definition: launcherController.h:218
MissileSimObjectFacadeMap myMissileSimObjectFacadeMap
Definition: launcherController.h:237
DtLauncherController is a controller that accepts input from a target sensor, and provides ammunition...
Definition: launcherController.h:63
Definition: event.h:13
DT_DLL_VRVCORE double distance(const makVrv::DtCoordinateSystem &, const DtVector &from, const DtVector &to)
Returns the distance from the two points. Coordinates are in local database coordinates The coordinat...
Instances of DtVectorOutputPort are output ports through which data producers can send a DtVector...
Definition: vectorIOPort.h:52
virtual const char * type() const
Returns a string identifies the class type of component. Type values are defined in compTypes...
MissileInfo(const MissileInfo &orig)
Definition: launcherController.h:195
MissileInfo()
Definition: launcherController.h:193
Definition: launcherController.h:191
std::vector< DtUUID > myRemovedMissiles
Definition: launcherController.h:240
virtual bool init()
Overridden to initialize values obtained from the descriptor.
std::map< DtUUID, DtMissileSimObjectFacade * > MissileSimObjectFacadeMap
Definition: launcherController.h:236
DtSimObjectReference simObjectReference
Definition: launcherController.h:200
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:90
The DtSimComponent class is the base class for the entire simulation model component hierarchy...
Definition: simComponent.h:70
double myAbandonPassedMissileDistance
If the missile passes its target within this distance, it will be abandoned and disconnected from the...
Definition: launcherController.h:232
virtual void registerAttributeFunctions()
Called to register functions that provide system attribute values. Called by init(). Empty in this class. Overridden in different components to add attribute provider functions.
Definition: simComponent.h:112
virtual bool createPorts()
Overridden to create the local ports.
DtStringOutputPort * myMissileIdPort
Output Port Name: missile-id Output Port Description: Object id of the missile. Output Port Range: O...
Definition: launcherController.h:211
virtual void fire()
updates weapon interface
boost::signals2::scoped_connection myMissileRemovedFromActiveListConnection
Definition: launcherController.h:242
MissileInfo(const DtUUID &u, DtSimObjectReference r)
Definition: launcherController.h:194
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

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)