10 #ifndef mm_mux_demux_SUBSCRIBER_HPP_ 11 #define mm_mux_demux_SUBSCRIBER_HPP_ 33 template<
unsigned int ID,
typename DataType>
47 void (*f)(DataType)) :
54 ss <<
"id '" <<
id <<
"' has not been registered";
57 if ( !MessageRegistry::isRegisteredWithType<DataType>(ID) ) {
59 ss <<
"id '" <<
id <<
"' is registered, but not with this type";
75 void (C::*f)(DataType), C &c) :
78 function(new
ecl::PartiallyBoundUnaryMemberFunction<C, DataType,void>(f,c))
87 void processPacket(
const unsigned char* buffer,
const unsigned int& size) {
static void registerSubscriber(const std::string &name, const unsigned int &id, void(C::*processPacket)(const unsigned char *, const unsigned int &), C &s)
Register a callback with the specified demux.
static bool isRegistered(const int &id)
ecl::UnaryFunction< DataType, void > * function
static void unregisterSubscriber(const std::string &name, const unsigned int &id)
mm_messages::ByteArray ByteArray
Short description of this file.
Subscriber(const std::string &name, void(*f)(DataType))
Subscriber(const std::string &name, void(C::*f)(DataType), C &c)
std::vector< unsigned char > ByteArray
void processPacket(const unsigned char *buffer, const unsigned int &size)
void f(int i) ecl_debug_throw_decl(StandardException)
static T decode(const unsigned char *buffer, const unsigned int &size)
mm_messages::MessageRegistry MessageRegistry