bpp-core  2.1.0
bpp::BasicTNode Class Reference

Simple implementation of TNode. More...

#include <Bpp/Graph/BasicTNode.h>

+ Inheritance diagram for bpp::BasicTNode:
+ Collaboration diagram for bpp::BasicTNode:

List of all members.

Public Member Functions

 BasicTNode ()
 Simple constructor.
virtual ~BasicTNode ()
 Destructor.
 BasicTNode (const BasicTNode &node)
 Copy constructor.
BasicTNodeoperator= (const BasicTNode &node)
 Assignation operator.
BasicTNodeclone () const
 Create a copy of this object and send a pointer to it.
const BasicTNodegetNeighbor (int pos) const
BasicTNodegetNeighbor (int pos)
int degree () const
 Get the degree i.e. the number of neighbors of this node.
const BasicTNodeoperator[] (int i) const
 Direct access to a neighbor in const context.
BasicTNodeoperator[] (int i)
 Direct access to a neighbor.
bool hasFather () const
 Tell if the node has a father.
bool hasFathers () const
 Tell if this node has one or more father nodes.
int getNumberOfFathers () const
 Give the number of father nodes for this node.
const BasicTNodegetFather (int pos) const
 Get a particular father in const environment.
BasicTNodegetFather (int pos)
 Get a particular father.
const BasicTNodegetFather () const
 Get the father in const environment.
BasicTNodegetFather ()
 Get the father.
virtual bool isFather (const BasicTNode *node) const
 Tell if the node is a father of this node.
virtual void addFather (BasicTNode *node)
 Add a father to this node.
virtual BasicTNoderemoveFather ()
 Remove the father of this node.
bool hasSons () const
 Tell if this node has one or more son nodes.
int getNumberOfSons () const
 Give the number of son nodes for this node.
const BasicTNodegetSon (int pos) const
 Get a particular son in const environment.
BasicTNodegetSon (int pos)
 Get a particular son.
virtual bool isSon (const BasicTNode *node) const
 Tell if a node is son of this node.
virtual void addSon (BasicTNode *node)
 Add a son to this node.
virtual void removeSon (BasicTNode *son)
 Remove a son of this node.
virtual BasicTNoderemoveSon (int pos)
 Remove a son of this node.

Private Attributes

std::vector< BasicTNode * > sons_
BasicTNodefather_

Detailed Description

Simple implementation of TNode.

Contains only methods for node manipulation.

Author:
Sylvain Gaillard

Definition at line 54 of file BasicTNode.h.


Constructor & Destructor Documentation

Simple constructor.

Definition at line 63 of file BasicTNode.h.

Referenced by clone().

BasicTNode::~BasicTNode ( ) [virtual]

Destructor.

When destroyed, the node remove himself as son of its father and as father of its sons.

Definition at line 44 of file BasicTNode.cpp.

References father_, removeSon(), and sons_.

Copy constructor.

Definition at line 53 of file BasicTNode.cpp.


Member Function Documentation

void BasicTNode::addFather ( BasicTNode node) [virtual]

Add a father to this node.

Definition at line 132 of file BasicTNode.cpp.

References addSon(), father_, isFather(), and isSon().

Referenced by addSon().

void BasicTNode::addSon ( BasicTNode node) [virtual]

Add a son to this node.

Definition at line 177 of file BasicTNode.cpp.

References addFather(), isFather(), isSon(), and sons_.

Referenced by addFather().

BasicTNode* bpp::BasicTNode::clone ( ) const [inline, virtual]

Create a copy of this object and send a pointer to it.

Returns:
A pointer toward the copy object.

Implements bpp::TNode.

Definition at line 83 of file BasicTNode.h.

References BasicTNode().

int bpp::BasicTNode::degree ( ) const [inline, virtual]

Get the degree i.e. the number of neighbors of this node.

Implements bpp::UNode.

Definition at line 92 of file BasicTNode.h.

References father_, and sons_.

const BasicTNode * BasicTNode::getFather ( int  pos) const [virtual]

Get a particular father in const environment.

Implements bpp::TNode.

Definition at line 104 of file BasicTNode.cpp.

References getFather().

BasicTNode * BasicTNode::getFather ( int  pos) [virtual]

Get a particular father.

Implements bpp::TNode.

Definition at line 111 of file BasicTNode.cpp.

References getFather().

const BasicTNode * BasicTNode::getFather ( ) const [virtual]

Get the father in const environment.

Implements bpp::TNode.

Definition at line 118 of file BasicTNode.cpp.

References father_.

Referenced by getFather().

Get the father.

Implements bpp::TNode.

Definition at line 122 of file BasicTNode.cpp.

References father_.

const BasicTNode * BasicTNode::getNeighbor ( int  pos) const [virtual]

Get a neighbor of this node in const context.

Parameters:
posthe position of the neighbor to get.
Returns:
A pointer toward the neighbor node.

Implements bpp::TNode.

Definition at line 66 of file BasicTNode.cpp.

References father_, and sons_.

BasicTNode * BasicTNode::getNeighbor ( int  pos) [virtual]

Get a neighbor of this node.

Parameters:
posthe position of the neighbor to get.
Returns:
A pointer toward the neighbor node.

Implements bpp::TNode.

Definition at line 76 of file BasicTNode.cpp.

References father_, and sons_.

int bpp::BasicTNode::getNumberOfFathers ( ) const [inline, virtual]

Give the number of father nodes for this node.

Implements bpp::ONode.

Definition at line 104 of file BasicTNode.h.

References father_.

int bpp::BasicTNode::getNumberOfSons ( ) const [inline, virtual]

Give the number of son nodes for this node.

Implements bpp::ONode.

Definition at line 131 of file BasicTNode.h.

References sons_.

const BasicTNode * BasicTNode::getSon ( int  pos) const [virtual]

Get a particular son in const environment.

Implements bpp::TNode.

Definition at line 155 of file BasicTNode.cpp.

References sons_.

BasicTNode * BasicTNode::getSon ( int  pos) [virtual]

Get a particular son.

Implements bpp::TNode.

Definition at line 162 of file BasicTNode.cpp.

References sons_.

bool bpp::BasicTNode::hasFather ( ) const [inline]

Tell if the node has a father.

Definition at line 102 of file BasicTNode.h.

References father_.

bool bpp::BasicTNode::hasFathers ( ) const [inline, virtual]

Tell if this node has one or more father nodes.

Implements bpp::ONode.

Definition at line 103 of file BasicTNode.h.

References father_.

Referenced by removeFather().

bool bpp::BasicTNode::hasSons ( ) const [inline, virtual]

Tell if this node has one or more son nodes.

Implements bpp::ONode.

Definition at line 130 of file BasicTNode.h.

References sons_.

bool BasicTNode::isFather ( const BasicTNode node) const [virtual]

Tell if the node is a father of this node.

Definition at line 126 of file BasicTNode.cpp.

References father_.

Referenced by addFather(), and addSon().

bool BasicTNode::isSon ( const BasicTNode node) const [virtual]

Tell if a node is son of this node.

Definition at line 169 of file BasicTNode.cpp.

References sons_.

Referenced by addFather(), and addSon().

BasicTNode & BasicTNode::operator= ( const BasicTNode node)

Assignation operator.

Definition at line 58 of file BasicTNode.cpp.

References father_, and sons_.

const BasicTNode * BasicTNode::operator[] ( int  i) const [virtual]

Direct access to a neighbor in const context.

  • a positive i gives access to sons (from 0 to n - 1)
  • a negative i gives access to fathers (from 1 to m)

No check is done, you have to ensure that you query an existing neighbor.

Parameters:
ithe position of the neighbor
Returns:
A pointer toward the neighbor

Implements bpp::TNode.

Definition at line 86 of file BasicTNode.cpp.

References father_, and sons_.

BasicTNode * BasicTNode::operator[] ( int  i) [virtual]

Direct access to a neighbor.

  • a positive i gives access to sons (from 0 to n - 1)
  • a negative i gives access to fathers (from 1 to m)

No check is done, you have to ensure that you query an existing neighbor.

Parameters:
ithe position of the neighbor
Returns:
A pointer toward the neighbor

Implements bpp::TNode.

Definition at line 94 of file BasicTNode.cpp.

References father_, and sons_.

Remove the father of this node.

Returns:
A pointer to the removed father node.

Definition at line 143 of file BasicTNode.cpp.

References father_, hasFathers(), and removeSon().

Referenced by removeSon().

void BasicTNode::removeSon ( BasicTNode son) [virtual]

Remove a son of this node.

Definition at line 186 of file BasicTNode.cpp.

References removeFather(), and sons_.

Referenced by removeFather(), and ~BasicTNode().

BasicTNode * BasicTNode::removeSon ( int  pos) [virtual]

Remove a son of this node.

Returns:
A pointer to the removed son node or a Null pointer if son is not found.

Definition at line 197 of file BasicTNode.cpp.

References sons_.


Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Friends