RSB
0.7.0
|
A informer to publish data of a specified type expressed through the template parameter. More...
#include <Informer.h>
Public Types | |
typedef boost::shared_ptr < Informer< T > > | Ptr |
Shared pointer type for this informer. | |
typedef boost::shared_ptr< T > | DataPtr |
Shared pointer type for the default data published by this informer. |
Public Member Functions | |
Informer (const std::vector< transport::OutConnectorPtr > &connectors, const Scope &scope, const ParticipantConfig &config, const std::string &type=detail::TypeName< T >()()) | |
Constructs a new informer. | |
virtual | ~Informer () |
std::string | getClassName () const |
EventPtr | createEvent () const |
Creates a new Event instance filled with the scope from this informer. | |
EventPtr | publish (boost::shared_ptr< T > data) |
Publishes data to the Informer's scope. | |
template<class T1 > | |
EventPtr | publish (boost::shared_ptr< T1 > data, std::string type=rsc::runtime::typeName(typeid(T1))) |
Published data in the channel in which the informer participates. | |
EventPtr | publish (EventPtr event) |
Publishes the event to the Informer's scope with the ability to define additional meta data. | |
Public Member Functions inherited from rsb::InformerBase | |
InformerBase (const std::vector< transport::OutConnectorPtr > &connectors, const Scope &scope, const ParticipantConfig &config, const std::string &defaultType) | |
virtual | ~InformerBase () |
void | printContents (std::ostream &stream) const |
std::string | getType () const |
Return the event payload type of this Informer. | |
void | setQualityOfSerivceSpecs (const QualityOfServiceSpec &specs) |
Defines the desired quality of service settings for this informers. | |
template<class T1 > | |
EventPtr | uncheckedPublish (boost::shared_ptr< T1 > data, const std::string &type=rsc::runtime::typeName< T1 >()) |
EventPtr | publish (VoidPtr data, const std::string &type) |
Publishes data to the Informer's scope. | |
EventPtr | uncheckedPublish (VoidPtr data, const std::string &type) |
Public Member Functions inherited from rsb::Participant | |
virtual | ~Participant () |
rsc::misc::UUID | getId () const |
Returns the unique id of the participant. | |
ScopePtr | getScope () const |
Returns the scope of this participant. | |
ParticipantConfig | getConfig () const |
Returns a copy of the participant's configuration. |
Private Attributes | |
rsc::logging::LoggerPtr | logger |
Additional Inherited Members | |
Protected Member Functions inherited from rsb::InformerBase | |
void | checkedPublish (EventPtr event) |
void | uncheckedPublish (EventPtr event) |
boost::uint32_t | nextSequenceNumber () |
Protected Attributes inherited from rsb::InformerBase | |
std::string | defaultType |
eventprocessing::OutRouteConfiguratorPtr | configurator |
boost::uint32_t | currentSequenceNumber |
A informer to publish data of a specified type expressed through the template parameter.
All data in RSB is maintained as shared pointers to avoid unnecessary copy operations. Typedefs simplify the use of the pointer types.
The basic usage pattern is explained with this example code:
T | Data type to send by this informer. |
Definition at line 227 of file Informer.h.
typedef boost::shared_ptr<T> rsb::Informer< T >::DataPtr |
Shared pointer type for the default data published by this informer.
Definition at line 238 of file Informer.h.
typedef boost::shared_ptr<Informer<T> > rsb::Informer< T >::Ptr |
Shared pointer type for this informer.
Definition at line 233 of file Informer.h.
|
inline |
Constructs a new informer.
connectors | A list of connectors the informer should use to connect to the bus |
scope | the scope under which the data are published |
config | the config that was used to setup this informer |
type | string describing the type of data sent by this informer. The empty string indicates that data of arbitrary type can be sent through this informer. |
Definition at line 254 of file Informer.h.
|
inlinevirtual |
Definition at line 261 of file Informer.h.
|
inlinevirtual |
Creates a new Event instance filled with the scope from this informer.
Moreover, this version also sets the type according to the template parameter of Informer.
Reimplemented from rsb::InformerBase.
Definition at line 276 of file Informer.h.
Referenced by rsb::Informer< void >::createEvent().
|
inline |
Definition at line 264 of file Informer.h.
|
inline |
Publishes data to the Informer's scope.
data | Pointer to the data to send. |
Definition at line 289 of file Informer.h.
Referenced by rsb::patterns::RemoteServer::callAsync(), and rsb::Informer< void >::publish().
|
inline |
Published data in the channel in which the informer participates.
T1 | The type of data. The value of this parameter is used infer the value of type. |
data | Pointer to the data that should be sent. Arbitrary pointer types are accepted at compile time, but may lead to type or conversion errors at runtime. |
type | A string indicating the type of data. I.e. "std::string" for std::string objects. If omitted, the type of data is inferred from T1. |
std::invalid_argument | If T1 or type is incompatible with the actual type of the informer. |
Reimplemented from rsb::InformerBase.
Definition at line 295 of file Informer.h.
|
inline |
Publishes the event to the Informer's scope with the ability to define additional meta data.
event | The event to publish. |
std::invalid_argument | If the type of the payload of event is incompatible with the actual type of the informer or if the scope of event is not a subscope of the scope of the informer. |
Reimplemented from rsb::InformerBase.
Definition at line 300 of file Informer.h.
|
private |
Definition at line 304 of file Informer.h.