RSB  0.7.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
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

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 = Factory::getInstance().createInformerBase(Scope("/example/informer"));
typename InformerBase::DataPtr<string>::type s(new string("blub"));
informer->publish(s);
Author
swrede
jmoringe

Definition at line 94 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 38 of file Informer.cpp.

References configurator.

rsb::InformerBase::~InformerBase ( )
virtual

Definition at line 54 of file Informer.cpp.

Member Function Documentation

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

Definition at line 97 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 >, rsb::Informer< AnyType >, and rsb::Informer< void >.

Definition at line 70 of file Informer.cpp.

References rsb::Participant::getScope().

Referenced by publish(), and uncheckedPublish().

Here is the call graph for this function:

Here is the caller graph for this function:

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 62 of file Informer.cpp.

References defaultType.

Referenced by checkedPublish(), rsb::Informer< void >::createEvent(), and rsb::Informer< void >::publish().

Here is the caller graph for this function:

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

TODO(jmoringe): needs atomic increment

Definition at line 130 of file Informer.cpp.

References currentSequenceNumber.

Referenced by uncheckedPublish().

Here is the caller graph for this function:

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

Reimplemented from rsb::Participant.

Definition at line 57 of file Informer.cpp.

References defaultType.

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.

Reimplemented in rsb::Informer< T >, rsb::Informer< AnyType >, and rsb::Informer< void >.

Definition at line 145 of file Informer.h.

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 76 of file Informer.cpp.

References checkedPublish(), and createEvent().

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.

Reimplemented in rsb::Informer< T >, rsb::Informer< AnyType >, and rsb::Informer< void >.

Definition at line 92 of file Informer.cpp.

References checkedPublish().

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 66 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 152 of file Informer.h.

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 84 of file Informer.cpp.

References createEvent(), and uncheckedPublish().

Here is the call graph for this function:

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

Definition at line 125 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

Definition at line 202 of file Informer.h.

Referenced by InformerBase(), setQualityOfSerivceSpecs(), and uncheckedPublish().

boost::uint32_t rsb::InformerBase::currentSequenceNumber
protected

Definition at line 203 of file Informer.h.

Referenced by nextSequenceNumber().

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

Definition at line 201 of file Informer.h.

Referenced by getType(), and printContents().

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

Definition at line 205 of file Informer.h.


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