VR-Forces 4.6 Class Documentation
 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. More...

Inheritance diagram for DtCommModel:
Inheritance graph
[legend]

Public Member Functions

virtual ~DtCommModel ()
virtual DtString type () const
virtual void registerRadio (DtVrfRadio *radio)
 Adds a new radio to the comm model.
virtual void unregisterRadio (DtVrfRadio *radio)
 Removes a radio from the comm model.
virtual void sendMessage (DtVrfObjectMessage *message, DtVrfRadio *sendingRadio)
 Sends the specified message though the comm model.
virtual void tick ()
 Method that is called every simulation tick.
virtual bool publishTransmitters () const
 Returns true if radios registered to this comm model should publish transmitters.

Static Public Member Functions

static DtCommModelcreate (DtCommModelCreationParams &params)
 Static creator function that can be registered with factories.
static void setFactory (DtCommModelFactory *factory)
 Sets the static factory to the specified radio network factory.
static DtCommModelcreateCommModel (const DtString &typeString, DtSimManager *simManager, const DtCommModelDescriptor *descriptor)
 Uses the static factory to create a new DtCommModel subclass and returns it.

Protected Types

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

Protected Member Functions

 DtCommModel (DtCommModelCreationParams &params)
 Use the create() method instead of calling the constructor.
virtual bool init ()
 Virtual init() called from the create() method.
virtual DtVrfRadiofindRadio (const DtUUID &object, int radioId) const
 Finds a radio registered with this comm model by object UUID and radio ID.
virtual DtVrfRadiofindRadio (const DtEntityIdentifier &entityId, int radioId) const
 Finds a radio registered with this comm model by entity ID and radio ID.
virtual void deliverMessageToRecipients (const DtVrfObjectMessage *message)
 Finds all local radios to which this message should be delivered and sends the message to those radios.

Protected Attributes

DtSimManagermySimManager
const DtCommModelDescriptormyDescriptor
DtRadioMap myRadios

Static Protected Attributes

static DtCommModelFactorytheFactory

Private Member Functions

 DtCommModel ()
 Not implemented.
 DtCommModel (const DtCommModel &orig)
DtCommModeloperator= (const DtCommModel &orig)

Detailed Description

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.

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
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
virtual bool DtCommModel::init ( )
protectedvirtual

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

Reimplemented in DtSimpleRadioCommModel, MyCommModel, and DtExternalCommModel.

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.

Reimplemented in DtSimpleRadioCommModel, MyCommModel, and DtExternalCommModel.

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,
DtSimManager 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 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
DtSimManager* DtCommModel::mySimManager
protected
const DtCommModelDescriptor* DtCommModel::myDescriptor
protected
DtRadioMap DtCommModel::myRadios
protected

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

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)