VR-Exchange 2.10 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions
MAKVrExchange::DtPortalConnection Class Reference

Connects a broker to the Portal Data Exchange. More...

Classes

struct  CallbackPair
 Structures, types and variables used to register callbacks. More...
 

Public Types

typedef void(* MessageCbFcn )(const DtPortalMessage &message, void *usr)
 

Public Member Functions

 DtPortalConnection (const DtString &brokerName, DtU8 brokerId, DtU32 brokerType, const DtString &controlQueueName, const DtString &interactionQueueName, const DtString &objectQueueName, int port=5111, int commandLineArgc=0, char **commandLineArgv=0)
 DtPortalConnection constructor. More...
 
virtual ~DtPortalConnection ()
 
virtual DtPortalMessageFactorymessageFactory ()
 Returns a pointer to the messageFactory. More...
 
virtual void send (const DtPortalMessage &message)
 Sends Portal Messages (which are sent on the constrol channel) More...
 
virtual void send (const DtPortalInteraction &inter)
 Sends Portal Interactions, will stamp the messaged with this broker's id. More...
 
virtual void send (const DtPortalObject &inter)
 Sends Portal ObjectUpdates, will stamp the messaged with this broker's id. More...
 
virtual void drainInput (int maxControlMessages=-1, int maxInterMessages=-1, int maxObjectMessages=-1)
 Drains all queues and evokes callbacks on registered messages. More...
 
virtual DtU8 brokerId () const
 Returns the brokerId for this DtPortalConnection instance. More...
 
virtual void setBrokerId (DtU8)
 allows setting the broker ID to something other than the initial value More...
 
virtual const DtStringbrokerName () const
 Returns the brokerName for this DtPortalConnection instance. More...
 
virtual DtClock * clock ()
 Returns a pointer to the internal clock;. More...
 
virtual double receivedMessagesPerSecond () const
 Returns the average messages received per second since start. More...
 
virtual double sentMessagesPerSecond () const
 Returns the average messages sent per second since start. More...
 
DtString lookupBrokerName (const DtU16 &brokerId) const
 Returns the string name of the brokerId passed in. More...
 
DtU16 lookupBrokerId (const DtString &brokerName) const
 Returns the brokerID from a string name passed in. More...
 
virtual void processRemoveBrokerMessage (const DtU32 id)
 Processes a broker removal message. Should be considered private. More...
 
virtual void processAddBrokerMessage (const DtString &name, const DtU32 id)
 Processes a broker addition message. Should be considered private. More...
 
Callbacks

These functions register methods to call when the DtPortalConnection receives a portal message.

These functions should not be called by users, developers should instead register their callbacks with the specific messages they wish to receive.

Adds callback for specific message.

Exceptions
DtExceptionif msgKnd is out of bounds.
virtual void addMessageCallback (DtPortalMessageKind msgKnd, MessageCbFcn fnc, void *usr)
 Adds callback for message without a type. More...
 
virtual void addMessageCallback (MessageCbFcn fnc, void *usr)
 Adds callback for message without a type. More...
 
virtual void removeMessageCallback (DtPortalMessageKind msgKnd, MessageCbFcn fnc, void *usr)
 Removes a callback from a specific message type. More...
 
virtual void removeMessageCallback (MessageCbFcn fnc, void *usr)
 Removes a callback with no type. More...
 

Static Public Member Functions

static const DtString version ()
 Returns a string indicating the version number of this API. More...
 
static const DtString build ()
 Returns a string indicating the build time for this library. More...
 

Protected Types

typedef std::list< CallbackPairCallbackPairList
 
typedef std::map< DtU16, DtStringBrokerIdToNameMap
 

Protected Member Functions

virtual void processMessage (const DtPortalMessage &message) const
 Processes a portal message and issues callbacks. More...
 
virtual void drainControlQueue (int maxMessages) const
 Processes the ControlQueue for maxMessages, if maxMessages is < 0 then it will read all messages. More...
 
virtual void drainInteractionQueue (int maxMessages) const
 Processes the InteractionQueue for maxMessages, if maxMessages is < 0 then it will read all messages. More...
 
virtual void drainObjectQueue (int maxMessages) const
 Processes the ObjectQueue for maxMessages, if maxMessages is < 0 then it will read all messages. More...
 
virtual void drainQueue (DtSubscribableMessageQueue *messageQueue, const int maxMessages) const
 Processes the messageQueue for maxMessages. More...
 
virtual void cleanupMessageQueues ()
 Used to delete the message queues. More...
 
virtual bool isQueueManagerOk ()
 Tests the tcp connection to the queueManager. More...
 

Protected Attributes

DtSubscribableMessageQueuemyControlMessageQueue
 
DtSubscribableMessageQueuemyInteractionMessageQueue
 
DtSubscribableMessageQueuemyObjectMessageQueue
 
DtString myBrokerName
 
DtU8 myBrokerId
 
DtU32 myBrokerType
 
DtU32 myObjectSerialNumber
 
DtU32 myInteractionSerialNumber
 
DtU32 myControlSerialNumber
 
DtPortalMessageFactory myMessageFactory
 
DtInetTcpSocket * myTcpSocket
 
DtClock myClock
 
DtU32 mySentControlMessages
 
DtU32 mySentInteractionMessages
 
DtU32 mySentObjectMessages
 
DtU32 myMutableReceivedMessages
 
DtTime myLastTcpHeartbeat
 
bool myOneTimeSendBrokerIdFlag
 
CallbackPairList myNoTypeCbList
 
CallbackPairList myCbList [DtMaxPortalMessageKinds]
 
BrokerIdToNameMap myBrokerIdToNameMap
 

Private Member Functions

 DtPortalConnection (const DtPortalConnection &other)
 Copy Ctor Not implemented – Class Not Copiable. More...
 
DtPortalConnectionoperator= (const DtPortalConnection &other)
 Assignment Operator Not implemented – Class Not Copiable. More...
 

Detailed Description

Connects a broker to the Portal Data Exchange.

Each instance of DtPortalConnection represents a connection to the VR-Exchange Data Exchange. A DtPortalConnection is required in each broker, and must be correctly established before a broker can be considered operational. The DtPortalConnection instance abstracts all internal communication mechanisms.

Member Typedef Documentation

typedef void(* MAKVrExchange::DtPortalConnection::MessageCbFcn)(const DtPortalMessage &message, void *usr)

Constructor & Destructor Documentation

MAKVrExchange::DtPortalConnection::DtPortalConnection ( const DtString brokerName,
DtU8  brokerId,
DtU32  brokerType,
const DtString controlQueueName,
const DtString interactionQueueName,
const DtString objectQueueName,
int  port = 5111,
int  commandLineArgc = 0,
char **  commandLineArgv = 0 
)

DtPortalConnection constructor.

Parameters
brokerName- a string name for this broker, must be unique.
brokerId- and integer ID for this broker, must be unique.
controlQueueName- A text name for the control queue in shared memory.
interactionQueueName- A text name for the interaction queue in shared memory.
objectQueueName- A text name for the object queue name in shared memory.
port- the port to listen for the portalManager on. If set to 0 then no port is used. The broker should still work with this configuration but it will not be as robust.
virtual MAKVrExchange::DtPortalConnection::~DtPortalConnection ( )
virtual
MAKVrExchange::DtPortalConnection::DtPortalConnection ( const DtPortalConnection other)
private

Copy Ctor Not implemented – Class Not Copiable.

Member Function Documentation

virtual void MAKVrExchange::DtPortalConnection::addMessageCallback ( DtPortalMessageKind  msgKnd,
MessageCbFcn  fnc,
void *  usr 
)
virtual

Adds callback for message without a type.

This callback will be fired for every message update.

virtual void MAKVrExchange::DtPortalConnection::addMessageCallback ( MessageCbFcn  fnc,
void *  usr 
)
virtual

Adds callback for message without a type.

This callback will be fired for every message update.

virtual DtU8 MAKVrExchange::DtPortalConnection::brokerId ( ) const
virtual

Returns the brokerId for this DtPortalConnection instance.

virtual const DtString& MAKVrExchange::DtPortalConnection::brokerName ( ) const
virtual

Returns the brokerName for this DtPortalConnection instance.

static const DtString MAKVrExchange::DtPortalConnection::build ( )
static

Returns a string indicating the build time for this library.

virtual void MAKVrExchange::DtPortalConnection::cleanupMessageQueues ( )
protectedvirtual

Used to delete the message queues.

Put in a utility function, because we need to make sure all allocated memory is deleted in several spots (i.e, if an exception is thrown in the CTOR, and some memory has already been allocated).

virtual DtClock* MAKVrExchange::DtPortalConnection::clock ( )
virtual

Returns a pointer to the internal clock;.

virtual void MAKVrExchange::DtPortalConnection::drainControlQueue ( int  maxMessages) const
protectedvirtual

Processes the ControlQueue for maxMessages, if maxMessages is < 0 then it will read all messages.

virtual void MAKVrExchange::DtPortalConnection::drainInput ( int  maxControlMessages = -1,
int  maxInterMessages = -1,
int  maxObjectMessages = -1 
)
virtual

Drains all queues and evokes callbacks on registered messages.

Parameters
maxControlMessages- the maximum number of control messages to read in this call, if set to -1 it will read all messages
maxInterMessage- the maximum number of interaction messages to read in this call, if set to -1 it will read all messages
maxObjectMessages- the maximum number of object messages to read in this call, if set to -1 it will read all messages
Exceptions
DtExceptionwhen the connection to the portal is broken. This is fatal, and the broker should shutdown
virtual void MAKVrExchange::DtPortalConnection::drainInteractionQueue ( int  maxMessages) const
protectedvirtual

Processes the InteractionQueue for maxMessages, if maxMessages is < 0 then it will read all messages.

virtual void MAKVrExchange::DtPortalConnection::drainObjectQueue ( int  maxMessages) const
protectedvirtual

Processes the ObjectQueue for maxMessages, if maxMessages is < 0 then it will read all messages.

virtual void MAKVrExchange::DtPortalConnection::drainQueue ( DtSubscribableMessageQueue messageQueue,
const int  maxMessages 
) const
protectedvirtual

Processes the messageQueue for maxMessages.

If maxMessages is < 0 then it will read all the queue's messages.

virtual bool MAKVrExchange::DtPortalConnection::isQueueManagerOk ( )
protectedvirtual

Tests the tcp connection to the queueManager.

DtU16 MAKVrExchange::DtPortalConnection::lookupBrokerId ( const DtString brokerName) const

Returns the brokerID from a string name passed in.

DtString MAKVrExchange::DtPortalConnection::lookupBrokerName ( const DtU16 &  brokerId) const

Returns the string name of the brokerId passed in.

virtual DtPortalMessageFactory* MAKVrExchange::DtPortalConnection::messageFactory ( )
virtual

Returns a pointer to the messageFactory.

DtPortalConnection& MAKVrExchange::DtPortalConnection::operator= ( const DtPortalConnection other)
private

Assignment Operator Not implemented – Class Not Copiable.

virtual void MAKVrExchange::DtPortalConnection::processAddBrokerMessage ( const DtString name,
const DtU32  id 
)
virtual

Processes a broker addition message. Should be considered private.

virtual void MAKVrExchange::DtPortalConnection::processMessage ( const DtPortalMessage message) const
protectedvirtual

Processes a portal message and issues callbacks.

virtual void MAKVrExchange::DtPortalConnection::processRemoveBrokerMessage ( const DtU32  id)
virtual

Processes a broker removal message. Should be considered private.

virtual double MAKVrExchange::DtPortalConnection::receivedMessagesPerSecond ( ) const
virtual

Returns the average messages received per second since start.

virtual void MAKVrExchange::DtPortalConnection::removeMessageCallback ( DtPortalMessageKind  msgKnd,
MessageCbFcn  fnc,
void *  usr 
)
virtual

Removes a callback from a specific message type.

Exceptions
DtExceptionif msgKnd is out of bounds.
virtual void MAKVrExchange::DtPortalConnection::removeMessageCallback ( MessageCbFcn  fnc,
void *  usr 
)
virtual

Removes a callback with no type.

virtual void MAKVrExchange::DtPortalConnection::send ( const DtPortalMessage message)
virtual

Sends Portal Messages (which are sent on the constrol channel)

virtual void MAKVrExchange::DtPortalConnection::send ( const DtPortalInteraction inter)
virtual

Sends Portal Interactions, will stamp the messaged with this broker's id.

virtual void MAKVrExchange::DtPortalConnection::send ( const DtPortalObject inter)
virtual

Sends Portal ObjectUpdates, will stamp the messaged with this broker's id.

This is usualy only used by an object publisher.

virtual double MAKVrExchange::DtPortalConnection::sentMessagesPerSecond ( ) const
virtual

Returns the average messages sent per second since start.

virtual void MAKVrExchange::DtPortalConnection::setBrokerId ( DtU8  )
virtual

allows setting the broker ID to something other than the initial value

static const DtString MAKVrExchange::DtPortalConnection::version ( )
static

Returns a string indicating the version number of this API.

Member Data Documentation

DtU8 MAKVrExchange::DtPortalConnection::myBrokerId
protected
BrokerIdToNameMap MAKVrExchange::DtPortalConnection::myBrokerIdToNameMap
protected
DtString MAKVrExchange::DtPortalConnection::myBrokerName
protected
DtU32 MAKVrExchange::DtPortalConnection::myBrokerType
protected
CallbackPairList MAKVrExchange::DtPortalConnection::myCbList[DtMaxPortalMessageKinds]
protected
DtClock MAKVrExchange::DtPortalConnection::myClock
protected
DtSubscribableMessageQueue* MAKVrExchange::DtPortalConnection::myControlMessageQueue
protected
DtU32 MAKVrExchange::DtPortalConnection::myControlSerialNumber
protected
DtSubscribableMessageQueue* MAKVrExchange::DtPortalConnection::myInteractionMessageQueue
protected
DtU32 MAKVrExchange::DtPortalConnection::myInteractionSerialNumber
protected
DtTime MAKVrExchange::DtPortalConnection::myLastTcpHeartbeat
protected
DtPortalMessageFactory MAKVrExchange::DtPortalConnection::myMessageFactory
protected
DtU32 MAKVrExchange::DtPortalConnection::myMutableReceivedMessages
mutableprotected
CallbackPairList MAKVrExchange::DtPortalConnection::myNoTypeCbList
protected
DtSubscribableMessageQueue* MAKVrExchange::DtPortalConnection::myObjectMessageQueue
protected
DtU32 MAKVrExchange::DtPortalConnection::myObjectSerialNumber
protected
bool MAKVrExchange::DtPortalConnection::myOneTimeSendBrokerIdFlag
protected
DtU32 MAKVrExchange::DtPortalConnection::mySentControlMessages
protected
DtU32 MAKVrExchange::DtPortalConnection::mySentInteractionMessages
protected
DtU32 MAKVrExchange::DtPortalConnection::mySentObjectMessages
protected
DtInetTcpSocket* MAKVrExchange::DtPortalConnection::myTcpSocket
protected

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

Document ID: Generated on Mon May 25 18:45:12 EDT 2026 from SVN revision 289111
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)