salsa  0.4.0
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::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 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. More...
 
void removeByUUID (std::string uuid)
 Remove node by uuid. More...
 
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

◆ find()

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

Find node by name.

Returns node by name

Definition at line 113 of file Node.cc.

References mChildNodes, and name().

◆ json()

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

Returns Node in json format

Definition at line 34 of file Node.cc.

Referenced by publish().

◆ print()

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

Prints node info

Definition at line 91 of file Node.cc.

References mChildNodes, mpNodeInfo, mpParent, and mPublishers.

◆ publish()

void Salsa::Node::publish ( )
virtual

Publish network status

Definition at line 150 of file Node.cc.

References json(), mPublishers, name(), parent(), and publishers().

◆ removeByUUID()

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

Remove node by uuid.

Removes node by uuid

Definition at line 130 of file Node.cc.

References mChildNodes.


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