iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MySubscriber.H
1 #ifndef MYSUBSCRIBER_H
2 #define MYSUBSCRIBER_H
3 
5 
6 NRT_DECLARE_MESSAGESUBSCRIBER_PORT(SomeTextPort, nrt::Message<std::string>, void, "Some text to print");
7 NRT_DECLARE_MESSAGESUBSCRIBER_PORT(SomeNumberPort, nrt::Message<float>, void, "Some number to print");
8 
9 class MySubscriber : public nrt::Module,
10  public nrt::MessageSubscriber<SomeTextPort, SomeNumberPort>
11 {
12  public:
13  // Constructor inherited from nrt::Module
14  using nrt::Module::Module;
15 
16  // Virtual destructor for safe inheritance, here it is a no-op
17  virtual ~MySubscriber() { }
18 
19  // Callback function associated with port SomeTextPort
20  virtual void onMessage(SomeTextPort::InPtr msg);
21 
22  // Callback function associated with port SomeNumberPort
23  virtual void onMessage(SomeNumberPort::InPtr msg);
24 };
25 
26 #endif // MYSUBSCRIBER_H