|
WSF
|
#include <WsfXIO_PublisherHelper.hpp>
Public Types | |
| typedef WsfXIO_PublishKey | PublisherKey |
| typedef WsfXIO_Publisher::SubscriptionId | SubscriptionId |
| typedef WsfXIO_PublishFilter | SubscriptionFilter |
| typedef WsfXIO_Publisher::SubscribeCallback | SubscriptionCallback |
| typedef std::map< SubscriptionId, WsfXIO_Publisher::SubscribeCallback * > | Subscriptions |
Public Member Functions | |
| WsfXIO_PublisherHelper (WsfXIO_Interface *aInterfacePtr, WsfSimulation &aSimulation) | |
| virtual | ~WsfXIO_PublisherHelper () |
| void | SetStateDirty (double aSimTime=-1.0) |
| void | Publish (const PublisherKey &aKey, const std::string &aData) |
| bool | GetPublishedData (const PublisherKey &aKey, std::string &aData) const |
| bool | HasSubscription (const SubscriptionId &aSubscriptionId) const |
| SubscriptionId | Subscribe (const SubscriptionFilter &aSubscriptionFilter, SubscriptionCallback *aSubscriptionCallbackPtr) |
| bool | Unsubscribe (const SubscriptionId &aSubscriptionId) |
Protected Member Functions | |
| virtual void | PublishState (double aSimTime) |
Friends | |
| class | PublishEvent |
This is a helper class that simplifies the interface to the WsfXIO_Publisher class. It uses an std::string as the message type. It can be used as a base class for dynamic plugins that would like to use XIO as a communication mechanism. Simply derive from WsfXIO_PublisherHelper or create an instance of it. You can receive remote messages by subscribing with a filter and callback using 'Subscribe'. You can publish messages by calling 'Publish'. If this class doesn't meet your needs, you can use WsfXIO_Publisher directly.
| typedef std::map<SubscriptionId, WsfXIO_Publisher::SubscribeCallback*> WsfXIO_PublisherHelper::Subscriptions |
| WsfXIO_PublisherHelper::WsfXIO_PublisherHelper | ( | WsfXIO_Interface * | aInterfacePtr, |
| WsfSimulation & | aSimulation ) |
|
virtual |
References Unsubscribe().
| bool WsfXIO_PublisherHelper::GetPublishedData | ( | const PublisherKey & | aKey, |
| std::string & | aData ) const |
Retrieves the published data given a key.
| aKey | The key to retrieve the data with. |
| aData | The data that is returned by reference. |
References WsfXIO_Publisher::GetData().
| bool WsfXIO_PublisherHelper::HasSubscription | ( | const SubscriptionId & | aSubscriptionId | ) | const |
Check to see if a subscription already exists.
| aSubscriptionId | The subscription id to check. |
| void WsfXIO_PublisherHelper::Publish | ( | const PublisherKey & | aKey, |
| const std::string & | aData ) |
Publish a message with the specified key.
| aKey | The key to associate the message with. |
| aData | The contents of the message. |
References WsfXIO_Publisher::Publish().
|
inlineprotectedvirtual |
Referenced by SetStateDirty().
| void WsfXIO_PublisherHelper::SetStateDirty | ( | double | aSimTime = -1.0 | ) |
References PublishState(), and simTime.
| WsfXIO_PublisherHelper::SubscriptionId WsfXIO_PublisherHelper::Subscribe | ( | const SubscriptionFilter & | aSubscriptionFilter, |
| SubscriptionCallback * | aSubscriptionCallbackPtr ) |
Create a new subscription with the specified filter.
| aSubscriptionFilter | The filter to match against any published messages. |
| aSubscriptionCallbackPtr | The callback to trigger when a publication that matches the filter is received. |
References WsfXIO_Publisher::Subscribe().
| bool WsfXIO_PublisherHelper::Unsubscribe | ( | const SubscriptionId & | aSubscriptionId | ) |
Cancel the specified subscription.
| aSubscriptionId | The subscription id to cancel. |
References WsfXIO_Publisher::Unsubscribe().
Referenced by ~WsfXIO_PublisherHelper().
|
friend |
References PublishEvent.
Referenced by PublishEvent.