BlueZero (BØ)
Middleware for distributed applications
publisher.h
1 #ifndef B0__PUBLISHER_H__INCLUDED
2 #define B0__PUBLISHER_H__INCLUDED
3 
4 #include <string>
5 
6 #include <b0/socket.h>
7 
8 namespace b0
9 {
10 
11 class Node;
12 
21 class Publisher : public Socket
22 {
23 public:
25 
29  Publisher(Node *node, std::string topic, bool managed = true, bool notify_graph = true);
30 
34  virtual ~Publisher();
35 
39  void log(LogLevel level, std::string message) const override;
40 
44  virtual void init() override;
45 
49  virtual void cleanup() override;
50 
54  std::string getTopicName();
55 
59  virtual void publish(const std::string &msg);
60 
61 protected:
65  virtual void connect();
66 
70  virtual void disconnect();
71 
73  const bool notify_graph_;
74 };
75 
76 } // namespace b0
77 
78 #endif // B0__PUBLISHER_H__INCLUDED
LogLevel
Definition: interface.h:23
virtual void publish(const std::string &msg)
Publish a message.
virtual void init() override
Perform initialization and optionally send graph notify.
virtual ~Publisher()
Publisher destructor.
virtual void cleanup() override
Perform cleanup and optionally send graph notify.
The abstraction for a node in the network.
Definition: node.h:40
virtual void disconnect()
Disconnect from the remote address.
The publisher class.
Definition: publisher.h:21
void log(LogLevel level, std::string message) const override
Log a message using node&#39;s logger, prepending this publisher informations.
std::string getTopicName()
Return the name of this publisher&#39;s topic.
The Socket class.
Definition: socket.h:31
virtual void log(LogLevel level, std::string message) const =0
Log a message to the remote logger, with a specified level.
virtual void connect()
Connect to the remote address.
Publisher(Node *node, std::string topic, bool managed=true, bool notify_graph=true)
Construct an Publisher child of the specified Node.
const bool notify_graph_
If false this socket will not send announcement to resolv (i.e. it will be "invisible") ...
Definition: publisher.h:73
Definition: node.h:17