![]() |
VR-Exchange 2.4 API Documentation
|
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, const DtString &controlQueueName, const DtString &interactionQueueName, const DtString &objectQueueName, int port=5111, int commandLineArgc=0, char **commandLineArgv=0) | |||
| DtPortalConnection constructor. | |||
| virtual | ~DtPortalConnection () | ||
| virtual DtPortalMessageFactory * | messageFactory () | ||
| Returns a pointer to the messageFactory. | |||
| virtual void | send (const DtPortalMessage &message) | ||
| Sends Portal Messages (which are sent on the constrol channel) | |||
| virtual void | send (const DtPortalInteraction &inter) | ||
| Sends Portal Interactions, will stamp the messaged with this broker's id. | |||
| virtual void | send (const DtPortalObject &inter) | ||
| Sends Portal ObjectUpdates, will stamp the messaged with this broker's id. | |||
| virtual void | drainInput (int maxControlMessages=-1, int maxInterMessages=-1, int maxObjectMessages=-1) | ||
| Drains all queues and evokes callbacks on registered messages. | |||
| virtual DtU8 | brokerId () const | ||
| Returns the brokerId for this DtPortalConnection instance. | |||
| virtual void | setBrokerId (DtU8) | ||
| allows setting the broker ID to something other than the initial value | |||
| virtual const DtString & | brokerName () const | ||
| Returns the brokerName for this DtPortalConnection instance. | |||
| virtual DtClock * | clock () | ||
| Returns a pointer to the internal clock;. | |||
| virtual double | receivedMessagesPerSecond () const | ||
| Returns the average messages received per second since start. | |||
| virtual double | sentMessagesPerSecond () const | ||
| Returns the average messages sent per second since start. | |||
| DtString | lookupBrokerName (const DtU16 &brokerId) const | ||
| Returns the string name of the brokerId passed in. | |||
| DtU16 | lookupBrokerId (const DtString &brokerName) const | ||
| Returns the brokerID from a string name passed in. | |||
| virtual void | processRemoveBrokerMessage (const DtU32 id) | ||
| Processes a broker removal message. Should be considered private. | |||
| virtual void | processAddBrokerMessage (const DtString &name, const DtU32 id) | ||
| Processes a broker addition message. Should be considered private. | |||
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.
| |||
| virtual void | addMessageCallback (DtPortalMessageKind msgKnd, MessageCbFcn fnc, void *usr) | ||
| Adds callback for message without a type. | |||
| virtual void | addMessageCallback (MessageCbFcn fnc, void *usr) | ||
| Adds callback for message without a type. | |||
| virtual void | removeMessageCallback (DtPortalMessageKind msgKnd, MessageCbFcn fnc, void *usr) | ||
| Removes a callback from a specific message type. | |||
| virtual void | removeMessageCallback (MessageCbFcn fnc, void *usr) | ||
| Removes a callback with no type. | |||
Static Public Member Functions | |
| static const DtString | version () |
| Returns a string indicating the version number of this API. | |
| static const DtString | build () |
| Returns a string indicating the build time for this library. | |
Protected Types | |
| typedef std::list< CallbackPair > | CallbackPairList |
| typedef std::map< DtU16, DtString > | BrokerIdToNameMap |
Protected Member Functions | |
| virtual void | processMessage (const DtPortalMessage &message) const |
| Processes a portal message and issues callbacks. | |
| virtual void | drainControlQueue (int maxMessages) const |
| Processes the ControlQueue for maxMessages, if maxMessages is < 0 then it will read all messages. | |
| virtual void | drainInteractionQueue (int maxMessages) const |
| Processes the InteractionQueue for maxMessages, if maxMessages is < 0 then it will read all messages. | |
| virtual void | drainObjectQueue (int maxMessages) const |
| Processes the ObjectQueue for maxMessages, if maxMessages is < 0 then it will read all messages. | |
| virtual void | drainQueue (DtSubscribableMessageQueue *messageQueue, const int maxMessages) const |
| Processes the messageQueue for maxMessages. | |
| virtual void | cleanupMessageQueues () |
| Used to delete the message queues. | |
| virtual bool | isQueueManagerOk () |
| Tests the tcp connection to the queueManager. | |
Protected Attributes | |
| DtSubscribableMessageQueue * | myControlMessageQueue |
| DtSubscribableMessageQueue * | myInteractionMessageQueue |
| DtSubscribableMessageQueue * | myObjectMessageQueue |
| DtString | myBrokerName |
| DtU8 | myBrokerId |
| 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. | |
| DtPortalConnection & | operator= (const DtPortalConnection &other) |
| Assignment Operator Not implemented – Class Not Copiable. | |
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.
|
protected |
|
protected |
| typedef void(* MAKVrExchange::DtPortalConnection::MessageCbFcn)(const DtPortalMessage &message, void *usr) |
| MAKVrExchange::DtPortalConnection::DtPortalConnection | ( | const DtString & | brokerName, |
| DtU8 | brokerId, | ||
| const DtString & | controlQueueName, | ||
| const DtString & | interactionQueueName, | ||
| const DtString & | objectQueueName, | ||
| int | port = 5111, |
||
| int | commandLineArgc = 0, |
||
| char ** | commandLineArgv = 0 |
||
| ) |
DtPortalConnection constructor.
| 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 |
|
private |
Copy Ctor Not implemented – Class Not Copiable.
|
virtual |
Adds callback for message without a type.
This callback will be fired for every message update.
|
virtual |
Adds callback for message without a type.
This callback will be fired for every message update.
|
virtual |
Returns the brokerId for this DtPortalConnection instance.
|
virtual |
Returns the brokerName for this DtPortalConnection instance.
|
static |
Returns a string indicating the build time for this library.
|
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 |
Returns a pointer to the internal clock;.
|
protectedvirtual |
Processes the ControlQueue for maxMessages, if maxMessages is < 0 then it will read all messages.
|
virtual |
Drains all queues and evokes callbacks on registered messages.
| 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 |
| DtException | when the connection to the portal is broken. This is fatal, and the broker should shutdown |
|
protectedvirtual |
Processes the InteractionQueue for maxMessages, if maxMessages is < 0 then it will read all messages.
|
protectedvirtual |
Processes the ObjectQueue for maxMessages, if maxMessages is < 0 then it will read all messages.
|
protectedvirtual |
Processes the messageQueue for maxMessages.
If maxMessages is < 0 then it will read all the queue's messages.
|
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 |
Returns a pointer to the messageFactory.
|
private |
Assignment Operator Not implemented – Class Not Copiable.
|
virtual |
Processes a broker addition message. Should be considered private.
|
protectedvirtual |
Processes a portal message and issues callbacks.
|
virtual |
Processes a broker removal message. Should be considered private.
|
virtual |
Returns the average messages received per second since start.
|
virtual |
Removes a callback from a specific message type.
| DtException | if msgKnd is out of bounds. |
|
virtual |
Removes a callback with no type.
|
virtual |
Sends Portal Messages (which are sent on the constrol channel)
|
virtual |
Sends Portal Interactions, will stamp the messaged with this broker's id.
|
virtual |
Sends Portal ObjectUpdates, will stamp the messaged with this broker's id.
This is usualy only used by an object publisher.
|
virtual |
Returns the average messages sent per second since start.
|
virtual |
allows setting the broker ID to something other than the initial value
|
static |
Returns a string indicating the version number of this API.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |