RSB
0.7.0
|
A informer to publish data. More...
#include <Informer.h>
Classes | |
struct | DataPtr |
Public Member Functions | |
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 | publish (boost::shared_ptr< T1 > data, std::string type=rsc::runtime::typeName< T1 >()) |
Published data in the channel in which the informer participates. | |
template<class T1 > | |
EventPtr | uncheckedPublish (boost::shared_ptr< T1 > data, const std::string &type=rsc::runtime::typeName< T1 >()) |
virtual EventPtr | createEvent () const |
Creates a new Event instance filled with the scope from this informer. | |
EventPtr | publish (VoidPtr data, const std::string &type) |
Publishes data to the Informer's scope. | |
EventPtr | uncheckedPublish (VoidPtr data, const std::string &type) |
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::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. |
Protected Member Functions | |
void | checkedPublish (EventPtr event) |
void | uncheckedPublish (EventPtr event) |
boost::uint32_t | nextSequenceNumber () |
Protected Member Functions inherited from rsb::Participant | |
Participant (const Scope &scope, const ParticipantConfig &config) |
Protected Attributes | |
std::string | defaultType |
eventprocessing::OutRouteConfiguratorPtr | configurator |
boost::uint32_t | currentSequenceNumber |
Private Attributes | |
rsc::logging::LoggerPtr | logger |
A informer to publish data.
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:
Definition at line 94 of file Informer.h.
rsb::InformerBase::InformerBase | ( | const std::vector< transport::OutConnectorPtr > & | connectors, |
const Scope & | scope, | ||
const ParticipantConfig & | config, | ||
const std::string & | defaultType | ||
) |
Definition at line 38 of file Informer.cpp.
References configurator.
|
virtual |
Definition at line 54 of file Informer.cpp.
|
protected |
Definition at line 97 of file Informer.cpp.
References rsb::Participant::getScope(), getType(), and uncheckedPublish().
Referenced by publish().
|
virtual |
Creates a new Event instance filled with the scope from this informer.
Reimplemented in rsb::Informer< T >, rsb::Informer< AnyType >, and rsb::Informer< void >.
Definition at line 70 of file Informer.cpp.
References rsb::Participant::getScope().
Referenced by publish(), and uncheckedPublish().
string rsb::InformerBase::getType | ( | ) | const |
Return the event payload type of this Informer.
Definition at line 62 of file Informer.cpp.
References defaultType.
Referenced by checkedPublish(), rsb::Informer< void >::createEvent(), and rsb::Informer< void >::publish().
|
protected |
TODO(jmoringe): needs atomic increment
Definition at line 130 of file Informer.cpp.
References currentSequenceNumber.
Referenced by uncheckedPublish().
void rsb::InformerBase::printContents | ( | std::ostream & | stream | ) | const |
Reimplemented from rsb::Participant.
Definition at line 57 of file Informer.cpp.
References defaultType.
|
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 in rsb::Informer< T >, rsb::Informer< AnyType >, and rsb::Informer< void >.
Definition at line 145 of file Informer.h.
Publishes data to the Informer's scope.
data | Pointer to the data to send. |
type | A string indicating the type of data. I.e. "std::string" for std::string objects. |
std::invalid_argument | If type is incompatible with the actual type of the informer. |
Definition at line 76 of file Informer.cpp.
References checkedPublish(), and createEvent().
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 in rsb::Informer< T >, rsb::Informer< AnyType >, and rsb::Informer< void >.
Definition at line 92 of file Informer.cpp.
References checkedPublish().
void rsb::InformerBase::setQualityOfSerivceSpecs | ( | const QualityOfServiceSpec & | specs | ) |
Defines the desired quality of service settings for this informers.
specs | QoS specs |
UnsupportedQualityOfServiceException | requirements cannot be met |
Definition at line 66 of file Informer.cpp.
References configurator.
|
inline |
Definition at line 152 of file Informer.h.
Referenced by checkedPublish(), and uncheckedPublish().
Definition at line 84 of file Informer.cpp.
References createEvent(), and uncheckedPublish().
|
protected |
Definition at line 125 of file Informer.cpp.
References configurator, rsb::Participant::getId(), and nextSequenceNumber().
|
protected |
Definition at line 202 of file Informer.h.
Referenced by InformerBase(), setQualityOfSerivceSpecs(), and uncheckedPublish().
|
protected |
Definition at line 203 of file Informer.h.
Referenced by nextSequenceNumber().
|
protected |
Definition at line 201 of file Informer.h.
Referenced by getType(), and printContents().
|
private |
Definition at line 205 of file Informer.h.