RSB  0.19.0
rsb::Informer< T > Class Template Reference

A informer to publish data of a specified type expressed through the template parameter. More...

#include <Informer.h>

Inheritance diagram for rsb::Informer< T >:
Inheritance graph
Collaboration diagram for rsb::Informer< T >:
Collaboration graph

Public Types

typedef boost::shared_ptr< Informer< T > > Ptr
 Shared pointer type for this informer. More...
 
typedef boost::shared_ptr< T > DataPtr
 Shared pointer type for the default data published by this informer. More...
 

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. More...
 
virtual ~Informer ()
 
std::string getClassName () const
 
EventPtr createEvent () const
 Creates a new Event instance filled with the scope from this informer. More...
 
EventPtr publish (boost::shared_ptr< T > data)
 Publishes data to the Informer's scope. More...
 
template<class T1 >
EventPtr publish (boost::shared_ptr< T1 > data, std::string type=rsc::runtime::typeName(typeid(T1)))
 
EventPtr publish (EventPtr event)
 
- 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
 
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 >())
 
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...
 

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 Member Functions inherited from rsb::Participant
 Participant (const Scope &scope, const ParticipantConfig &config)
 
- Protected Attributes inherited from rsb::InformerBase
std::string defaultType
 
eventprocessing::OutRouteConfiguratorPtr configurator
 

Detailed Description

template<class T>
class rsb::Informer< T >

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:

Informer<string>::Ptr informer = getFactory().createInformer<string>(Scope("/example/informer"));
Informer<string>::DataPtr s(new string("blub"));
informer->publish(s);
Author
swrede
Template Parameters
TData type to send by this informer.

Definition at line 236 of file Informer.h.

Member Typedef Documentation

template<class T>
typedef boost::shared_ptr<T> rsb::Informer< T >::DataPtr

Shared pointer type for the default data published by this informer.

Definition at line 247 of file Informer.h.

template<class T>
typedef boost::shared_ptr<Informer<T> > rsb::Informer< T >::Ptr

Shared pointer type for this informer.

Definition at line 242 of file Informer.h.

Constructor & Destructor Documentation

template<class T>
rsb::Informer< T >::Informer ( const std::vector< transport::OutConnectorPtr > &  connectors,
const Scope scope,
const ParticipantConfig config,
const std::string &  type = detail::TypeName<T>()() 
)
inline

Constructs a new informer.

Parameters
connectorsA list of connectors the informer should use to connect to the bus
scopethe scope under which the data are published
configthe config that was used to setup this informer
typestring describing the type of data sent by this informer. The empty string indicates that data of arbitrary type can be sent through this informer.
Note
This constructor is exposed for unit tests and such. Use Factory::createInformer instead of calling this directly.

Definition at line 263 of file Informer.h.

template<class T>
virtual rsb::Informer< T >::~Informer ( )
inlinevirtual

Definition at line 270 of file Informer.h.

Member Function Documentation

template<class T>
EventPtr rsb::Informer< T >::createEvent ( ) const
inlinevirtual

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

Returns
new Event instance with scope set

Moreover, this version also sets the type according to the template parameter of Informer.

Returns
new Event with scope and type set.

Reimplemented from rsb::InformerBase.

Definition at line 285 of file Informer.h.

References rsb::InformerBase::createEvent(), and event.

Here is the call graph for this function:

template<class T>
std::string rsb::Informer< T >::getClassName ( ) const
inline

Definition at line 273 of file Informer.h.

template<class T>
EventPtr rsb::Informer< T >::publish ( boost::shared_ptr< T >  data)
inline

Publishes data to the Informer's scope.

Parameters
dataPointer to the data to send.
Returns
A boost::shared_ptr to the rsb::Event object that has been implicitly created.

Definition at line 298 of file Informer.h.

References rsb::InformerBase::publish().

Here is the call graph for this function:

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

Definition at line 304 of file Informer.h.

References rsb::InformerBase::publish().

Here is the call graph for this function:

template<class T>
EventPtr rsb::Informer< T >::publish ( EventPtr  event)
inline

Definition at line 309 of file Informer.h.

References rsb::InformerBase::publish().

Here is the call graph for this function:

Member Data Documentation

template<class T>
rsc::logging::LoggerPtr rsb::Informer< T >::logger
private

Definition at line 313 of file Informer.h.


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