C++ API Documentation

User-Level API

namespace rsb

Typedefs

typedef boost::shared_ptr<Scope> ScopePtr
typedef boost::shared_ptr<void> VoidPtr
typedef boost::shared_ptr<Event> EventPtr
typedef std::pair<std::string, boost::shared_ptr<void>> AnnotatedData

A combination of data type and the actual data.

typedef std::map<rsb::Scope, std::vector<rsb::EventPtr>> EventsByScopeMap
typedef boost::shared_ptr<EventId> EventIdPtr
typedef boost::shared_ptr<Handler> HandlerPtr
typedef boost::signals2::signal<void(ParticipantPtr, Participant *)> SignalParticipantCreated
typedef boost::shared_ptr<SignalParticipantCreated> SignalParticipantCreatedPtr
typedef boost::function<void(EventPtr)> EventFunction
typedef boost::shared_ptr<InformerBase> InformerBasePtr
typedef boost::shared_ptr<Listener> ListenerPtr
typedef boost::signals2::signal<void(Participant *)> SignalParticipantDestroyed
typedef boost::shared_ptr<SignalParticipantDestroyed> SignalParticipantDestroyedPtr
typedef boost::shared_ptr<Participant> ParticipantPtr

Functions

RSB_EXPORT InformerBasePtr rsb::crateInformerBase(const Scope & scope, const std::string & dataType, const ParticipantConfig & config = getFactory ().getDefaultParticipantConfig())

Creates and returns a new Informer that publishes Event s under the Scope scope.

Return

A shared_ptr pointing to the new Informer instance.

Parameters
  • scope: The scope of the informer.

  • dataType: A string representation of the type of data sent via the new Informer.

  • config: The configuration for the informer to use. Defaults to the global default configuration stored in the Factory instance.

Exceptions
  • RSBError: If the requested informer cannot be created.

RSB_EXPORT ListenerPtr rsb::createListener(const Scope & scope, const ParticipantConfig & config = getFactory ().getDefaultParticipantConfig())

Creates and returns a new Listener for the Scope scope.

Return

A shared_ptr pointing to the new Listener instance.

Parameters
  • scope: The scope of the new listener

  • config: The configuration for the listener to use. Defaults to the global default configuration stored in the Factory instance.

Exceptions
  • RSBError: If the requested listener cannot be created.

RSB_EXPORT patterns::ReaderPtr rsb::createReader(const Scope & scope, const ParticipantConfig & config = getFactory ().getDefaultParticipantConfig())

Creates and returns a new Reader object for Scope scope.

Reader objects receive event via a pull-style interface by calls to Reader::read.

Return

A shared_ptr to the new Reader object.

Parameters
  • scope: the scope of the new receiver

  • config: The configuration for the reader to use. Defaults to the global default configuration stored in the Factory instance.

Exceptions
  • RSBError: If the requested reader cannot be created.

RSB_EXPORT patterns::LocalServerPtr rsb::createLocalServer(const Scope & scope)

Creates and returns a Server object that exposes methods under the Scope scope.

Return

A shared_ptr to the new Server object.

Parameters
  • scope: The scope under which the new server exposes its methods.

RSB_EXPORT patterns::RemoteServerPtr rsb::createRemoteServer(const Scope & scope)

Creates and returns a RemoteServer object for the server at Scope scope.

Return

A shared_ptr to the new RemoteServer object.

Parameters
  • scope: The scope at which the remote server object exposes itself.

template<class DataType>
Informer<DataType>::Ptr createInformer(const Scope &scope, const ParticipantConfig &config = getFactory().getDefaultParticipantConfig(), const std::string &dataType = detail::TypeName<DataType>()())

Creates and returns a new Informer that publishes Event s under the Scope scope.

Return

A shared_ptr pointing to the new Informer instance.

Template Parameters
  • DataType: the C++ data type this informer publishes

Parameters
  • scope: The scope of the informer.

  • config: The configuration for the informer to use. Defaults to the global default configuration stored in the Factory instance.

  • dataType: A string representation of the type of data sent via the new Informer.

Exceptions
  • RSBError: If the requested informer cannot be created.

RSB_EXPORT Factory & rsb::getFactory()

Returns a factory for client-level RSB objects.

Return

the factory instance to create client level RSB objects.

RSB_EXPORT std::ostream & rsb::operator<<(ostream & stream, const MetaData & meta)
RSB_EXPORT std::ostream & rsb::operator<<(ostream & stream, const QualityOfServiceSpec & spec)
void verifyAndSplit(const string &s, vector<string> &components, string &normalizedString)

Validate that s satisfies the regular expression /([-_a-zA-Z0-9]+/)* and splits it at ‘/’ characters.

Parameters
  • s: String representation that should be verified and split.

  • components: A vector in which the extracted scope components should be stored

  • normalizedString: returns a normalized version of the scope’s string representation

RSB_EXPORT std::ostream & rsb::operator<<(ostream & stream, const Scope & scope)

Variables

const std::string CONFIG_DEBUG_ENVIRONMENT_VARIABLE = "RSB_CONFIG_DEBUG"
const std::string CONFIG_FILES_ENVIRONEMNT_VARIABLE = "RSB_CONFIG_FILES"
Factory *factoryWhileLoadingPlugins = NULL
class CommException : public rsb::Exception
#include <CommException.h>

General exception thrown upon communication errors.

Author

: swrede

Subclassed by rsb::protocol::ProtocolException

Public Functions

CommException(const std::string &m)
~CommException()
class Event : public virtual Printable
#include <Event.h>

Basic message that is exchanged between informers and listeners.

It is a combination of metadata and the actual data to publish / subscribe as payload.

Author

swrede

scope access

There are two ways of getting and setting scopes for events.

One uses copies of Scopes, which may be expensive and one uses ScopePtr s to avoid the copy operation. Setting the scope with one method makes it also available using the copy getter and vice versa.

ScopePtr getScopePtr() const
Scope getScope() const
void setScopePtr(ScopePtr scope)
void setScope(const Scope &scope)

cause handling

Events are often caused by other events, which e.g.

means that their contained payload was calculated on the payload of one or more other events.

To express these relations each event contains a set of EventIds that express the direct causes of the event. This means, transitive event causes are not modeled.

Cause handling is inspired by the ideas proposed in: David Luckham, The Power of Events, Addison-Wessley, 2007

bool addCause(const EventId &id)

Adds the id of one event to the causes of this event.

If the set of causing events already contained the given id, this call has no effect.

Return

true if the causes was added, false if it already existed

Parameters
  • id: the id of a causing event

bool removeCause(const EventId &id)

Removes a causing event from the set of causes for this event.

If the id was not contained in this set, the call has no effect.

Return

true if an event with this id was removed from the causes, else false

Parameters
  • id: of the causing event

bool isCause(const EventId &id) const

Tells whether the id of one event is already marked as a cause of this event.

Return

true if id is marked as a cause for this event, else false

Parameters
  • id: id of the event to test causality for

set<EventId> getCauses() const

Returns all causing events marked so far.

Return

set of causing event ids. Modifications to this set do not affect this event as it is a copy.

meta-data access

MetaData getMetaData() const

Returns a copy of the current meta-data state of this event.

Return

copy of event’s meta-data

MetaData &mutableMetaData()

Returns an in-place mutable version of the event’s meta-data.

Return

meta-data reference to modify

void setMetaData(const MetaData &metaData)

Replaces the event’s meta-data with a new instance.

Parameters
  • metaData: new meta-data to set

Public Functions

Event()
Event(const Event &event)
Event(ScopePtr scope, boost::shared_ptr<void> payload, const std::string &type, const std::string &method = "")

Constructor.

Parameters
  • scope: scope of the event

  • payload: payload of the event

  • type: type identifier to serialize / deserialize the event payload

  • method: a method that is represented by this event. Am empty string specifies an undecided method.

Event(Scope scope, boost::shared_ptr<void> payload, const std::string &type, const std::string &method = "")
~Event()
string getClassName() const
void printContents(std::ostream &stream) const
EventId getId() const

Returns the id of this event.

The id is not defined until the event is sent by an informer.

Return

id of the event

Exceptions
  • rsc::misc::IllegalStateException: if there cannot be an id because the event was not sent so far.

void setId(const rsc::misc::UUID &senderId, const boost::uint32_t &sequenceNumber)

Sets all information necessary to generate an id for this event.

Parameters
  • senderId: id of the sender of this event

  • sequenceNumber: the unique number per sender this event was sent with

string getType() const
void setType(const std::string &type)
VoidPtr getData()
void setData(VoidPtr d)
string getMethod() const

Returns the method associated with this event.

An empty string indicates an unspecified method.

Return

method name or empty string

void setMethod(const std::string &method)

Sets the method associated with this event.

Parameters
  • method: method name or empty string for unspecified method.

class Impl

Public Members

EventIdPtr id
ScopePtr scope
VoidPtr content
std::string type
std::string method
std::set<EventId> causes
MetaData metaData
class EventId : private boost::totally_ordered<EventId>, public Printable
#include <EventId.h>

A unique ID for events in RSB.

Ids are composed of the sending participant’s ID and a sequence number and can optionally be converted to UUIDs.

Author

jwienke

Public Functions

EventId(const rsc::misc::UUID &participantId, const boost::uint32_t &sequenceNumber)
~EventId()
rsc::misc::UUID getParticipantId() const
boost::uint32_t getSequenceNumber() const
rsc::misc::UUID getAsUUID() const
bool operator==(const EventId &other) const
bool operator<(const EventId &other) const
string getClassName() const
void printContents(std::ostream &stream) const
class Exception : public std::runtime_error
#include <Exception.h>

Author

swrede

Subclassed by rsb::CommException, rsb::converter::SerializationException, rsb::patterns::MethodExistsException, rsb::UnsupportedQualityOfServiceException

Public Functions

Exception()
Exception(const std::string &m)
~Exception()
struct ConfigDebugPrinter

Public Functions

ConfigDebugPrinter(const std::string &phase, bool enabled)
~ConfigDebugPrinter()

Public Members

std::string phase
bool enabled
class Factory
#include <Factory.h>

Factory for RSB user-level domain objects for communication patterns.

Author

jwienke

jmoringe

Public Functions

~Factory()
SignalParticipantCreatedPtr getSignalParticipantCreated()
SignalParticipantDestroyedPtr getSignalParticipantDestroyed()
template<class DataType>
Informer<DataType>::Ptr createInformer(const Scope &scope, const ParticipantConfig &config = getFactory().getDefaultParticipantConfig(), const std::string &dataType = detail::TypeName<DataType>()(), Participant *parent = 0)

Creates and returns a new Informer that publishes Event s under the Scope scope.

Return

a shared_ptr pointing to the new Informer instance.

Template Parameters
  • DataType: the C++ data type this informer publishes

Parameters
  • scope: the scope of the informer

  • config: the configuration for the informer to use, defaults to the general config held in this factory.

  • dataType: A string representation of the type of data sent via the new Informer

  • parent: Optional. A Participant that should be considered to be the parent of the new Informer.

Exceptions
  • RSBError: If the requested informer cannot be created.

InformerBasePtr createInformerBase(const Scope &scope, const std::string &dataType = "", const ParticipantConfig &config = getFactory().getDefaultParticipantConfig(), Participant *parent = 0)

Creates and returns a new Informer that publishes Event s under the Scope scope.

Return

A shared_ptr pointing to the a InformerBase instance.

Parameters
  • scope: the scope of the informer

  • dataType: A string representation of the type of data sent via the new Informer.

  • config: The configuration for the informer to use, defaults to the general config held in this factory.

  • parent: Optional. A Participant which should be considered the parent of the new Informer.

Exceptions
  • RSBError: If the requested informer cannot be created.

ListenerPtr createListener(const Scope &scope, const ParticipantConfig &config = getFactory().getDefaultParticipantConfig(), Participant *parent = 0)

Creates a new listener for the specified scope.

Return

a shared_ptr pointing to the new Listener instance.

Parameters
  • scope: the scope of the new listener

  • config: the configuration for the LISTENER to use, defaults to the general config held in this factory.

  • parent: Optional. A Participant which should be considered the parent of the new Listener.

patterns::ReaderPtr createReader(const Scope &scope, const ParticipantConfig &config = getFactory().getDefaultParticipantConfig(), Participant *parent = 0)

Creates a new Reader object for the specified scope.

Reader objects receive event via a pull-style interface by calls to Reader::read.

Return

A shared_ptr to the new Reader object.

Parameters
  • scope: the scope of the new receiver

  • config: The configuration the new Reader should use. Defaults to the global default configuration of the factory.

  • parent: Optional. A Participant which should be considered the parent of the new Reader.

Exceptions
  • RSBError: when the requested connection cannot be established.

patterns::LocalServer::LocalMethodPtr createLocalMethod(const Scope &scope, patterns::LocalServer::CallbackPtr callback, const ParticipantConfig &listenerConfig = getFactory().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig = getFactory().getDefaultParticipantConfig(), Participant *parent = 0)

Creates a patterns::LocalServer::LocalMethod.

Return

A shared_ptr to the new patterns::LocalServer::LocalMethod object.

Parameters
  • scope: The scope, including the method name as its final component, on which the new method should be available.

  • callback: The callback that should be executed to implement the behavior of the method when it is called.

  • listenerConfig: configuration to use for the request listener

  • informerConfig: configuration to use for the reply informer

  • parent: Optional. A Participant that should be considered to be the parent of the newly created method.

patterns::LocalServerPtr createLocalServer(const Scope &scope, const ParticipantConfig &listenerConfig = getFactory().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig = getFactory().getDefaultParticipantConfig(), Participant *parent = 0)

Creates a Server object that exposes methods under the scope scope.

Return

A shared_ptr to the new Server object.

Parameters
  • scope: The scope under which the new server exposes its methods.

  • listenerConfig: configuration to use for all request listeners

  • informerConfig: configuration to use for all reply informers

  • parent: Optional. A Participant which should be considered the parent of the new server.

patterns::RemoteServer::RemoteMethodPtr createRemoteMethod(const Scope &scope, const ParticipantConfig &listenerConfig = getFactory().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig = getFactory().getDefaultParticipantConfig(), Participant *parent = 0)

Creates a patterns::RemoteServer::RemoteMethod.

Return

A shared_ptr to the new patterns::RemoteServer::RemoteMethod object.

Parameters
  • scope: The scope, including the method name as its final component, on which the new method should operate.

  • listenerConfig: configuration to use for the request listener

  • informerConfig: configuration to use for the reply informer

  • parent: Optional. A Participant that should be considered to be the parent of the new method.

patterns::RemoteServerPtr createRemoteServer(const Scope &scope, const ParticipantConfig &listenerConfig = getFactory().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig = getFactory().getDefaultParticipantConfig(), Participant *parent = 0)

Creates a RemoteServer object for the server at scope scope.

Return

A shared_ptr to the new RemoteServer object.

Parameters
  • scope: The scope at which the remote server object exposes itself.

  • listenerConfig: configuration to use for all reply listeners

  • informerConfig: configuration to use for all request informers

  • parent: Optional. A Participant which should be considered the parent of the new server.

ParticipantConfig getDefaultParticipantConfig() const

Returns the default configuration for new participants.

Return

copy of the default configuration

void setDefaultParticipantConfig(const ParticipantConfig &config)

Sets the default config for participants that will be used for every new participant that is created after this call.

Parameters
  • config: new config

rsc::plugins::ManagerPtr getPluginManager() const

Returns the plugin manager instance used by the RSB core.

Return

plugin manager instance

Public Static Functions

void provideConfigOptions(const std::string &environmentVariablePrefix, rsc::config::OptionHandler &handler, bool stripPrefix = true)

Provides the default configuration options for RSB to the specified handler.

This method can e.g. be used by plugins to get options from the default configuration system. Options are presented to the handler without any prefix like “rsb”.

Note

that the option processing performed by this method can be expensive.

Parameters
  • environmentVariablePrefix: TODO

  • handler: the handler to inform about options

class Handler : public rsb::eventprocessing::Handler
#include <Handler.h>

Asynchronously called handler interface on the client level.

Handler may have associated methods and are only called for events that match their desired method.

Author

jwienke

Subclassed by rsb::DataFunctionHandler< T >, rsb::DataHandler< DataType >, rsb::EventFunctionHandler, rsb::FilteringHandler, rsb::introspection::QueryHandler, rsb::patterns::Method, rsb::util::EventQueuePushHandler, rsb::util::QueuePushHandler< T, DisableEventWarning >

Public Functions

set<string> getMethods() const

Returns the desired set of methods this handler can handle.

An empty set means no restrictions on methods are placed.

Return

set of desired methods or empty for all methods

bool acceptsMethod(const std::string &method) const
class EventFunctionHandler : public rsb::Handler
#include <Handler.h>

A utility class to simplify event handling in ordinary functions or member functions.

This class is primarily intended for use with Boost.Bind.

Public Functions

EventFunctionHandler(const EventFunction &function, const std::string &method = "")
string getClassName() const
void printContents(std::ostream &stream) const
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

template<typename T>
class DataFunctionHandler : public rsb::Handler
#include <Handler.h>

A utility class to simplify data handling by automatically passing the data of the desired type to a function.

This class is primarily intended for use with Boost.Bind.

Author

swrede

Template Parameters
  • T: desired data type to retrieve from the listeners

Public Types

typedef boost::shared_ptr<T> DataPtr
typedef boost::function<void(DataPtr)> DataFunction

Public Functions

std::string getClassName() const
void printContents(std::ostream &stream) const
DataFunctionHandler(const DataFunction &function)
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

template<class DataType>
class DataHandler : public rsb::Handler
#include <Handler.h>

A Handler that automatically performs the desired type casting.

Author

jwienke

Template Parameters
  • DataType: type of the data received by this handler, omitting the shared pointer

Public Functions

virtual ~DataHandler()
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

virtual void notify(boost::shared_ptr<DataType> data) = 0
class FilteringHandler : public rsb::Handler
#include <Handler.h>

A utility class that forwards events to another rsb::Handler object if they match a given rsb::filter::Filter.

Author

jmoringe

Public Functions

FilteringHandler(rsb::filter::FilterPtr filter, HandlerPtr next)
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

class AnyType
#include <Informer.h>

A tag type for constructing Informer instances that can publish data of arbitrary types.

Usage example:

getFactory().createInformer<AnyType>(Scope("/scope"));

class InformerBase : public rsb::Participant
#include <Informer.h>

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

Subclassed by rsb::Informer< T >

Public Functions

InformerBase(const std::vector<transport::OutConnectorPtr> &connectors, const Scope &scope, const ParticipantConfig &config, const std::string &defaultType)
~InformerBase()
void printContents(std::ostream &stream) const
std::string getKind() const

Return the kind of the participant.

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

Return

a string describing the kind of the participant.

const std::set<std::string> getTransportURLs() const

TODO.

string getType() const

Return the event payload type of this Informer.

Return

A string designating the event payload type of this Informer.

void setQualityOfSerivceSpecs(const QualityOfServiceSpec &specs)

Defines the desired quality of service settings for this informers.

Parameters
  • specs: QoS specs

Exceptions

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.

Return

A boost::shared_ptr to the rsb::Event object that has been implicitly created.

Template Parameters
  • T1: The type of data. The value of this parameter is used infer the value of type.

Parameters
  • 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.

Exceptions
  • std::invalid_argument: If T1 or type is incompatible with the actual type of the informer.

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

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

Return

new Event instance with scope set

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

Publishes data to the Informer’s scope.

Return

A boost::shared_ptr to the rsb::Event object that has been implicitly created.

Parameters
  • data: Pointer to the data to send.

  • type: A string indicating the type of data. I.e. “std::string” for std::string objects.

Exceptions
  • std::invalid_argument: If type is incompatible with the actual type of the informer.

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.

Return

modified event.

Parameters
  • event: The event to publish.

Exceptions
  • 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.

template<typename T>
struct DataPtr
#include <Informer.h>

Public Types

typedef boost::shared_ptr<T> type
template<class T>
class Informer : public rsb::InformerBase
#include <Informer.h>

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
  • T: Data type to send by this informer.

Public Types

typedef boost::shared_ptr<Informer<T>> Ptr

Shared pointer type for this informer.

typedef boost::shared_ptr<T> DataPtr

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

Public 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.

Note

This constructor is exposed for unit tests and such. Use Factory::createInformer instead of calling this directly.

Parameters
  • connectors: A list of connectors the informer should use to connect to the bus

  • scope: the scope under which the data are published

  • config: the config that was used to setup this informer

  • type: string describing the type of data sent by this informer. The empty string indicates that data of arbitrary type can be sent through this informer.

virtual ~Informer()
std::string getClassName() const
EventPtr createEvent() const

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

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

Informer.
Return

new Event instance with scope set

Return

new Event with scope and type set.

EventPtr publish(boost::shared_ptr<T> data)

Publishes data to the Informer’s scope.

Return

A boost::shared_ptr to the rsb::Event object that has been implicitly created.

Parameters
  • data: Pointer to the data to send.

template<class T1>
EventPtr publish(boost::shared_ptr<T1> data, std::string type = rsc::runtime::typeName(typeid(T1)))
EventPtr publish(EventPtr event)
class Listener : public rsb::Participant
#include <Listener.h>

A Listener receives events published by rsb::Informer objects by participating in a channel with a suitable scope.

Handler objects have to be added to the listener to actually process received events. These events can be filtered for all handlers by adding Filter instances to this class. Filter form a conjunction.

Usage example:

ListenerPtr listener = getFactory().createListener(Scope("/example/informer"));
boost::shared_ptr<MyDataHandler> dh(new MyDataHandler());
listener->addHandler(dh);

Author

swrede

Public Functions

Listener(const std::vector<transport::InConnectorPtr> &connectors, const Scope &scope, const ParticipantConfig &config)

Constructs a new Listener assigned to the specified scope.

The Listener connects to the bus using the supplied connectors.

Note

This constructor is exposed for unit tests and such. Use Factory::createListener instead of calling this directly.

Parameters
  • connectors: a list of connectors that the listener should use to communicate with the bus.

  • scope: the scope where the data is received from.

  • config: the configuration that was used to setup this listener

~Listener()
std::string getKind() const

Return the kind of the participant.

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

Return

a string describing the kind of the participant.

const std::set<std::string> getTransportURLs() const

TODO.

void addFilter(filter::FilterPtr filter)

Adds a filter that will be applied after some time (but not immediately after this call) for all handlers.

Parameters
  • filter: filter to add

void removeFilter(filter::FilterPtr filter)

Removes a previously installed filter if it is present by pointer comparison some time after this call.

Parameters
  • filter: filter to remove if present

void addHandler(HandlerPtr h, bool wait = true)

Adds a rsb::Handler to the Listener.

Events which match the restrictions described by the associated filters are passed to all handlers.

Parameters
  • h: a pointer to the Handler.

  • wait: if set to true, this method will return only after the handler has completely been installed and will receive the next available message. Otherwise it may return earlier.

void removeHandler(HandlerPtr h, bool wait = true)

Removes a Handler instance to process newly received events.

Parameters
  • h: handler to remove if present (comparison based on pointer)

  • wait: if set to true, this method will return only after the handler has been completely removed from the event processing and will not be called anymore from this listener.

class Impl

Public Members

rsc::logging::LoggerPtr logger
eventprocessing::InRouteConfiguratorPtr configurator
class MetaData : public virtual Printable, private boost::equality_comparable<MetaData>
#include <MetaData.h>

Framework-supplied meta data attached to each event that give information e.g.

about timing issues.

For all timestamps UTC unix timestamps are assumed. For the conversion from boost::posix_time::ptime the client has to ensure that the ptim is given in UTC (e.g. using universal_time).

Author

jwienke

framework timestamps

Timestamps supplied by the framework itself.

boost::uint64_t getCreateTime() const

Returns a time stamp that is automatically filled with the time the event instance was created by the language binding.

This should usually reflect the time at which the notified condition most likely occurred in the sender. If event instances are reused, it has to be reset manually by the client.

This timestamp is initially set to the creating time stamp of this instance.

Return

timestamp in microseconds

void setCreateTime(const boost::uint64_t &time = 0)

Sets the time stamp that is automatically filled with the time the event instance was created by the language binding.

This should usually reflect the time at which the notified condition most likely occurred in the sender. If event instances are reused, it has to be reset manually by the client.

Parameters
  • time: timestamp in microseconds or 0 to use current system time

void setCreateTime(const double &time)

Parameters
  • time: time in seconds since unix epoche.

void setCreateTime(const boost::posix_time::ptime &time)
boost::uint64_t getSendTime() const

Returns the time at which the generated notification for an event was sent on the bus (after serialization).

Return

timestamp in microseconds

void setSendTime(const boost::uint64_t &time = 0)

Sets the time at which the generated notification for an event was sent on the bus (after serialization).

Parameters
  • time: timestamp in microseconds or 0 to use current system time

void setSendTime(const double &time)
void setSendTime(const boost::posix_time::ptime &time)
boost::uint64_t getReceiveTime() const

Returns the time at which an event is received by listener in its encoded form.

Return

timestamp in microseconds

void setReceiveTime(const boost::uint64_t &time = 0)

Sets the time at which an event is received by listener in its encoded form.

Parameters
  • time: timestamp in microseconds or 0 to use current system time

void setReceiveTime(const double &time)
void setReceiveTime(const boost::posix_time::ptime &time)
boost::uint64_t getDeliverTime() const

Returns the time at which an event was decoded and will be dispatched to the client as soon as possible (set directly before passing it to the client handler).

Return

timestamp in microseconds

void setDeliverTime(const boost::uint64_t &time = 0)

Sets the time at which an event was decoded and will be dispatched to the client as soon as possible (set directly before passing it to the client handler).

Parameters
  • time: timestamp in microseconds or 0 to use current system time

void setDeliverTime(const double &time)
void setDeliverTime(const boost::posix_time::ptime &time)

user timestamps

Additional timestamps that can be filled by the framework client.

Keys are unique.

set<string> userTimeKeys() const

Returns the keys of all available user times.

Return

set of all keys

bool hasUserTime(const std::string &key) const

Checks whether a user-provided timestamp with the given key exists.

Return

true if a timestamp for the given key exists, else false

Parameters
  • key: the key to check

boost::uint64_t getUserTime(const std::string &key) const

Returns the user timestamp stored under the provided key.

Return

timestamp

Parameters
  • key: key of the user-provided timestamp

Exceptions
  • std::invalid_argument: no timestamp stored und the provided key

void setUserTime(const std::string &key, const boost::uint64_t &time = 0)

Sets a user timestamp and replaces existing entries.

Parameters
  • key: the key for the timestamp

  • time: time in microseconds or 0 to use current system time

void setUserTime(const std::string &key, const double &time)
void setUserTime(const std::string &key, const boost::posix_time::ptime &time)
map<string, boost::uint64_t>::const_iterator userTimesBegin() const
map<string, boost::uint64_t>::const_iterator userTimesEnd() const

user infos

A set of key-value style string infos that can be used by the client.

Keys are unique.

set<string> userInfoKeys() const

Returns all keys of user-defined infos.

Return

set of all defined keys

bool hasUserInfo(const std::string &key) const

Checks whether a user info exists under the provided key.

Return

true if an info for the key is defined, else false

Parameters
  • key: key to check

string getUserInfo(const std::string &key) const

Returns the user-defined string for the given key.

Return

user info given for this key

Parameters
  • key: key to look up

Exceptions
  • std::invalid_argument: no info set for the specified key

void setUserInfo(const std::string &key, const std::string &value)

Sets a user info with the specified key and value or replaces and already existing one.

Parameters
  • key: the key to set

  • value: the user value

map<string, string>::const_iterator userInfosBegin() const
map<string, string>::const_iterator userInfosEnd() const

Public Functions

MetaData()
~MetaData()
string getClassName() const
void printContents(std::ostream &stream) const
bool operator==(const MetaData &other) const
class Participant : public virtual Printable, public noncopyable
#include <Participant.h>

Objects of this class participate in the exchange of notifications on one channel of the bus.

Since each channel is identified by scope, each rsb::Participant has an associated scope. On the other hand, scopes do not uniquely identify rsb::Participant s since zero, one or more of these can participate in the exchange of any given scope. For this reason, each rsb::Participant has a unique id.

Author

jmoringe

Subclassed by rsb::InformerBase, rsb::Listener, rsb::patterns::LocalServer<>, rsb::patterns::Method, rsb::patterns::Reader, rsb::patterns::RemoteServer

Public Functions

~Participant()
void printContents(std::ostream &stream) const
virtual std::string getKind() const = 0

Return the kind of the participant.

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

Return

a string describing the kind of the participant.

rsc::misc::UUID getId() const

Returns the unique id of the participant.

Return

unique id

ScopePtr getScope() const

Returns the scope of this participant.

Return

scope

ParticipantConfig getConfig() const

Returns a copy of the participant’s configuration.

Return

copy of this participant’s config

virtual const std::set<std::string> getTransportURLs() const = 0

TODO.

class Impl

Public Members

rsc::logging::LoggerPtr logger
rsc::misc::UUID id
ScopePtr scope
ParticipantConfig config
SignalParticipantDestroyedPtr signalParticipantDestroyed
class ParticipantConfig : public OptionHandler, public Printable
#include <ParticipantConfig.h>

A class describing the configuration of Participant instances.

This contains:

Author

jwienke

jmoringe

Public Types

enum ErrorStrategy

Possible error handling strategies in user-provided code like event handlers.

Author

jwienke

Values:

ERROR_STRATEGY_LOG

Logs a message using the logging mechanism.

ERROR_STRATEGY_PRINT

Uses stderr for printing a message.

ERROR_STRATEGY_EXIT

exits the program.

Public Functions

ParticipantConfig()

Constructs a new empty configuration using the default QoS settings and #LOG as error strategy.

~ParticipantConfig()
QualityOfServiceSpec getQualityOfServiceSpec() const

Returns the current settings for QoS.

Return

quality of service settings as immutable copy

QualityOfServiceSpec &mutableQualityOfServiceSpec()

Returns mutable quality of service settings.

Return

reference to QoS settings

void setQualityOfServiceSpec(const QualityOfServiceSpec &spec)

Sets the desired QoS settings.

Parameters
  • spec: new settings

ParticipantConfig::ErrorStrategy getErrorStrategy() const

Returns the selected error strategy for the configured participant.

Return

strategy to use

void setErrorStrategy(const ErrorStrategy &strategy)

Sets the desired error strategy for the participant.

set<ParticipantConfig::Transport> getTransports(bool includeDisabled = false) const

Returns the set of desired transports for a participant.

Return

set of transports identified by strings

Note

generates a copy. Changing the returned object does not change this configuration

Parameters
  • includeDisabled: If true, include transports that have been disabled via configuration options.

ParticipantConfig::Transport getTransport(const std::string &name) const

Returns an immutable copy of a single configured transport.

Return

copy of the transport

Parameters
  • name: name of the transport to get

Exceptions
  • rsc::runtime::NoSuchObject: no such transport available with the given name

ParticipantConfig::Transport &mutableTransport(const std::string &name)

Returns a single configured transport which can be modified in place.

Return

reference to the transport

Parameters
  • name: name of the transport to get

Exceptions
  • rsc::runtime::NoSuchObject: no such transport available with the given name

void addTransport(const Transport &transport)

Adds a transport to the list of desired transport mechanisms.

It will replace a potentially existing transport configuration for the same transport name.

Parameters
  • transport: config of the transport

void removeTransport(const Transport &transport)

Removes a transport from the list of desired transports if it was present.

Parameters
  • transport: to remove

void setTransports(const std::set<Transport> &transports)

Replaces all existing transports with the ones given here.

Parameters
  • transports: set of transports

const ParticipantConfig::EventProcessingStrategy &getEventReceivingStrategy() const
ParticipantConfig::EventProcessingStrategy &mutableEventReceivingStrategy()
const ParticipantConfig::EventProcessingStrategy &getEventSendingStrategy() const
bool isIntrospectionEnabled() const

Indicates whether introspection should be enabled for the participant.

Return

true if introspection should be enabled for the participant, false otherwise.

void setIsIntrospectionEnabled(bool newValue)

Controls whether introspection should be enabled for the participant.

Parameters
  • newValue: If true, introspection should be enabled for the participant.

rsc::runtime::Properties getOptions() const

Returns additional options besides the transport-specific ones.

Return

copy of additional options

rsc::runtime::Properties &mutableOptions()

Returns a mutable reference to the freestyle options in this configuration.

Return

mutable reference to additional options

void setOptions(const rsc::runtime::Properties &options)

Sets the additional options besides the transport-specific ones.

Parameters
  • options: new options replacing all old ones

class EventProcessingStrategy : public OptionHandler, public Printable
#include <ParticipantConfig.h>

Instances of this class describe the selection and configuration of an event processing strategy.

This mechanism is applied to select and configure implementations of eventprocessing::EventSendingStrategy and eventprocessing::EventReceivingStrategy.

Author

jmoringe

Public Functions

EventProcessingStrategy(const std::string &name)
string getName() const

Returns the name of the implementation to be selected.

Return

The name of the processing strategy implementation that should be used.

void setName(const std::string &name)

Sets the name of the implementation to be selected.

Parameters
  • name: - Name of the processing strategy implementation that should be used.

Properties getOptions() const

Returns the options for the strategy.

Return

copy of options for the strategy

rsc::runtime::Properties &mutableOptions()

Returns the options for the strategy.

Return

mutable reference to options for the strategy

void setOptions(const rsc::runtime::Properties &options)

Sets the options for the strategy.

Parameters
  • options: new options replacing all old ones

void handleOption(const std::vector<std::string> &key, const std::string &value)
void printContents(std::ostream &stream) const
class Transport : private boost::totally_ordered<Transport>, public OptionHandler, public Printable
#include <ParticipantConfig.h>

Description of a desired transport.

Transport configurations are compared by the name of the transport they describe because one transport can exist only once per participant.

Author

jwienke

Public Types

typedef std::set<std::pair<std::string, std::string>> ConverterNames

Public Functions

Transport(const std::string &name, bool enabled = true)

Creates a new transport description for the transport with the given name.

Parameters
  • name: name of the transport to describe

  • enabled: controls whether the transport is used by default.

Exceptions
  • std::invalid_argument: empty name given, a transport cannot have an empty name

~Transport()
string getName() const

Returns the name of this transport description.

ParticipantConfig::Transport::ConverterNames getConverters() const
rsc::runtime::Properties getOptions() const

Returns the specified options for the transport.

Return

copy of options for the transport

rsc::runtime::Properties &mutableOptions()

Returns the options for the transport.

Return

mutable reference to options for the transport

void setOptions(const rsc::runtime::Properties &options)

Sets the options for the transport.

Parameters
  • options: new options replacing all old ones

bool isEnabled() const
void setEnabled(bool value)
bool operator==(const Transport &other) const
bool operator<(const Transport &other) const
string getClassName() const
void printContents(std::ostream &stream) const
void handleOption(const std::vector<std::string> &key, const std::string &value)
class QualityOfServiceSpec : private boost::equality_comparable<QualityOfServiceSpec>
#include <QualityOfServiceSpec.h>

Specification of desired quality of service settings for sending and receiving events.

Specification given here are required “at least”. This means concrete port instances can implement “better” QoS specs without any notification to the clients. Better is decided by the integer value of the specification enums. Higher values mean better services.

Author

jwienke

Public Types

enum Ordering

Specifies the ordering of events for listeners on a informer.

Author

jwienke

Values:

UNORDERED = 10

The events are delivered in arbitrary order.

ORDERED = 20

Every listener receives the events of one informer in the order the informer sent the events.

No guarantees are given for events of multiple informers.

enum Reliability

Specifies the reliability of messages.

Author

jwienke

Values:

UNRELIABLE = 10

Events may be dropped and not be visible to a listener.

RELIABLE = 20

Messages are guaranteed to be delivered.

Otherwise an error is raised.

Public Functions

QualityOfServiceSpec()

Constructs the default QoS specs for every informers.

Messages are unordered but reliably.

QualityOfServiceSpec(Ordering ordering, Reliability reliability)

Constructs a new QoS specification with desired details.

Parameters
  • ordering: desired ordering type

  • reliability: desired reliability type

~QualityOfServiceSpec()

Destructor.

QualityOfServiceSpec::Ordering getOrdering() const

Returns the desired ordering settings.

Return

ordering requirements

QualityOfServiceSpec::Reliability getReliability() const

Returns the desired reliability settings.

Return

reliability requirements

bool operator==(const QualityOfServiceSpec &other) const

Friends

RSB_EXPORT std::ostream& operator<<(std::ostream & stream, const QualityOfServiceSpec & spec)
class Scope : private boost::totally_ordered<Scope>
#include <Scope.h>

Scope is a descriptor for a hierarchical channel of the unified bus.

It can be described through a syntax like “/a/parent/scope/”.

Author

jwienke

Public Functions

Scope(const std::string &scope)

Constructs scope from a string syntax.

Parameters
  • scope: string representation of the desired scope

Exceptions
  • std::invalid_argument: invalid syntax

Scope(const char *scope)

Constructs scope from a string syntax.

Parameters
  • scope: string representation of the desired scope

Exceptions
  • std::invalid_argument: invalid syntax

Scope()

Creates a scope representing “/”.

Use this wisely!

~Scope()

Destructor.

const vector<string> &getComponents() const

Returns all components of the scope as an ordered list.

Components are the names between the separator character ‘/’. The first entry in the list is the highest level of hierarchy. The scope ‘/’ returns an empty list.

Return

components of the represented scope as ordered list with highest level as first entry

const std::string &toString() const

Reconstructs a fully formal string representation of the scope with leading an trailing slashes.

Return

string representation of the scope

Scope concat(const Scope &childScope) const

Creates a new scope that is a sub-scope of this one with the subordinated scope described by the given argument.

E.g. “/this/is/”.concat(“/a/test/”) results in “/this/is/a/test”.

Return

new scope instance representing the created sub-scope

Parameters
  • childScope: child to concatenate to the current scope for forming a sub-scope

bool isSubScopeOf(const Scope &other) const

Tests whether this scope is a sub-scope of the given other scope, which means that the other scope is a prefix of this scope.

E.g. “/a/b/” is a sub-scope of “/a/”.

Return

true if this is a sub-scope of the other scope, equality gives false, too

Parameters
  • other: other scope to test

bool isSuperScopeOf(const Scope &other) const

Inverse operation of isSubScopeOf.

Return

true if this scope is a strict super scope of the other scope. equality also gives false.

Parameters
  • other: other scope to test

vector<Scope> superScopes(const bool &includeSelf = false) const

Generates all super scopes of this scope including the root scope “/”.

The returned list of scopes is ordered by hierarchy with “/” being the first entry.

Return

list of all super scopes ordered by hierarchy, “/” being first

Parameters
  • includeSelf: if set to true, this scope is also included as last element of the returned list

bool operator==(const Scope &other) const
bool operator<(const Scope &other) const

Public Static Attributes

const char COMPONENT_SEPARATOR = '/'
class UnsupportedQualityOfServiceException : private rsb::Exception
#include <UnsupportedQualityOfServiceException.h>

An exception indicating that a desired QualityOfServiceSpec cannot be reached by a transport.

Author

jwienke

Public Functions

UnsupportedQualityOfServiceException(const std::string &message, const QualityOfServiceSpec &spec)
~UnsupportedQualityOfServiceException()
const char *what() const
namespace converter

internal repository implementation

All this is done so that the memory of Repositories is maintained inside the RSB DLL on windows.

Otherwise multiple clients would have different instances of the repositories.

Moreover, I have added a general name-based lookup for repositories instead of being fixed to wire types (c++ types) as this might become a scalability problem later. We might find out that e.g. several connectors use string as their data type and still converters need to be fundamentally different. For this purpose general name-based lookup is possible now. So far only internally and the type-based methods map to this mechanism by using RTTI names.

RSB_EXPORT void * rsb::converter::converterRepositoryByName(const std::string & wireTypeName, RepositoryCreater & creater)

Returns a repository for a converters of a certain wire type by a look up based on a name for the wire type.

Return

converter repository.

Note

currently an internal method. Do not use it.

Parameters
  • wireTypeName: of of the wire type.

  • creater: if no repository exists with this name, this object is used to instantiate a new one.

Typedefs

typedef boost::shared_ptr<BoolConverter> BoolConverterPtr
typedef boost::shared_ptr<ConverterPredicate> ConverterPredicatePtr
typedef boost::shared_ptr<VoidConverter> VoidConverterPtr

Functions

RSB_EXPORT void rsb::converter::registerDefaultConverters()
Repository<string>::Ptr stringConverterRepository()
template<class WireType>
Repository<WireType>::Ptr converterRepository()

Returns a Repository of Converter instances specifically for the given wire type.

Return

converter repository

Template Parameters
  • WireType: type of the wire to serialize to / from

Variables

bool registered = false
boost::mutex registrationMutex
map<string, void *> repositoriesByName
boost::mutex repositoriesByNameMutex
class BoolConverter : public rsb::converter::Converter<std::string>
#include <BoolConverter.h>

Converter for bool.

Author

jwienke

Public Functions

BoolConverter()
~BoolConverter()
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class ByteArrayConverter : public rsb::converter::Converter<std::string>
#include <ByteArrayConverter.h>

“Converts” arbitrary payloads into a std::string which should be interpreted as an array of bytes.

Author

jmoringe

Public Functions

ByteArrayConverter()
~ByteArrayConverter()
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

template<class WireType>
class Converter : public Printable
#include <Converter.h>

Author

swrede

jwienke

Template Parameters
  • WireType: is the serialization format, uchar, string, binary, …

Public Types

typedef boost::shared_ptr<Converter<WireType>> Ptr

Public Functions

virtual ~Converter()
virtual std::string serialize(const AnnotatedData &data, WireType &wire) = 0

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

virtual AnnotatedData deserialize(const std::string &wireSchema, const WireType &wire) = 0

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

virtual std::string getDataType() const

Returns the name of the data type this converter is applicable for.

Return

name of the data type this converter can be used for

virtual std::string getWireSchema() const

Returns the name of the wire schema this converter can (de)serialize from/to.

Return

name of the wire schema from/to this converter can (de)serialize

template<typename WireType>
class ConverterSelectionStrategy : public Printable
#include <ConverterSelectionStrategy.h>

Implementation of this interface perform mappings of one of the followings forms:

  • wire-schema -> Converter

  • data-type -> Converter

Author

jmoringe

Subclassed by rsb::converter::PredicateConverterList< WireType >, rsb::converter::UnambiguousConverterMap< WireType >

Public Types

typedef Converter<WireType>::Ptr ConverterPtr
typedef boost::shared_ptr<ConverterSelectionStrategy<WireType>> Ptr

Public Functions

virtual ConverterPtr getConverter(const std::string &key) const = 0

Tries to look up the converter designator by key.

Return

A boost::shared_ptr holding the converter.

Parameters
  • key: A wire-schema or data-type desinated the desired converter.

Exceptions
  • rsc::runtime::NoSuchObject: If there is no converter fo key.

class EventIdConverter : public rsb::converter::Converter<std::string>
#include <EventIdConverter.h>

A converter for EventId.

Author

jwienke

Public Functions

EventIdConverter()

Constructs a new converter.

~EventIdConverter()
string getClassName() const
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

string getWireSchema() const

Returns the name of the wire schema this converter can (de)serialize from/to.

Return

name of the wire schema from/to this converter can (de)serialize

class EventsByScopeMapConverter : public rsb::converter::Converter<std::string>
#include <EventsByScopeMapConverter.h>

A converter for aggregated events ordered by their scope and time for each scope.

Author

jwienke

Public Functions

EventsByScopeMapConverter(ConverterSelectionStrategy<std::string>::Ptr serializationConverters = converterRepository<std::string>()->getConvertersForSerialization(), ConverterSelectionStrategy<std::string>::Ptr deserializationConverters = converterRepository<std::string>()->getConvertersForDeserialization())

Constructs a new converter and optionally allows to specify a converter::Repository which will be used for the contained events of arbitrary types.

Parameters
  • serializationConverters: converters to use for serialization. Defaults to the unambiguous map from stringConverterRepository

  • deserializationConverters: converters to use for deserialization. Defaults to the unambiguous map from stringConverterRepository

~EventsByScopeMapConverter()
string getClassName() const
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

string getWireSchema() const

Returns the name of the wire schema this converter can (de)serialize from/to.

Return

name of the wire schema from/to this converter can (de)serialize

template<typename T>
class FloatingPointConverter : public rsb::converter::Converter<std::string>
#include <FloatingPointConverter.h>

Base class for floating point type converters.

Author

jmoringe

Public Types

typedef boost::shared_ptr<FloatingPointConverter<T>> Ptr

Public Functions

FloatingPointConverter(const std::string &wireSchema)
virtual ~FloatingPointConverter()
std::string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class FloatConverter : public rsb::converter::FloatingPointConverter<float>
#include <FloatingPointConverter.h>

Converter for float type.

Author

jmoringe

Public Functions

FloatConverter()
class DoubleConverter : public rsb::converter::FloatingPointConverter<double>
#include <FloatingPointConverter.h>

Converter for double type.

Author

jmoringe

Public Functions

DoubleConverter()
template<typename T>
class IntegerConverter : public rsb::converter::Converter<std::string>
#include <IntegerConverter.h>

Base class for integer type converters.

Author

jmoringe

Public Types

typedef boost::shared_ptr<IntegerConverter<T>> Ptr

Public Functions

IntegerConverter(const std::string &wireSchema)
virtual ~IntegerConverter()
std::string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class Uint32Converter : public rsb::converter::IntegerConverter<boost::uint32_t>
#include <IntegerConverter.h>

Converter for boost::uint32_t.

Author

jmoringe

Public Functions

Uint32Converter()
class Uint64Converter : public rsb::converter::IntegerConverter<boost::uint64_t>
#include <IntegerConverter.h>

Converter for boost::uint64_t.

Author

jmoringe

Public Functions

Uint64Converter()
class Int32Converter : public rsb::converter::IntegerConverter<boost::int32_t>
#include <IntegerConverter.h>

Converter for boost::int32_t.

Author

jmoringe

Public Functions

Int32Converter()
class Int64Converter : public rsb::converter::IntegerConverter<boost::int64_t>
#include <IntegerConverter.h>

Converter for boost::int64_t.

Author

jmoringe

Public Functions

Int64Converter()
class ConverterPredicate : public Printable
#include <PredicateConverterList.h>

Implementations of this interface can be used to perform Converter selection based on predicate evaluation.

Depending on the context, the match method of predicates is invoked with either a wire-schema string or a data-type string in order to decide whether an associated converter should be selected.

Author

jmoringe

Subclassed by rsb::converter::AlwaysApplicable, rsb::converter::RegexConverterPredicate, rsb::converter::TypeNameConverterPredicate

Public Functions

virtual ~ConverterPredicate()
virtual bool match(const std::string &key) const = 0

Return true if the Converter associated to this predicate should be selected for key.

Return

true if the associated converter should be selected; false otherwise.

Parameters
  • key: Depending on the context, either a wire-schema or a data-type for which a converter has to be selected.

class AlwaysApplicable : public rsb::converter::ConverterPredicate
#include <PredicateConverterList.h>

A predicate that unconditionally causes its associated Converter to be selected.

Author

jmoringe

Public Functions

bool match(const std::string &key) const

Return true if the Converter associated to this predicate should be selected for key.

Return

true if the associated converter should be selected; false otherwise.

Parameters
  • key: Depending on the context, either a wire-schema or a data-type for which a converter has to be selected.

std::string getClassName() const
void printContents(std::ostream&) const
template<typename WireType>
class PredicateConverterList : public rsb::converter::ConverterSelectionStrategy<WireType>
#include <PredicateConverterList.h>

Objects of this class are used to perform Converter selection via a chain-of-responsibility strategy.

A list of predicates and associated converters is maintained. Converter selection queries are processed by traversing the list and selected the first converter the associated predicate of which matches the query wire-schema or data-type.

Author

jmoringe

Public Types

typedef ConverterSelectionStrategy<WireType>::ConverterPtr ConverterPtr
typedef std::list<std::pair<ConverterPredicatePtr, ConverterPtr>> ConverterList

Public Functions

template<typename ForwardIterator>
PredicateConverterList(ForwardIterator begin, ForwardIterator end)

Construct a new PredicateConverterList object, initializing its Converter to the elements of the iterator range given by start and end.

Parameters
  • begin: A ForwardIterator the value type of which is a std::pair of a ConverterPredicatePtr and a Converter<WireType>::Ptr.

  • end: An associated end iterator.

ConverterPtr getConverter(const std::string &key) const

Tries to look up the converter designator by key.

Return

A boost::shared_ptr holding the converter.

Parameters
  • key: A wire-schema or data-type desinated the desired converter.

Exceptions
  • rsc::runtime::NoSuchObject: If there is no converter fo key.

std::string getClassName() const
void printContents(std::ostream &stream) const
template<typename ProtocolBuffer>
class ProtocolBufferConverter : public rsb::converter::Converter<std::string>
#include <ProtocolBufferConverter.h>

A generic converter for data types based on Protocol Buffer messages.

Author

jmoringe

Template Parameters
  • ProtocolBuffer: type of the protobuf message to be converted

Public Functions

ProtocolBufferConverter()
~ProtocolBufferConverter()
std::string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class RegexConverterPredicate : public rsb::converter::ConverterPredicate
#include <RegexConverterPredicate.h>

Objects of this class select Converter s by matching the query wire-schema or data-type against a sotred reqular expression.

Author

jmoringe

Public Functions

RegexConverterPredicate(const std::string &regex)

Construct a new RegexConverterPredicate that matches queries against the regular expression regex.

Parameters
  • regex: The regular expression the new predicate should use.

RegexConverterPredicate(const boost::regex &regex)

Construct a new RegexConverterPredicate that matches queries against the regular expression regex.

Parameters
  • regex: The regular expression the new predicate should use.

bool match(const std::string &key) const

Return true if the Converter associated to this predicate should be selected for key.

Return

true if the associated converter should be selected; false otherwise.

Parameters
  • key: Depending on the context, either a wire-schema or a data-type for which a converter has to be selected.

template<class WireType>
class Repository : public Printable
#include <Repository.h>

Maintains a collection of converters for a specific wire format.

Each converter has a wire type describing the actual message that is written on the wire and a data type that indicates which data it can serialize on the wire.

Author

jwienke

Template Parameters
  • WireType: the wire-type of the collected converters.

Public Types

typedef Converter<WireType>::Ptr ConverterPtr
typedef std::pair<std::string, std::string> ConverterSignature

WireSchema and DataType.

typedef std::map<std::string, std::string> ConverterSelectionMap
typedef boost::shared_ptr<Repository<WireType>> Ptr

Public Functions

Repository()
ConverterSelectionStrategy<WireType>::Ptr getConvertersForSerialization(const ConverterSelectionMap &selection = ConverterSelectionMap()) const
ConverterSelectionStrategy<WireType>::Ptr getConvertersForDeserialization(const ConverterSelectionMap &selection = ConverterSelectionMap()) const
void registerConverter(ConverterPtr converter, bool replace = false)

Registers converter in the collection.

Parameters
  • converter: The converter to register.

  • replace: If a converter with the same wire schema and data type as converter is already registered, should it be replaced?

Exceptions
  • std::invalid_argument: If there is already a converter registered with the same wire schema and data type.

ConverterPtr getConverter(const std::string &wireSchema, const std::string &dataType) const
ConverterPtr getConverter(const ConverterSignature &signature) const
void clear()
class RepositoryCreater
#include <Repository.h>

An internal factory object to create typed converter repositories.

Author

jwienke

Note

internal class

Subclassed by rsb::converter::TypeBasedRepositoryCreater< WireType >

Public Functions

~RepositoryCreater()
virtual void *create() = 0

Factory method to create a new Repository.

Return

new Repository instance

template<class WireType>
class TypeBasedRepositoryCreater : public rsb::converter::RepositoryCreater
#include <Repository.h>

A RepositoryCreate which can be statically typed using a template argument for the desired wire type.

Author

jwienke

Template Parameters
  • WireType: type of the wire of underlying converters

Public Functions

virtual ~TypeBasedRepositoryCreater()
void *create()

Factory method to create a new Repository.

Return

new Repository instance

template<typename Mechanism, typename DataType, typename WireSchema>
class RosettaConverter : public rsb::converter::Converter<std::string>
#include <RosettaConverter.h>

Author

jmoringe

Template Parameters
  • Mechanism:

  • DataType:

  • WireSchema:

Public Functions

RosettaConverter()
~RosettaConverter()
std::string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class SchemaAndByteArrayConverter : public rsb::converter::Converter<std::string>
#include <SchemaAndByteArrayConverter.h>

“Converts” arbitrary payloads into a pair consisting of the original wire schema and a std::string which should be interpreted as an array of bytes.

Author

jwienke

Public Functions

SchemaAndByteArrayConverter()
~SchemaAndByteArrayConverter()
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class ScopeConverter : public rsb::converter::Converter<std::string>
#include <ScopeConverter.h>

(De)serializes rsb::Scope objects.

Author

jmoringe

Public Functions

ScopeConverter()
~ScopeConverter()
std::string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class SerializationException : public rsb::Exception
#include <SerializationException.h>

An exception indicating a serialization or deserialization problem for data.

Author

jwienke

Public Functions

SerializationException(const std::string &message)
class StringConverter : public rsb::converter::Converter<std::string>
#include <StringConverter.h>

Converts any string into any string serializing content to a string.

Author

swrede

Public Functions

StringConverter()
~StringConverter()
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class TypeNameConverterPredicate : public rsb::converter::ConverterPredicate
#include <TypeNameConverterPredicate.h>

Objects of this class select Converter s by matching the query wire-schema or data-type against a stored string.

The functionality of this class is a subset of RegexConverterPredicate. Using this class you do not need to care to replace special characters for regular expressions and the implementation is probably much faster.

Author

jwienke

Public Functions

TypeNameConverterPredicate(const std::string &typeName)

Construct a new TypeNameConverterPredicate that matches queries against the wanted type name typeName.

Parameters
  • regex: The regular expression the new predicate should use.

bool match(const std::string &key) const

Return true if the Converter associated to this predicate should be selected for key.

Return

true if the associated converter should be selected; false otherwise.

Parameters
  • key: Depending on the context, either a wire-schema or a data-type for which a converter has to be selected.

template<typename WireType>
class UnambiguousConverterMap : public rsb::converter::ConverterSelectionStrategy<WireType>
#include <UnambiguousConverterMap.h>

Objects this class store mappings of one of the followings forms.

  • wire-schema -> Converter

  • data-type -> Converter This association is unambiguous.

Author

jmoringe

Public Types

typedef ConverterSelectionStrategy<WireType>::ConverterPtr ConverterPtr

Public Functions

ConverterPtr getConverter(const std::string &key) const

Tries to look up the converter designator by key.

Return

A boost::shared_ptr holding the converter.

Parameters
  • key: A wire-schema or data-type designated the desired converter.

Exceptions
  • rsc::runtime::NoSuchObject: If there is no converter fo key.

void addConverter(const std::string &key, ConverterPtr converter)

Stores converter in the map under the name key.

Note

Converter::getDataType and Converter::getWireSchema are not considered in any way.

Parameters
  • key: Either a wire-schema or a data-type depending on the context in which the map is used.

  • converter: The converter that should be added.

Exceptions
  • std::invalid_argument: If there already is a converter for the name key.

class VoidConverter : public rsb::converter::Converter<std::string>
#include <VoidConverter.h>

Fulfill the interface…

Converts nothing to nothing. ;)

Author

jwienke

Public Functions

VoidConverter()
~VoidConverter()
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

namespace detail
template<typename T>
struct TypeName
#include <Informer.h>

Public Functions

std::string operator()() const
template<>
struct TypeName<AnyType>
#include <Informer.h>

Public Functions

std::string operator()() const
namespace eventprocessing

Typedefs

typedef boost::shared_ptr<EventReceivingStrategy> EventReceivingStrategyPtr
typedef rsc::patterns::SingletonFactory<std::string, EventReceivingStrategy> EventReceivingStrategyFactory

Note

Do not use the Singleton::getInstance function. Instead use getEventReceivingStrategyFactory.

typedef boost::shared_ptr<EventSendingStrategy> EventSendingStrategyPtr
typedef rsc::patterns::SingletonFactory<std::string, EventSendingStrategy> EventSendingStrategyFactory

Note

Do not use the Singleton::getInstance function. Instead use getEventSendingStrategyFactory.

typedef boost::shared_ptr<Handler> HandlerPtr
typedef boost::shared_ptr<InRouteConfigurator> InRouteConfiguratorPtr
typedef std::list<transport::OutConnectorPtr> ConnectorList
typedef boost::shared_ptr<OutRouteConfigurator> OutRouteConfiguratorPtr
typedef boost::shared_ptr<PushInRouteConfigurator> PushInRouteConfiguratorPtr

Functions

RSB_EXPORT EventReceivingStrategyFactory & rsb::eventprocessing::getEventReceivingStrategyFactory()
RSB_EXPORT EventSendingStrategyFactory & rsb::eventprocessing::getEventSendingStrategyFactory()
void registerDefaultEventProcessingStrategies()

Variables

bool registered = false
boost::mutex registrationMutex
class DirectEventReceivingStrategy : public rsb::eventprocessing::EventReceivingStrategy
#include <DirectEventReceivingStrategy.h>

This event receiving strategy filters and dispatches rsb::Event s in the context of the thread calling handle.

Even calls to rsb::Handler s run in this thread, so stack exhaustion and deadlocks are possible.

Additionally, all locking can be disabled for situation in which it can be guaranteed that only one thread at a time calls any of the classes methods.

Author

jmoringe

Public Functions

DirectEventReceivingStrategy(bool singleThreaded = false)
~DirectEventReceivingStrategy()
void printContents(std::ostream &stream) const
void addHandler(rsb::HandlerPtr handler, const bool &wait)

Adds a new handler that will be notified about new events.

Parameters
  • handler: handler to add

  • wait: if set to true, this method must only return after the handler has been install completely so that the next event will be delivered to it

void removeHandler(rsb::HandlerPtr handler, const bool &wait)

Removes a handler that will will then not be notified anymore.

Parameters
  • handler: handler to remove

  • wait: if set to true, this method must only return after the handler has been removed completely and will not receive any more notifications

void addFilter(filter::FilterPtr filter)
void removeFilter(filter::FilterPtr filter)
void setHandlerErrorStrategy(const ParticipantConfig::ErrorStrategy &strategy)

Defines the strategy to use for handling dispatching errors to the client handler.

Parameters
  • strategy: the new strategy to use

void handle(EventPtr event)

Dispatches the event to the listener.

Parameters
  • event: the event to dispatch

Public Static Functions

EventReceivingStrategy *create(const rsc::runtime::Properties &props)
class DirectEventSendingStrategy : public rsb::eventprocessing::EventSendingStrategy
#include <DirectEventSendingStrategy.h>

This event sending strategy just passes incoming events to its associated rsb::transport::OutConnector s without modification, queueing or anything else.

Author

jmoringe

Public Functions

void printContents(std::ostream &stream) const
void addConnector(transport::OutConnectorPtr connector)

Add connector to the list of connectors to which this strategy should deliver events.

Parameters
  • connector: The new rsb::transport::OutConnector .

void removeConnector(transport::OutConnectorPtr connector)

Remove connector from the list of connectors to which this strategy should deliver events.

Parameters
  • connector: The rsb::transport::OutConnector that should be removed.

void process(EventPtr event)

Deliver event to all rsb::transport::OutConnector objects associated to this strategy.

Parameters
  • event: An rsb::Event that should be delivered to the connectors.

Public Static Functions

EventSendingStrategy *create(const rsc::runtime::Properties &props)
class EventReceivingStrategy : public rsb::eventprocessing::Handler, private noncopyable
#include <EventReceivingStrategy.h>

Implementations of this interface organize the receiving of events via rsb::transport::InConnector s.

A list of handlers is maintained and dispatching of events is done by calling each handler.

Author

swrede

jmoringe

Subclassed by rsb::eventprocessing::DirectEventReceivingStrategy, rsb::eventprocessing::ParallelEventReceivingStrategy

Public Functions

~EventReceivingStrategy()
virtual void addFilter(filter::FilterPtr filter) = 0
virtual void removeFilter(filter::FilterPtr filter) = 0
virtual void addHandler(rsb::HandlerPtr handler, const bool &wait) = 0

Adds a new handler that will be notified about new events.

Parameters
  • handler: handler to add

  • wait: if set to true, this method must only return after the handler has been install completely so that the next event will be delivered to it

virtual void removeHandler(rsb::HandlerPtr handler, const bool &wait) = 0

Removes a handler that will will then not be notified anymore.

Parameters
  • handler: handler to remove

  • wait: if set to true, this method must only return after the handler has been removed completely and will not receive any more notifications

virtual void setHandlerErrorStrategy(const ParticipantConfig::ErrorStrategy &strategy) = 0

Defines the strategy to use for handling dispatching errors to the client handler.

Parameters
  • strategy: the new strategy to use

virtual void handle(EventPtr event) = 0

Dispatches the event to the listener.

Parameters
  • event: the event to dispatch

class EventSendingStrategy : public virtual Printable, private noncopyable
#include <EventSendingStrategy.h>

Implementations of this interface organize the sending of events via rsb::transport::OutConnector s.

Author

swrede

jmoringe

Subclassed by rsb::eventprocessing::DirectEventSendingStrategy

Public Functions

~EventSendingStrategy()
virtual void addConnector(transport::OutConnectorPtr connector) = 0

Add connector to the list of connectors to which this strategy should deliver events.

Parameters
  • connector: The new rsb::transport::OutConnector .

virtual void removeConnector(transport::OutConnectorPtr connector) = 0

Remove connector from the list of connectors to which this strategy should deliver events.

Parameters
  • connector: The rsb::transport::OutConnector that should be removed.

virtual void process(EventPtr event) = 0

Deliver event to all rsb::transport::OutConnector objects associated to this strategy.

Parameters
  • event: An rsb::Event that should be delivered to the connectors.

class Handler : public virtual Printable
#include <Handler.h>

Implementations of this class can be used in contexts where an “event sink” is required.

Author

jmoringe

Subclassed by rsb::eventprocessing::EventReceivingStrategy, rsb::Handler, rsb::transport::inprocess::Bus, rsb::transport::inprocess::InConnector, rsb::transport::OutConnector, rsb::transport::socket::Bus, rsb::transport::socket::InConnector

Public Functions

~Handler()
virtual void handle(EventPtr event) = 0

Handle event.

Parameters
  • event: The event that should be handled.

class InRouteConfigurator : public virtual Printable, private noncopyable
#include <InRouteConfigurator.h>

A class responsible of configuring the route that processes incoming events from one or more rsb::transport::InConnector instances.

This responsibility includes updates to the transport and filter layers.

Author

swrede

jmoringe

Public Types

typedef std::set<transport::InConnectorPtr> ConnectorSet

Public Functions

InRouteConfigurator(const Scope &scope, const ParticipantConfig &config)
~InRouteConfigurator()
string getClassName() const
void printContents(std::ostream &stream) const
const std::set<std::string> getTransportURLs() const
void activate()
void deactivate()
EventReceivingStrategyPtr getEventReceivingStrategy() const
InRouteConfigurator::ConnectorSet getConnectors()
void addConnector(transport::InConnectorPtr connector)
void removeConnector(transport::InConnectorPtr connector)
void filterAdded(filter::FilterPtr filter)
void filterRemoved(filter::FilterPtr filter)
void handlerAdded(rsb::HandlerPtr handler, const bool &wait)

Adds a new handler that will be notified about received events.

Parameters
  • handler: the handler to add

  • wait: if set to true, this call will return only after the handler has been completely installed and will receive the next available event

void handlerRemoved(rsb::HandlerPtr handler, const bool &wait)

Removes a previously registered handle.

Parameters
  • handler: handler to remove

  • wait: if set to true, this call will return only after the handler has been completely removed and will not be notified anymore

void setErrorStrategy(const ParticipantConfig::ErrorStrategy &strategy)

Sets the desired error strategy to use.

Parameters
  • strategy: the strategy to use

void setQualityOfServiceSpecs(const QualityOfServiceSpec &specs)

Define the desired quality of service specifications for published events.

Parameters
  • specs: QoS specification

Exceptions

class Impl

Public Functions

Impl(const ParticipantConfig::EventProcessingStrategy &receivingStrategyConfig)

Public Members

rsc::logging::LoggerPtr logger
ParticipantConfig::EventProcessingStrategy receivingStrategyConfig
Scope scope
ConnectorSet connectors
ParticipantConfig::ErrorStrategy errorStrategy
EventReceivingStrategyPtr eventReceivingStrategy
volatile bool shutdown
class OutRouteConfigurator : public virtual Printable, private noncopyable
#include <OutRouteConfigurator.h>

Author

swrede

jmoringe

Public Functions

OutRouteConfigurator(const Scope &scope)
~OutRouteConfigurator()
string getClassName() const
void printContents(std::ostream &stream) const
const std::set<std::string> getTransportURLs() const
void activate()
void deactivate()
void addConnector(transport::OutConnectorPtr connector)
void removeConnector(transport::OutConnectorPtr connector)
void publish(EventPtr e)

Publish event to out ports of this router.

Parameters
  • e: event to publish

void setQualityOfServiceSpecs(const QualityOfServiceSpec &specs)

Define the desired quality of service specifications for published events.

Parameters
  • specs: QoS specification

Exceptions

class Impl

Public Members

rsc::logging::LoggerPtr logger
Scope scope
ConnectorList connectors
EventSendingStrategyPtr eventSendingStrategy
volatile bool shutdown
class ParallelEventReceivingStrategy : public rsb::eventprocessing::EventReceivingStrategy
#include <ParallelEventReceivingStrategy.h>

This push-style event receiving strategy uses one or more threads to filter rsb::Event s and dispatch matching events to rsb::Handler s.

Author

swrede

Public Functions

ParallelEventReceivingStrategy(unsigned int numThreads = 5, bool parallelHandlerCalls = false)
~ParallelEventReceivingStrategy()
string getClassName() const
void printContents(std::ostream &stream) const
void addHandler(rsb::HandlerPtr handler, const bool &wait)

Adds a new handler that will be notified about new events.

Parameters
  • handler: handler to add

  • wait: if set to true, this method must only return after the handler has been install completely so that the next event will be delivered to it

void removeHandler(rsb::HandlerPtr handler, const bool &wait)

Removes a handler that will will then not be notified anymore.

Parameters
  • handler: handler to remove

  • wait: if set to true, this method must only return after the handler has been removed completely and will not receive any more notifications

void addFilter(filter::FilterPtr filter)
void removeFilter(filter::FilterPtr filter)
void setHandlerErrorStrategy(const ParticipantConfig::ErrorStrategy &strategy)

Defines the strategy to use for handling dispatching errors to the client handler.

Parameters
  • strategy: the new strategy to use

void handle(EventPtr event)

Dispatches the event to the listener.

Parameters
  • event: the event to dispatch

Public Static Functions

EventReceivingStrategy *create(const rsc::runtime::Properties &props)
template<typename T>
class ScopeDispatcher
#include <ScopeDispatcher.h>

Maps scopes to sets of sinks of type T.

Sinks are usually objects to which events are dispatched based on their scopes.

Author

jmoringe

Public Functions

bool empty() const

Indicates whether there are scopes with associated sinks.

Return

if there are no scopes with associated sinks, otherwise

size_t size() const

Returns number of scopes with associated sinks.

Return

The number of scopes with associated sinks.

void addSink(const Scope &scope, const T &sink)

Associates sink with scope.

Parameters
  • scope: The scope with which sink should be associated.

  • sink: The sink which should be added to the list of sinks associated to scope.

void removeSink(const Scope &scope, const T &sink)

Removes sink from the list of sinks associated to scope.

Parameters
  • scope: The scope from which sink should be removed.

  • sink: The sink which should be removed from the list of sinks associated to scope.

void mapSinks(const Scope &scope, boost::function<void(const T&)> function) const

Calls function for each sink associated to scope-scopes of scope.

Relevant sinks are computed by taking the union of the sinks respectively associated to all super-scopes of scope.

Parameters
  • scope: Determines relevant sinks.

  • function: The function that should be called for each relevant sink.

void mapAllSinks(boost::function<void(const T&)> function) const

Calls function for each sink in the dispatcher.

Parameters
  • function: The function that should be called for each sink.

template<typename T>
class WeakScopeDispatcher : public rsb::eventprocessing::ScopeDispatcher<boost::weak_ptr<T>>
#include <ScopeDispatcher.h>

A variant of ScopeDispatcher that references sinks weakly.

Author

jmoringe

Public Functions

void removeSink(const Scope &scope, const T *sink)
void mapSinks(const Scope &scope, boost::function<void(T&)> function) const
void mapAllSinks(boost::function<void(T&)> function) const
namespace filter

Typedefs

typedef boost::shared_ptr<Filter> FilterPtr
typedef boost::shared_ptr<FilterObserver> FilterObserverPtr
class CauseFilter : public rsb::filter::Filter
#include <CauseFilter.h>

This filter matches events in which a particular cause is present.

Author

jmoringe

Public Functions

CauseFilter(const rsc::misc::UUID &cause, bool invert = false)

Creates a new cause filter that matches event in whose cause vector cause is present.

Parameters
  • cause: The cause that has to be present in events matching the filter.

  • invert: If true, events match if cause is not present in their cause vector.

CauseFilter(const EventId &cause, bool invert = false)

Creates a new cause filter that matches event in whose cause vector cause is present.

Parameters
  • cause: The cause that has to be present in events matching the filter.

  • invert: If true, events match if cause is not present in their cause vector.

UUID getCause() const

Return the cause that has to be present in events matched by this filter.

Return

The cause potentially converted to a rsc::misc::UUID.

bool isInverted() const

Indicates whether the filter is inverted.

Return

true if the filter is inverted.

bool match(EventPtr e)

Matches the given event against the constraints specified by this filter.

Return

true if the event matches the restrictions specified by this filter and hence can be delivered to the client, false to remove the event from the stream.

Parameters
  • e: the event to match. Must not be changed!

void notifyObserver(FilterObserverPtr fo, FilterAction::Types at)

Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface.

The default implementation does not generate a specific notification on FilterObserver. Override this method if there is a specific reception method in FilterObserver.

Parameters
  • fo: the observer to notify

  • at: action that is performed with this filter. Just pass this to the observer

class Filter : public virtual Printable
#include <Filter.h>

A filter filters an event stream by removing unwanted events.

Therefore it has a function to match an event against its restrictions.

As some there may be optimization possible for certain specific filter types, a double-dispatch logic is available using FilterObserver. Instances must implement this notifyObserver if they are relevant for FilterObserver instances.

Note

most RSB classes using filters expect that the filters will not change their configuration after they have been added to e.g. the listener. So generally do not change a filter after this. Instead first remove it and then re-add the reconfigured instance.

Author

swrede

Subclassed by rsb::filter::CauseFilter, rsb::filter::MethodFilter, rsb::filter::OriginFilter, rsb::filter::ScopeFilter, rsb::filter::TypeFilter

Public Functions

Filter()
~Filter()
virtual bool match(EventPtr e) = 0

Matches the given event against the constraints specified by this filter.

Return

true if the event matches the restrictions specified by this filter and hence can be delivered to the client, false to remove the event from the stream.

Parameters
  • e: the event to match. Must not be changed!

void notifyObserver(FilterObserverPtr fo, FilterAction::Types at)

Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface.

The default implementation does not generate a specific notification on FilterObserver. Override this method if there is a specific reception method in FilterObserver.

Parameters
  • fo: the observer to notify

  • at: action that is performed with this filter. Just pass this to the observer

class FilterAction
#include <FilterActionTypes.h>

A class to encapsulate enum constants that specify changes of a Filter for FilterObserver instances.

Author

swrede

Public Types

enum Types

Possible actions with filters.

Note

There is not update action because filters would then need a more detailed observation model. Instead, the assumption is that a filter’s settings will not change after it has been notified to a FilterObserver.

Author

swrede

Values:

ADD

A filter shall be added to the FilterObserver.

REMOVE

A filter shall be remove from the observer.

class FilterObserver : public virtual Printable
#include <FilterObserver.h>

Author

swrede

Subclassed by rsb::transport::InConnector

Public Functions

FilterObserver()
~FilterObserver()
void notify(Filter *filter, const FilterAction::Types &at)
void notify(ScopeFilter *filter, const FilterAction::Types &at)
class MethodFilter : public rsb::filter::Filter
#include <MethodFilter.h>

This filter matches events based on the value of their method field.

Author

jmoringe

Public Functions

MethodFilter(const std::string &method, bool invert = false)

Creates a new method filter that matches events whose method fields have the value method.

Parameters
  • method: String value that the method field of matched events has to have.

  • invert: If true, events match if their method fields do not match method.

const std::string &getMethod() const
bool isInverted() const
bool match(EventPtr e)

Matches the given event against the constraints specified by this filter.

Return

true if the event matches the restrictions specified by this filter and hence can be delivered to the client, false to remove the event from the stream.

Parameters
  • e: the event to match. Must not be changed!

void notifyObserver(FilterObserverPtr fo, FilterAction::Types at)

Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface.

The default implementation does not generate a specific notification on FilterObserver. Override this method if there is a specific reception method in FilterObserver.

Parameters
  • fo: the observer to notify

  • at: action that is performed with this filter. Just pass this to the observer

class OriginFilter : public rsb::filter::Filter
#include <OriginFilter.h>

This filter matches events that originate from a particular participant.

Author

jmoringe

Public Functions

OriginFilter(const rsc::misc::UUID &origin, bool invert = false)

Creates a new origin filter that matches event originating from origin.

Parameters
  • origin: Id of the participant from which matching events have to originate.

  • invert: If true, events match if they do not originate from origin.

UUID getOrigin() const
bool isInverted() const
bool match(EventPtr e)

Matches the given event against the constraints specified by this filter.

Return

true if the event matches the restrictions specified by this filter and hence can be delivered to the client, false to remove the event from the stream.

Parameters
  • e: the event to match. Must not be changed!

void notifyObserver(FilterObserverPtr fo, FilterAction::Types at)

Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface.

The default implementation does not generate a specific notification on FilterObserver. Override this method if there is a specific reception method in FilterObserver.

Parameters
  • fo: the observer to notify

  • at: action that is performed with this filter. Just pass this to the observer

class ScopeFilter : public rsb::filter::Filter
#include <ScopeFilter.h>

Author

swrede

Public Functions

ScopeFilter(const Scope &scope)
~ScopeFilter()
void printContents(std::ostream &stream) const
bool match(EventPtr e)

Matches the given event against the constraints specified by this filter.

Return

true if the event matches the restrictions specified by this filter and hence can be delivered to the client, false to remove the event from the stream.

Parameters
  • e: the event to match. Must not be changed!

Scope getScope() const
void notifyObserver(FilterObserverPtr fo, FilterAction::Types at)

Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface.

The default implementation does not generate a specific notification on FilterObserver. Override this method if there is a specific reception method in FilterObserver.

Parameters
  • fo: the observer to notify

  • at: action that is performed with this filter. Just pass this to the observer

class TypeFilter : public rsb::filter::Filter
#include <TypeFilter.h>

This filter matches events based on the data type of their payload.

Author

jmoringe

Public Functions

TypeFilter(const std::string &type, bool invert = false)

Creates a new type filter that matches events whose payload is of the type designated by type.

Parameters
  • type: String designating the which the payload of matching events has to have.

  • invert: If true, events match if their payload type does not match type.

const std::string &getType() const
bool isInverted() const
bool match(EventPtr e)

Matches the given event against the constraints specified by this filter.

Return

true if the event matches the restrictions specified by this filter and hence can be delivered to the client, false to remove the event from the stream.

Parameters
  • e: the event to match. Must not be changed!

void notifyObserver(FilterObserverPtr fo, FilterAction::Types at)

Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface.

The default implementation does not generate a specific notification on FilterObserver. Override this method if there is a specific reception method in FilterObserver.

Parameters
  • fo: the observer to notify

  • at: action that is performed with this filter. Just pass this to the observer

Public Static Functions

template<typename T>
static TypeFilter *createForType(bool invert = false)

Creates a new type filter that matches events whose payload is of type T.

Return

A pointer to the newly created object.

Template Parameters
  • T: The type matching event payloads must have.

Parameters
  • invert: If true, events match if their type fields do not match type.

namespace introspection

Typedefs

typedef boost::shared_ptr<IntrospectionSender> IntrospectionSenderPtr

Functions

std::string tryCurrentProgramName()
std::vector<std::string> tryCurrentCommandlineArguments()
boost::posix_time::ptime tryCurrentProcessStartTime()
std::string tryCurrentExecutingUser()
std::string tryCurrentHostId()
std::string currentCompatibleHostId()
std::string tryCurrentHostname()
std::string tryCurrentMachineType()
std::string tryCurrentMachineVersion()
std::string tryCurrentSoftwareType()
std::string tryCurrentSoftwareVersion()
const Scope rsb::introspection::INTROSPECTION_PARTICIPANTS_SCOPE(INTROSPECTION_SCOPE. concat"/participants")
const Scope rsb::introspection::INTROSPECTION_HOSTS_SCOPE(INTROSPECTION_SCOPE. concat"/hosts")

Variables

const boost::posix_time::ptime UNIX_EPOCH = boost::posix_time::ptime(boost::gregorian::date(1970, , ))
const Scope INTROSPECTION_SCOPE
const Scope INTROSPECTION_PARTICIPANTS_SCOPE
const Scope INTROSPECTION_HOSTS_SCOPE
struct QueryHandler : public rsb::Handler

Public Functions

QueryHandler(IntrospectionSender &sender)
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

void handleSurvey(EventPtr query)
void handleRequest(EventPtr query)
void handlePing(EventPtr query)
void sendPong(const ParticipantInfo &participant, EventPtr)

Public Members

IntrospectionSender &sender
struct EchoCallback : public rsb::patterns::LocalServer<>::EventCallback

Public Functions

EventPtr call(const std::string&, EventPtr request)
class IntrospectionSender
#include <IntrospectionSender.h>

Instances of this class publish information about the local host, the current process and its participants for consumption by introspection receivers.

Author

jmoringe

Public Functions

IntrospectionSender(boost::shared_ptr<std::string> processDisplayName, const ParticipantConfig &listenerConfig = getFactory().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig = getFactory().getDefaultParticipantConfig())
void addParticipant(ParticipantPtr participant, Participant *parent)
bool removeParticipant(const Participant &participant)
class ParticipantInfo
#include <Model.h>

Instances of this class store information about participants in the current process.

Author

jmoringe

Public Functions

ParticipantInfo(const std::string &kind, const rsc::misc::UUID &id, const rsc::misc::UUID &parentId, const Scope &scope, const std::string &type, const std::set<std::string> &transportURLs)
~ParticipantInfo()
const std::string &getKind() const
const rsc::misc::UUID &getId() const
const rsc::misc::UUID &getParentId() const
const Scope &getScope() const
const std::string &getType() const
const std::set<std::string> &getTransportURLs() const
class ProcessInfo
#include <Model.h>

Instances of this class store information about the current process.

Author

jmoringe

Public Functions

ProcessInfo(unsigned int pid = rsc::os::currentProcessId(), const std::string &programName = tryCurrentProgramName(), const std::vector<std::string> &arguments = tryCurrentCommandlineArguments(), const boost::posix_time::ptime &startTime = tryCurrentProcessStartTime(), const std::string &rsbVersion = rsb::Version::string() + "-" + rsb::Version::buildId(), const std::string &executingUser = tryCurrentExecutingUser())
~ProcessInfo()
unsigned int getPid() const
const std::string &getProgramName() const
const std::vector<std::string> &getArguments() const
const boost::posix_time::ptime &getStartTime() const
const std::string &getRSBVersion() const
const std::string &getExecutingUser() const
class HostInfo
#include <Model.h>

Instances of this class store information about the local host.

Author

jmoringe

Public Functions

HostInfo(const std::string &id = currentCompatibleHostId(), const std::string &hostname = tryCurrentHostname(), const std::string &machineType = tryCurrentMachineType(), const std::string &machineVersion = tryCurrentMachineVersion(), const std::string &softwareType = tryCurrentSoftwareType(), const std::string &softwareVersion = tryCurrentSoftwareVersion())
~HostInfo()
const std::string &getId() const
const std::string &getHostname() const
const std::string &getMachineType() const
const std::string &getMachineVersion() const
const std::string &getSoftwareType() const
const std::string &getSoftwareVersion() const
namespace patterns

Typedefs

typedef boost::shared_ptr<LocalServer> LocalServerPtr
typedef boost::shared_ptr<Reader> ReaderPtr
typedef boost::shared_ptr<RemoteServer> RemoteServerPtr
typedef boost::shared_ptr<Method> MethodPtr
class
#include <LocalServer.h>

The server side of a request-reply-based communication channel.

An adapter to use boost functions without a call argument and without return values for callbacks.

A callback which does not take a request and does not produce a result.

Author

jwienke

jmoringe

jmoringe.

jwienke

Public Types

typedef boost::shared_ptr<IntlCallback> CallbackPtr
typedef boost::shared_ptr<LocalMethod> LocalMethodPtr
typedef boost::function<void(void)> FunctionType

Type of functions that can be accepted.

Public Functions

LocalServer(const Scope &scope, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig)
~LocalServer()
std::string getKind() const

Return the kind of the participant.

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

Return

a string describing the kind of the participant.

const std::set<std::string> getTransportURLs() const

TODO.

void registerMethod(const std::string &name, CallbackPtr callback)

Register a new method with the given name.

Parameters
  • name: Name of the new method. Has to be a legal scope component string.

  • callback: callback to execute for the method

Exceptions
  • MethodExistsException: thrown if a method with this name already exists

Callback()
virtual void call(const std::string &methodName) = 0

Implement this method to perform actions.

Parameters
  • methodName: called method

Exceptions
  • std::exception: all exceptions based on this type are automatically caught and delivered to the remote server

FunctionCallback(FunctionType function, const std::string &requestType = rsc::runtime::typeName(typeid(void)), const std::string &replyType = rsc::runtime::typeName(typeid(void)))
template<class RequestType>
class AnyReplyTypeCallback : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

A callback which allows any kind of reply type but is restricted to a single request type.

Author

jwienke

Template Parameters
  • RequestType: request type class

Public Functions

template<>
AnyReplyTypeCallback(const std::string &requestType = rsc::runtime::typeName(typeid(RequestType)))
template<>
virtual AnnotatedData call(const std::string &methodName, boost::shared_ptr<RequestType> input) = 0

Implement this method to perform actions.

Return

result data for the method with type name added

Parameters
  • methodName: called method

  • input: input data for the method

Exceptions
  • std::exception: all exceptions based on this type are automatically caught and delivered to the remote server

template<class RequestType, class ReplyType>
class Callback : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

Callback object used to register one method for a server.

Author

jwienke

Template Parameters
  • RequestType: the data type of the request payload

  • ReplyType: the data type of the reply payload

Public Functions

template<>
Callback(const std::string &requestType = rsc::runtime::typeName(typeid(RequestType)), const std::string &replyType = rsc::runtime::typeName(typeid(ReplyType)))
template<>
virtual boost::shared_ptr<ReplyType> call(const std::string &methodName, boost::shared_ptr<RequestType> input) = 0

Implement this method to perform actions.

Return

result data for the method

Parameters
  • methodName: called method

  • input: input data for the method

Exceptions
  • std::exception: all exceptions based on this type are automatically caught and delivered to the remote server

template<class RequestType>
class Callback<RequestType, void> : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

Public Functions

template<>
Callback(const std::string &requestType = rsc::runtime::typeName(typeid(RequestType)), const std::string &replyType = rsc::runtime::typeName(typeid(void)))
template<>
virtual void call(const std::string &methodName, boost::shared_ptr<RequestType> input) = 0

Implement this method to perform actions.

Parameters
  • methodName: called method

  • input: input data for the method

Exceptions
  • std::exception: all exceptions based on this type are automatically caught and delivered to the remote server

template<class ReplyType>
class Callback<void, ReplyType> : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

Public Functions

template<>
Callback(const std::string &requestType = rsc::runtime::typeName(typeid(void)), const std::string &replyType = rsc::runtime::typeName(typeid(ReplyType)))
template<>
virtual boost::shared_ptr<ReplyType> call(const std::string &methodName) = 0

Implement this method to perform actions.

Return

result data for the method

Parameters
  • methodName: called method

Exceptions
  • std::exception: all exceptions based on this type are automatically caught and delivered to the remote server

class CallbackBase : public rsb::patterns::LocalServer<>::IntlCallback
#include <LocalServer.h>

Base class for callback classes.

Author

jmoringe

Subclassed by rsb::patterns::LocalServer<>::AnyReplyTypeCallback< RequestType >, rsb::patterns::LocalServer<>::Callback< RequestType, ReplyType >, rsb::patterns::LocalServer<>::Callback< RequestType, void >, rsb::patterns::LocalServer<>::Callback< void, ReplyType >, rsb::patterns::LocalServer<>::FunctionCallback< RequestType, ReplyType >, rsb::patterns::LocalServer<>::FunctionCallback< RequestType, void >, rsb::patterns::LocalServer<>::FunctionCallback< void, ReplyType >

Public Functions

template<>
const string &getRequestType() const
template<>
const string &getReplyType() const
class EventCallback : public rsb::patterns::LocalServer<>::IntlCallback
#include <LocalServer.h>

Callback class with receives and returns events.

Author

jmoringe

Subclassed by rsb::introspection::EchoCallback

Public Functions

template<>
virtual EventPtr call(const std::string &methodName, EventPtr request) = 0
template<class RequestType, class ReplyType>
class FunctionCallback : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

An adapter to use boost functions for callbacks.

You can use any existing method via implicit conversion to a boost function or via boost bind as long as the types match.

Author

jwienke

Public Types

template<>
typedef boost::function<typename boost::shared_ptr<ReplyType> typename boost::shared_ptr<RequestType>)> FunctionType

Type of functions that can be accepted.

Public Functions

template<>
FunctionCallback(FunctionType function, const std::string &requestType = rsc::runtime::typeName(typeid(RequestType)), const std::string &replyType = rsc::runtime::typeName(typeid(ReplyType)))
template<class RequestType>
class FunctionCallback<RequestType, void> : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

An adapter to use boost functions without out return values as calblacks.

Author

jwienke

Public Types

template<>
typedef boost::function<void(typename boost::shared_ptr<RequestType>)> FunctionType

Type of functions that can be accepted.

Public Functions

template<>
FunctionCallback(FunctionType function, const std::string &requestType = rsc::runtime::typeName(typeid(RequestType)), const std::string &replyType = rsc::runtime::typeName(typeid(void)))
template<class ReplyType>
class FunctionCallback<void, ReplyType> : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

An adapter to use boost functions without a call argument for callbacks.

Author

jwienke

Public Types

template<>
typedef boost::function<typename boost::shared_ptr<ReplyType>void)> FunctionType

Type of functions that can be accepted.

Public Functions

template<>
FunctionCallback(FunctionType function, const std::string &requestType = rsc::runtime::typeName(typeid(void)), const std::string &replyType = rsc::runtime::typeName(typeid(ReplyType)))
class IntlCallback
#include <LocalServer.h>

Callback object interface to implement for registering callable methods.

Author

jwienke

Subclassed by rsb::patterns::LocalServer<>::CallbackBase, rsb::patterns::LocalServer<>::EventCallback

Public Functions

template<>
~IntlCallback()
template<>
virtual EventPtr intlCall(const std::string &methodName, EventPtr request) = 0
class LocalMethod : public rsb::patterns::Method
#include <LocalServer.h>

A derived Method class which can be called from the remote side and implements its behavior by invoking a client-supplied callback.

Author

jmoringe

Public Functions

template<>
LocalMethod(const Scope &scope, const std::string &name, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig, CallbackPtr callback)
template<>
~LocalMethod()
template<>
std::string getKind() const

Return the kind of the participant.

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

Return

a string describing the kind of the participant.

class MethodExistsException : public rsb::Exception
#include <MethodExistsException.h>

Indicates that a method of a Server already exists.

Author

jwienke

Public Functions

MethodExistsException(const std::string &methodName, const std::string &server)

Constructs a new exception.

Parameters
  • methodName: name of the method

  • server: name of the server

~MethodExistsException()
class Reader : public rsb::Participant, public boost::enable_shared_from_this<Reader>
#include <Reader.h>

A Reader receives and synchronously delivers events.

In contrast to the Listener participant, a Reader delivers events using a pull-style interface: the read method has to be called in order to receive events. This method may block (depending on the block parameter) until an event becomes available. The received event, if any, is returned to the caller.

Usage example:

rsb::patterns::ReaderPtr reader
        = rsb::getFactory().createReader("/example/informer");
reader->read();

Author

jmoringe

Public Functions

Reader(const Scope &scope, const ParticipantConfig &config)

Constructs a new reader object attached to scope.

Note

This constructor is exposed for unit tests and such. Use Factory::createReader instead of calling this directly.

Parameters
  • scope: the scope from which data is received.

  • config: the configuration for this reader

~Reader()
std::string getKind() const

Return the kind of the participant.

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

Return

a string describing the kind of the participant.

const std::set<std::string> getTransportURLs() const

TODO.

EventPtr read(bool block = true)

Reads one event from the bus.

If block is true, blocks until an event is available. If block is false and no event is available, an empty EventPtr is returned.

Return

A boost::shared_ptr to the received event or an empty boost::shared_ptr if no event was available and block was false.

Parameters
  • block: Controls whether the call should block and wait for an event if no event is immediately available.

Exceptions
  • RSBError: when a communication error occurs while receiving or decoding the event.

class RemoteServer : public rsb::Participant
#include <RemoteServer.h>

The client side of a request-reply-based communication channel.

Objects of this class represent remote servers in a way that allows calling methods on them as if they were local.

Author

jwienke

jmoringe

Public Types

typedef rsc::threading::Future<EventPtr> FutureType
typedef boost::shared_ptr<FutureType> FuturePtr
typedef boost::shared_ptr<RemoteMethod> RemoteMethodPtr

Public Functions

RemoteServer(const Scope &scope, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig)

Construct a new RemoteServer object which can be used to call methods of the server at scope.

Parameters
  • scope: The base scope of the server the methods of which will be called.

~RemoteServer()
std::string getKind() const

Return the kind of the participant.

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

Return

a string describing the kind of the participant.

const std::set<std::string> getTransportURLs() const

TODO.

template<class I>
EventPtr prepareRequestEvent(boost::shared_ptr<I> args)

Prepares an Event which can be used for a request based on typed data.

Return

event containing the data and appropriate type tags

Parameters
  • args: data for the event

Template Parameters
  • I: data type for the data in the event

RemoteServer::FuturePtr callAsync(const std::string &methodName, EventPtr data)

Call the method named methodName on the remote server, passing it the event data as argument and returning an event which contains the value returned by the remote method.

Return

A rsc::threading::TimeoutFuture object from which the result (an EventPtr) of the method call can be obtained at the caller’s discretion.

Parameters
  • methodName: Name of the method that should be called.

  • data: An Event object containing the argument object that should be passed to the called method.

template<typename O, typename I>
DataFuture<O> callAsync(const std::string &methodName, boost::shared_ptr<I> args)

Call the method named methodName on the remote server, passing it the argument object args and returning the value returned by the remote method.

Return

A DataFuture object from which the result (a shared_ptr to an object of type O) of the method call can be obtained at the caller’s discretion.

Template Parameters
  • I: type of the method call argument object.

  • O: type of the method return value.

Parameters
  • methodName: Name of the method that should be called.

  • args: The argument object that should be passed to the called method.

template<typename O>
DataFuture<O> callAsync(const std::string &methodName)

Call the method named methodName on the remote server, without arguments and returning the value returned by the remote method.

Return

A DataFuture object from which the result (a shared_ptr to an object of type O) of the method call can be obtained at the caller’s discretion.

Template Parameters
  • O: type of the method return value.

Parameters
  • methodName: Name of the method that should be called.

EventPtr call(const std::string &methodName, EventPtr data, unsigned int maxReplyWaitTime = 25)

Call the method named methodName on the remote server, passing it the event data as argument and returning an event which contains the value returned by the remote method.

This method blocks until the computation on the remote side has been completed and the result has been received.

Return

An Event object containing the result of the method call.

Parameters
  • methodName: Name of the method that should be called.

  • data: An Event object containing the argument object that should be passed to the called method.

  • maxReplyWaitTime: Maximum number of seconds to wait for a reply from the server when calling a method.

Exceptions
  • rsc::threading::FutureTimeoutException: if the method call is not completed within the maximum waiting time.

  • rsc::threading::FutureTaskExecutionException: if the method call fails.

template<typename O, typename I>
boost::shared_ptr<O> call(const std::string &methodName, boost::shared_ptr<I> args, unsigned int maxReplyWaitTime = 25)

Call the method named methodName on the remote server, passing it the argument object args and return the value returned by the remote method.

This method blocks until the computation on the remote side has been completed and the result has been received.

Return

The result of the method call.

Template Parameters
  • I: type of the method call argument object.

  • O: type of the method return value.

Parameters
  • methodName: Name of the method that should be called.

  • args: The argument object that should be passed to the called method.

  • maxReplyWaitTime: Maximum number of seconds to wait for a reply from the server when calling a method.

Exceptions
  • rsc::threading::FutureTimeoutException: if the method call is not completed within the maximum waiting time.

  • rsc::threading::FutureTaskExecutionException: if the method call fails.

template<typename O>
boost::shared_ptr<O> call(const std::string &methodName, unsigned int maxReplyWaitTime = 25)

Call the method named methodName on the remote server, without arguments and return the value returned by the remote method.

This method blocks until the computation on the remote side has been completed and the result has been received.

Return

The result of the method call.

Template Parameters
  • O: type of the method return value.

Parameters
  • methodName: Name of the method that should be called.

  • maxReplyWaitTime: Maximum number of seconds to wait for a reply from the server when calling a method.

Exceptions
  • rsc::threading::FutureTimeoutException: if the method call is not completed within the maximum waiting time.

  • rsc::threading::FutureTaskExecutionException: if the method call fails.

template<typename O>
class DataFuture
#include <RemoteServer.h>

Public Functions

DataFuture(FuturePtr target)
bool isDone()
boost::shared_ptr<O> get(double timeout)
template<>
class DataFuture<void>
#include <RemoteServer.h>

Public Functions

DataFuture(FuturePtr target)
bool isDone()
boost::shared_ptr<void> get(double timeout)
class RemoteMethod : public rsb::patterns::Method
#include <RemoteServer.h>

A derived Method class which can be used to invoke methods on a remote LocalServer object.

Author

jmoringe

Public Functions

RemoteMethod(const Scope &scope, const std::string &name, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig)
~RemoteMethod()
std::string getKind() const

Return the kind of the participant.

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

Return

a string describing the kind of the participant.

RemoteServer::FuturePtr call(const std::string &methodName, EventPtr request)
class Method : public rsb::Participant, public rsb::Handler, public boost::enable_shared_from_this<Method>
#include <Server.h>

Base class for method classes.

Manages a listener and an informer participant and their respective configurations.

Author

jmoringe

Subclassed by rsb::patterns::LocalServer<>::LocalMethod, rsb::patterns::RemoteServer::RemoteMethod

Public Functions

Method(const Scope &scope, const std::string &name, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig)
~Method()
void activate()
void deactivate()
const std::string &getName() const

Returns the name of the method.

const std::set<std::string> getTransportURLs() const

TODO.

namespace protocol

Typedefs

typedef boost::shared_ptr<rsb::protocol::FragmentedNotification> FragmentedNotificationPtr
typedef boost::shared_ptr<rsb::protocol::Notification> NotificationPtr

Functions

RSB_EXPORT void rsb::protocol::fillEventId(protocol::EventId & id, const rsb::EventId & realId)

Utility function to fill a protocol::EventId.

Parameters
  • id: the id to fill

  • realId: the source id

RSB_EXPORT void rsb::protocol::fillNotificationId(protocol::Notification & notification, const EventPtr & event)

Fills the notification with minimal information required to identify it along several notifications sent on a wire.

Namely, this is the EventId contained in the notification.

Parameters
  • notification: the notification to fill

  • event: the event to take then information from

RSB_EXPORT void rsb::protocol::fillNotificationHeader(protocol::Notification & notification, const EventPtr & event, const std::string & wireSchema)

Fills a protocol::Notification with header contents.

This includes meta data and causal vector but excludes the id information. These can be set with fillNotificationId.

Parameters
  • notification: notification to fill

  • event: the event that generated the notification

  • wireSchema: wire schema of the serialized data

void fillEvent(EventPtr event, const protocol::Notification &notification, VoidPtr data, const string &dataType)
RSB_EXPORT void rsb::protocol::fillEvent(EventPtr event, const rsb::protocol::Notification & notification, boost::shared_ptr< void > data, const std::string & dataType)

Parses the data from a protocol::Notification and fills an event with these data.

Parameters
  • event: event to fill

  • notification: notification to read data from

  • data: the decoded event data, probably generated by a Converter

  • dataType: the string identifier of the data type

class ProtocolException : public rsb::CommException
#include <ProtocolException.h>

Author

swrede

Public Functions

ProtocolException(const std::string &m)
virtual ~ProtocolException()
namespace transport

Typedefs

typedef OutConnector::Ptr OutConnectorPtr
typedef InConnector::Ptr InConnectorPtr
typedef boost::shared_ptr<AsioServiceContext> AsioServiceContextPtr
typedef boost::shared_ptr<Connector> ConnectorPtr
typedef ConnectorFactory<InConnector> InFactory
typedef ConnectorFactory<OutConnector> OutFactory

Enums

enum Directions

Transport directions.

Can be combined via bitwise or.

Values:

DIRECTION_IN = 0x01
DIRECTION_OUT = 0x02

Functions

RSB_EXPORT InFactory & rsb::transport::getInFactory()
RSB_EXPORT OutFactory & rsb::transport::getOutFactory()
RSB_EXPORT void rsb::transport::registerDefaultTransports()
RSB_EXPORT std::set< std::string > rsb::transport::getAvailableTransports(unsigned int requiredDirections)

Returns the names of all available transports which support requiredDirections.

Return

The set of names of the available transports.

Parameters
  • requiredDirections: One or more of Directions.

RSB_EXPORT bool rsb::transport::isAvailable(const std::string & transportName, unsigned int requiredDirections)

Returns true if transportName names a transport which is available and supports requiredDirections .

Return

true if the requested transport is available, false otherwise.

Parameters
  • requiredDirections: One or more of Directions.

RSB_EXPORT bool rsb::transport::isRemote(const std::string & transportName)

Returns true if transportName names a remote transport.

Return

true if the transport implements remote communication, false otherwise.

Exceptions
  • rsc::runtime::NoSuchObject: If transportName does not name an available transport.

Variables

bool registered = false
boost::mutex registrationMutex
class AsioServiceContext
#include <AsioServiceContext.h>

A class that keeps a boost asio service alive as long as this class lives.

So it is best maintained in shared_ptr instances (AsioServiceContextPtr).

Author

jwienke

Public Types

typedef boost::shared_ptr<boost::asio::io_service> ServicePtr

Public Functions

AsioServiceContext()
~AsioServiceContext()
AsioServiceContext::ServicePtr getService()
class Connector : public virtual Printable
#include <Connector.h>

Author

swrede

Subclassed by rsb::transport::InConnector, rsb::transport::OutConnector

Public Functions

~Connector()
virtual void setScope(const Scope &scope) = 0

Sets the scope this connector will send/receive events to/from.

Parameters
  • scope: scope of the connector

virtual void activate() = 0

Activates the connector.

Settings made between construction and activation via this method must be applied on a call to this method.

virtual void deactivate() = 0
virtual void setQualityOfServiceSpecs(const QualityOfServiceSpec &specs) = 0

Requests new QoS settings for publishing events.

Does not influence the receiving part.

Parameters
  • specs: QoS specification

Exceptions

virtual const std::string getTransportURL() const = 0

Return an URL describing the transport kind and its configuration for this connector.

Return

A string representation of the transport URL.

template<typename WireType>
class ConverterSelectingConnector
#include <ConverterSelectingConnector.h>

This base class enables look up of suitable rsb::converter::Converter s in rsb::transport::Connector classes.

Author

jmoringe

Public Types

typedef converter::Converter<WireType>::Ptr ConverterPtr
typedef converter::ConverterSelectionStrategy<WireType>::Ptr ConverterSelectionStrategyPtr
template<typename Interface>
class ConnectorFactory : public rsc::patterns::Factory<std::string, Interface>, public Printable
#include <Factory.h>

Objects of this class are specialized factories that construct Connector objects and provide introspection for connector implementations without instantiating them.

Author

jmoringe

Public Functions

ConnectorFactory()
ConnectorInfo getConnectorInfo(const std::string &name) const

Return information regarding the connector implementation named name.

Return

A ConnectorInfo object.

Parameters
  • name: Name of the implementation for which information should be returned.

Exceptions
  • rsc::runtime::NoSuchObject: If a record for name cannot be found.

std::set<ConnectorInfo> getConnectorInfos() const
void registerConnector(const std::string &name, const CreateFunction &constructor, const std::set<std::string> &schemas = std::set<std::string>(), bool remote = true, const std::set<std::string> &options = std::set<std::string>())

For the connector implementation named name, register the construct function constructor, supported schemas schemas and recognized configuration options options.

Parameters
  • name: Name of the connector implementation.

  • constructor: Construct function.

  • schemas: A list of strings designating schemas supported by the implementation.

  • options: A list of strings describing configuration options recognized by the implementation.

void registerConnector(const std::string &name, const CreateFunction &constructor, const std::string &schema, bool remote = true, const std::set<std::string> &options = std::set<std::string>())
class ConnectorInfo : public Printable
#include <Factory.h>

Instances of this class describe capabilities and properties of connector implementations.

Author

jmoringe

Public Types

template<>
typedef std::set<std::string> SchemaList
template<>
typedef std::set<std::string> OptionList

Public Functions

template<>
ConnectorInfo(const std::string &name, const SchemaList &schemas, bool remote, const OptionList &options)
template<>
std::string getName() const

Return the name of the implementation.

template<>
SchemaList getSchemas() const

Return the set of schemas supported by the connector implementation.

Return

A std::set containing the supported schemas as strings.

template<>
OptionList getOptions() const

Return a list of option names describing configurations options recognized by the implementation.

Return

A std::set containing the names of recognized options.

template<>
bool isRemote() const

Return “remoteness” of the implementation.

Return

true if the transport allows communication across process boundaries, false otherwise.

template<>
bool operator<(const ConnectorInfo &other) const
class InConnector : public virtual rsb::transport::Connector, public rsb::filter::FilterObserver, public boost::enable_shared_from_this<InConnector>
#include <InConnector.h>

Objects of classes which implement this interface can be used to receive events by means of one transport mechanism.

Received events are dispatched to an associated observer.

Author

jmoringe

Subclassed by rsb::transport::inprocess::InConnector, rsb::transport::socket::InConnector

Public Types

typedef boost::shared_ptr<InConnector> Ptr

Public Functions

~InConnector()
void addHandler(eventprocessing::HandlerPtr handler)
void removeHandler(eventprocessing::HandlerPtr handler)
void setErrorStrategy(ParticipantConfig::ErrorStrategy strategy)

A temporary hack to pass an ErrorStrategy to in-connectors so that they can be instructed by clients on what to do in case of asynchronous receive errors.

The current convention is that ERROR_STRATEGY_LOG and ERROR_STRATEGY_PRINT shall use the declared channel for displaying the error once and afterwards connectors should stop processing.

Parameters
  • strategy: the new error strategy to use

class OutConnector : public virtual rsb::transport::Connector, public rsb::eventprocessing::Handler
#include <OutConnector.h>

Objects of classes which implement this interface can be used to send events by means of one transport mechanism.

The handle method of this class has to update the send time of the event meta data according to the time the event was sent on the wire.

Author

jmoringe

Subclassed by rsb::transport::inprocess::OutConnector, rsb::transport::socket::OutConnector

Public Types

typedef boost::shared_ptr<OutConnector> Ptr

Public Functions

~OutConnector()
namespace inprocess

Typedefs

typedef boost::shared_ptr<InConnector> InConnectorPtr
typedef boost::shared_ptr<Bus> BusPtr

Functions

RSB_EXPORT BusPtr rsb::transport::inprocess::getDefaultBus()
class Bus : public rsb::eventprocessing::Handler
#include <Bus.h>

Author

jmoringe

Public Functions

Bus()
~Bus()
void addSink(InConnectorPtr sink)
void removeSink(InConnector *sink)
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

class InConnector : public virtual rsb::transport::InConnector, public virtual rsb::eventprocessing::Handler
#include <InConnector.h>

Instances of this class receive events from the in-process bus.

Author

jmoringe

Public Functions

InConnector(BusPtr bus = getDefaultBus())
~InConnector()
void printContents(std::ostream &stream) const
void activate()

Activates the connector.

Settings made between construction and activation via this method must be applied on a call to this method.

void deactivate()
Scope getScope() const
void setScope(const Scope &scope)

Sets the scope this connector will send/receive events to/from.

Parameters
  • scope: scope of the connector

const std::string getTransportURL() const

Return an URL describing the transport kind and its configuration for this connector.

Return

A string representation of the transport URL.

void setQualityOfServiceSpecs(const QualityOfServiceSpec &specs)

Requests new QoS settings for publishing events.

Does not influence the receiving part.

Parameters
  • specs: QoS specification

Exceptions

void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

Public Static Functions

transport::InConnector *create(const rsc::runtime::Properties &args)
class OutConnector : public rsb::transport::OutConnector
#include <OutConnector.h>

Instances of this class send events to the in-process bus.

Author

jmoringe

Public Functions

OutConnector(BusPtr bus = getDefaultBus())
void setScope(const Scope &scope)

Sets the scope this connector will send/receive events to/from.

Parameters
  • scope: scope of the connector

const std::string getTransportURL() const

Return an URL describing the transport kind and its configuration for this connector.

Return

A string representation of the transport URL.

void activate()

Activates the connector.

Settings made between construction and activation via this method must be applied on a call to this method.

void deactivate()
void setQualityOfServiceSpecs(const QualityOfServiceSpec &specs)

Requests new QoS settings for publishing events.

Does not influence the receiving part.

Parameters
  • specs: QoS specification

Exceptions

void handle(rsb::EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

Public Static Functions

static rsb::transport::OutConnector *create(const rsc::runtime::Properties &args)
namespace socket

Typedefs

typedef boost::shared_ptr<InConnector> InConnectorPtr
typedef boost::shared_ptr<BusConnection> BusConnectionPtr
typedef boost::shared_ptr<Bus> BusPtr
typedef boost::shared_ptr<BusServer> BusServerPtr
typedef boost::shared_ptr<ConnectorBase> ConnectorBasePtr
typedef boost::shared_ptr<Factory> FactoryPtr

Enums

enum Server

Values:

SERVER_NO = 0
SERVER_YES = 1
SERVER_AUTO = 2

Functions

std::string safeSocketExceptionString(const std::exception &exception)
RSB_EXPORT FactoryPtr rsb::transport::socket::getDefaultFactory()
EventPtr notificationToEvent(protocol::Notification &notification, bool exposeWireSchema = false)

Converts notification into an Event.

The event payload will be copied from notification into the event unmodified to allow application of arbitrary converters.

Return

A shared pointer to a newly allocated rsb::Event.

Parameters
  • notification: The protocol::Notification from which the event should be constructed.

  • exposeWireSchema: Controls whether the wire-schema stored in notification should be exposed in a meta data item of the created event.

void eventToNotification(protocol::Notification &notification, const EventPtr &event, const std::string &wireSchema, const std::string &data)

Converts the Event event into a protocol::Notification, storing the result in notification.

Parameters
  • notification: The protocol::Notification object into which the conversion should be performed.

  • event: event The Event object that should be serialized.

  • wireSchema: The wire-Schema that should be stored in notification.

  • data: The payload that should be stored in notification.

template<typename Ch, typename Tr>
std::basic_istream<Ch, Tr> &operator>>(std::basic_istream<Ch, Tr> &stream, Server &value)
template<typename Ch, typename Tr>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &stream, const Server &value)

Variables

const std::string DEFAULT_HOST = "localhost"
const boost::uint16_t DEFAULT_PORT = 55555
class Bus : public rsb::eventprocessing::Handler
#include <Bus.h>

Instances of this class provide access to a socket-based bus.

It is transparent for clients (connectors) of this class whether is accessed by running the bus server or by connecting to the bus server as a client.

In-direction connectors add themselves as event sinks using the addSink method.

Out-direction connectors submit events to the bus using the handle method.

Author

jmoringe

Subclassed by rsb::transport::socket::BusImpl, rsb::transport::socket::BusServer

Public Functions

~Bus()
virtual void addSink(InConnectorPtr sink) = 0
virtual void removeSink(const InConnector *sink) = 0
virtual void addConnection(BusConnectionPtr connection) = 0

Adds connection to the list of connections of the bus.

connection should start receiving events, only after being added to the bus.

Parameters
  • connection: The connection that should be added.

virtual void removeConnection(BusConnectionPtr connection) = 0

Removes connection from the list of connections of this bus.

connection is not closed or otherwise modified.

Parameters
  • connection: The connection that should be removed.

virtual bool isTcpnodelay() const = 0
virtual void handle(EventPtr event) = 0

Handle event.

Parameters
  • event: The event that should be handled.

virtual void handleIncoming(EventPtr event, BusConnectionPtr connection) = 0
virtual const std::string getTransportURL() const = 0
class BusConnection : public boost::enable_shared_from_this<BusConnection>, public Printable
#include <BusConnection.h>

Instances of this class implement connections to a socket-based bus.

The basic operations provided by this class are receiving an event by calling receiveEvent and submitting an event to the bus by calling sendEvent.

In a process which acts as a client for a particular bus, a single instance of this class is connected to the remote bus server and provides access to the bus for all participants in the process.

A process which acts as the server for a particular bus, manages (via the BusServer class) one BusConnection object for each client (remote process) connected to the bus.

This class is not thread-safe.

Author

jmoringe

Public Types

typedef boost::shared_ptr<boost::asio::ip::tcp::socket> SocketPtr

Public Functions

BusConnection(BusPtr bus, SocketPtr socket, bool client, bool tcpNoDelay = false)
~BusConnection()
void shutdown()
void startReceiving()
void sendEvent(EventPtr event, const std::string &wireSchema)
const std::string getTransportURL() const
class BusImpl : public virtual rsb::transport::socket::Bus
#include <BusImpl.h>

Author

jmoringe

Subclassed by rsb::transport::socket::BusServerImpl

Public Functions

BusImpl(AsioServiceContextPtr asioService, bool tcpnodelay = false)
~BusImpl()
void addSink(InConnectorPtr sink)
void removeSink(const InConnector *sink)
void addConnection(BusConnectionPtr connection)

Adds connection to the list of connections of the bus.

connection should start receiving events, only after being added to the bus.

Parameters
  • connection: The connection that should be added.

void removeConnection(BusConnectionPtr connection)

Removes connection from the list of connections of this bus.

connection is not closed or otherwise modified.

Parameters
  • connection: The connection that should be removed.

bool isTcpnodelay() const
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

void handleIncoming(EventPtr event, BusConnectionPtr connection)
void printContents(std::ostream &stream) const
const std::string getTransportURL() const
class BusServer : public virtual rsb::transport::socket::Bus
#include <BusServer.h>

Instances of this class provide access to a socket-based bus for local and remote bus clients.

Remote clients can connect to a server socket in order to send and receive events through the resulting socket connection.

Local clients (connectors) use the usual Bus interface to receive events submitted by remote clients and submit events which will be distributed to remote clients by the BusServer.

Author

jmoringe

Subclassed by rsb::transport::socket::BusServerImpl, rsb::transport::socket::LifecycledBusServer

Public Functions

~BusServer()
virtual void activate() = 0
virtual void deactivate() = 0
virtual void handleIncoming(EventPtr event, BusConnectionPtr connection) = 0
class BusServerImpl : public virtual rsb::transport::socket::BusImpl, public virtual rsb::transport::socket::BusServer, public boost::enable_shared_from_this<BusServerImpl>
#include <BusServerImpl.h>

Instances of this class provide access to a socket-based bus for local and remote bus clients.

Remote clients can connect to a server socket in order to send and receive events through the resulting socket connection.

Local clients (connectors) use the usual Bus interface to receive events submitted by remote clients and submit events which will be distributed to remote clients by the BusServerImpl.

Author

jmoringe

Public Functions

BusServerImpl(AsioServiceContextPtr asioService, boost::uint16_t port, bool tcpnodelay, bool waitForClientDisconnects)
~BusServerImpl()
void activate()

Activate the object.

Note

This member function can only be called when a boost::shared_ptr owning the object exists.

void deactivate()
void removeConnection(BusConnectionPtr connection)

Removes connection from the list of connections of this bus.

connection is not closed or otherwise modified.

Parameters
  • connection: The connection that should be removed.

void handleIncoming(EventPtr event, BusConnectionPtr connection)
const std::string getTransportURL() const
class ConnectorBase : public rsb::transport::ConverterSelectingConnector<std::string>
#include <ConnectorBase.h>

This class is intended to be used as a base class for connector classes of the socket-based transport.

It provides establishing and managing a connection to the bus via an instance of the Bus class.

Author

jmoringe

Subclassed by rsb::transport::socket::InConnector, rsb::transport::socket::OutConnector

Public Functions

ConnectorBase(FactoryPtr factory, ConverterSelectionStrategyPtr converters, const std::string &host, unsigned int port, Server server, bool tcpnodelay, bool waitForClientDisconnects = true)

Creates a connector for the given combination of host, port and server.

Parameters
  • converters: A strategy for converter selection within the newly created connector.

  • host: The host of the socket through which the newly created connector will operate.

  • port: The port of the socket through which the newly created connector will operate.

  • server: Controls whether the newly created connector should create a listening socket and wait for connections (value SERVER_YES), connect to an existing listen socket (value SERVER_NO) or try to automatically determine whether there already is a listening socket and create one only if necessary (value SERVER_AUTO).

  • tcpnodelay: Controls whether the TCP_NODELAY socket option should be set for the socket implementing the communication of the newly created connector. Setting this option trades decreased latency for decreased throughput.

  • waitForClientDisconnects: If true, delay shutdown of the server socket until all clients have disconnected.

~ConnectorBase()
Scope getScope() const
void setScope(const Scope &scope)
const std::string getTransportURL() const
class Factory
#include <Factory.h>

The singleton instance of this class is responsible for managing bus provider objects.

For each endpoint (i.e. address and port), at most one client or server bus provider can exist.

Attention

This class is not thread safe and needs to be accessed in a synchronized manner, except for getBus.

Author

jmoringe

Public Functions

Factory()
~Factory()
BusPtr getBus(const Server &serverMode, const std::string &host, const boost::uint16_t &port, bool tcpnodelay, bool waitForClientDisconnects)

Returns either a BusClient or Server depending on the chosen serverMode and the existence of a server in the current process.

class InConnector : public virtual rsb::transport::socket::ConnectorBase, public virtual rsb::transport::InConnector, public virtual rsb::eventprocessing::Handler
#include <InConnector.h>

Instances of this class receive events from a bus that is accessed via a socket connection.

The receiving and dispatching of events is done in push mode: each instance has a BusConnection which pushes appropriate events into the instance. The connector deserializes event payloads and pushes the events into handlers (usually objects which implement EventReceivingStrategy).

Author

jmoringe

Public Functions

InConnector(FactoryPtr factory, ConverterSelectionStrategyPtr converters, const std::string &host, unsigned int port, Server server, bool tcpnodelay, bool waitForClientDisconnects)

Creates a connector for the given combination of host, port and server.

Parameters
  • converters: A strategy for converter selection within the newly created connector.

  • host: The host of the socket through which the newly created connector will operate.

  • port: The port of the socket through which the newly created connector will operate.

  • server: Controls whether the newly created connector should create a listening socket and wait for connections (value SERVER_YES), connect to an existing listen socket (value SERVER_NO) or try to automatically determine whether there already is a listening socket and create one only if necessary (value SERVER_AUTO).

  • tcpnodelay: Controls whether the TCP_NODELAY socket option should be set for the socket implementing the communication of the newly created connector. Setting this option trades decreased latency for decreased throughput.

  • waitForClientDisconnects: If true, delay shutdown of the server socket until all clients have disconnected.

~InConnector()
void activate()
void deactivate()
void setScope(const Scope &scope)
void setQualityOfServiceSpecs(const QualityOfServiceSpec &specs)

Requests new QoS settings for publishing events.

Does not influence the receiving part.

Parameters
  • specs: QoS specification

Exceptions

void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

const std::string getTransportURL() const

Public Static Functions

static rsb::transport::InConnector *create(const rsc::runtime::Properties &args)
class LifecycledBusServer : public rsb::transport::socket::BusServer
#include <LifecycledBusServer.h>

A facade around BusServer instances to allow breaking dependency cycles.

This implementation specifically calls deactivate on the underlying server instance in its destructor. This is known to break a dependency cycle in BusServerImpl which would otherwise prevent clean destruction through shared_ptr instances.

Apart from this behavior, all calls are passed to the underlying instance.

Author

jwienke

Public Functions

LifecycledBusServer(BusServerPtr server)
~LifecycledBusServer()
void addSink(InConnectorPtr sink)
void removeSink(const InConnector *sink)
void addConnection(BusConnectionPtr connection)

Adds connection to the list of connections of the bus.

connection should start receiving events, only after being added to the bus.

Parameters
  • connection: The connection that should be added.

void removeConnection(BusConnectionPtr connection)

Removes connection from the list of connections of this bus.

connection is not closed or otherwise modified.

Parameters
  • connection: The connection that should be removed.

bool isTcpnodelay() const
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

void activate()
void deactivate()
void handleIncoming(EventPtr event, BusConnectionPtr connection)
const string getTransportURL() const
void printContents(std::ostream &stream) const
class OutConnector : public rsb::transport::socket::ConnectorBase, public rsb::transport::OutConnector
#include <OutConnector.h>

Instances of this connector class push events into Bus objects which take care of socket-based broadcast and delivery.

Author

jmoringe

Public Functions

OutConnector(FactoryPtr factory, ConverterSelectionStrategyPtr converters, const std::string &host, unsigned int port, Server server, bool tcpnodelay, bool waitForClientDisconnects = true)

Creates a connector for the given combination of host, port and server.

Parameters
  • converters: A strategy for converter selection within the newly created connector.

  • host: The host of the socket through which the newly created connector will operate.

  • port: The port of the socket through which the newly created connector will operate.

  • server: Controls whether the newly created connector should create a listening socket and wait for connections (value SERVER_YES), connect to an existing listen socket (value SERVER_NO) or try to automatically determine whether there already is a listening socket and create one only if necessary (value SERVER_AUTO).

  • tcpnodelay: Controls whether the TCP_NODELAY socket option should be set for the socket implementing the communication of the newly created connector. Setting this option trades decreased latency for decreased throughput.

  • waitForClientDisconnects: If true, delay shutdown of the server socket until all clients have disconnected.

~OutConnector()
void setScope(const Scope &scope)
void activate()
void deactivate()
void setQualityOfServiceSpecs(const QualityOfServiceSpec &specs)

Requests new QoS settings for publishing events.

Does not influence the receiving part.

Parameters
  • specs: QoS specification

Exceptions

void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

const std::string getTransportURL() const

Public Static Functions

static transport::OutConnector *create(const rsc::runtime::Properties &args)
namespace util

Functions

void freeMd5Hash(void *hash)
RSB_EXPORT std::ostream & rsb::util::operator<<(ostream & stream, const MD5 & sum)
class EventQueuePushHandler : public rsb::Handler
#include <EventQueuePushHandler.h>

A rsb::Handler for rsb::Listener s that pushes all received events on a rsc::SynchronizedQueue.

Author

jwienke

Public Functions

EventQueuePushHandler(boost::shared_ptr<rsc::threading::SynchronizedQueue<EventPtr>> queue, const std::string &method = "")

Constructs a new instance.

Parameters
  • queue: the queue to push received data on

  • method: method of this handler to react on, empty means all events

string getClassName() const
void printContents(std::ostream &stream) const
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

class MD5Hasher

Public Types

typedef unsigned int u32
typedef unsigned char byte

Public Functions

MD5Hasher()
~MD5Hasher()
byte *hash(byte *buf, size_t nbytes)

FPM: At this point I diverge from GnuPG’s implementation to write my own wrapper function.

I’ll use this to hash the passphrase.

class MD5
#include <MD5.h>

A simple class representing an md5 sum for a given string.

Author

jwienke

Public Functions

MD5(const std::string &s)

Creates a new m5s sum for the given string.

Parameters
  • s: string to create sum for

~MD5()
string toHexString(const bool &pretty = false) const

Returns a hex encoded string of the sum.

Parameters
  • pretty: if true, the string will be separated in blocks by spaces

template<class T, class DisableEventWarning = void>
class QueuePushHandler : public rsb::Handler
#include <QueuePushHandler.h>

A rsb::Handler for rsb::Listener s that pushes all received data on a rsc::SynchronizedQueue.

This queue must handle shared pointers of the data type.

Author

jwienke

Template Parameters
  • T: data type received by the handler. All data is handeled as a shared pointer of this type

Public Functions

rsb::util::QueuePushHandler::STATIC_ASSERT_WARN_TEMPLATE(QUEUE_PUSH_HANDLER_EVENT_WARNING, (boost::is_same< DisableEventWarning, Event >::value||!boost::is_same< T, Event >::value), "You probably do not want to use QueuePushHandler with type Event. If you want to receive complete Event instances inside a queue, you need to use EventQueuePushHandler.If you really want to use this class and want to get rid of this warning, define the second template parameter of this class to Event, too.")
QueuePushHandler(boost::shared_ptr<rsc::threading::SynchronizedQueue<boost::shared_ptr<T>>> queue, const std::string &method = "")

Constructs a new instance.

Parameters
  • queue: the queue to push received data on

  • method: method of this handler to react on, empty means all events

std::string getClassName() const
void printContents(std::ostream &stream) const
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

namespace patterns

Typedefs

typedef boost::shared_ptr<LocalServer> LocalServerPtr
typedef boost::shared_ptr<Reader> ReaderPtr
typedef boost::shared_ptr<RemoteServer> RemoteServerPtr
typedef boost::shared_ptr<Method> MethodPtr
class
#include <LocalServer.h>

The server side of a request-reply-based communication channel.

An adapter to use boost functions without a call argument and without return values for callbacks.

A callback which does not take a request and does not produce a result.

Author

jwienke

jmoringe

jmoringe.

jwienke

Public Types

typedef boost::shared_ptr<IntlCallback> CallbackPtr
typedef boost::shared_ptr<LocalMethod> LocalMethodPtr
typedef boost::function<void(void)> FunctionType

Type of functions that can be accepted.

Public Functions

LocalServer(const Scope &scope, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig)
~LocalServer()
std::string getKind() const

Return the kind of the participant.

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

Return

a string describing the kind of the participant.

const std::set<std::string> getTransportURLs() const

TODO.

void registerMethod(const std::string &name, CallbackPtr callback)

Register a new method with the given name.

Parameters
  • name: Name of the new method. Has to be a legal scope component string.

  • callback: callback to execute for the method

Exceptions
  • MethodExistsException: thrown if a method with this name already exists

Callback()
virtual void call(const std::string &methodName) = 0

Implement this method to perform actions.

Parameters
  • methodName: called method

Exceptions
  • std::exception: all exceptions based on this type are automatically caught and delivered to the remote server

FunctionCallback(FunctionType function, const std::string &requestType = rsc::runtime::typeName(typeid(void)), const std::string &replyType = rsc::runtime::typeName(typeid(void)))
template<class RequestType>
class AnyReplyTypeCallback : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

A callback which allows any kind of reply type but is restricted to a single request type.

Author

jwienke

Template Parameters
  • RequestType: request type class

Public Functions

template<>
AnyReplyTypeCallback(const std::string &requestType = rsc::runtime::typeName(typeid(RequestType)))
template<>
virtual AnnotatedData call(const std::string &methodName, boost::shared_ptr<RequestType> input) = 0

Implement this method to perform actions.

Return

result data for the method with type name added

Parameters
  • methodName: called method

  • input: input data for the method

Exceptions
  • std::exception: all exceptions based on this type are automatically caught and delivered to the remote server

template<class RequestType, class ReplyType>
class Callback : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

Callback object used to register one method for a server.

Author

jwienke

Template Parameters
  • RequestType: the data type of the request payload

  • ReplyType: the data type of the reply payload

Public Functions

template<>
Callback(const std::string &requestType = rsc::runtime::typeName(typeid(RequestType)), const std::string &replyType = rsc::runtime::typeName(typeid(ReplyType)))
template<>
virtual boost::shared_ptr<ReplyType> call(const std::string &methodName, boost::shared_ptr<RequestType> input) = 0

Implement this method to perform actions.

Return

result data for the method

Parameters
  • methodName: called method

  • input: input data for the method

Exceptions
  • std::exception: all exceptions based on this type are automatically caught and delivered to the remote server

template<class RequestType>
class Callback<RequestType, void> : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

Public Functions

template<>
Callback(const std::string &requestType = rsc::runtime::typeName(typeid(RequestType)), const std::string &replyType = rsc::runtime::typeName(typeid(void)))
template<>
virtual void call(const std::string &methodName, boost::shared_ptr<RequestType> input) = 0

Implement this method to perform actions.

Parameters
  • methodName: called method

  • input: input data for the method

Exceptions
  • std::exception: all exceptions based on this type are automatically caught and delivered to the remote server

template<class ReplyType>
class Callback<void, ReplyType> : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

Public Functions

template<>
Callback(const std::string &requestType = rsc::runtime::typeName(typeid(void)), const std::string &replyType = rsc::runtime::typeName(typeid(ReplyType)))
template<>
virtual boost::shared_ptr<ReplyType> call(const std::string &methodName) = 0

Implement this method to perform actions.

Return

result data for the method

Parameters
  • methodName: called method

Exceptions
  • std::exception: all exceptions based on this type are automatically caught and delivered to the remote server

class CallbackBase : public rsb::patterns::LocalServer<>::IntlCallback
#include <LocalServer.h>

Base class for callback classes.

Author

jmoringe

Subclassed by rsb::patterns::LocalServer<>::AnyReplyTypeCallback< RequestType >, rsb::patterns::LocalServer<>::Callback< RequestType, ReplyType >, rsb::patterns::LocalServer<>::Callback< RequestType, void >, rsb::patterns::LocalServer<>::Callback< void, ReplyType >, rsb::patterns::LocalServer<>::FunctionCallback< RequestType, ReplyType >, rsb::patterns::LocalServer<>::FunctionCallback< RequestType, void >, rsb::patterns::LocalServer<>::FunctionCallback< void, ReplyType >

Public Functions

template<>
const string &getRequestType() const
template<>
const string &getReplyType() const
class EventCallback : public rsb::patterns::LocalServer<>::IntlCallback
#include <LocalServer.h>

Callback class with receives and returns events.

Author

jmoringe

Subclassed by rsb::introspection::EchoCallback

Public Functions

template<>
virtual EventPtr call(const std::string &methodName, EventPtr request) = 0
template<class RequestType, class ReplyType>
class FunctionCallback : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

An adapter to use boost functions for callbacks.

You can use any existing method via implicit conversion to a boost function or via boost bind as long as the types match.

Author

jwienke

Public Types

template<>
typedef boost::function<typename boost::shared_ptr<ReplyType> typename boost::shared_ptr<RequestType>)> FunctionType

Type of functions that can be accepted.

Public Functions

template<>
FunctionCallback(FunctionType function, const std::string &requestType = rsc::runtime::typeName(typeid(RequestType)), const std::string &replyType = rsc::runtime::typeName(typeid(ReplyType)))
template<class RequestType>
class FunctionCallback<RequestType, void> : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

An adapter to use boost functions without out return values as calblacks.

Author

jwienke

Public Types

template<>
typedef boost::function<void(typename boost::shared_ptr<RequestType>)> FunctionType

Type of functions that can be accepted.

Public Functions

template<>
FunctionCallback(FunctionType function, const std::string &requestType = rsc::runtime::typeName(typeid(RequestType)), const std::string &replyType = rsc::runtime::typeName(typeid(void)))
template<class ReplyType>
class FunctionCallback<void, ReplyType> : public rsb::patterns::LocalServer<>::CallbackBase
#include <LocalServer.h>

An adapter to use boost functions without a call argument for callbacks.

Author

jwienke

Public Types

template<>
typedef boost::function<typename boost::shared_ptr<ReplyType>void)> FunctionType

Type of functions that can be accepted.

Public Functions

template<>
FunctionCallback(FunctionType function, const std::string &requestType = rsc::runtime::typeName(typeid(void)), const std::string &replyType = rsc::runtime::typeName(typeid(ReplyType)))
class IntlCallback
#include <LocalServer.h>

Callback object interface to implement for registering callable methods.

Author

jwienke

Subclassed by rsb::patterns::LocalServer<>::CallbackBase, rsb::patterns::LocalServer<>::EventCallback

Public Functions

template<>
~IntlCallback()
template<>
virtual EventPtr intlCall(const std::string &methodName, EventPtr request) = 0
class LocalMethod : public rsb::patterns::Method
#include <LocalServer.h>

A derived Method class which can be called from the remote side and implements its behavior by invoking a client-supplied callback.

Author

jmoringe

Public Functions

template<>
LocalMethod(const Scope &scope, const std::string &name, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig, CallbackPtr callback)
template<>
~LocalMethod()
template<>
std::string getKind() const

Return the kind of the participant.

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

Return

a string describing the kind of the participant.

class MethodExistsException : public rsb::Exception
#include <MethodExistsException.h>

Indicates that a method of a Server already exists.

Author

jwienke

Public Functions

MethodExistsException(const std::string &methodName, const std::string &server)

Constructs a new exception.

Parameters
  • methodName: name of the method

  • server: name of the server

~MethodExistsException()
class Reader : public rsb::Participant, public boost::enable_shared_from_this<Reader>
#include <Reader.h>

A Reader receives and synchronously delivers events.

In contrast to the Listener participant, a Reader delivers events using a pull-style interface: the read method has to be called in order to receive events. This method may block (depending on the block parameter) until an event becomes available. The received event, if any, is returned to the caller.

Usage example:

rsb::patterns::ReaderPtr reader
        = rsb::getFactory().createReader("/example/informer");
reader->read();

Author

jmoringe

Public Functions

Reader(const Scope &scope, const ParticipantConfig &config)

Constructs a new reader object attached to scope.

Note

This constructor is exposed for unit tests and such. Use Factory::createReader instead of calling this directly.

Parameters
  • scope: the scope from which data is received.

  • config: the configuration for this reader

~Reader()
std::string getKind() const

Return the kind of the participant.

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

Return

a string describing the kind of the participant.

const std::set<std::string> getTransportURLs() const

TODO.

EventPtr read(bool block = true)

Reads one event from the bus.

If block is true, blocks until an event is available. If block is false and no event is available, an empty EventPtr is returned.

Return

A boost::shared_ptr to the received event or an empty boost::shared_ptr if no event was available and block was false.

Parameters
  • block: Controls whether the call should block and wait for an event if no event is immediately available.

Exceptions
  • RSBError: when a communication error occurs while receiving or decoding the event.

class RemoteServer : public rsb::Participant
#include <RemoteServer.h>

The client side of a request-reply-based communication channel.

Objects of this class represent remote servers in a way that allows calling methods on them as if they were local.

Author

jwienke

jmoringe

Public Types

typedef rsc::threading::Future<EventPtr> FutureType
typedef boost::shared_ptr<FutureType> FuturePtr
typedef boost::shared_ptr<RemoteMethod> RemoteMethodPtr

Public Functions

RemoteServer(const Scope &scope, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig)

Construct a new RemoteServer object which can be used to call methods of the server at scope.

Parameters
  • scope: The base scope of the server the methods of which will be called.

~RemoteServer()
std::string getKind() const

Return the kind of the participant.

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

Return

a string describing the kind of the participant.

const std::set<std::string> getTransportURLs() const

TODO.

template<class I>
EventPtr prepareRequestEvent(boost::shared_ptr<I> args)

Prepares an Event which can be used for a request based on typed data.

Return

event containing the data and appropriate type tags

Parameters
  • args: data for the event

Template Parameters
  • I: data type for the data in the event

RemoteServer::FuturePtr callAsync(const std::string &methodName, EventPtr data)

Call the method named methodName on the remote server, passing it the event data as argument and returning an event which contains the value returned by the remote method.

Return

A rsc::threading::TimeoutFuture object from which the result (an EventPtr) of the method call can be obtained at the caller’s discretion.

Parameters
  • methodName: Name of the method that should be called.

  • data: An Event object containing the argument object that should be passed to the called method.

template<typename O, typename I>
DataFuture<O> callAsync(const std::string &methodName, boost::shared_ptr<I> args)

Call the method named methodName on the remote server, passing it the argument object args and returning the value returned by the remote method.

Return

A DataFuture object from which the result (a shared_ptr to an object of type O) of the method call can be obtained at the caller’s discretion.

Template Parameters
  • I: type of the method call argument object.

  • O: type of the method return value.

Parameters
  • methodName: Name of the method that should be called.

  • args: The argument object that should be passed to the called method.

template<typename O>
DataFuture<O> callAsync(const std::string &methodName)

Call the method named methodName on the remote server, without arguments and returning the value returned by the remote method.

Return

A DataFuture object from which the result (a shared_ptr to an object of type O) of the method call can be obtained at the caller’s discretion.

Template Parameters
  • O: type of the method return value.

Parameters
  • methodName: Name of the method that should be called.

EventPtr call(const std::string &methodName, EventPtr data, unsigned int maxReplyWaitTime = 25)

Call the method named methodName on the remote server, passing it the event data as argument and returning an event which contains the value returned by the remote method.

This method blocks until the computation on the remote side has been completed and the result has been received.

Return

An Event object containing the result of the method call.

Parameters
  • methodName: Name of the method that should be called.

  • data: An Event object containing the argument object that should be passed to the called method.

  • maxReplyWaitTime: Maximum number of seconds to wait for a reply from the server when calling a method.

Exceptions
  • rsc::threading::FutureTimeoutException: if the method call is not completed within the maximum waiting time.

  • rsc::threading::FutureTaskExecutionException: if the method call fails.

template<typename O, typename I>
boost::shared_ptr<O> call(const std::string &methodName, boost::shared_ptr<I> args, unsigned int maxReplyWaitTime = 25)

Call the method named methodName on the remote server, passing it the argument object args and return the value returned by the remote method.

This method blocks until the computation on the remote side has been completed and the result has been received.

Return

The result of the method call.

Template Parameters
  • I: type of the method call argument object.

  • O: type of the method return value.

Parameters
  • methodName: Name of the method that should be called.

  • args: The argument object that should be passed to the called method.

  • maxReplyWaitTime: Maximum number of seconds to wait for a reply from the server when calling a method.

Exceptions
  • rsc::threading::FutureTimeoutException: if the method call is not completed within the maximum waiting time.

  • rsc::threading::FutureTaskExecutionException: if the method call fails.

template<typename O>
boost::shared_ptr<O> call(const std::string &methodName, unsigned int maxReplyWaitTime = 25)

Call the method named methodName on the remote server, without arguments and return the value returned by the remote method.

This method blocks until the computation on the remote side has been completed and the result has been received.

Return

The result of the method call.

Template Parameters
  • O: type of the method return value.

Parameters
  • methodName: Name of the method that should be called.

  • maxReplyWaitTime: Maximum number of seconds to wait for a reply from the server when calling a method.

Exceptions
  • rsc::threading::FutureTimeoutException: if the method call is not completed within the maximum waiting time.

  • rsc::threading::FutureTaskExecutionException: if the method call fails.

template<typename O>
class DataFuture
#include <RemoteServer.h>

Public Functions

DataFuture(FuturePtr target)
bool isDone()
boost::shared_ptr<O> get(double timeout)
template<>
class DataFuture<void>
#include <RemoteServer.h>

Public Functions

DataFuture(FuturePtr target)
bool isDone()
boost::shared_ptr<void> get(double timeout)
class RemoteMethod : public rsb::patterns::Method
#include <RemoteServer.h>

A derived Method class which can be used to invoke methods on a remote LocalServer object.

Author

jmoringe

Public Functions

RemoteMethod(const Scope &scope, const std::string &name, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig)
~RemoteMethod()
std::string getKind() const

Return the kind of the participant.

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

Return

a string describing the kind of the participant.

RemoteServer::FuturePtr call(const std::string &methodName, EventPtr request)
class Method : public rsb::Participant, public rsb::Handler, public boost::enable_shared_from_this<Method>
#include <Server.h>

Base class for method classes.

Manages a listener and an informer participant and their respective configurations.

Author

jmoringe

Subclassed by rsb::patterns::LocalServer<>::LocalMethod, rsb::patterns::RemoteServer::RemoteMethod

Public Functions

Method(const Scope &scope, const std::string &name, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig)
~Method()
void activate()
void deactivate()
const std::string &getName() const

Returns the name of the method.

const std::set<std::string> getTransportURLs() const

TODO.

namespace converter

internal repository implementation

All this is done so that the memory of Repositories is maintained inside the RSB DLL on windows.

Otherwise multiple clients would have different instances of the repositories.

Moreover, I have added a general name-based lookup for repositories instead of being fixed to wire types (c++ types) as this might become a scalability problem later. We might find out that e.g. several connectors use string as their data type and still converters need to be fundamentally different. For this purpose general name-based lookup is possible now. So far only internally and the type-based methods map to this mechanism by using RTTI names.

RSB_EXPORT void * rsb::converter::converterRepositoryByName(const std::string & wireTypeName, RepositoryCreater & creater)

Returns a repository for a converters of a certain wire type by a look up based on a name for the wire type.

Return

converter repository.

Note

currently an internal method. Do not use it.

Parameters
  • wireTypeName: of of the wire type.

  • creater: if no repository exists with this name, this object is used to instantiate a new one.

Typedefs

typedef boost::shared_ptr<BoolConverter> BoolConverterPtr
typedef boost::shared_ptr<ConverterPredicate> ConverterPredicatePtr
typedef boost::shared_ptr<VoidConverter> VoidConverterPtr

Functions

RSB_EXPORT void rsb::converter::registerDefaultConverters()
Repository<string>::Ptr stringConverterRepository()
template<class WireType>
Repository<WireType>::Ptr converterRepository()

Returns a Repository of Converter instances specifically for the given wire type.

Return

converter repository

Template Parameters
  • WireType: type of the wire to serialize to / from

Variables

bool registered = false
boost::mutex registrationMutex
map<string, void *> repositoriesByName
boost::mutex repositoriesByNameMutex
class BoolConverter : public rsb::converter::Converter<std::string>
#include <BoolConverter.h>

Converter for bool.

Author

jwienke

Public Functions

BoolConverter()
~BoolConverter()
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class ByteArrayConverter : public rsb::converter::Converter<std::string>
#include <ByteArrayConverter.h>

“Converts” arbitrary payloads into a std::string which should be interpreted as an array of bytes.

Author

jmoringe

Public Functions

ByteArrayConverter()
~ByteArrayConverter()
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

template<class WireType>
class Converter : public Printable
#include <Converter.h>

Author

swrede

jwienke

Template Parameters
  • WireType: is the serialization format, uchar, string, binary, …

Public Types

typedef boost::shared_ptr<Converter<WireType>> Ptr

Public Functions

virtual ~Converter()
virtual std::string serialize(const AnnotatedData &data, WireType &wire) = 0

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

virtual AnnotatedData deserialize(const std::string &wireSchema, const WireType &wire) = 0

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

virtual std::string getDataType() const

Returns the name of the data type this converter is applicable for.

Return

name of the data type this converter can be used for

virtual std::string getWireSchema() const

Returns the name of the wire schema this converter can (de)serialize from/to.

Return

name of the wire schema from/to this converter can (de)serialize

template<typename WireType>
class ConverterSelectionStrategy : public Printable
#include <ConverterSelectionStrategy.h>

Implementation of this interface perform mappings of one of the followings forms:

  • wire-schema -> Converter

  • data-type -> Converter

Author

jmoringe

Subclassed by rsb::converter::PredicateConverterList< WireType >, rsb::converter::UnambiguousConverterMap< WireType >

Public Types

typedef Converter<WireType>::Ptr ConverterPtr
typedef boost::shared_ptr<ConverterSelectionStrategy<WireType>> Ptr

Public Functions

virtual ConverterPtr getConverter(const std::string &key) const = 0

Tries to look up the converter designator by key.

Return

A boost::shared_ptr holding the converter.

Parameters
  • key: A wire-schema or data-type desinated the desired converter.

Exceptions
  • rsc::runtime::NoSuchObject: If there is no converter fo key.

class EventIdConverter : public rsb::converter::Converter<std::string>
#include <EventIdConverter.h>

A converter for EventId.

Author

jwienke

Public Functions

EventIdConverter()

Constructs a new converter.

~EventIdConverter()
string getClassName() const
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

string getWireSchema() const

Returns the name of the wire schema this converter can (de)serialize from/to.

Return

name of the wire schema from/to this converter can (de)serialize

class EventsByScopeMapConverter : public rsb::converter::Converter<std::string>
#include <EventsByScopeMapConverter.h>

A converter for aggregated events ordered by their scope and time for each scope.

Author

jwienke

Public Functions

EventsByScopeMapConverter(ConverterSelectionStrategy<std::string>::Ptr serializationConverters = converterRepository<std::string>()->getConvertersForSerialization(), ConverterSelectionStrategy<std::string>::Ptr deserializationConverters = converterRepository<std::string>()->getConvertersForDeserialization())

Constructs a new converter and optionally allows to specify a converter::Repository which will be used for the contained events of arbitrary types.

Parameters
  • serializationConverters: converters to use for serialization. Defaults to the unambiguous map from stringConverterRepository

  • deserializationConverters: converters to use for deserialization. Defaults to the unambiguous map from stringConverterRepository

~EventsByScopeMapConverter()
string getClassName() const
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

string getWireSchema() const

Returns the name of the wire schema this converter can (de)serialize from/to.

Return

name of the wire schema from/to this converter can (de)serialize

template<typename T>
class FloatingPointConverter : public rsb::converter::Converter<std::string>
#include <FloatingPointConverter.h>

Base class for floating point type converters.

Author

jmoringe

Public Types

typedef boost::shared_ptr<FloatingPointConverter<T>> Ptr

Public Functions

FloatingPointConverter(const std::string &wireSchema)
virtual ~FloatingPointConverter()
std::string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class FloatConverter : public rsb::converter::FloatingPointConverter<float>
#include <FloatingPointConverter.h>

Converter for float type.

Author

jmoringe

Public Functions

FloatConverter()
class DoubleConverter : public rsb::converter::FloatingPointConverter<double>
#include <FloatingPointConverter.h>

Converter for double type.

Author

jmoringe

Public Functions

DoubleConverter()
template<typename T>
class IntegerConverter : public rsb::converter::Converter<std::string>
#include <IntegerConverter.h>

Base class for integer type converters.

Author

jmoringe

Public Types

typedef boost::shared_ptr<IntegerConverter<T>> Ptr

Public Functions

IntegerConverter(const std::string &wireSchema)
virtual ~IntegerConverter()
std::string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class Uint32Converter : public rsb::converter::IntegerConverter<boost::uint32_t>
#include <IntegerConverter.h>

Converter for boost::uint32_t.

Author

jmoringe

Public Functions

Uint32Converter()
class Uint64Converter : public rsb::converter::IntegerConverter<boost::uint64_t>
#include <IntegerConverter.h>

Converter for boost::uint64_t.

Author

jmoringe

Public Functions

Uint64Converter()
class Int32Converter : public rsb::converter::IntegerConverter<boost::int32_t>
#include <IntegerConverter.h>

Converter for boost::int32_t.

Author

jmoringe

Public Functions

Int32Converter()
class Int64Converter : public rsb::converter::IntegerConverter<boost::int64_t>
#include <IntegerConverter.h>

Converter for boost::int64_t.

Author

jmoringe

Public Functions

Int64Converter()
class ConverterPredicate : public Printable
#include <PredicateConverterList.h>

Implementations of this interface can be used to perform Converter selection based on predicate evaluation.

Depending on the context, the match method of predicates is invoked with either a wire-schema string or a data-type string in order to decide whether an associated converter should be selected.

Author

jmoringe

Subclassed by rsb::converter::AlwaysApplicable, rsb::converter::RegexConverterPredicate, rsb::converter::TypeNameConverterPredicate

Public Functions

virtual ~ConverterPredicate()
virtual bool match(const std::string &key) const = 0

Return true if the Converter associated to this predicate should be selected for key.

Return

true if the associated converter should be selected; false otherwise.

Parameters
  • key: Depending on the context, either a wire-schema or a data-type for which a converter has to be selected.

class AlwaysApplicable : public rsb::converter::ConverterPredicate
#include <PredicateConverterList.h>

A predicate that unconditionally causes its associated Converter to be selected.

Author

jmoringe

Public Functions

bool match(const std::string &key) const

Return true if the Converter associated to this predicate should be selected for key.

Return

true if the associated converter should be selected; false otherwise.

Parameters
  • key: Depending on the context, either a wire-schema or a data-type for which a converter has to be selected.

std::string getClassName() const
void printContents(std::ostream&) const
template<typename WireType>
class PredicateConverterList : public rsb::converter::ConverterSelectionStrategy<WireType>
#include <PredicateConverterList.h>

Objects of this class are used to perform Converter selection via a chain-of-responsibility strategy.

A list of predicates and associated converters is maintained. Converter selection queries are processed by traversing the list and selected the first converter the associated predicate of which matches the query wire-schema or data-type.

Author

jmoringe

Public Types

typedef ConverterSelectionStrategy<WireType>::ConverterPtr ConverterPtr
typedef std::list<std::pair<ConverterPredicatePtr, ConverterPtr>> ConverterList

Public Functions

template<typename ForwardIterator>
PredicateConverterList(ForwardIterator begin, ForwardIterator end)

Construct a new PredicateConverterList object, initializing its Converter to the elements of the iterator range given by start and end.

Parameters
  • begin: A ForwardIterator the value type of which is a std::pair of a ConverterPredicatePtr and a Converter<WireType>::Ptr.

  • end: An associated end iterator.

ConverterPtr getConverter(const std::string &key) const

Tries to look up the converter designator by key.

Return

A boost::shared_ptr holding the converter.

Parameters
  • key: A wire-schema or data-type desinated the desired converter.

Exceptions
  • rsc::runtime::NoSuchObject: If there is no converter fo key.

std::string getClassName() const
void printContents(std::ostream &stream) const
template<typename ProtocolBuffer>
class ProtocolBufferConverter : public rsb::converter::Converter<std::string>
#include <ProtocolBufferConverter.h>

A generic converter for data types based on Protocol Buffer messages.

Author

jmoringe

Template Parameters
  • ProtocolBuffer: type of the protobuf message to be converted

Public Functions

ProtocolBufferConverter()
~ProtocolBufferConverter()
std::string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class RegexConverterPredicate : public rsb::converter::ConverterPredicate
#include <RegexConverterPredicate.h>

Objects of this class select Converter s by matching the query wire-schema or data-type against a sotred reqular expression.

Author

jmoringe

Public Functions

RegexConverterPredicate(const std::string &regex)

Construct a new RegexConverterPredicate that matches queries against the regular expression regex.

Parameters
  • regex: The regular expression the new predicate should use.

RegexConverterPredicate(const boost::regex &regex)

Construct a new RegexConverterPredicate that matches queries against the regular expression regex.

Parameters
  • regex: The regular expression the new predicate should use.

bool match(const std::string &key) const

Return true if the Converter associated to this predicate should be selected for key.

Return

true if the associated converter should be selected; false otherwise.

Parameters
  • key: Depending on the context, either a wire-schema or a data-type for which a converter has to be selected.

template<class WireType>
class Repository : public Printable
#include <Repository.h>

Maintains a collection of converters for a specific wire format.

Each converter has a wire type describing the actual message that is written on the wire and a data type that indicates which data it can serialize on the wire.

Author

jwienke

Template Parameters
  • WireType: the wire-type of the collected converters.

Public Types

typedef Converter<WireType>::Ptr ConverterPtr
typedef std::pair<std::string, std::string> ConverterSignature

WireSchema and DataType.

typedef std::map<std::string, std::string> ConverterSelectionMap
typedef boost::shared_ptr<Repository<WireType>> Ptr

Public Functions

Repository()
ConverterSelectionStrategy<WireType>::Ptr getConvertersForSerialization(const ConverterSelectionMap &selection = ConverterSelectionMap()) const
ConverterSelectionStrategy<WireType>::Ptr getConvertersForDeserialization(const ConverterSelectionMap &selection = ConverterSelectionMap()) const
void registerConverter(ConverterPtr converter, bool replace = false)

Registers converter in the collection.

Parameters
  • converter: The converter to register.

  • replace: If a converter with the same wire schema and data type as converter is already registered, should it be replaced?

Exceptions
  • std::invalid_argument: If there is already a converter registered with the same wire schema and data type.

ConverterPtr getConverter(const std::string &wireSchema, const std::string &dataType) const
ConverterPtr getConverter(const ConverterSignature &signature) const
void clear()
class RepositoryCreater
#include <Repository.h>

An internal factory object to create typed converter repositories.

Author

jwienke

Note

internal class

Subclassed by rsb::converter::TypeBasedRepositoryCreater< WireType >

Public Functions

~RepositoryCreater()
virtual void *create() = 0

Factory method to create a new Repository.

Return

new Repository instance

template<class WireType>
class TypeBasedRepositoryCreater : public rsb::converter::RepositoryCreater
#include <Repository.h>

A RepositoryCreate which can be statically typed using a template argument for the desired wire type.

Author

jwienke

Template Parameters
  • WireType: type of the wire of underlying converters

Public Functions

virtual ~TypeBasedRepositoryCreater()
void *create()

Factory method to create a new Repository.

Return

new Repository instance

template<typename Mechanism, typename DataType, typename WireSchema>
class RosettaConverter : public rsb::converter::Converter<std::string>
#include <RosettaConverter.h>

Author

jmoringe

Template Parameters
  • Mechanism:

  • DataType:

  • WireSchema:

Public Functions

RosettaConverter()
~RosettaConverter()
std::string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class SchemaAndByteArrayConverter : public rsb::converter::Converter<std::string>
#include <SchemaAndByteArrayConverter.h>

“Converts” arbitrary payloads into a pair consisting of the original wire schema and a std::string which should be interpreted as an array of bytes.

Author

jwienke

Public Functions

SchemaAndByteArrayConverter()
~SchemaAndByteArrayConverter()
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class ScopeConverter : public rsb::converter::Converter<std::string>
#include <ScopeConverter.h>

(De)serializes rsb::Scope objects.

Author

jmoringe

Public Functions

ScopeConverter()
~ScopeConverter()
std::string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class SerializationException : public rsb::Exception
#include <SerializationException.h>

An exception indicating a serialization or deserialization problem for data.

Author

jwienke

Public Functions

SerializationException(const std::string &message)
class StringConverter : public rsb::converter::Converter<std::string>
#include <StringConverter.h>

Converts any string into any string serializing content to a string.

Author

swrede

Public Functions

StringConverter()
~StringConverter()
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

class TypeNameConverterPredicate : public rsb::converter::ConverterPredicate
#include <TypeNameConverterPredicate.h>

Objects of this class select Converter s by matching the query wire-schema or data-type against a stored string.

The functionality of this class is a subset of RegexConverterPredicate. Using this class you do not need to care to replace special characters for regular expressions and the implementation is probably much faster.

Author

jwienke

Public Functions

TypeNameConverterPredicate(const std::string &typeName)

Construct a new TypeNameConverterPredicate that matches queries against the wanted type name typeName.

Parameters
  • regex: The regular expression the new predicate should use.

bool match(const std::string &key) const

Return true if the Converter associated to this predicate should be selected for key.

Return

true if the associated converter should be selected; false otherwise.

Parameters
  • key: Depending on the context, either a wire-schema or a data-type for which a converter has to be selected.

template<typename WireType>
class UnambiguousConverterMap : public rsb::converter::ConverterSelectionStrategy<WireType>
#include <UnambiguousConverterMap.h>

Objects this class store mappings of one of the followings forms.

  • wire-schema -> Converter

  • data-type -> Converter This association is unambiguous.

Author

jmoringe

Public Types

typedef ConverterSelectionStrategy<WireType>::ConverterPtr ConverterPtr

Public Functions

ConverterPtr getConverter(const std::string &key) const

Tries to look up the converter designator by key.

Return

A boost::shared_ptr holding the converter.

Parameters
  • key: A wire-schema or data-type designated the desired converter.

Exceptions
  • rsc::runtime::NoSuchObject: If there is no converter fo key.

void addConverter(const std::string &key, ConverterPtr converter)

Stores converter in the map under the name key.

Note

Converter::getDataType and Converter::getWireSchema are not considered in any way.

Parameters
  • key: Either a wire-schema or a data-type depending on the context in which the map is used.

  • converter: The converter that should be added.

Exceptions
  • std::invalid_argument: If there already is a converter for the name key.

class VoidConverter : public rsb::converter::Converter<std::string>
#include <VoidConverter.h>

Fulfill the interface…

Converts nothing to nothing. ;)

Author

jwienke

Public Functions

VoidConverter()
~VoidConverter()
string serialize(const AnnotatedData &data, std::string &wire)

Serialized the given domain object to the wire.

Return

the wire schema the data is encoded with

Parameters
  • data: data to serialize

  • wire: the wire to serialize on

Exceptions
  • SerializationException: if the serialization failed

AnnotatedData deserialize(const std::string &wireSchema, const std::string &wire)

Deserializes a domain object from a wire type.

Return

the deserialized domain object annotated with its data type name

Parameters
  • wireSchema: type of the wire message

  • wire: the wire containing the data

Exceptions
  • SerializationException: if deserializing the message fails

namespace filter

Typedefs

typedef boost::shared_ptr<Filter> FilterPtr
typedef boost::shared_ptr<FilterObserver> FilterObserverPtr
class CauseFilter : public rsb::filter::Filter
#include <CauseFilter.h>

This filter matches events in which a particular cause is present.

Author

jmoringe

Public Functions

CauseFilter(const rsc::misc::UUID &cause, bool invert = false)

Creates a new cause filter that matches event in whose cause vector cause is present.

Parameters
  • cause: The cause that has to be present in events matching the filter.

  • invert: If true, events match if cause is not present in their cause vector.

CauseFilter(const EventId &cause, bool invert = false)

Creates a new cause filter that matches event in whose cause vector cause is present.

Parameters
  • cause: The cause that has to be present in events matching the filter.

  • invert: If true, events match if cause is not present in their cause vector.

UUID getCause() const

Return the cause that has to be present in events matched by this filter.

Return

The cause potentially converted to a rsc::misc::UUID.

bool isInverted() const

Indicates whether the filter is inverted.

Return

true if the filter is inverted.

bool match(EventPtr e)

Matches the given event against the constraints specified by this filter.

Return

true if the event matches the restrictions specified by this filter and hence can be delivered to the client, false to remove the event from the stream.

Parameters
  • e: the event to match. Must not be changed!

void notifyObserver(FilterObserverPtr fo, FilterAction::Types at)

Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface.

The default implementation does not generate a specific notification on FilterObserver. Override this method if there is a specific reception method in FilterObserver.

Parameters
  • fo: the observer to notify

  • at: action that is performed with this filter. Just pass this to the observer

class Filter : public virtual Printable
#include <Filter.h>

A filter filters an event stream by removing unwanted events.

Therefore it has a function to match an event against its restrictions.

As some there may be optimization possible for certain specific filter types, a double-dispatch logic is available using FilterObserver. Instances must implement this notifyObserver if they are relevant for FilterObserver instances.

Note

most RSB classes using filters expect that the filters will not change their configuration after they have been added to e.g. the listener. So generally do not change a filter after this. Instead first remove it and then re-add the reconfigured instance.

Author

swrede

Subclassed by rsb::filter::CauseFilter, rsb::filter::MethodFilter, rsb::filter::OriginFilter, rsb::filter::ScopeFilter, rsb::filter::TypeFilter

Public Functions

Filter()
~Filter()
virtual bool match(EventPtr e) = 0

Matches the given event against the constraints specified by this filter.

Return

true if the event matches the restrictions specified by this filter and hence can be delivered to the client, false to remove the event from the stream.

Parameters
  • e: the event to match. Must not be changed!

void notifyObserver(FilterObserverPtr fo, FilterAction::Types at)

Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface.

The default implementation does not generate a specific notification on FilterObserver. Override this method if there is a specific reception method in FilterObserver.

Parameters
  • fo: the observer to notify

  • at: action that is performed with this filter. Just pass this to the observer

class FilterAction
#include <FilterActionTypes.h>

A class to encapsulate enum constants that specify changes of a Filter for FilterObserver instances.

Author

swrede

Public Types

enum Types

Possible actions with filters.

Note

There is not update action because filters would then need a more detailed observation model. Instead, the assumption is that a filter’s settings will not change after it has been notified to a FilterObserver.

Author

swrede

Values:

ADD

A filter shall be added to the FilterObserver.

REMOVE

A filter shall be remove from the observer.

class FilterObserver : public virtual Printable
#include <FilterObserver.h>

Author

swrede

Subclassed by rsb::transport::InConnector

Public Functions

FilterObserver()
~FilterObserver()
void notify(Filter *filter, const FilterAction::Types &at)
void notify(ScopeFilter *filter, const FilterAction::Types &at)
class MethodFilter : public rsb::filter::Filter
#include <MethodFilter.h>

This filter matches events based on the value of their method field.

Author

jmoringe

Public Functions

MethodFilter(const std::string &method, bool invert = false)

Creates a new method filter that matches events whose method fields have the value method.

Parameters
  • method: String value that the method field of matched events has to have.

  • invert: If true, events match if their method fields do not match method.

const std::string &getMethod() const
bool isInverted() const
bool match(EventPtr e)

Matches the given event against the constraints specified by this filter.

Return

true if the event matches the restrictions specified by this filter and hence can be delivered to the client, false to remove the event from the stream.

Parameters
  • e: the event to match. Must not be changed!

void notifyObserver(FilterObserverPtr fo, FilterAction::Types at)

Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface.

The default implementation does not generate a specific notification on FilterObserver. Override this method if there is a specific reception method in FilterObserver.

Parameters
  • fo: the observer to notify

  • at: action that is performed with this filter. Just pass this to the observer

class OriginFilter : public rsb::filter::Filter
#include <OriginFilter.h>

This filter matches events that originate from a particular participant.

Author

jmoringe

Public Functions

OriginFilter(const rsc::misc::UUID &origin, bool invert = false)

Creates a new origin filter that matches event originating from origin.

Parameters
  • origin: Id of the participant from which matching events have to originate.

  • invert: If true, events match if they do not originate from origin.

UUID getOrigin() const
bool isInverted() const
bool match(EventPtr e)

Matches the given event against the constraints specified by this filter.

Return

true if the event matches the restrictions specified by this filter and hence can be delivered to the client, false to remove the event from the stream.

Parameters
  • e: the event to match. Must not be changed!

void notifyObserver(FilterObserverPtr fo, FilterAction::Types at)

Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface.

The default implementation does not generate a specific notification on FilterObserver. Override this method if there is a specific reception method in FilterObserver.

Parameters
  • fo: the observer to notify

  • at: action that is performed with this filter. Just pass this to the observer

class ScopeFilter : public rsb::filter::Filter
#include <ScopeFilter.h>

Author

swrede

Public Functions

ScopeFilter(const Scope &scope)
~ScopeFilter()
void printContents(std::ostream &stream) const
bool match(EventPtr e)

Matches the given event against the constraints specified by this filter.

Return

true if the event matches the restrictions specified by this filter and hence can be delivered to the client, false to remove the event from the stream.

Parameters
  • e: the event to match. Must not be changed!

Scope getScope() const
void notifyObserver(FilterObserverPtr fo, FilterAction::Types at)

Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface.

The default implementation does not generate a specific notification on FilterObserver. Override this method if there is a specific reception method in FilterObserver.

Parameters
  • fo: the observer to notify

  • at: action that is performed with this filter. Just pass this to the observer

class TypeFilter : public rsb::filter::Filter
#include <TypeFilter.h>

This filter matches events based on the data type of their payload.

Author

jmoringe

Public Functions

TypeFilter(const std::string &type, bool invert = false)

Creates a new type filter that matches events whose payload is of the type designated by type.

Parameters
  • type: String designating the which the payload of matching events has to have.

  • invert: If true, events match if their payload type does not match type.

const std::string &getType() const
bool isInverted() const
bool match(EventPtr e)

Matches the given event against the constraints specified by this filter.

Return

true if the event matches the restrictions specified by this filter and hence can be delivered to the client, false to remove the event from the stream.

Parameters
  • e: the event to match. Must not be changed!

void notifyObserver(FilterObserverPtr fo, FilterAction::Types at)

Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface.

The default implementation does not generate a specific notification on FilterObserver. Override this method if there is a specific reception method in FilterObserver.

Parameters
  • fo: the observer to notify

  • at: action that is performed with this filter. Just pass this to the observer

Public Static Functions

template<typename T>
static TypeFilter *createForType(bool invert = false)

Creates a new type filter that matches events whose payload is of type T.

Return

A pointer to the newly created object.

Template Parameters
  • T: The type matching event payloads must have.

Parameters
  • invert: If true, events match if their type fields do not match type.

namespace transport

Typedefs

typedef OutConnector::Ptr OutConnectorPtr
typedef InConnector::Ptr InConnectorPtr
typedef boost::shared_ptr<AsioServiceContext> AsioServiceContextPtr
typedef boost::shared_ptr<Connector> ConnectorPtr
typedef ConnectorFactory<InConnector> InFactory
typedef ConnectorFactory<OutConnector> OutFactory

Enums

enum Directions

Transport directions.

Can be combined via bitwise or.

Values:

DIRECTION_IN = 0x01
DIRECTION_OUT = 0x02

Functions

RSB_EXPORT InFactory & rsb::transport::getInFactory()
RSB_EXPORT OutFactory & rsb::transport::getOutFactory()
RSB_EXPORT void rsb::transport::registerDefaultTransports()
RSB_EXPORT std::set< std::string > rsb::transport::getAvailableTransports(unsigned int requiredDirections)

Returns the names of all available transports which support requiredDirections.

Return

The set of names of the available transports.

Parameters
  • requiredDirections: One or more of Directions.

RSB_EXPORT bool rsb::transport::isAvailable(const std::string & transportName, unsigned int requiredDirections)

Returns true if transportName names a transport which is available and supports requiredDirections .

Return

true if the requested transport is available, false otherwise.

Parameters
  • requiredDirections: One or more of Directions.

RSB_EXPORT bool rsb::transport::isRemote(const std::string & transportName)

Returns true if transportName names a remote transport.

Return

true if the transport implements remote communication, false otherwise.

Exceptions
  • rsc::runtime::NoSuchObject: If transportName does not name an available transport.

Variables

bool registered = false
boost::mutex registrationMutex
class AsioServiceContext
#include <AsioServiceContext.h>

A class that keeps a boost asio service alive as long as this class lives.

So it is best maintained in shared_ptr instances (AsioServiceContextPtr).

Author

jwienke

Public Types

typedef boost::shared_ptr<boost::asio::io_service> ServicePtr

Public Functions

AsioServiceContext()
~AsioServiceContext()
AsioServiceContext::ServicePtr getService()
class Connector : public virtual Printable
#include <Connector.h>

Author

swrede

Subclassed by rsb::transport::InConnector, rsb::transport::OutConnector

Public Functions

~Connector()
virtual void setScope(const Scope &scope) = 0

Sets the scope this connector will send/receive events to/from.

Parameters
  • scope: scope of the connector

virtual void activate() = 0

Activates the connector.

Settings made between construction and activation via this method must be applied on a call to this method.

virtual void deactivate() = 0
virtual void setQualityOfServiceSpecs(const QualityOfServiceSpec &specs) = 0

Requests new QoS settings for publishing events.

Does not influence the receiving part.

Parameters
  • specs: QoS specification

Exceptions

virtual const std::string getTransportURL() const = 0

Return an URL describing the transport kind and its configuration for this connector.

Return

A string representation of the transport URL.

template<typename WireType>
class ConverterSelectingConnector
#include <ConverterSelectingConnector.h>

This base class enables look up of suitable rsb::converter::Converter s in rsb::transport::Connector classes.

Author

jmoringe

Public Types

typedef converter::Converter<WireType>::Ptr ConverterPtr
typedef converter::ConverterSelectionStrategy<WireType>::Ptr ConverterSelectionStrategyPtr
template<typename Interface>
class ConnectorFactory : public rsc::patterns::Factory<std::string, Interface>, public Printable
#include <Factory.h>

Objects of this class are specialized factories that construct Connector objects and provide introspection for connector implementations without instantiating them.

Author

jmoringe

Public Functions

ConnectorFactory()
ConnectorInfo getConnectorInfo(const std::string &name) const

Return information regarding the connector implementation named name.

Return

A ConnectorInfo object.

Parameters
  • name: Name of the implementation for which information should be returned.

Exceptions
  • rsc::runtime::NoSuchObject: If a record for name cannot be found.

std::set<ConnectorInfo> getConnectorInfos() const
void registerConnector(const std::string &name, const CreateFunction &constructor, const std::set<std::string> &schemas = std::set<std::string>(), bool remote = true, const std::set<std::string> &options = std::set<std::string>())

For the connector implementation named name, register the construct function constructor, supported schemas schemas and recognized configuration options options.

Parameters
  • name: Name of the connector implementation.

  • constructor: Construct function.

  • schemas: A list of strings designating schemas supported by the implementation.

  • options: A list of strings describing configuration options recognized by the implementation.

void registerConnector(const std::string &name, const CreateFunction &constructor, const std::string &schema, bool remote = true, const std::set<std::string> &options = std::set<std::string>())
class ConnectorInfo : public Printable
#include <Factory.h>

Instances of this class describe capabilities and properties of connector implementations.

Author

jmoringe

Public Types

template<>
typedef std::set<std::string> SchemaList
template<>
typedef std::set<std::string> OptionList

Public Functions

template<>
ConnectorInfo(const std::string &name, const SchemaList &schemas, bool remote, const OptionList &options)
template<>
std::string getName() const

Return the name of the implementation.

template<>
SchemaList getSchemas() const

Return the set of schemas supported by the connector implementation.

Return

A std::set containing the supported schemas as strings.

template<>
OptionList getOptions() const

Return a list of option names describing configurations options recognized by the implementation.

Return

A std::set containing the names of recognized options.

template<>
bool isRemote() const

Return “remoteness” of the implementation.

Return

true if the transport allows communication across process boundaries, false otherwise.

template<>
bool operator<(const ConnectorInfo &other) const
class InConnector : public virtual rsb::transport::Connector, public rsb::filter::FilterObserver, public boost::enable_shared_from_this<InConnector>
#include <InConnector.h>

Objects of classes which implement this interface can be used to receive events by means of one transport mechanism.

Received events are dispatched to an associated observer.

Author

jmoringe

Subclassed by rsb::transport::inprocess::InConnector, rsb::transport::socket::InConnector

Public Types

typedef boost::shared_ptr<InConnector> Ptr

Public Functions

~InConnector()
void addHandler(eventprocessing::HandlerPtr handler)
void removeHandler(eventprocessing::HandlerPtr handler)
void setErrorStrategy(ParticipantConfig::ErrorStrategy strategy)

A temporary hack to pass an ErrorStrategy to in-connectors so that they can be instructed by clients on what to do in case of asynchronous receive errors.

The current convention is that ERROR_STRATEGY_LOG and ERROR_STRATEGY_PRINT shall use the declared channel for displaying the error once and afterwards connectors should stop processing.

Parameters
  • strategy: the new error strategy to use

class OutConnector : public virtual rsb::transport::Connector, public rsb::eventprocessing::Handler
#include <OutConnector.h>

Objects of classes which implement this interface can be used to send events by means of one transport mechanism.

The handle method of this class has to update the send time of the event meta data according to the time the event was sent on the wire.

Author

jmoringe

Subclassed by rsb::transport::inprocess::OutConnector, rsb::transport::socket::OutConnector

Public Types

typedef boost::shared_ptr<OutConnector> Ptr

Public Functions

~OutConnector()
namespace inprocess

Typedefs

typedef boost::shared_ptr<InConnector> InConnectorPtr
typedef boost::shared_ptr<Bus> BusPtr

Functions

RSB_EXPORT BusPtr rsb::transport::inprocess::getDefaultBus()
class Bus : public rsb::eventprocessing::Handler
#include <Bus.h>

Author

jmoringe

Public Functions

Bus()
~Bus()
void addSink(InConnectorPtr sink)
void removeSink(InConnector *sink)
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

class InConnector : public virtual rsb::transport::InConnector, public virtual rsb::eventprocessing::Handler
#include <InConnector.h>

Instances of this class receive events from the in-process bus.

Author

jmoringe

Public Functions

InConnector(BusPtr bus = getDefaultBus())
~InConnector()
void printContents(std::ostream &stream) const
void activate()

Activates the connector.

Settings made between construction and activation via this method must be applied on a call to this method.

void deactivate()
Scope getScope() const
void setScope(const Scope &scope)

Sets the scope this connector will send/receive events to/from.

Parameters
  • scope: scope of the connector

const std::string getTransportURL() const

Return an URL describing the transport kind and its configuration for this connector.

Return

A string representation of the transport URL.

void setQualityOfServiceSpecs(const QualityOfServiceSpec &specs)

Requests new QoS settings for publishing events.

Does not influence the receiving part.

Parameters
  • specs: QoS specification

Exceptions

void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

Public Static Functions

transport::InConnector *create(const rsc::runtime::Properties &args)
class OutConnector : public rsb::transport::OutConnector
#include <OutConnector.h>

Instances of this class send events to the in-process bus.

Author

jmoringe

Public Functions

OutConnector(BusPtr bus = getDefaultBus())
void setScope(const Scope &scope)

Sets the scope this connector will send/receive events to/from.

Parameters
  • scope: scope of the connector

const std::string getTransportURL() const

Return an URL describing the transport kind and its configuration for this connector.

Return

A string representation of the transport URL.

void activate()

Activates the connector.

Settings made between construction and activation via this method must be applied on a call to this method.

void deactivate()
void setQualityOfServiceSpecs(const QualityOfServiceSpec &specs)

Requests new QoS settings for publishing events.

Does not influence the receiving part.

Parameters
  • specs: QoS specification

Exceptions

void handle(rsb::EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

Public Static Functions

static rsb::transport::OutConnector *create(const rsc::runtime::Properties &args)
namespace socket

Typedefs

typedef boost::shared_ptr<InConnector> InConnectorPtr
typedef boost::shared_ptr<BusConnection> BusConnectionPtr
typedef boost::shared_ptr<Bus> BusPtr
typedef boost::shared_ptr<BusServer> BusServerPtr
typedef boost::shared_ptr<ConnectorBase> ConnectorBasePtr
typedef boost::shared_ptr<Factory> FactoryPtr

Enums

enum Server

Values:

SERVER_NO = 0
SERVER_YES = 1
SERVER_AUTO = 2

Functions

std::string safeSocketExceptionString(const std::exception &exception)
RSB_EXPORT FactoryPtr rsb::transport::socket::getDefaultFactory()
EventPtr notificationToEvent(protocol::Notification &notification, bool exposeWireSchema = false)

Converts notification into an Event.

The event payload will be copied from notification into the event unmodified to allow application of arbitrary converters.

Return

A shared pointer to a newly allocated rsb::Event.

Parameters
  • notification: The protocol::Notification from which the event should be constructed.

  • exposeWireSchema: Controls whether the wire-schema stored in notification should be exposed in a meta data item of the created event.

void eventToNotification(protocol::Notification &notification, const EventPtr &event, const std::string &wireSchema, const std::string &data)

Converts the Event event into a protocol::Notification, storing the result in notification.

Parameters
  • notification: The protocol::Notification object into which the conversion should be performed.

  • event: event The Event object that should be serialized.

  • wireSchema: The wire-Schema that should be stored in notification.

  • data: The payload that should be stored in notification.

template<typename Ch, typename Tr>
std::basic_istream<Ch, Tr> &operator>>(std::basic_istream<Ch, Tr> &stream, Server &value)
template<typename Ch, typename Tr>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &stream, const Server &value)

Variables

const std::string DEFAULT_HOST = "localhost"
const boost::uint16_t DEFAULT_PORT = 55555
class Bus : public rsb::eventprocessing::Handler
#include <Bus.h>

Instances of this class provide access to a socket-based bus.

It is transparent for clients (connectors) of this class whether is accessed by running the bus server or by connecting to the bus server as a client.

In-direction connectors add themselves as event sinks using the addSink method.

Out-direction connectors submit events to the bus using the handle method.

Author

jmoringe

Subclassed by rsb::transport::socket::BusImpl, rsb::transport::socket::BusServer

Public Functions

~Bus()
virtual void addSink(InConnectorPtr sink) = 0
virtual void removeSink(const InConnector *sink) = 0
virtual void addConnection(BusConnectionPtr connection) = 0

Adds connection to the list of connections of the bus.

connection should start receiving events, only after being added to the bus.

Parameters
  • connection: The connection that should be added.

virtual void removeConnection(BusConnectionPtr connection) = 0

Removes connection from the list of connections of this bus.

connection is not closed or otherwise modified.

Parameters
  • connection: The connection that should be removed.

virtual bool isTcpnodelay() const = 0
virtual void handle(EventPtr event) = 0

Handle event.

Parameters
  • event: The event that should be handled.

virtual void handleIncoming(EventPtr event, BusConnectionPtr connection) = 0
virtual const std::string getTransportURL() const = 0
class BusConnection : public boost::enable_shared_from_this<BusConnection>, public Printable
#include <BusConnection.h>

Instances of this class implement connections to a socket-based bus.

The basic operations provided by this class are receiving an event by calling receiveEvent and submitting an event to the bus by calling sendEvent.

In a process which acts as a client for a particular bus, a single instance of this class is connected to the remote bus server and provides access to the bus for all participants in the process.

A process which acts as the server for a particular bus, manages (via the BusServer class) one BusConnection object for each client (remote process) connected to the bus.

This class is not thread-safe.

Author

jmoringe

Public Types

typedef boost::shared_ptr<boost::asio::ip::tcp::socket> SocketPtr

Public Functions

BusConnection(BusPtr bus, SocketPtr socket, bool client, bool tcpNoDelay = false)
~BusConnection()
void shutdown()
void startReceiving()
void sendEvent(EventPtr event, const std::string &wireSchema)
const std::string getTransportURL() const
class BusImpl : public virtual rsb::transport::socket::Bus
#include <BusImpl.h>

Author

jmoringe

Subclassed by rsb::transport::socket::BusServerImpl

Public Functions

BusImpl(AsioServiceContextPtr asioService, bool tcpnodelay = false)
~BusImpl()
void addSink(InConnectorPtr sink)
void removeSink(const InConnector *sink)
void addConnection(BusConnectionPtr connection)

Adds connection to the list of connections of the bus.

connection should start receiving events, only after being added to the bus.

Parameters
  • connection: The connection that should be added.

void removeConnection(BusConnectionPtr connection)

Removes connection from the list of connections of this bus.

connection is not closed or otherwise modified.

Parameters
  • connection: The connection that should be removed.

bool isTcpnodelay() const
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

void handleIncoming(EventPtr event, BusConnectionPtr connection)
void printContents(std::ostream &stream) const
const std::string getTransportURL() const
class BusServer : public virtual rsb::transport::socket::Bus
#include <BusServer.h>

Instances of this class provide access to a socket-based bus for local and remote bus clients.

Remote clients can connect to a server socket in order to send and receive events through the resulting socket connection.

Local clients (connectors) use the usual Bus interface to receive events submitted by remote clients and submit events which will be distributed to remote clients by the BusServer.

Author

jmoringe

Subclassed by rsb::transport::socket::BusServerImpl, rsb::transport::socket::LifecycledBusServer

Public Functions

~BusServer()
virtual void activate() = 0
virtual void deactivate() = 0
virtual void handleIncoming(EventPtr event, BusConnectionPtr connection) = 0
class BusServerImpl : public virtual rsb::transport::socket::BusImpl, public virtual rsb::transport::socket::BusServer, public boost::enable_shared_from_this<BusServerImpl>
#include <BusServerImpl.h>

Instances of this class provide access to a socket-based bus for local and remote bus clients.

Remote clients can connect to a server socket in order to send and receive events through the resulting socket connection.

Local clients (connectors) use the usual Bus interface to receive events submitted by remote clients and submit events which will be distributed to remote clients by the BusServerImpl.

Author

jmoringe

Public Functions

BusServerImpl(AsioServiceContextPtr asioService, boost::uint16_t port, bool tcpnodelay, bool waitForClientDisconnects)
~BusServerImpl()
void activate()

Activate the object.

Note

This member function can only be called when a boost::shared_ptr owning the object exists.

void deactivate()
void removeConnection(BusConnectionPtr connection)

Removes connection from the list of connections of this bus.

connection is not closed or otherwise modified.

Parameters
  • connection: The connection that should be removed.

void handleIncoming(EventPtr event, BusConnectionPtr connection)
const std::string getTransportURL() const
class ConnectorBase : public rsb::transport::ConverterSelectingConnector<std::string>
#include <ConnectorBase.h>

This class is intended to be used as a base class for connector classes of the socket-based transport.

It provides establishing and managing a connection to the bus via an instance of the Bus class.

Author

jmoringe

Subclassed by rsb::transport::socket::InConnector, rsb::transport::socket::OutConnector

Public Functions

ConnectorBase(FactoryPtr factory, ConverterSelectionStrategyPtr converters, const std::string &host, unsigned int port, Server server, bool tcpnodelay, bool waitForClientDisconnects = true)

Creates a connector for the given combination of host, port and server.

Parameters
  • converters: A strategy for converter selection within the newly created connector.

  • host: The host of the socket through which the newly created connector will operate.

  • port: The port of the socket through which the newly created connector will operate.

  • server: Controls whether the newly created connector should create a listening socket and wait for connections (value SERVER_YES), connect to an existing listen socket (value SERVER_NO) or try to automatically determine whether there already is a listening socket and create one only if necessary (value SERVER_AUTO).

  • tcpnodelay: Controls whether the TCP_NODELAY socket option should be set for the socket implementing the communication of the newly created connector. Setting this option trades decreased latency for decreased throughput.

  • waitForClientDisconnects: If true, delay shutdown of the server socket until all clients have disconnected.

~ConnectorBase()
Scope getScope() const
void setScope(const Scope &scope)
const std::string getTransportURL() const
class Factory
#include <Factory.h>

The singleton instance of this class is responsible for managing bus provider objects.

For each endpoint (i.e. address and port), at most one client or server bus provider can exist.

Attention

This class is not thread safe and needs to be accessed in a synchronized manner, except for getBus.

Author

jmoringe

Public Functions

Factory()
~Factory()
BusPtr getBus(const Server &serverMode, const std::string &host, const boost::uint16_t &port, bool tcpnodelay, bool waitForClientDisconnects)

Returns either a BusClient or Server depending on the chosen serverMode and the existence of a server in the current process.

class InConnector : public virtual rsb::transport::socket::ConnectorBase, public virtual rsb::transport::InConnector, public virtual rsb::eventprocessing::Handler
#include <InConnector.h>

Instances of this class receive events from a bus that is accessed via a socket connection.

The receiving and dispatching of events is done in push mode: each instance has a BusConnection which pushes appropriate events into the instance. The connector deserializes event payloads and pushes the events into handlers (usually objects which implement EventReceivingStrategy).

Author

jmoringe

Public Functions

InConnector(FactoryPtr factory, ConverterSelectionStrategyPtr converters, const std::string &host, unsigned int port, Server server, bool tcpnodelay, bool waitForClientDisconnects)

Creates a connector for the given combination of host, port and server.

Parameters
  • converters: A strategy for converter selection within the newly created connector.

  • host: The host of the socket through which the newly created connector will operate.

  • port: The port of the socket through which the newly created connector will operate.

  • server: Controls whether the newly created connector should create a listening socket and wait for connections (value SERVER_YES), connect to an existing listen socket (value SERVER_NO) or try to automatically determine whether there already is a listening socket and create one only if necessary (value SERVER_AUTO).

  • tcpnodelay: Controls whether the TCP_NODELAY socket option should be set for the socket implementing the communication of the newly created connector. Setting this option trades decreased latency for decreased throughput.

  • waitForClientDisconnects: If true, delay shutdown of the server socket until all clients have disconnected.

~InConnector()
void activate()
void deactivate()
void setScope(const Scope &scope)
void setQualityOfServiceSpecs(const QualityOfServiceSpec &specs)

Requests new QoS settings for publishing events.

Does not influence the receiving part.

Parameters
  • specs: QoS specification

Exceptions

void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

const std::string getTransportURL() const

Public Static Functions

static rsb::transport::InConnector *create(const rsc::runtime::Properties &args)
class LifecycledBusServer : public rsb::transport::socket::BusServer
#include <LifecycledBusServer.h>

A facade around BusServer instances to allow breaking dependency cycles.

This implementation specifically calls deactivate on the underlying server instance in its destructor. This is known to break a dependency cycle in BusServerImpl which would otherwise prevent clean destruction through shared_ptr instances.

Apart from this behavior, all calls are passed to the underlying instance.

Author

jwienke

Public Functions

LifecycledBusServer(BusServerPtr server)
~LifecycledBusServer()
void addSink(InConnectorPtr sink)
void removeSink(const InConnector *sink)
void addConnection(BusConnectionPtr connection)

Adds connection to the list of connections of the bus.

connection should start receiving events, only after being added to the bus.

Parameters
  • connection: The connection that should be added.

void removeConnection(BusConnectionPtr connection)

Removes connection from the list of connections of this bus.

connection is not closed or otherwise modified.

Parameters
  • connection: The connection that should be removed.

bool isTcpnodelay() const
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

void activate()
void deactivate()
void handleIncoming(EventPtr event, BusConnectionPtr connection)
const string getTransportURL() const
void printContents(std::ostream &stream) const
class OutConnector : public rsb::transport::socket::ConnectorBase, public rsb::transport::OutConnector
#include <OutConnector.h>

Instances of this connector class push events into Bus objects which take care of socket-based broadcast and delivery.

Author

jmoringe

Public Functions

OutConnector(FactoryPtr factory, ConverterSelectionStrategyPtr converters, const std::string &host, unsigned int port, Server server, bool tcpnodelay, bool waitForClientDisconnects = true)

Creates a connector for the given combination of host, port and server.

Parameters
  • converters: A strategy for converter selection within the newly created connector.

  • host: The host of the socket through which the newly created connector will operate.

  • port: The port of the socket through which the newly created connector will operate.

  • server: Controls whether the newly created connector should create a listening socket and wait for connections (value SERVER_YES), connect to an existing listen socket (value SERVER_NO) or try to automatically determine whether there already is a listening socket and create one only if necessary (value SERVER_AUTO).

  • tcpnodelay: Controls whether the TCP_NODELAY socket option should be set for the socket implementing the communication of the newly created connector. Setting this option trades decreased latency for decreased throughput.

  • waitForClientDisconnects: If true, delay shutdown of the server socket until all clients have disconnected.

~OutConnector()
void setScope(const Scope &scope)
void activate()
void deactivate()
void setQualityOfServiceSpecs(const QualityOfServiceSpec &specs)

Requests new QoS settings for publishing events.

Does not influence the receiving part.

Parameters
  • specs: QoS specification

Exceptions

void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

const std::string getTransportURL() const

Public Static Functions

static transport::OutConnector *create(const rsc::runtime::Properties &args)
namespace util

Functions

void freeMd5Hash(void *hash)
RSB_EXPORT std::ostream & rsb::util::operator<<(ostream & stream, const MD5 & sum)
class EventQueuePushHandler : public rsb::Handler
#include <EventQueuePushHandler.h>

A rsb::Handler for rsb::Listener s that pushes all received events on a rsc::SynchronizedQueue.

Author

jwienke

Public Functions

EventQueuePushHandler(boost::shared_ptr<rsc::threading::SynchronizedQueue<EventPtr>> queue, const std::string &method = "")

Constructs a new instance.

Parameters
  • queue: the queue to push received data on

  • method: method of this handler to react on, empty means all events

string getClassName() const
void printContents(std::ostream &stream) const
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.

class MD5Hasher

Public Types

typedef unsigned int u32
typedef unsigned char byte

Public Functions

MD5Hasher()
~MD5Hasher()
byte *hash(byte *buf, size_t nbytes)

FPM: At this point I diverge from GnuPG’s implementation to write my own wrapper function.

I’ll use this to hash the passphrase.

class MD5
#include <MD5.h>

A simple class representing an md5 sum for a given string.

Author

jwienke

Public Functions

MD5(const std::string &s)

Creates a new m5s sum for the given string.

Parameters
  • s: string to create sum for

~MD5()
string toHexString(const bool &pretty = false) const

Returns a hex encoded string of the sum.

Parameters
  • pretty: if true, the string will be separated in blocks by spaces

template<class T, class DisableEventWarning = void>
class QueuePushHandler : public rsb::Handler
#include <QueuePushHandler.h>

A rsb::Handler for rsb::Listener s that pushes all received data on a rsc::SynchronizedQueue.

This queue must handle shared pointers of the data type.

Author

jwienke

Template Parameters
  • T: data type received by the handler. All data is handeled as a shared pointer of this type

Public Functions

rsb::util::QueuePushHandler::STATIC_ASSERT_WARN_TEMPLATE(QUEUE_PUSH_HANDLER_EVENT_WARNING, (boost::is_same< DisableEventWarning, Event >::value||!boost::is_same< T, Event >::value), "You probably do not want to use QueuePushHandler with type Event. If you want to receive complete Event instances inside a queue, you need to use EventQueuePushHandler.If you really want to use this class and want to get rid of this warning, define the second template parameter of this class to Event, too.")
QueuePushHandler(boost::shared_ptr<rsc::threading::SynchronizedQueue<boost::shared_ptr<T>>> queue, const std::string &method = "")

Constructs a new instance.

Parameters
  • queue: the queue to push received data on

  • method: method of this handler to react on, empty means all events

std::string getClassName() const
void printContents(std::ostream &stream) const
void handle(EventPtr event)

Handle event.

Parameters
  • event: The event that should be handled.