Evoplex  0.2.1
Public Member Functions | Friends | List of all members
evoplex::Edge Class Reference

An Edge connects a Node to itself or to another Node. More...

#include <edge.h>

Public Member Functions

 Edge (EdgePtr edge)
 Constructor. More...
 
 Edge (const std::pair< const int, Edge > &p)
 Constructor to ease range-based for loops. More...
 
 Edge ()
 Constructor.
 
int id () const
 Gets the edge's id. More...
 
const Nodeorigin () const
 Gets the source Node. More...
 
const Nodeneighbour () const
 Gets the target Node. More...
 
const Attributesattrs () const
 Gets the edge's attributes. More...
 
const Valueattr (int id) const
 Gets the value of the attribute at id. More...
 
Value attr (const QString &name, Value defaultValue=Value()) const
 Gets the value corresponding to name. More...
 
void setAttr (const int id, const Value &value)
 Sets the value at id. More...
 
void addAttr (QString name, Value value)
 Appends the attribute name with the value value. More...
 

Friends

class AbstractGraph
 
class TestEdge
 

Detailed Description

An Edge connects a Node to itself or to another Node.

This class wraps a std::shared_ptr<BaseEdge>.

Note
An edge should be created by an AbstractGraph derived object.

Constructor & Destructor Documentation

◆ Edge() [1/2]

evoplex::Edge::Edge ( EdgePtr  edge)

Constructor.

Parameters
edgestd::shared_ptr<BaseEdge>

◆ Edge() [2/2]

evoplex::Edge::Edge ( const std::pair< const int, Edge > &  p)

Constructor to ease range-based for loops.

Parameters
pA pair <edgeId, Edge>.

Member Function Documentation

◆ addAttr()

void evoplex::Edge::addAttr ( QString  name,
Value  value 
)

Appends the attribute name with the value value.

Parameters
nameThe attribute's name.
valueThe attribute's value.

◆ attr() [1/2]

const Value& evoplex::Edge::attr ( int  id) const

Gets the value of the attribute at id.

Parameters
idThe attribute's id.
Exceptions
std::out_of_rangeif the id is not present.

◆ attr() [2/2]

Value evoplex::Edge::attr ( const QString &  name,
Value  defaultValue = Value() 
) const

Gets the value corresponding to name.

Parameters
nameThe attribute's name.
defaultValueA Value to be returned if name is not present.

◆ attrs()

const Attributes* evoplex::Edge::attrs ( ) const

Gets the edge's attributes.

◆ id()

int evoplex::Edge::id ( ) const

Gets the edge's id.

◆ neighbour()

const Node& evoplex::Edge::neighbour ( ) const

Gets the target Node.

◆ origin()

const Node& evoplex::Edge::origin ( ) const

Gets the source Node.

◆ setAttr()

void evoplex::Edge::setAttr ( const int  id,
const Value value 
)

Sets the value at id.

Parameters
idThe attribute's id.
valueThe new attribute's value.
Exceptions
std::out_of_rangeif the id is not present.

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