RSB
0.12.2
|
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 |
virtual std::string | getKind () const |
Return the kind of the participant. More... | |
std::string | getType () const |
Return the event payload type of this Informer. More... | |
void | setQualityOfSerivceSpecs (const QualityOfServiceSpec &specs) |
Defines the desired quality of service settings for this informers. More... | |
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. More... | |
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. More... | |
EventPtr | publish (VoidPtr data, const std::string &type) |
Publishes data to the Informer's scope. More... | |
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. More... | |
Public Member Functions inherited from rsb::Participant | |
virtual | ~Participant () |
void | printContents (std::ostream &stream) const |
rsc::misc::UUID | getId () const |
Returns the unique id of the participant. More... | |
ScopePtr | getScope () const |
Returns the scope of this participant. More... | |
ParticipantConfig | getConfig () const |
Returns a copy of the participant's configuration. More... | |
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 |
Private Attributes | |
rsc::logging::LoggerPtr | logger |
boost::uint32_t | currentSequenceNumber |
boost::mutex | sequenceNumberMutex |
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 95 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 39 of file Informer.cpp.
References configurator, and rsb::ParticipantConfig::getQualityOfServiceSpec().
|
virtual |
Definition at line 57 of file Informer.cpp.
|
protected |
Definition at line 104 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 >.
Definition at line 77 of file Informer.cpp.
References rsb::Participant::getScope().
Referenced by rsb::Informer< T >::createEvent(), publish(), and uncheckedPublish().
|
virtual |
Return the kind of the participant.
Examples include "informer"
, "listener"
and "reader"
.
Implements rsb::Participant.
Definition at line 65 of file Informer.cpp.
string rsb::InformerBase::getType | ( | ) | const |
Return the event payload type of this Informer.
Definition at line 69 of file Informer.cpp.
References defaultType.
Referenced by checkedPublish(), rsb::Informer< T >::createEvent(), and rsb::Informer< T >::publish().
|
protected |
Definition at line 137 of file Informer.cpp.
References currentSequenceNumber, and sequenceNumberMutex.
Referenced by uncheckedPublish().
void rsb::InformerBase::printContents | ( | std::ostream & | stream | ) | const |
Definition at line 60 of file Informer.cpp.
References defaultType, and rsb::Participant::printContents().
|
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. |
Definition at line 149 of file Informer.h.
Referenced by rsb::Informer< T >::publish().
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 83 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. |
Definition at line 99 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 73 of file Informer.cpp.
References configurator.
|
inline |
Definition at line 156 of file Informer.h.
Referenced by checkedPublish(), and uncheckedPublish().
Definition at line 91 of file Informer.cpp.
References createEvent(), and uncheckedPublish().
|
protected |
Definition at line 132 of file Informer.cpp.
References configurator, rsb::Participant::getId(), and nextSequenceNumber().
|
protected |
Definition at line 206 of file Informer.h.
Referenced by InformerBase(), setQualityOfSerivceSpecs(), and uncheckedPublish().
|
private |
Definition at line 210 of file Informer.h.
Referenced by nextSequenceNumber().
|
protected |
Definition at line 205 of file Informer.h.
Referenced by getType(), and printContents().
|
private |
Definition at line 209 of file Informer.h.
|
private |
Definition at line 211 of file Informer.h.
Referenced by nextSequenceNumber().