VR-Forces 5.0.2 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
vrfObjectCommunicationInterface.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2007 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 #pragma once
11 
15 #include <list>
16 #include <set>
17 #include <map>
18 
19 class DtLocalObject;
21 class DtSimMessage;
24 class DtVrfRadio;
26 
41 {
42 private:
49 
50 public:
57  static DtVrfObjectCommunicationInterface* create(DtLocalObject* vrfObject);
58 
59 protected:
63  virtual bool init();
64 
65 public:
66  virtual DtSimulationServices* simulationServices();
67 
71  virtual void createRadiosFromDescriptorList();
74  virtual void createRadiosFromDescriptorList(const DtRadioDescriptorList& descList);
75 
80  virtual void sendSimInternalMessage(DtVrfObjectMessage* message);
81 
87 
88  virtual bool sendRadioMessage(const DtString& radioName, DtVrfObjectMessage* message);
93  virtual bool sendRadioMessage(int radioId, DtVrfObjectMessage* message);
96  virtual bool sendRadioMessage(DtVrfObjectMessage* message);
98 
102  virtual DtVrfRadio* lookupRadio(int radioId);
103  virtual const DtVrfRadio* lookupRadio(int radioId) const;
104 
107  virtual DtVrfRadio* lookupRadio(const DtString& radioName);
108  virtual const DtVrfRadio* lookupRadio(const DtString& radioName) const;
109 
112  virtual DtVrfRadio* defaultRadio();
113  virtual const DtVrfRadio* defaultRadio() const;
114 
119  DtSimInternalCommunicationInterface* simInternalCommunicationInterface();
120 
124 
125  virtual void addMessageCallback(DtVrfObjectMessageCallbackFcn fcn, void* usr) const;
126  virtual void removeMessageCallback(DtVrfObjectMessageCallbackFcn fcn, void* usr) const;
128 
132 
133  template<typename messageType>
134  void addMessageCallback(const messageType& type, DtVrfObjectMessageCallbackFcn fcn, void* usr) const
135  {
136  myMessageExecutive.addMessageCallback(type, fcn, usr);
137  }
138 
139  template<typename messageType>
140  void removeMessageCallback(const messageType& type, DtVrfObjectMessageCallbackFcn fcn, void* usr) const
141  {
142  myMessageExecutive.removeMessageCallback(type, fcn, usr);
143  }
145 
146 
152 
153  virtual void addMessageCallbackByCategory(int category, DtVrfObjectMessageCallbackFcn fcn, void* usr) const;
154  virtual void removeMessageCallbackByCategory(int category, DtVrfObjectMessageCallbackFcn fcn, void* usr) const;
156 
159  virtual void tick();
160 
161 protected:
162 
165 
166  static void vrfObjectMessageCallback(const DtVrfObjectMessage* msg, void* usr);
167  virtual void processVrfObjectMessage(const DtVrfObjectMessage* msg);
169 
170 protected:
174 
175  typedef std::map<DtSymbolString, DtVrfRadio*> DtRadioMap;
178 };
179 
DtSimInternalCommunicationInterface * mySimInternalInterface
Definition: vrfObjectCommunicationInterface.h:173
DtVrfObjectMessageExecutive myMessageExecutive
Definition: vrfObjectCommunicationInterface.h:172
The handler for all SimInternal messages that are sent to and from a specified DtLocalObject. This class is the central interface of a DtLocalObject to the SimInternal message system of inter-VrfObject communication. Callbacks can be registered for message receipt and messages can be sent. Normally, components on an entity will register with 3CommunicationInterface instead of with this object directly.
Definition: simInternalCommunicationInterface.h:20
DtRadioMap myRadios
Definition: vrfObjectCommunicationInterface.h:176
DtLocalObject * myLocalObject
Definition: vrfObjectCommunicationInterface.h:171
void removeMessageCallback(const messageType &type, DtVrfObjectMessageCallbackFcn fcn, void *usr) const
Callback which is called when a specific type of object message is processed. The type parameter is t...
Definition: vrfObjectCommunicationInterface.h:140
std::map< DtSymbolString, DtVrfRadio * > DtRadioMap
Definition: vrfObjectCommunicationInterface.h:175
void addMessageCallback(const messageType &type, DtVrfObjectMessageCallbackFcn fcn, void *usr) const
Callback which is called when a specific type of object message is processed. The type parameter is t...
Definition: vrfObjectCommunicationInterface.h:134
Callback manager for DtVrfObjectMessage receipt. Callbacks can be registered on various attributes of...
Definition: vrfObjectMessageExecutive.h:26
List of DtRadioDescriptor subclasses that can be read from a RW type file. This class owns all descri...
Definition: radioDescriptorList.h:27
#define DT_DLL_vrfobjcore
This file is used to determine how to build.
Definition: vrfobjcoreDefines.h:24
File: simMsg.h.
Definition: simMessage.h:35
The base class for all messages to/from a specific DtVrfObject. Various subclasses of this class will...
Definition: vrfObjectMessage.h:30
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:90
void(* DtVrfObjectMessageCallbackFcn)(const DtVrfObjectMessage *msg, void *usr)
This class is a convenience object for callback functions on DtVrfObjectMessages particularly those d...
Definition: vrfObjectMessageTypeCallbackMap.h:29
DtVrfRadio * myDefaultRadio
Definition: vrfObjectCommunicationInterface.h:177
The central class of a DtLocalObject for all communications to and from the object. This class manages all communications on a specific DtLocalObject, though both simulation internal communication, and communication though the simulated radios of the object. All communication is done though the use of the DtVrfObjectMessage class and its subclasses. Callbacks can be registered on this interface which will be called on receipt of a message by this entity. Messages can be sent from this entity by using the message sending functions. These messages may be sent though the SimInternal message mechanism, or the radio message system. Radios will not exist until createRadiosFromDescriptorList() or createRadiosFromDescriptorList(const DtRadioDescriptorList&amp; descList) is called.
Definition: vrfObjectCommunicationInterface.h:40
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
Base class for any radios on VrfObjects. A DtVrfRadio acts as the interface between an entity and a D...
Definition: vrfRadio.h:41
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 Sun Dec 4 20:22:03 EST 2022 from SVN revision 249613
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)