DiaDes  0.1
DIAgnosis of Discrete-Event System
Public Types | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
Diades::Graph::Node Class Reference

#include <Node.hh>

Public Types

typedef Diades::Utils::Exception< NodeException
 
typedef vector< Node >::size_type SizeType
 
typedef SizeType NodeId
 

Public Member Functions

Constructors
 Node ()=default
 
 Node (const Node &node)=default
 
 Node (Node &&node)=default
 
Nodeoperator= (Node &&other)=default
 
 Node (NodeData *data)
 
 ~Node ()=default
 
NodeDatadata ()
 
Nodeoperator= (const Node &node)=default
 
Accessors
SizeType memoryUsage () const
 
SizeType degree () const
 
SizeType outDeg () const
 
SizeType inDeg () const
 
OutEdgeIterator outEdgeBegin () const
 
OutEdgeIterator outEdgeEnd () const
 
InEdgeIterator inEdgeBegin () const
 
InEdgeIterator inEdgeEnd () const
 
bool valid () const
 
bool isValid () const
 
bool operator== (const Node &node) const
 
bool operator!= (const Node &node) const
 
bool operator< (const Node &node) const
 
bool operator> (const Node &node) const
 
const Graphowner () const
 
NodeId id () const
 
void printInformation () const
 

Static Public Member Functions

static string typeName ()
 

Private Member Functions

void create (NodeId idt, Graph *own)
 
void destroy ()
 
void changeId (NodeId id)
 

Private Attributes

NodeData_nData
 

Friends

class Graph
 the underling NodeData of the Node More...
 
ostream & operator<< (ostream &os, const Node &node)
 

Detailed Description

A Node of the Graph

A Node of a Graph can have input edges (Edge) or output edges (Edge) To associate an information with one Node, you can use a EdgeMap<T>

Author
Y. Pencolé
Version
1.0
Date
last update Feb 21 2017

Definition at line 30 of file Node.hh.

Member Typedef Documentation

◆ Exception

typedef Diades::Utils::Exception<Node> Diades::Graph::Node::Exception

Definition at line 38 of file Node.hh.

◆ NodeId

typedef SizeType Diades::Graph::Node::NodeId

Definition at line 42 of file Node.hh.

◆ SizeType

typedef vector<Node>::size_type Diades::Graph::Node::SizeType

Definition at line 41 of file Node.hh.

Constructor & Destructor Documentation

◆ Node() [1/4]

Diades::Graph::Node::Node ( )
default

Default constructor.

Create an invalid node.

Referenced by memoryUsage().

◆ Node() [2/4]

Diades::Graph::Node::Node ( const Node node)
default

Copy constructor.

Parameters
nodeNode to copy

◆ Node() [3/4]

Diades::Graph::Node::Node ( Node &&  node)
default

Move constructor.

Parameters
nodeNode to copy

◆ Node() [4/4]

Diades::Graph::Node::Node ( NodeData data)
inline

Constructor that maps a Node with a NodeData

Parameters
data

Definition at line 85 of file Node.hh.

References require, and ~Node().

◆ ~Node()

Diades::Graph::Node::~Node ( )
default

Desctuctor

Referenced by Node().

Member Function Documentation

◆ changeId()

void Diades::Graph::Node::changeId ( NodeId  id)
inlineprivate
Parameters
idthe new Id of the Node

Definition at line 291 of file Node.hh.

References _nData, require, Diades::Graph::NodeData::setIdentifier(), and valid().

◆ create()

void Diades::Graph::Node::create ( NodeId  idt,
Graph own 
)
inlineprivate
Parameters
idtthe identifier of the created node
ownthe Graph that owns the created node

Create the NodeData of id idt in the Graph *own

Definition at line 70 of file NodeImpl.hh.

References _nData, ensure, require, Diades::Graph::NodeData::setIdentifier(), Diades::Graph::NodeData::setOwner(), and valid().

Referenced by id().

◆ data()

NodeData* Diades::Graph::Node::data ( )
inline
Returns
the data associated with the Node

Definition at line 101 of file Node.hh.

References _nData, and operator=().

◆ degree()

SizeType Diades::Graph::Node::degree ( ) const
inline

Degree of a node

Precondition
valid()
Returns
the number of input and output edges of the node.

Definition at line 128 of file Node.hh.

References inDeg(), outDeg(), require, and valid().

◆ destroy()

void Diades::Graph::Node::destroy ( )
inlineprivate

Destroy the underlying NodeData

Definition at line 275 of file Node.hh.

References _nData, ensure, Diades::Graph::NodeData::inEdges(), Diades::Graph::NodeData::outEdges(), require, and valid().

◆ id()

NodeId Diades::Graph::Node::id ( ) const
inline

◆ inDeg()

SizeType Diades::Graph::Node::inDeg ( ) const
inline

Input Degree of a node

Precondition
valid()
Returns
the number of input edges of the node.

Definition at line 148 of file Node.hh.

References _nData, Diades::Graph::NodeData::inEdgesNb(), require, and valid().

Referenced by degree(), and printInformation().

◆ inEdgeBegin()

InEdgeIterator Diades::Graph::Node::inEdgeBegin ( ) const
inline

Iterator on Edges

Precondition
valid()
Returns
an iterator pointing to the first input edge

Definition at line 178 of file Node.hh.

References _nData, Diades::Graph::NodeData::inEdges(), require, and valid().

Referenced by Diades::Graph::Graph::inEdgeBegin().

◆ inEdgeEnd()

InEdgeIterator Diades::Graph::Node::inEdgeEnd ( ) const
inline

Iterator on Edges

Precondition
valid()
Returns
a forward iterator pointing to the end of all input edges

Definition at line 188 of file Node.hh.

References _nData, Diades::Graph::NodeData::inEdges(), require, and valid().

Referenced by Diades::Graph::Graph::inEdgeEnd().

◆ isValid()

bool Diades::Graph::Node::isValid ( ) const
inline

Validity (rename of valid() for consistency)

Returns
true if the node is valid.

Definition at line 202 of file Node.hh.

References valid().

Referenced by Diades::Graph::NodeData::owner().

◆ memoryUsage()

SizeType Diades::Graph::Node::memoryUsage ( ) const
inline

Size of a node

Returns
the memory usage of a node

Definition at line 119 of file Node.hh.

References Node().

◆ operator!=()

bool Diades::Graph::Node::operator!= ( const Node node) const
inline

Inequality operator

Parameters
nodeNode to compare
Returns
true if the nodes are not the same in the Graph

Definition at line 217 of file Node.hh.

References operator<().

◆ operator<()

bool Diades::Graph::Node::operator< ( const Node node) const
inline

Order of Node

Definition at line 83 of file NodeImpl.hh.

References id(), owner(), and valid().

Referenced by operator!=().

◆ operator=() [1/2]

Node& Diades::Graph::Node::operator= ( Node &&  other)
default

Move assignement (default)

Parameters
other
Returns
the current ComposableModel

Referenced by data().

◆ operator=() [2/2]

Node& Diades::Graph::Node::operator= ( const Node node)
default

Assignation

◆ operator==()

bool Diades::Graph::Node::operator== ( const Node node) const
inline

Equality operator

Parameters
nodeNode to compare
Returns
true if the nodes are the same in the Graph

Definition at line 208 of file Node.hh.

References _nData.

◆ operator>()

bool Diades::Graph::Node::operator> ( const Node node) const
inline

Order of Node

Definition at line 230 of file Node.hh.

References owner().

◆ outDeg()

SizeType Diades::Graph::Node::outDeg ( ) const
inline

Output Degree of a node

Precondition
valid()
Returns
the number of output edges of the node.

Definition at line 138 of file Node.hh.

References _nData, Diades::Graph::NodeData::outEdgesNb(), require, and valid().

Referenced by degree(), and printInformation().

◆ outEdgeBegin()

OutEdgeIterator Diades::Graph::Node::outEdgeBegin ( ) const
inline

Iterator on Edges

Precondition
valid()
Returns
a forward iterator pointing to the first output edge

Definition at line 158 of file Node.hh.

References _nData, Diades::Graph::NodeData::outEdges(), require, and valid().

Referenced by Diades::Graph::Graph::outEdgeBegin().

◆ outEdgeEnd()

OutEdgeIterator Diades::Graph::Node::outEdgeEnd ( ) const
inline

Iterator on Edges

Precondition
valid()
Returns
a forward iterator pointing to the end of all output edges

Definition at line 168 of file Node.hh.

References _nData, Diades::Graph::NodeData::outEdges(), require, and valid().

Referenced by Diades::Graph::Graph::outEdgeEnd().

◆ owner()

const Graph & Diades::Graph::Node::owner ( ) const
inline

◆ printInformation()

void Diades::Graph::Node::printInformation ( ) const
inline

Print Node Information

Definition at line 52 of file NodeImpl.hh.

References id(), inDeg(), outDeg(), owner(), and valid().

Referenced by id().

◆ typeName()

static string Diades::Graph::Node::typeName ( )
inlinestatic

Definition at line 34 of file Node.hh.

◆ valid()

bool Diades::Graph::Node::valid ( ) const
inline

Friends And Related Function Documentation

◆ Graph

friend class Graph
friend

the underling NodeData of the Node

Node is a friend class of Graph

EdgeData is a friend class of Graph

Definition at line 301 of file Node.hh.

◆ operator<<

ostream& operator<< ( ostream &  os,
const Node node 
)
friend

Output stream operator

Postcondition
the output stream os contains the identifier node.id() of the Node node

Definition at line 309 of file Node.hh.

Member Data Documentation

◆ _nData

NodeData* Diades::Graph::Node::_nData
private

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