salsa 0.7.1
Loading...
Searching...
No Matches
Salsa::Node Class Reference

Base Node class. More...

#include <Node.hh>

Inheritance diagram for Salsa::Node:
Salsa::NodeZyre

Public Member Functions

 Node (std::string name="", std::string uuid="")
 
virtual ~Node ()
 
virtual void print () const
 
virtual void json (Json::Value &root)
 
virtual void publish ()
 
std::string name () const
 Returns node name.
 
std::string uuid () const
 Returns node UUID.
 
std::string hostname () const
 Returns node hostname.
 
std::weak_ptr< Nodeparent () const
 Returns parent node.
 
std::vector< std::shared_ptr< Node > > nodes () const
 Returns nodes.
 
void name (std::string n)
 Sets node name.
 
void uuid (std::string uuid)
 Sets node uuid.
 
void hostname (std::string h)
 Sets node hostname.
 
void parent (std::weak_ptr< Node > node)
 Sets parent.
 
void add (std::shared_ptr< Node > node)
 Adds node to the list of nodes.
 
std::shared_ptr< Nodefind (std::string name) const
 Find node by name.
 
void removeByUUID (std::string uuid)
 Remove node by uuid.
 
void add (std::shared_ptr< Publisher > pPublisher)
 Adds publisher to the node.
 
std::vector< std::shared_ptr< Publisher > > publishers () const
 Returns publishers.
 
NodeInfo * nodeInfo () const
 Returns Node Info.
 

Protected Attributes

NodeInfo * mpNodeInfo {new NodeInfo()}
 Node Info.
 
std::weak_ptr< NodempParent
 Parent node.
 
std::vector< std::shared_ptr< Node > > mChildNodes = {}
 List of nodes.
 
std::vector< std::shared_ptr< Publisher > > mPublishers = {}
 List of publishers.
 

Detailed Description

Constructor & Destructor Documentation

◆ Node()

Salsa::Node::Node ( std::string name = "",
std::string uuid = "" )

Constructor

Definition at line 5 of file Node.cc.

References mpNodeInfo, and uuid().

◆ ~Node()

Salsa::Node::~Node ( )
virtual

Destructor

Definition at line 17 of file Node.cc.

References mpNodeInfo, and mPublishers.

Member Function Documentation

◆ add() [1/2]

void Salsa::Node::add ( std::shared_ptr< Node > node)
inline

Adds node to the list of nodes.

Definition at line 53 of file Node.hh.

References mChildNodes.

Referenced by Salsa::NodeZyre::addSocket().

◆ add() [2/2]

void Salsa::Node::add ( std::shared_ptr< Publisher > pPublisher)
inline

Adds publisher to the node.

Definition at line 65 of file Node.hh.

References mPublishers.

◆ find()

std::shared_ptr< Node > Salsa::Node::find ( std::string name) const

Find node by name.

Returns node by name

Definition at line 103 of file Node.cc.

References mChildNodes, and name().

◆ hostname() [1/2]

std::string Salsa::Node::hostname ( ) const
inline

Returns node hostname.

Definition at line 37 of file Node.hh.

References mpNodeInfo.

Referenced by Salsa::NodeZyre::init().

◆ hostname() [2/2]

void Salsa::Node::hostname ( std::string h)
inline

Sets node hostname.

Definition at line 48 of file Node.hh.

References mpNodeInfo.

◆ json()

void Salsa::Node::json ( Json::Value & root)
virtual

Returns Node in json format

Definition at line 34 of file Node.cc.

References mChildNodes.

◆ name() [1/2]

std::string Salsa::Node::name ( ) const
inline

Returns node name.

Definition at line 33 of file Node.hh.

References mpNodeInfo.

Referenced by find().

◆ name() [2/2]

void Salsa::Node::name ( std::string n)
inline

Sets node name.

Definition at line 44 of file Node.hh.

References mpNodeInfo.

◆ nodeInfo()

NodeInfo * Salsa::Node::nodeInfo ( ) const
inline

Returns Node Info.

Definition at line 69 of file Node.hh.

References mpNodeInfo.

◆ nodes()

std::vector< std::shared_ptr< Node > > Salsa::Node::nodes ( ) const
inline

Returns nodes.

Definition at line 41 of file Node.hh.

References mChildNodes.

◆ parent() [1/2]

std::weak_ptr< Node > Salsa::Node::parent ( ) const
inline

Returns parent node.

Definition at line 39 of file Node.hh.

References mpParent.

◆ parent() [2/2]

void Salsa::Node::parent ( std::weak_ptr< Node > node)
inline

Sets parent.

Definition at line 50 of file Node.hh.

References mpParent.

◆ print()

void Salsa::Node::print ( ) const
virtual

Prints node info

Definition at line 81 of file Node.cc.

References mChildNodes, mpNodeInfo, mpParent, and mPublishers.

◆ publish()

void Salsa::Node::publish ( )
virtual

Publish network status

Definition at line 140 of file Node.cc.

◆ publishers()

std::vector< std::shared_ptr< Publisher > > Salsa::Node::publishers ( ) const
inline

Returns publishers.

Definition at line 67 of file Node.hh.

References mPublishers.

◆ removeByUUID()

void Salsa::Node::removeByUUID ( std::string uuid)

Remove node by uuid.

Removes node by uuid

Definition at line 120 of file Node.cc.

References mChildNodes.

◆ uuid() [1/2]

std::string Salsa::Node::uuid ( ) const
inline

Returns node UUID.

Definition at line 35 of file Node.hh.

References mpNodeInfo.

Referenced by Node(), and uuid().

◆ uuid() [2/2]

void Salsa::Node::uuid ( std::string uuid)
inline

Sets node uuid.

Definition at line 46 of file Node.hh.

References mpNodeInfo, and uuid().

Member Data Documentation

◆ mChildNodes

std::vector<std::shared_ptr<Node> > Salsa::Node::mChildNodes = {}
protected

List of nodes.

Definition at line 74 of file Node.hh.

Referenced by add(), find(), json(), nodes(), print(), and removeByUUID().

◆ mpNodeInfo

NodeInfo* Salsa::Node::mpNodeInfo {new NodeInfo()}
protected

Node Info.

Definition at line 72 of file Node.hh.

Referenced by hostname(), hostname(), name(), name(), Node(), nodeInfo(), print(), uuid(), uuid(), ~Node(), and Salsa::NodeZyre::~NodeZyre().

◆ mpParent

std::weak_ptr<Node> Salsa::Node::mpParent
protected

Parent node.

Definition at line 73 of file Node.hh.

Referenced by parent(), parent(), and print().

◆ mPublishers

std::vector<std::shared_ptr<Publisher> > Salsa::Node::mPublishers = {}
protected

List of publishers.

Definition at line 75 of file Node.hh.

Referenced by add(), print(), publishers(), and ~Node().


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