#include <graph.h>
Basic node template for a graph, reppresent a node with attached strokes pointers list basically an node with an adjacency list.
NODEDATA | Custom Data attched to the node. |
EDGE | Edge type have to be GraphEdgeBase<this->Type>. |
GraphNodeBase is the protected base class of GraphNode. GraphNode adds no further data members, therefore both have the same memory layout. You only have to work with GraphNodeBase when you implement GraphModelInterface and need access to its data members.
Public Types | |
typedef GraphNodeBase< NODEDATA, EDGE > | NodeType |
Public Member Functions | |
GraphNodeBase () | |
GraphNodeBase (const NODEDATA &data, Vector pos=Vector()) | |
~GraphNodeBase () | |
GraphNodeBase (GraphNodeBase &&src) | |
Result< void > | CopyFrom (const GraphNodeBase &src) |
Vector | GetPosition () const |
void | SetPosition (const Vector &pos) |
Int | GetEdgesCount () const |
Result< EDGE * > | GetEdge (Int pos) const |
Result< NodeType * > | GetNeighbor (Int pos) const |
Result< EDGE * > | FindEdge (NodeType *otherHand) |
Result< void > | AddEdge (EDGE *edge) |
Result< void > | DeleteEdge (Int32 pos) |
Result< void > | DeleteEdge (EDGE *edge) |
const NODEDATA * | GetData () const |
Result< void > | SetData (const NODEDATA &data) |
void | Visit () |
void | Unvisit () |
Bool | IsVisited () const |
void | Reset () |
const GraphNodeBase & | GetBase () const |
GraphNodeBase & | GetBase () |
Public Attributes | |
GraphModelRef | _graph |
Int | _mem [MEMCOUNT] |
Static Public Attributes | |
static const Int | MEMCOUNT |
Protected Member Functions | |
const GraphNode & | GetGraphNode () const |
GraphModelInterface * | PrivateGetGraph () const |
const ThreadReferencedError & | GetErrorStorage () const |
Protected Attributes | |
NODEDATA | _data |
Vector | _pos |
Bool | _visited |
BaseArray< EDGE * > | _edges |
Static Private Attributes | |
static constexpr Bool | HAS_ERROR |
typedef GraphNodeBase<NODEDATA, EDGE> NodeType |
|
explicit |
|
explicit |
~GraphNodeBase | ( | ) |
GraphNodeBase | ( | GraphNodeBase< NODEDATA, EDGE > && | src | ) |
Result<void> CopyFrom | ( | const GraphNodeBase< NODEDATA, EDGE > & | src | ) |
Vector GetPosition | ( | ) | const |
Get the Node position.
void SetPosition | ( | const Vector & | pos | ) |
Set the Node position.
[in] | pos | The new Node position. |
Int GetEdgesCount | ( | ) | const |
Get the edges count for this point.
Get the edges at pos in the list.
[in] | pos | The edge index position. |
Get The other hand of the edge at index pos.
[in] | pos | the edge index. |
Find an edge in between this node and otherHand node.
[in] | otherHand | The other node which create the edge. |
Result<void> AddEdge | ( | EDGE * | edge | ) |
Add a new edges to the point.
[in] | edge | The edge to add. |
Remove the edge at pos.
[in] | pos | The edge list index. |
Result<void> DeleteEdge | ( | EDGE * | edge | ) |
Remove edge form the list.
[in] | edge | The edge to be removed. |
const NODEDATA* GetData | ( | void | ) | const |
Get a pointer to user data.
Result<void> SetData | ( | const NODEDATA & | data | ) |
Replace current user data with the passed one, data is duplicated.
[in] | data | The new data to be used. |
void Visit | ( | ) |
Process this node.
void Unvisit | ( | ) |
Reset the processing status.
Bool IsVisited | ( | ) | const |
Get the processing status.
void Reset | ( | void | ) |
Free memory and reset all values, could be extended for each implementation.
const GraphNodeBase& GetBase | ( | ) | const |
Returns this GraphNode, downcasted to its protected base class GraphNodeBase. This function is needed by implementations of GraphModelInterface to access the protected data members of GraphNodeBase.
GraphNodeBase& GetBase | ( | ) |
Returns this GraphNode, downcasted to its protected base class GraphNodeBase. This function is needed by implementations of GraphModelInterface to access the protected data members of GraphNodeBase.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
GraphModelRef _graph |
The graph model of this graph node.
|
static |
Number of Int elements in _mem, currently 5.
Some storage space for free use by the GraphModelInterface implementation. Typically this holds information to identify the graph node such as a path.
|
staticconstexprprivate |