RSB  0.19.0
rsb::InformerBase Class Reference

A informer to publish data. More...

#include <Informer.h>

Inheritance diagram for rsb::InformerBase:
Inheritance graph
Collaboration diagram for rsb::InformerBase:
Collaboration graph

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...
 
virtual const std::set< std::string > getTransportURLs () const
 TODO. 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
 

Detailed Description

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:

InformerBasePtr informer = getFactory().createInformerBase(Scope("/example/informer"));
typename InformerBase::DataPtr<string>::type s(new string("blub"));
informer->publish(s);
Author
swrede
jmoringe

Definition at line 95 of file Informer.h.

Constructor & Destructor Documentation

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().

Here is the call graph for this function:

rsb::InformerBase::~InformerBase ( )
virtual

Definition at line 57 of file Informer.cpp.

Member Function Documentation

void rsb::InformerBase::checkedPublish ( EventPtr  event)
protected

Definition at line 109 of file Informer.cpp.

References rsb::Participant::getScope(), getType(), and uncheckedPublish().

Referenced by publish().

Here is the call graph for this function:

Here is the caller graph for this function:

EventPtr rsb::InformerBase::createEvent ( ) const
virtual

Creates a new Event instance filled with the scope from this informer.

Returns
new Event instance with scope set

Reimplemented in rsb::Informer< T >.

Definition at line 82 of file Informer.cpp.

References event, and rsb::Participant::getScope().

Referenced by rsb::Informer< T >::createEvent(), publish(), and uncheckedPublish().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string rsb::InformerBase::getKind ( ) const
virtual

Return the kind of the participant.

Examples include "informer", "listener" and "reader".

Returns
a string describing the kind of the participant.

Implements rsb::Participant.

Definition at line 65 of file Informer.cpp.

const std::set< std::string > rsb::InformerBase::getTransportURLs ( ) const
virtual

TODO.

Implements rsb::Participant.

Definition at line 69 of file Informer.cpp.

References configurator.

string rsb::InformerBase::getType ( ) const

Return the event payload type of this Informer.

Returns
A string designating the event payload type of this Informer.

Definition at line 74 of file Informer.cpp.

References defaultType.

Referenced by checkedPublish().

Here is the caller graph for this function:

boost::uint32_t rsb::InformerBase::nextSequenceNumber ( )
protected

Definition at line 142 of file Informer.cpp.

References currentSequenceNumber, and sequenceNumberMutex.

Referenced by uncheckedPublish().

Here is the caller graph for this function:

void rsb::InformerBase::printContents ( std::ostream &  stream) const

Definition at line 60 of file Informer.cpp.

References defaultType, and rsb::Participant::printContents().

Here is the call graph for this function:

template<class T1 >
EventPtr rsb::InformerBase::publish ( boost::shared_ptr< T1 >  data,
std::string  type = rsc::runtime::typeName<T1>() 
)
inline

Published data in the channel in which the informer participates.

Template Parameters
T1The type of data. The value of this parameter is used infer the value of type.
Parameters
dataPointer 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.
typeA string indicating the type of data. I.e. "std::string" for std::string objects. If omitted, the type of data is inferred from T1.
Returns
A boost::shared_ptr to the rsb::Event object that has been implicitly created.
Exceptions
std::invalid_argumentIf T1 or type is incompatible with the actual type of the informer.

Definition at line 152 of file Informer.h.

Referenced by rsb::Informer< T >::publish().

Here is the caller graph for this function:

EventPtr rsb::InformerBase::publish ( VoidPtr  data,
const std::string &  type 
)

Publishes data to the Informer's scope.

Parameters
dataPointer to the data to send.
typeA string indicating the type of data. I.e. "std::string" for std::string objects.
Returns
A boost::shared_ptr to the rsb::Event object that has been implicitly created.
Exceptions
std::invalid_argumentIf type is incompatible with the actual type of the informer.

Definition at line 88 of file Informer.cpp.

References checkedPublish(), createEvent(), and event.

Here is the call graph for this function:

EventPtr rsb::InformerBase::publish ( EventPtr  event)

Publishes the event to the Informer's scope with the ability to define additional meta data.

Parameters
eventThe event to publish.
Returns
modified event.
Exceptions
std::invalid_argumentIf 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 104 of file Informer.cpp.

References checkedPublish(), and event.

Here is the call graph for this function:

void rsb::InformerBase::setQualityOfSerivceSpecs ( const QualityOfServiceSpec specs)

Defines the desired quality of service settings for this informers.

Parameters
specsQoS specs
Exceptions
UnsupportedQualityOfServiceExceptionrequirements cannot be met

Definition at line 78 of file Informer.cpp.

References configurator.

template<class T1 >
EventPtr rsb::InformerBase::uncheckedPublish ( boost::shared_ptr< T1 >  data,
const std::string &  type = rsc::runtime::typeName<T1>() 
)
inline

Definition at line 159 of file Informer.h.

References event.

Referenced by checkedPublish(), and uncheckedPublish().

Here is the caller graph for this function:

EventPtr rsb::InformerBase::uncheckedPublish ( VoidPtr  data,
const std::string &  type 
)

Definition at line 96 of file Informer.cpp.

References createEvent(), event, and uncheckedPublish().

Here is the call graph for this function:

void rsb::InformerBase::uncheckedPublish ( EventPtr  event)
protected

Definition at line 137 of file Informer.cpp.

References configurator, rsb::Participant::getId(), and nextSequenceNumber().

Here is the call graph for this function:

Member Data Documentation

eventprocessing::OutRouteConfiguratorPtr rsb::InformerBase::configurator
protected
boost::uint32_t rsb::InformerBase::currentSequenceNumber
private

Definition at line 213 of file Informer.h.

Referenced by nextSequenceNumber().

std::string rsb::InformerBase::defaultType
protected

Definition at line 208 of file Informer.h.

Referenced by getType(), and printContents().

rsc::logging::LoggerPtr rsb::InformerBase::logger
private

Definition at line 212 of file Informer.h.

boost::mutex rsb::InformerBase::sequenceNumberMutex
private

Definition at line 214 of file Informer.h.

Referenced by nextSequenceNumber().


The documentation for this class was generated from the following files: