31 #include <boost/shared_ptr.hpp>
32 #include <boost/function.hpp>
34 #include <rsc/runtime/TypeStringTools.h>
42 #include "rsb/rsbexports.h"
62 std::set<std::string> getMethods()
const;
63 bool acceptsMethod(
const std::string& method)
const;
73 explicit Handler(
const std::string& method =
"");
81 explicit Handler(
const std::set<std::string>& methods);
86 return rsc::runtime::typeName(
typeid(*
this));
104 const std::string& method =
"");
106 std::string getClassName()
const;
107 void printContents(std::ostream& stream)
const;
130 return "DataFunctionHandler";
134 stream <<
"DataType = " << rsc::runtime::typeName<T>()
135 <<
", function = " <<
function;
143 this->
function(boost::static_pointer_cast<T>(
event->getData()));
156 template<
class DataType>
163 notify(boost::static_pointer_cast<DataType>(event->getData()));
166 virtual void notify(boost::shared_ptr<DataType> data) = 0;
180 : filter(filter), next(next) {
184 if (this->filter->match(event)) {
185 this->next->handle(event);
A Handler that automatically performs the desired type casting.
DataFunctionHandler(const DataFunction &function)
boost::function< void(DataPtr)> DataFunction
void handle(EventPtr event)
Handle event.
void handle(EventPtr event)
Handle event.
std::string getClassName() const
Asynchronously called handler interface on the client level.
FilteringHandler(rsb::filter::FilterPtr filter, HandlerPtr next)
boost::shared_ptr< Filter > FilterPtr
boost::function< void(EventPtr)> EventFunction
void handle(EventPtr event)
Handle event.
std::string getClassName() const
A utility class to simplify event handling in ordinary functions or member functions.
boost::shared_ptr< Handler > HandlerPtr
A utility class to simplify data handling by automatically passing the data of the desired type to a ...
rsb::filter::FilterPtr filter
boost::shared_ptr< T > DataPtr
Implementations of this class can be used in contexts where an "event sink" is required.
std::set< std::string > methods
A utility class that forwards events to another rsb::Handler object if they match a given rsb::filter...
boost::shared_ptr< Event > EventPtr
void printContents(std::ostream &stream) const
virtual void notify(boost::shared_ptr< DataType > data)=0