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

#include <graph.h>

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

Public Types

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
 

Public Member Functions

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
 

Detailed Description

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

Graph API

Template Parameters
NodeTypeNode implementation
EdgeTypeEdge implementation

Member Typedef Documentation

◆ NodeIdType

template<typename NodeType , typename EdgeType >
typedef NodeType::IdType fpmas::api::graph::Graph< NodeType, EdgeType >::NodeIdType

Node ID type

◆ EdgeIdType

template<typename NodeType , typename EdgeType >
typedef EdgeType::IdType fpmas::api::graph::Graph< NodeType, EdgeType >::EdgeIdType

Edge ID type

◆ NodeIdHash

template<typename NodeType , typename EdgeType >
typedef fpmas::api::graph::IdHash<typename NodeType::IdType> fpmas::api::graph::Graph< NodeType, EdgeType >::NodeIdHash

Node ID hash function

◆ EdgeIdHash

template<typename NodeType , typename EdgeType >
typedef fpmas::api::graph::IdHash<typename EdgeType::IdType> fpmas::api::graph::Graph< NodeType, EdgeType >::EdgeIdHash

Edge ID hash function

◆ NodeMap

template<typename NodeType , typename EdgeType >
typedef std::unordered_map< NodeIdType, NodeType*, NodeIdHash > fpmas::api::graph::Graph< NodeType, EdgeType >::NodeMap

Node map type

◆ EdgeMap

template<typename NodeType , typename EdgeType >
typedef std::unordered_map< EdgeIdType, EdgeType*, EdgeIdHash > fpmas::api::graph::Graph< NodeType, EdgeType >::EdgeMap

Edge map type

Member Function Documentation

◆ insert() [1/2]

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

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

Implemented in fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >, and fpmas::graph::Graph< NodeType, EdgeType >.

◆ insert() [2/2]

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

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

Implemented in fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >, and fpmas::graph::Graph< NodeType, EdgeType >.

◆ erase() [1/2]

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

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

Implemented in fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >, and fpmas::graph::Graph< NodeType, EdgeType >.

◆ erase() [2/2]

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

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

Implemented in fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >, and fpmas::graph::Graph< NodeType, EdgeType >.

◆ addCallOnInsertNode()

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

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

Parameters
callbackinsert node callback

Implemented in fpmas::graph::Graph< NodeType, EdgeType >.

◆ onInsertNodeCallbacks()

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

Current insert node callbacks list.

Returns
insert node callbacks

Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.

◆ addCallOnEraseNode()

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

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

Parameters
callbackinsert node callback

Implemented in fpmas::graph::Graph< NodeType, EdgeType >.

◆ onEraseNodeCallbacks()

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

Current erase node callbacks list.

Returns
erase node callbacks

Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.

◆ addCallOnInsertEdge()

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

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

Parameters
callbackinsert edge callback

Implemented in fpmas::graph::Graph< NodeType, EdgeType >.

◆ onInsertEdgeCallbacks()

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

Current insert edge callbacks list.

Returns
insert edge callbacks

Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.

◆ addCallOnEraseEdge()

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

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

Parameters
callbackerase edge callback

Implemented in fpmas::graph::Graph< NodeType, EdgeType >.

◆ onEraseEdgeCallbacks()

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

Current erase edge callbacks list.

Returns
erase edge callbacks

Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.

◆ getNode() [1/2]

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

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

Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.

◆ getNode() [2/2]

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

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

Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.

◆ getNodes()

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

NodeMap representing the nodes contained in this graph.

Returns
graph's nodes

Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.

◆ getEdge() [1/2]

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

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

Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.

◆ getEdge() [2/2]

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

◆ getEdges()

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

EdgeMap representing the edges contained in this graph.

Returns
graph's edges

Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.

◆ clear()

template<typename NodeType , typename EdgeType >
virtual void fpmas::api::graph::Graph< NodeType, EdgeType >::clear ( )
pure virtual

Erases all nodes and edges contained in the graph.

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

Implemented in fpmas::graph::Graph< NodeType, EdgeType >, and fpmas::graph::Graph< api::graph::DistributedNode< T >, api::graph::DistributedEdge< T > >.


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