Open Search
    GraphNodeBase< NODEDATA, EDGE > Class Template Reference

    #include <graphbase.h>

    Detailed Description

    template<typename NODEDATA, typename EDGE>
    class maxon::geomgraph::GraphNodeBase< NODEDATA, EDGE >

    Basic node template for a graph, reppresent a node with attached strokes pointers list basically an node with an adjacency list.

    Template Parameters
    NODEDATACustom Data attched to the node.
    EDGEEdge type have to be GraphEdgeBase<this->Type>.

    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 ()
     

    Protected Attributes

    NODEDATA _data
     
    Vector _pos
     
    Bool _visited
     
    BaseArray< EDGE * > _edges
     

    Member Typedef Documentation

    ◆ NodeType

    typedef GraphNodeBase<NODEDATA, EDGE> NodeType

    Constructor & Destructor Documentation

    ◆ GraphNodeBase() [1/3]

    GraphNodeBase ( )
    explicit

    ◆ GraphNodeBase() [2/3]

    GraphNodeBase ( const NODEDATA &  data,
    Vector  pos = Vector() 
    )
    explicit

    ◆ ~GraphNodeBase()

    ◆ GraphNodeBase() [3/3]

    GraphNodeBase ( GraphNodeBase< NODEDATA, EDGE > &&  src)

    Member Function Documentation

    ◆ CopyFrom()

    Result<void> CopyFrom ( const GraphNodeBase< NODEDATA, EDGE > &  src)

    ◆ GetPosition()

    Vector GetPosition ( ) const

    Get the Node position.

    Returns
    The Node position.

    ◆ SetPosition()

    void SetPosition ( const Vector pos)

    Set the Node position.

    Parameters
    [in]posThe new Node position.

    ◆ GetEdgesCount()

    Int GetEdgesCount ( ) const

    Get the edges count for this point.

    Returns
    The PenPoint::EdgeType count.

    ◆ GetEdge()

    Result<EDGE*> GetEdge ( Int  pos) const

    Get the edges at pos in the list.

    Parameters
    [in]posThe edge index position.
    Returns
    The PenPoint::EdgeType pointer pos or error if pos is out of bounds.

    ◆ GetNeighbor()

    Result<NodeType*> GetNeighbor ( Int  pos) const

    Get The other hand of the edge at index pos.

    Parameters
    [in]posthe edge index.
    Returns
    The node pointer otherwise an error.

    ◆ FindEdge()

    Result<EDGE*> FindEdge ( NodeType otherHand)

    Find an edge in between this node and otherHand node.

    Parameters
    [in]otherHandThe other node which create the edge.
    Returns
    The edge pointer of an error if used nodes does not share any edge.

    ◆ AddEdge()

    Result<void> AddEdge ( EDGE *  edge)

    Add a new edges to the point.

    Parameters
    [in]edgeThe edge to add.
    Returns
    OK on success.

    ◆ DeleteEdge() [1/2]

    Result<void> DeleteEdge ( Int32  pos)

    Remove the edge at pos.

    Parameters
    [in]posThe edge list index.
    Returns
    OK on success.

    ◆ DeleteEdge() [2/2]

    Result<void> DeleteEdge ( EDGE *  edge)

    Remove edge form the list.

    Parameters
    [in]edgeThe edge to be removed.
    Returns
    OK on success.

    ◆ GetData()

    const NODEDATA* GetData ( ) const

    Get a pointer to user data.

    Returns
    The user data pointer.

    ◆ SetData()

    Result<void> SetData ( const NODEDATA &  data)

    Replace current user data with the passed one, data is duplicated.

    Parameters
    [in]dataThe new data to be used.
    Returns
    OK on success.

    ◆ Visit()

    void Visit ( )

    Process this node.

    ◆ Unvisit()

    void Unvisit ( )

    Reset the processing status.

    ◆ IsVisited()

    Bool IsVisited ( ) const

    Get the processing status.

    Returns
    The processing status.

    ◆ Reset()

    void Reset ( )

    Free memory and reset all values, could be extended for each implementation.

    Member Data Documentation

    ◆ _data

    NODEDATA _data
    protected

    ◆ _pos

    Vector _pos
    protected

    ◆ _visited

    Bool _visited
    protected

    ◆ _edges

    BaseArray<EDGE*> _edges
    protected