VR-Forces 4.2 Class Documentation
List of all members | Public Member Functions | Static Public Member Functions | Protected Types | Protected Attributes | Static Protected Attributes
DtVrfRadio Class Reference

Base class for any radios on VrfObjects. More...

Public Member Functions

 DtVrfRadio (DtRadioCreationParams &params)
virtual ~DtVrfRadio ()
virtual bool init ()
 Virtual init. Must be called after construction.
virtual DtString type () const
virtual bool sendMessage (DtVrfObjectMessage *message)
 Fills in the sender name, and sends the message out to any designated recipients.
template<typename messageType >
void addMessageCallback (const messageType &type, DtVrfObjectMessageCallbackFcn fcn, void *usr)
template<typename messageType >
void removeMessageCallback (const messageType &type, DtVrfObjectMessageCallbackFcn fcn, void *usr)
virtual bool readyToSend () const
 Indicates whether or not this radio is currently clear to send messages.
virtual void tick ()
 Called every simulation tick.
virtual void receiveMessage (const DtVrfObjectMessage *message)
 This method pushes this message into the message executive, and any appropriate callbacks are invoked.
virtual void setReadyToSend (bool val)
 Changes the readyToSend state of this radio.
virtual DtVrfObjectvrfObject ()
virtual int radioId () const
virtual double sampleRate () const
virtual void processReadCommModelSettings (const DtSettingsObject *settings)
virtual void addMessageCallback (DtVrfObjectMessageCallbackFcn fcn, void *usr)
 Callback which is called for every message that is received by this interface.
virtual void removeMessageCallback (DtVrfObjectMessageCallbackFcn fcn, void *usr)
 Callback which is called for every message that is received by this interface.
virtual const
DtVrfRadioTransmitter
radioTransmitter () const
virtual DtVrfRadioTransmitterradioTransmitter ()

Static Public Member Functions

static DtVrfRadiocreate (DtRadioCreationParams &params)
 Static creator function that can be registered with factories.
static void setFactory (DtVrfRadioFactory *factory)
 Sets the static factory to the specified radio factory.
static DtVrfRadiocreateRadio (const DtString &typeString, DtVrfObject *vrfObject, const DtVrfRadioDescriptor *descriptor, int radioId)
 Uses the static factory to create a new DtRadio subclass and returns it.
static void readCommModelSettingsCallback (const DtSettingsObject *settings, void *usr)
 If this radio's comm-model-name is "default-radio-comm-model" this callback is registered with the DtVrfSimSettingsManager and will switch between the "default-internal-radio-comm-model" and the "default-external-radio-comm-model" based on the "use-external-comm-model" back-end setting.

Protected Types

typedef std::deque
< DtVrfObjectMessagePtr
DtMessageQueue

Protected Attributes

DtVrfObjectmyVrfObject
const DtVrfRadioDescriptormyRadioDescriptor
DtVrfObjectMessageExecutive myMessageExecutive
DtCommModelmyCommModel
 The radio network which this radio is part of.
DtVrfRadioTransmittermyRadioTransmitter
int myRadioId
bool myReadyToSend
DtMessageQueue myMessageQueuedToSend

Static Protected Attributes

static DtVrfRadioFactorytheFactory

Private Member Functions

 DtVrfRadio ()
 Not implemented.
 DtVrfRadio (const DtVrfRadio &orig)
 Not implemented.
DtVrfRadiooperator= (const DtVrfRadio &orig)
 Not implemented.

Detailed Description

Base class for any radios on VrfObjects.

A DtVrfRadio acts as the interface between an entity and a DtCommModel. Callbacks can be registered on a radio for receipt of various message types, and messages can be sent though the radio by calling sendMessage().

Member Typedef Documentation

typedef std::deque<DtVrfObjectMessagePtr> DtVrfRadio::DtMessageQueue
protected

Constructor & Destructor Documentation

DtVrfRadio::DtVrfRadio ( )
private

Not implemented.

DtVrfRadio::DtVrfRadio ( const DtVrfRadio orig)
private

Not implemented.

DtVrfRadio::DtVrfRadio ( DtRadioCreationParams params)
virtual DtVrfRadio::~DtVrfRadio ( )
virtual

Member Function Documentation

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

Not implemented.

virtual bool DtVrfRadio::init ( )
virtual

Virtual init. Must be called after construction.

virtual DtString DtVrfRadio::type ( ) const
virtual
Returns
DtRadioType. Radio types are defined in radioTypes.h.
virtual bool DtVrfRadio::sendMessage ( DtVrfObjectMessage message)
virtual

Fills in the sender name, and sends the message out to any designated recipients.

Returns
True if the message was successfully sent to the radio network.
virtual void DtVrfRadio::addMessageCallback ( DtVrfObjectMessageCallbackFcn  fcn,
void *  usr 
)
virtual

Callback which is called for every message that is received by this interface.

virtual void DtVrfRadio::removeMessageCallback ( DtVrfObjectMessageCallbackFcn  fcn,
void *  usr 
)
virtual

Callback which is called for every message that is received by this interface.

template<typename messageType >
void DtVrfRadio::addMessageCallback ( const messageType &  type,
DtVrfObjectMessageCallbackFcn  fcn,
void *  usr 
)
inline
template<typename messageType >
void DtVrfRadio::removeMessageCallback ( const messageType &  type,
DtVrfObjectMessageCallbackFcn  fcn,
void *  usr 
)
inline
virtual bool DtVrfRadio::readyToSend ( ) const
virtual

Indicates whether or not this radio is currently clear to send messages.

Depending on the comm model that this radio is associated with, it may not be able to send a message because the radio network is busy. When it is not ready to send, calls to sendMessage() will cause the message to be queued for later sending.

virtual void DtVrfRadio::tick ( )
virtual

Called every simulation tick.

Tick the radio transmitter, if present.

virtual void DtVrfRadio::receiveMessage ( const DtVrfObjectMessage message)
virtual

This method pushes this message into the message executive, and any appropriate callbacks are invoked.

This method should only be called by a DtCommModel.

virtual void DtVrfRadio::setReadyToSend ( bool  val)
virtual

Changes the readyToSend state of this radio.

This method should only be called by a DtCommModel.

virtual DtVrfObject* DtVrfRadio::vrfObject ( )
virtual
Returns
The pointer to the DtVrfObject with which this radio is associated.
virtual int DtVrfRadio::radioId ( ) const
virtual
Returns
The unique (for this entity) radio index of this radio.
virtual double DtVrfRadio::sampleRate ( ) const
virtual
Returns
The sample rate to be used in signal PDUs/interactions sent by this radio. Returns the value in myRadioDescriptor.
virtual const DtVrfRadioTransmitter* DtVrfRadio::radioTransmitter ( ) const
virtual
Returns
A pointer to the DtVrfRadioTransmitter associated with this radio if there is one. Not all radios will have one, depending on how they are configured. Any radio that publishes a radio transmitter object in DIS/RPR will have a transmitter defined here.
virtual DtVrfRadioTransmitter* DtVrfRadio::radioTransmitter ( )
virtual
Returns
A pointer to the DtVrfRadioTransmitter associated with this radio if there is one. Not all radios will have one, depending on how they are configured. Any radio that publishes a radio transmitter object in DIS/RPR will have a transmitter defined here.
static DtVrfRadio* DtVrfRadio::create ( DtRadioCreationParams params)
static

Static creator function that can be registered with factories.

static void DtVrfRadio::setFactory ( DtVrfRadioFactory factory)
static

Sets the static factory to the specified radio factory.

static DtVrfRadio* DtVrfRadio::createRadio ( const DtString typeString,
DtVrfObject vrfObject,
const DtVrfRadioDescriptor descriptor,
int  radioId 
)
static

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

static void DtVrfRadio::readCommModelSettingsCallback ( const DtSettingsObject settings,
void *  usr 
)
static

If this radio's comm-model-name is "default-radio-comm-model" this callback is registered with the DtVrfSimSettingsManager and will switch between the "default-internal-radio-comm-model" and the "default-external-radio-comm-model" based on the "use-external-comm-model" back-end setting.

See commModelParams.mtl in the config directory for the definitions of the comm models, and vrfSimSettings.xml for the current state of "use-external-comm-model".

virtual void DtVrfRadio::processReadCommModelSettings ( const DtSettingsObject settings)
virtual

Member Data Documentation

DtVrfRadioFactory* DtVrfRadio::theFactory
staticprotected
DtVrfObject* DtVrfRadio::myVrfObject
protected
const DtVrfRadioDescriptor& DtVrfRadio::myRadioDescriptor
protected
DtVrfObjectMessageExecutive DtVrfRadio::myMessageExecutive
protected
DtCommModel* DtVrfRadio::myCommModel
protected

The radio network which this radio is part of.

DtVrfRadioTransmitter* DtVrfRadio::myRadioTransmitter
protected
int DtVrfRadio::myRadioId
protected
bool DtVrfRadio::myReadyToSend
protected
DtMessageQueue DtVrfRadio::myMessageQueuedToSend
protected

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

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)