ZIO
Python and C++ interface to ZeroMQ and Zyre
Public Member Functions | List of all members
zio::Node Class Reference

An identified vertex in a ported, directed graph. More...

#include <node.hpp>

Public Member Functions

 Node (nickname_t nick="", origin_t origin=0, const std::string &hostname="")
 Create a node. More...
 
 ~Node ()
 
nickname_t nick () const
 Return a previously set node nickname. More...
 
origin_t origin () const
 Return a previously set node origin. More...
 
const std::vector< std::string > & portnames () const
 Return names of all ports in order of their creation. More...
 
void set_nick (const nickname_t &nick)
 Set the node nickname. More...
 
void set_origin (origin_t origin)
 Set the node origin. More...
 
void set_verbose (bool verbose=true)
 Set verbose for underlying Zyre and internal debug messages. More...
 
bool verbose () const
 
portptr_t port (const std::string &name, int stype)
 Create a named port with the given socket type. More...
 
portptr_t port (const std::string &name)
 Return a previously created port. More...
 
void online (const headerset_t &extra_headers={})
 Bring the node online. More...
 
void offline ()
 Bring the node offline. More...
 

Detailed Description

An identified vertex in a ported, directed graph.

Each port (a zio::Port) is named uniquely within the node and has a ZeroMQ socket which may (simultaneously) bind and connect.

Every bind is advertised for discovery by a zio::Peer.

Each connect may be direct which completes immediately or indirect (given based on node/port names) which waits for peer discovery to resolve.

Nodes start in "offline" state. During that state, ports may be created. The ports also start in "offline" state and while offline they may bind() or connect(). When a node is brought "online" it brings all ports "online" and it is then when any bind() or connect() and associated discovery are performed. A node and its ports may be taken subsequently "offline" and the cycle repeated.

Definition at line 30 of file node.hpp.

Constructor & Destructor Documentation

◆ Node()

zio::Node::Node ( nickname_t  nick = "",
origin_t  origin = 0,
const std::string &  hostname = "" 
)

Create a node.

Definition at line 19 of file node.cpp.

◆ ~Node()

zio::Node::~Node ( )

Definition at line 31 of file node.cpp.

Member Function Documentation

◆ nick()

nickname_t zio::Node::nick ( ) const
inline

Return a previously set node nickname.

Definition at line 48 of file node.hpp.

◆ offline()

void zio::Node::offline ( )

Bring the node offline.

Definition at line 78 of file node.cpp.

◆ online()

void zio::Node::online ( const headerset_t extra_headers = {})

Bring the node online.

The extra headers are merged with those provided by this nodes zio::Peer.

Definition at line 59 of file node.cpp.

◆ origin()

origin_t zio::Node::origin ( ) const
inline

Return a previously set node origin.

Definition at line 50 of file node.hpp.

◆ port() [1/2]

zio::portptr_t zio::Node::port ( const std::string &  name,
int  stype 
)

Create a named port with the given socket type.

If port of given name exits, return it.

Definition at line 37 of file node.cpp.

◆ port() [2/2]

zio::portptr_t zio::Node::port ( const std::string &  name)

Return a previously created port.

Definition at line 49 of file node.cpp.

◆ portnames()

const std::vector<std::string>& zio::Node::portnames ( ) const
inline

Return names of all ports in order of their creation.

Definition at line 52 of file node.hpp.

◆ set_nick()

void zio::Node::set_nick ( const nickname_t nick)
inline

Set the node nickname.

Definition at line 57 of file node.hpp.

◆ set_origin()

void zio::Node::set_origin ( origin_t  origin)

Set the node origin.

Definition at line 89 of file node.cpp.

◆ set_verbose()

void zio::Node::set_verbose ( bool  verbose = true)

Set verbose for underlying Zyre and internal debug messages.

Definition at line 96 of file node.cpp.

◆ verbose()

bool zio::Node::verbose ( ) const
inline

Definition at line 64 of file node.hpp.


The documentation for this class was generated from the following files: