ZIO
Python and C++ interface to ZeroMQ and Zyre
node.hpp
Go to the documentation of this file.
1 
2 #ifndef ZIO_NODE_HPP_SEEN
3 #define ZIO_NODE_HPP_SEEN
4 
5 #include "zio/port.hpp"
6 
7 namespace zio {
8 
30  class Node {
31  nickname_t m_nick;
32  origin_t m_origin;
33 
34  std::string m_hostname;
35  Peer* m_peer;
36  std::unordered_map<std::string, portptr_t> m_ports;
37  std::vector<std::string> m_portnames; // in order of creation.
38  bool m_verbose{false};
39 
40  public:
43  const std::string& hostname="");
44 
45  ~Node();
46 
48  nickname_t nick() const { return m_nick; }
50  origin_t origin() const { return m_origin; }
52  const std::vector<std::string>& portnames() const {
53  return m_portnames;
54  }
55 
57  void set_nick(const nickname_t& nick) { m_nick = nick; }
58 
61 
63  void set_verbose(bool verbose = true);
64  bool verbose() const { return m_verbose; }
65 
69  portptr_t port(const std::string& name, int stype);
70 
72  portptr_t port(const std::string& name);
73 
78  void online(const headerset_t& extra_headers = {});
79 
81  void offline();
82 
83  };
84 }
85 
86 #endif
bool verbose() const
Definition: node.hpp:64
An identified vertex in a ported, directed graph.
Definition: node.hpp:30
void online(const headerset_t &extra_headers={})
Bring the node online.
Definition: node.cpp:59
const std::vector< std::string > & portnames() const
Return names of all ports in order of their creation.
Definition: node.hpp:52
void set_nick(const nickname_t &nick)
Set the node nickname.
Definition: node.hpp:57
void set_verbose(bool verbose=true)
Set verbose for underlying Zyre and internal debug messages.
Definition: node.cpp:96
portptr_t port(const std::string &name, int stype)
Create a named port with the given socket type.
Definition: node.cpp:37
Node(nickname_t nick="", origin_t origin=0, const std::string &hostname="")
Create a node.
Definition: node.cpp:19
name
Definition: setup.py:4
std::map< header_key_t, header_value_t > headerset_t
Definition: peer.hpp:22
nickname_t nick() const
Return a previously set node nickname.
Definition: node.hpp:48
origin_t origin() const
Return a previously set node origin.
Definition: node.hpp:50
void set_origin(origin_t origin)
Set the node origin.
Definition: node.cpp:89
std::shared_ptr< Port > portptr_t
The context can&#39;t be copied and ports like to be shared.
Definition: port.hpp:148
uint64_t origin_t
Definition: message.hpp:36
std::string nickname_t
A peer asserts a nickname.
Definition: peer.hpp:12
void offline()
Bring the node offline.
Definition: node.cpp:78
implementation of ZIO data flow protocol endpoints
Definition: actor.hpp:14
Peer at the network to discover peers and advertise self.
Definition: peer.hpp:44
~Node()
Definition: node.cpp:31