fpmas 1.6
Public Member Functions | List of all members
fpmas::graph::Graph< NodeType, EdgeType > Class Template Reference

#include <graph.h>

Inheritance diagram for fpmas::graph::Graph< NodeType, EdgeType >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::graph::Graph< NodeType, EdgeType >:
Collaboration graph
[legend]

Public Member Functions

 Graph ()
 
 Graph (const Graph< NodeType, EdgeType > &)=delete
 
Graph< NodeType, EdgeType > & operator= (const Graph< NodeType, EdgeType > &)=delete
 
 Graph (Graph< NodeType, EdgeType > &&graph)
 
Graph< NodeType, EdgeType > & operator= (Graph< NodeType, EdgeType > &&)
 
void insert (NodeType *) override
 
void insert (EdgeType *) override
 
void erase (NodeType *) override
 
void erase (EdgeType *) override
 
void addCallOnInsertNode (api::utils::Callback< NodeType * > *callback) override
 
std::vector< api::utils::Callback< NodeType * > * > onInsertNodeCallbacks () const override
 
void addCallOnEraseNode (api::utils::Callback< NodeType * > *callback) override
 
std::vector< api::utils::Callback< NodeType * > * > onEraseNodeCallbacks () const override
 
void addCallOnInsertEdge (api::utils::Callback< EdgeType * > *callback) override
 
std::vector< api::utils::Callback< EdgeType * > * > onInsertEdgeCallbacks () const override
 
void addCallOnEraseEdge (api::utils::Callback< EdgeType * > *callback) override
 
std::vector< api::utils::Callback< EdgeType * > * > onEraseEdgeCallbacks () const override
 
NodeType * getNode (NodeIdType) override
 
const NodeType * getNode (NodeIdType) const override
 
const NodeMapgetNodes () const override
 
EdgeType * getEdge (EdgeIdType) override
 
const EdgeType * getEdge (EdgeIdType) const override
 
const EdgeMapgetEdges () const override
 
void clear () override
 
virtual void insert (NodeType *node)=0
 
virtual void insert (EdgeType *edge)=0
 
virtual void erase (NodeType *node)=0
 
virtual void erase (EdgeType *edge)=0
 
virtual void addCallOnInsertNode (api::utils::Callback< NodeType * > *callback)=0
 
virtual std::vector< api::utils::Callback< NodeType * > * > onInsertNodeCallbacks () const =0
 
virtual void addCallOnEraseNode (api::utils::Callback< NodeType * > *callback)=0
 
virtual std::vector< api::utils::Callback< NodeType * > * > onEraseNodeCallbacks () const =0
 
virtual void addCallOnInsertEdge (api::utils::Callback< EdgeType * > *callback)=0
 
virtual std::vector< api::utils::Callback< EdgeType * > * > onInsertEdgeCallbacks () const =0
 
virtual void addCallOnEraseEdge (api::utils::Callback< EdgeType * > *callback)=0
 
virtual std::vector< api::utils::Callback< EdgeType * > * > onEraseEdgeCallbacks () const =0
 
virtual NodeType * getNode (NodeIdType id)=0
 
virtual const NodeType * getNode (NodeIdType id) const =0
 
virtual const NodeMapgetNodes () const =0
 
virtual EdgeType * getEdge (EdgeIdType id)=0
 
virtual const EdgeType * getEdge (EdgeIdType) const =0
 
virtual const EdgeMapgetEdges () const =0
 
virtual void clear ()=0
 

Additional Inherited Members

- Public Types inherited from fpmas::api::graph::Graph< NodeType, EdgeType >
typedef NodeType::IdType NodeIdType
 
typedef EdgeType::IdType EdgeIdType
 
typedef fpmas::api::graph::IdHash< typename NodeType::IdType > NodeIdHash
 
typedef fpmas::api::graph::IdHash< typename EdgeType::IdType > EdgeIdHash
 
typedef std::unordered_map< NodeIdType, NodeType *, NodeIdHashNodeMap
 
typedef std::unordered_map< EdgeIdType, EdgeType *, EdgeIdHashEdgeMap
 

Detailed Description

template<typename NodeType, typename EdgeType>
class fpmas::graph::Graph< NodeType, EdgeType >

api::graph::Graph implementation.

Constructor & Destructor Documentation

◆ Graph() [1/2]

template<typename NodeType , typename EdgeType >
fpmas::graph::Graph< NodeType, EdgeType >::Graph ( )
inline

Graph default constructor.

◆ Graph() [2/2]

template<typename NodeType , typename EdgeType >
fpmas::graph::Graph< NodeType, EdgeType >::Graph ( Graph< NodeType, EdgeType > &&  graph)

Graph move constructor.

◆ ~Graph()

template<typename NodeType , typename EdgeType >
fpmas::graph::Graph< NodeType, EdgeType >::~Graph
virtual

Member Function Documentation

◆ operator=()

template<typename NodeType , typename EdgeType >
Graph< NodeType, EdgeType > & fpmas::graph::Graph< NodeType, EdgeType >::operator= ( Graph< NodeType, EdgeType > &&  graph)

Graph move assignment operator.

◆ insert() [1/2]

template<typename NodeType , typename EdgeType >
void fpmas::graph::Graph< NodeType, EdgeType >::insert ( NodeType *  node)
overridevirtual

Inserts a Node into the graph.

Upon return, the NodeMap returned by getNodes() must contain an entry {node->getId(), node}.

Callbacks registered using addCallOnInsertNode() are also called after the node has effectively been inserted into the graph.

Parameters
nodepointer to node to insert in the graph

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ insert() [2/2]

template<typename NodeType , typename EdgeType >
void fpmas::graph::Graph< NodeType, EdgeType >::insert ( EdgeType *  edge)
overridevirtual

Inserts an Edge into the graph.

Upon return, the EdgeMap returned by getEdges() must contain an entry {edge->getId(), edge}.

Callbacks registered using addCallOnInsertEdge() are also called after the edge has effectively been inserted into the graph.

Parameters
edgepointer to edge to insert in the graph

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ erase() [1/2]

template<typename NodeType , typename EdgeType >
void fpmas::graph::Graph< NodeType, EdgeType >::erase ( NodeType *  node)
overridevirtual

Erases a previously inserted node from the graph.

Upon return, the entry {node->getId(), node} must not be contained anymore in the NodeMap returned by getNodes().

Moreover, all incoming and outgoing edges, as returned by Node::getIncomingEdges and Node::getOutgoingEdges, should also be erased from the Graph, as specified by the erase(EdgeType*) function.

Callbacks registered using addCallOnEraseNode() are also called after the node has effectively been removed from the graph.

Erasing a node not contained in the Graph produces an unexpected behavior.

Parameters
nodenode to erase from the graph

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ erase() [2/2]

template<typename NodeType , typename EdgeType >
void fpmas::graph::Graph< NodeType, EdgeType >::erase ( EdgeType *  edge)
overridevirtual

Erases a previously inserted edge from the graph.

Upon return, the entry {edge->getId(), edge} must not be contained anymore in the NodeMap returned by getEdges().

Callbacks registered using addCallOnEraseEdge() are also called after the edge has effectively been removed from the graph.

Erasing an edge not contained in the Graph produces an unexpected behavior.

Parameters
edgeedge to erase from the graph

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ addCallOnInsertNode()

template<typename NodeType , typename EdgeType >
void fpmas::graph::Graph< NodeType, EdgeType >::addCallOnInsertNode ( api::utils::Callback< NodeType * > *  callback)
inlineoverridevirtual

Adds an insert node callback, called on insert(NodeType*).

Parameters
callbackinsert node callback

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ onInsertNodeCallbacks()

template<typename NodeType , typename EdgeType >
std::vector< api::utils::Callback< NodeType * > * > fpmas::graph::Graph< NodeType, EdgeType >::onInsertNodeCallbacks ( ) const
inlineoverridevirtual

Current insert node callbacks list.

Returns
insert node callbacks

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ addCallOnEraseNode()

template<typename NodeType , typename EdgeType >
void fpmas::graph::Graph< NodeType, EdgeType >::addCallOnEraseNode ( api::utils::Callback< NodeType * > *  callback)
inlineoverridevirtual

Adds an erase node callback, called on erase(NodeType*).

Parameters
callbackinsert node callback

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ onEraseNodeCallbacks()

template<typename NodeType , typename EdgeType >
std::vector< api::utils::Callback< NodeType * > * > fpmas::graph::Graph< NodeType, EdgeType >::onEraseNodeCallbacks ( ) const
inlineoverridevirtual

Current erase node callbacks list.

Returns
erase node callbacks

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ addCallOnInsertEdge()

template<typename NodeType , typename EdgeType >
void fpmas::graph::Graph< NodeType, EdgeType >::addCallOnInsertEdge ( api::utils::Callback< EdgeType * > *  callback)
inlineoverridevirtual

Adds an insert edge callback, called on insert(EdgeType*).

Parameters
callbackinsert edge callback

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ onInsertEdgeCallbacks()

template<typename NodeType , typename EdgeType >
std::vector< api::utils::Callback< EdgeType * > * > fpmas::graph::Graph< NodeType, EdgeType >::onInsertEdgeCallbacks ( ) const
inlineoverridevirtual

Current insert edge callbacks list.

Returns
insert edge callbacks

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ addCallOnEraseEdge()

template<typename NodeType , typename EdgeType >
void fpmas::graph::Graph< NodeType, EdgeType >::addCallOnEraseEdge ( api::utils::Callback< EdgeType * > *  callback)
inlineoverridevirtual

Adds an erase edge callback, called on erase(EdgeType*).

Parameters
callbackerase edge callback

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ onEraseEdgeCallbacks()

template<typename NodeType , typename EdgeType >
std::vector< api::utils::Callback< EdgeType * > * > fpmas::graph::Graph< NodeType, EdgeType >::onEraseEdgeCallbacks ( ) const
inlineoverridevirtual

Current erase edge callbacks list.

Returns
erase edge callbacks

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ getNode() [1/2]

template<typename NodeType , typename EdgeType >
NodeType * fpmas::graph::Graph< NodeType, EdgeType >::getNode ( NodeIdType  id)
overridevirtual

Gets the pointer to the node associated to the given id in the Graph.

The returned pointer must correspond to the entry {id, node} contained in the NodeMap returned by getNodes().

If id does not correspond to a node contained in the graph, behavior is unspecified.

Parameters
idnode id
Returns
corresponding node in the graph

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ getNode() [2/2]

template<typename NodeType , typename EdgeType >
const NodeType * fpmas::graph::Graph< NodeType, EdgeType >::getNode ( NodeIdType  id) const
overridevirtual

Gets the pointer to the node associated to the given id in the Graph.

The returned pointer must correspond to the entry {id, node} contained in the NodeMap returned by getNodes().

If id does not correspond to a node contained in the graph, behavior is unspecified.

Parameters
idnode id
Returns
corresponding node in the graph

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ getNodes()

template<typename NodeType , typename EdgeType >
const Graph< NodeType, EdgeType >::NodeMap & fpmas::graph::Graph< NodeType, EdgeType >::getNodes ( ) const
overridevirtual

NodeMap representing the nodes contained in this graph.

Returns
graph's nodes

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ getEdge() [1/2]

template<typename NodeType , typename EdgeType >
EdgeType * fpmas::graph::Graph< NodeType, EdgeType >::getEdge ( EdgeIdType  id)
overridevirtual

Gets the pointer to the edge associated to the given id in the Graph.

The returned pointer must correspond to the entry {id, edge} contained in the EdgeMap returned by getEdges().

If id does not correspond to an edge contained in the graph, behavior is unspecified.

Parameters
idedge id
Returns
corresponding edge in the graph

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ getEdge() [2/2]

template<typename NodeType , typename EdgeType >
const EdgeType * fpmas::graph::Graph< NodeType, EdgeType >::getEdge ( EdgeIdType  ) const
overridevirtual

◆ getEdges()

template<typename NodeType , typename EdgeType >
const Graph< NodeType, EdgeType >::EdgeMap & fpmas::graph::Graph< NodeType, EdgeType >::getEdges ( ) const
overridevirtual

EdgeMap representing the edges contained in this graph.

Returns
graph's edges

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.

◆ clear()

template<typename NodeType , typename EdgeType >
void fpmas::graph::Graph< NodeType, EdgeType >::clear ( )
overridevirtual

Erases all nodes and edges contained in the graph.

All erase node and erase edge callbacks must be called properly for each item.

Implements fpmas::api::graph::Graph< NodeType, EdgeType >.


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