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 Types | Protected Member Functions | Protected Attributes | Static Protected Attributes
DtCommModel Class Reference

Base class for all communication models in VR-Forces. A DtCommModel is the central point for modeling communications between VR-Forces entities, such as radio communication. DtCommModels are responsible for moving messages from the sender radio to any appropriate receiver radios, including possibly transporting the messages over the physical network. DtVrfRadio instances register themselves with the DtCommModel when they are initialized, so the comm model always has a list of all the local radios that are connected to it. Radios call sendMessage() when they have a message to be sent though the comm model, and the comm model should call DtVrfRadio::receiveMessage() any time the comm model wishes to deliver a message to a particular radio. This base class implementation will not deliver any messages. A subclass must be used. See Radio Messages for more on simulated radio messages in VR-Forces.

Inheritance diagram for DtCommModel:
Inheritance graph
[legend]

Public Member Functions

virtual ~DtCommModel ()
 
virtual DtString type () const
 
virtual void registerRadio (DtVrfRadio *radio)
 
virtual void unregisterRadio (DtVrfRadio *radio)
 
virtual void sendMessage (DtVrfObjectMessage *message, DtVrfRadio *sendingRadio)
 
virtual void tick ()
 
virtual bool publishTransmitters () const
 
virtual bool sendReceivedCommMessageOnBroadcast () const
 
virtual void clearPendingRadioMessages ()
 

Static Public Member Functions

static DtCommModelcreate (DtCommModelCreationParams &params)
 
static void setFactory (DtCommModelFactory *factory)
 
static DtCommModelcreateCommModel (const DtString &typeString, DtSimulationServices *simManager, const DtCommModelDescriptor *descriptor)
 

Protected Types

typedef std::multimap< DtUUID,
DtVrfRadio * > 
DtRadioMap
 

Protected Member Functions

 DtCommModel (DtCommModelCreationParams &params)
 
virtual bool init ()
 
virtual DtVrfRadiofindRadio (const DtUUID &object, int radioId) const
 
virtual DtVrfRadiofindRadio (const DtEntityIdentifier &entityId, int radioId) const
 
virtual void deliverMessageToRecipients (const DtVrfObjectMessage *message)
 

Protected Attributes

DtSimulationServicesmySimulationServices
 
const DtCommModelDescriptormyDescriptor
 
DtRadioMap myRadios
 
tbb::spin_rw_mutex myMutex
 

Static Protected Attributes

static DtCommModelFactorytheFactory
 

Private Member Functions

 DtCommModel ()
 
 DtCommModel (const DtCommModel &orig)
 
DtCommModeloperator= (const DtCommModel &orig)
 

Member Typedef Documentation

typedef std::multimap<DtUUID, DtVrfRadio*> DtCommModel::DtRadioMap
protected

Constructor & Destructor Documentation

DtCommModel::DtCommModel ( )
private

Not implemented.

DtCommModel::DtCommModel ( const DtCommModel orig)
private

Not implemented.

DtCommModel::DtCommModel ( DtCommModelCreationParams params)
protected

Use the create() method instead of calling the constructor.

virtual DtCommModel::~DtCommModel ( )
virtual

Member Function Documentation

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

Not implemented.

virtual bool DtCommModel::init ( )
protectedvirtual

Virtual init() called from the create() method.

Reimplemented in DtSimpleRadioCommModel, DtExternalCommModel, and MyCommModel.

static DtCommModel* DtCommModel::create ( DtCommModelCreationParams params)
static

Static creator function that can be registered with factories. Calls the constructor, and init() on the new instance before returning it.

virtual DtString DtCommModel::type ( ) const
virtual
Returns
DtCommModelType. Type strings for DtCommModel subclasses are defined in commModelTypes.h.

Reimplemented in DtSimpleRadioCommModel, MyCommModel, and DtExternalCommModel.

virtual void DtCommModel::registerRadio ( DtVrfRadio radio)
virtual

Adds a new radio to the comm model. A radio must be part of the comm model in order to send or receive messages.

Reimplemented in DtSimpleRadioCommModel, MyCommModel, and DtExternalCommModel.

virtual void DtCommModel::unregisterRadio ( DtVrfRadio radio)
virtual

Removes a radio from the comm model.

virtual void DtCommModel::sendMessage ( DtVrfObjectMessage message,
DtVrfRadio sendingRadio 
)
virtual

Sends the specified message though the comm model. This is the entry point for a message into the network. This should typically only be called by radios that are part of the network. A pointer to the sending radio is passed in, in case the model needs to use parameters from this radio to transmit the message.

Reimplemented in DtSimpleRadioCommModel, and DtExternalCommModel.

virtual void DtCommModel::tick ( )
virtual

Method that is called every simulation tick. Base class implementation does nothing.

Reimplemented in DtExternalCommModel, and DtSimpleRadioCommModel.

static void DtCommModel::setFactory ( DtCommModelFactory factory)
static

Sets the static factory to the specified radio network factory.

static DtCommModel* DtCommModel::createCommModel ( const DtString typeString,
DtSimulationServices simManager,
const DtCommModelDescriptor descriptor 
)
static

Uses the static factory to create a new DtCommModel subclass and returns it.

virtual bool DtCommModel::publishTransmitters ( ) const
virtual

Returns true if radios registered to this comm model should publish transmitters.

virtual bool DtCommModel::sendReceivedCommMessageOnBroadcast ( ) const
virtual

Returns true if this model should send a message that the radio message was received on broadcast.

virtual void DtCommModel::clearPendingRadioMessages ( )
virtual

Called to clear any pending radio messages in the comm model map that are waiting to be sent. This method is called when a scenario is being rolled back/rewound.

Reimplemented in DtSimpleRadioCommModel.

virtual DtVrfRadio* DtCommModel::findRadio ( const DtUUID object,
int  radioId 
) const
protectedvirtual

Finds a radio registered with this comm model by object UUID and radio ID.

virtual DtVrfRadio* DtCommModel::findRadio ( const DtEntityIdentifier &  entityId,
int  radioId 
) const
protectedvirtual

Finds a radio registered with this comm model by entity ID and radio ID.

virtual void DtCommModel::deliverMessageToRecipients ( const DtVrfObjectMessage message)
protectedvirtual

Finds all local radios to which this message should be delivered and sends the message to those radios. Radios must be registered with this DtCommModel. Messages that are sent to DtVrfObjectMessageSendToAll are delivered to all local radios except the sender.

Reimplemented in DtSimpleRadioCommModel.

Member Data Documentation

DtCommModelFactory* DtCommModel::theFactory
staticprotected
DtSimulationServices* DtCommModel::mySimulationServices
protected
const DtCommModelDescriptor* DtCommModel::myDescriptor
protected
DtRadioMap DtCommModel::myRadios
protected
tbb::spin_rw_mutex DtCommModel::myMutex
mutableprotected

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

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)