Rosetta
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
utility::graph::LowMemEdge Class Reference

An Edge class for LowMemGraph. Will often be overriden. @detail Be careful with this class! It doesn't use actual virtual functions. Never do this: LowMemEdgeOP op = MyDerivedEdgeOP() Instead, if you wish to use an owning pointer, you must do this: MyDerivedEdgeOP op = MyDerivedEdgeOP() More...

#include <LowMemGraph.hh>

Public Member Functions

 LowMemEdge (uint32_t first_node_ind, uint32_t second_node_ind)
 Main edge constructor. This should only be invoked by create_new_edge, which itself is only called by add_edge. The ONLY way an edge should be added to a graph is through add_edge. NOTE: edges should be only be deleted by a call to the Graph's delete_edge method. More...
 
 ~LowMemEdge ()
 This class should have a virtual destructor. But adding virtual functions adds an extra 8 bytes per class. Be careful!!! More...
 
uint32_t get_other_ind (uint32_t node_ind) const
 returns the index of the one node given the index of the other. node_index must be one of the two nodes that this edge is incident upon. More...
 
LowMemNode const * get_other_node (uint32_t node_index, LowMemGraphBase const &graph) const
 returns a const pointer to one node given the index of the other. node_index must be one of the two nodes that this edge is incident upon. More...
 
LowMemNodeget_other_node (uint32_t node_index, LowMemGraphBase &graph)
 returns a non-const pointer to one node given the index of the other. node_index must be one of the two nodes that this edge is incident upon. More...
 
uint32_t get_first_node_ind () const
 returns the index of the lower node More...
 
uint32_t get_second_node_ind () const
 returns the index of the upper node More...
 
bool same_edge (uint32_t node1, uint32_t node2) const
 Is this the same edge as another edge (node1,node2)? Note: this graph does not work for multi-graphs. Edges must be unique. More...
 
platform::Size count_static_memory () const
 how much memory is statically allocated by this edge More...
 
platform::Size count_dynamic_memory () const
 how much memory is dynamically allocated by this edge – must be recursively invoked by a derived class. More...
 
void internal_delete_self ()
 Don't call this!!! Only to be called by LowMemGraph. More...
 

Protected Member Functions

bool internal_deleted () const
 

Private Attributes

uint32_t first_node_ind_
 
uint32_t second_node_ind_
 

Friends

class LowMemEdgeListIter
 
class LowMemEdgeListConstIter
 

Detailed Description

An Edge class for LowMemGraph. Will often be overriden. @detail Be careful with this class! It doesn't use actual virtual functions. Never do this: LowMemEdgeOP op = MyDerivedEdgeOP() Instead, if you wish to use an owning pointer, you must do this: MyDerivedEdgeOP op = MyDerivedEdgeOP()

Having any virtual functions increases a class's footprint by 8 bytes

Remarks
If writing a derived class, "override" these three functions: ~LowMemNode() count_static_memory() count_dynamic_memory()

See core/scoring/hbonds/graph/HBondGraph.hh for example

Constructor & Destructor Documentation

◆ LowMemEdge()

utility::graph::LowMemEdge::LowMemEdge ( uint32_t  first_node_ind,
uint32_t  second_node_ind 
)
inline

Main edge constructor. This should only be invoked by create_new_edge, which itself is only called by add_edge. The ONLY way an edge should be added to a graph is through add_edge. NOTE: edges should be only be deleted by a call to the Graph's delete_edge method.

Referenced by count_static_memory().

◆ ~LowMemEdge()

utility::graph::LowMemEdge::~LowMemEdge ( )
inline

This class should have a virtual destructor. But adding virtual functions adds an extra 8 bytes per class. Be careful!!!

Member Function Documentation

◆ count_dynamic_memory()

Size utility::graph::LowMemEdge::count_dynamic_memory ( ) const

how much memory is dynamically allocated by this edge – must be recursively invoked by a derived class.

memory accounting scheme

This function isn't technically virtual, but if you override it, your code WILL be called by getTotalMemoryUsage()

◆ count_static_memory()

Size utility::graph::LowMemEdge::count_static_memory ( ) const

how much memory is statically allocated by this edge

memory accounting scheme

This function isn't technically virtual, but if you override it, your code WILL be called by getTotalMemoryUsage()

References LowMemEdge().

◆ get_first_node_ind()

uint32_t utility::graph::LowMemEdge::get_first_node_ind ( ) const
inline

◆ get_other_ind()

uint32_t utility::graph::LowMemEdge::get_other_ind ( uint32_t  node_ind) const

returns the index of the one node given the index of the other. node_index must be one of the two nodes that this edge is incident upon.

References debug_assert, first_node_ind_, and second_node_ind_.

Referenced by utility::graph::LowMemNode::internal_drop_edge().

◆ get_other_node() [1/2]

LowMemNode * utility::graph::LowMemEdge::get_other_node ( uint32_t  node_index,
LowMemGraphBase graph 
)

returns a non-const pointer to one node given the index of the other. node_index must be one of the two nodes that this edge is incident upon.

References debug_assert, first_node_ind_, utility::graph::LowMemGraphBase::get_node(), and second_node_ind_.

◆ get_other_node() [2/2]

LowMemNode const * utility::graph::LowMemEdge::get_other_node ( uint32_t  node_index,
LowMemGraphBase const &  graph 
) const

returns a const pointer to one node given the index of the other. node_index must be one of the two nodes that this edge is incident upon.

References debug_assert, first_node_ind_, utility::graph::LowMemGraphBase::get_node(), and second_node_ind_.

◆ get_second_node_ind()

uint32_t utility::graph::LowMemEdge::get_second_node_ind ( ) const
inline

◆ internal_delete_self()

void utility::graph::LowMemEdge::internal_delete_self ( )

Don't call this!!! Only to be called by LowMemGraph.

References first_node_ind_, and second_node_ind_.

Referenced by utility::graph::LowMemGraph< _LMNode, _LMEdge >::delete_edge().

◆ internal_deleted()

bool utility::graph::LowMemEdge::internal_deleted ( ) const
protected

◆ same_edge()

bool utility::graph::LowMemEdge::same_edge ( uint32_t  node1,
uint32_t  node2 
) const

Is this the same edge as another edge (node1,node2)? Note: this graph does not work for multi-graphs. Edges must be unique.

References first_node_ind_, second_node_ind_, and erraser_analysis::temp.

Friends And Related Function Documentation

◆ LowMemEdgeListConstIter

friend class LowMemEdgeListConstIter
friend

◆ LowMemEdgeListIter

friend class LowMemEdgeListIter
friend

Member Data Documentation

◆ first_node_ind_

uint32_t utility::graph::LowMemEdge::first_node_ind_
private

◆ second_node_ind_

uint32_t utility::graph::LowMemEdge::second_node_ind_
private

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