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

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

#include <LowMemGraph.hh>

Public Member Functions

 LowMemNode (uint32_t node_index)
 
 ~LowMemNode ()
 This class should have a virtual destructor. But adding virtual functions adds an extra 8 bytes per class. Be careful!!! More...
 
void drop_all_edges (LowMemGraphBase &graph)
 deletes all edges incident upon this node More...
 
LowMemEdge const * find_edge (uint32_t other_node_ind, LowMemGraphBase const &graph) const
 a "slow" (linear) search for an edge. More...
 
LowMemEdgefind_edge (uint32_t other_node_ind, LowMemGraphBase &graph)
 a "slow" (linear) search for an edge. More...
 
void print () const
 send summaray data about this node to the screen More...
 
LowMemEdgeListIter edge_list_begin (LowMemGraphBase &graph)
 returns a non-const iterator to the beginning of its edge list More...
 
LowMemEdgeListConstIter const_edge_list_begin (LowMemGraphBase const &graph) const
 returns a const iterator to the beginning of its edge list More...
 
LowMemEdgeListIter edge_list_end (LowMemGraphBase &graph)
 returns a non-const iterator to the end of its edge list More...
 
LowMemEdgeListConstIter const_edge_list_end (LowMemGraphBase const &graph) const
 returns a const iterator to the end of its edge list More...
 
uint32_t get_node_index () const
 the index for this node More...
 
platform::Size num_edges () const
 the number of edges incident on this node, which may include a loop edge More...
 
platform::Size count_static_memory () const
 how much memory is statically allocated by this node More...
 
platform::Size count_dynamic_memory () const
 how much memory is dynamically allocated by this node – must be recursively invoked by a derived class. More...
 
void internal_add_edge (platform::Size edge_offset)
 Don't call this!!!. Adds an edge from the edge list to this node @detail Only made public so we don't have to friend the templated LowMemGraph. More...
 
platform::Size internal_drop_edge (LowMemEdge const *edge, LowMemGraphBase const &graph)
 Don't call this!!!. It only locally deletes the edge from this node. @detail Only made public so we don't have to friend the templated LowMemGraph. Returns offset in the global edge list. More...
 
std::vector< platform::Size > const & internal_get_edge_list () const
 Don't call this!!!. Only to be used by LowMemGraph @detail Only made public so we don't have to friend the templated LowMemGraph. More...
 

Protected Member Functions

LowMemEdgeinternal_get_edge (platform::Size local_offset, LowMemGraphBase &graph)
 
LowMemEdge const * internal_get_edge (platform::Size local_offset, LowMemGraphBase const &graph) const
 
platform::Size internal_find_edge (uint32_t other_node_ind, LowMemGraphBase const &graph) const
 

Private Attributes

std::vector< platform::Sizeedge_vec_
 
uint32_t node_index_
 

Friends

class LowMemEdgeListIter
 
class LowMemEdgeListConstIter
 

Detailed Description

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

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

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

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

Constructor & Destructor Documentation

◆ LowMemNode()

utility::graph::LowMemNode::LowMemNode ( uint32_t  node_index)
inline

Referenced by count_static_memory().

◆ ~LowMemNode()

utility::graph::LowMemNode::~LowMemNode ( )
inline

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

Member Function Documentation

◆ const_edge_list_begin()

LowMemEdgeListConstIter utility::graph::LowMemNode::const_edge_list_begin ( LowMemGraphBase const &  graph) const
inline

returns a const iterator to the beginning of its edge list

References LowMemEdgeListConstIter.

◆ const_edge_list_end()

LowMemEdgeListConstIter utility::graph::LowMemNode::const_edge_list_end ( LowMemGraphBase const &  graph) const
inline

returns a const iterator to the end of its edge list

References LowMemEdgeListConstIter, and num_edges().

◆ count_dynamic_memory()

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

how much memory is dynamically allocated by this node – 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()

References edge_vec_.

◆ count_static_memory()

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

how much memory is statically allocated by this node

memory accounting scheme

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

References LowMemNode().

◆ drop_all_edges()

void utility::graph::LowMemNode::drop_all_edges ( LowMemGraphBase graph)

deletes all edges incident upon this node

Although edges are deleted, the memory for the edges is not freed.

References utility::graph::LowMemGraphBase::drop_all_edges_for_node(), and get_node_index().

◆ edge_list_begin()

LowMemEdgeListIter utility::graph::LowMemNode::edge_list_begin ( LowMemGraphBase graph)
inline

returns a non-const iterator to the beginning of its edge list

References LowMemEdgeListIter.

◆ edge_list_end()

LowMemEdgeListIter utility::graph::LowMemNode::edge_list_end ( LowMemGraphBase graph)
inline

returns a non-const iterator to the end of its edge list

References LowMemEdgeListIter, and num_edges().

◆ find_edge() [1/2]

LowMemEdge * utility::graph::LowMemNode::find_edge ( uint32_t  other_node_ind,
LowMemGraphBase graph 
)

◆ find_edge() [2/2]

LowMemEdge const * utility::graph::LowMemNode::find_edge ( uint32_t  other_node_ind,
LowMemGraphBase const &  graph 
) const

◆ get_node_index()

uint32_t utility::graph::LowMemNode::get_node_index ( ) const
inline

the index for this node

References node_index_.

Referenced by drop_all_edges(), and internal_drop_edge().

◆ internal_add_edge()

void utility::graph::LowMemNode::internal_add_edge ( platform::Size  edge_offset)

Don't call this!!!. Adds an edge from the edge list to this node @detail Only made public so we don't have to friend the templated LowMemGraph.

References edge_vec_.

◆ internal_drop_edge()

Size utility::graph::LowMemNode::internal_drop_edge ( LowMemEdge const *  edge,
LowMemGraphBase const &  graph 
)

Don't call this!!!. It only locally deletes the edge from this node. @detail Only made public so we don't have to friend the templated LowMemGraph. Returns offset in the global edge list.

References edge_vec_, get_node_index(), utility::graph::LowMemEdge::get_other_ind(), and internal_find_edge().

◆ internal_find_edge()

Size utility::graph::LowMemNode::internal_find_edge ( uint32_t  other_node_ind,
LowMemGraphBase const &  graph 
) const
protected

◆ internal_get_edge() [1/2]

LowMemEdge* utility::graph::LowMemNode::internal_get_edge ( platform::Size  local_offset,
LowMemGraphBase graph 
)
protected

◆ internal_get_edge() [2/2]

LowMemEdge const* utility::graph::LowMemNode::internal_get_edge ( platform::Size  local_offset,
LowMemGraphBase const &  graph 
) const
protected

◆ internal_get_edge_list()

std::vector<platform::Size> const& utility::graph::LowMemNode::internal_get_edge_list ( ) const
inline

Don't call this!!!. Only to be used by LowMemGraph @detail Only made public so we don't have to friend the templated LowMemGraph.

References edge_vec_.

◆ num_edges()

platform::Size utility::graph::LowMemNode::num_edges ( ) const
inline

the number of edges incident on this node, which may include a loop edge

References edge_vec_.

Referenced by const_edge_list_end(), edge_list_end(), utility::graph::LowMemEdgeListIter::valid(), and utility::graph::LowMemEdgeListConstIter::valid().

◆ print()

void utility::graph::LowMemNode::print ( ) const
inline

send summaray data about this node to the screen

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

Friends And Related Function Documentation

◆ LowMemEdgeListConstIter

friend class LowMemEdgeListConstIter
friend

◆ LowMemEdgeListIter

friend class LowMemEdgeListIter
friend

Referenced by edge_list_begin(), and edge_list_end().

Member Data Documentation

◆ edge_vec_

std::vector<platform::Size> utility::graph::LowMemNode::edge_vec_
private

◆ node_index_

uint32_t utility::graph::LowMemNode::node_index_
private

Referenced by get_node_index().


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