Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 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 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. 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 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 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

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

Referenced by count_static_memory().

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

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.

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

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_.

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

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

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

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

References LowMemEdgeListIter.

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

LowMemEdge const * utility::graph::LowMemNode::find_edge ( uint32_t  other_node_ind,
LowMemGraphBase const &  graph 
) const
LowMemEdge * utility::graph::LowMemNode::find_edge ( uint32_t  other_node_ind,
LowMemGraphBase graph 
)
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().

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 Only made public so we don't have to friend the templated LowMemGraph.

References edge_vec_.

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

Size utility::graph::LowMemNode::internal_find_edge ( uint32_t  other_node_ind,
LowMemGraphBase const &  graph 
) const
protected
LowMemEdge* utility::graph::LowMemNode::internal_get_edge ( platform::Size  local_offset,
LowMemGraphBase graph 
)
protected
LowMemEdge const* utility::graph::LowMemNode::internal_get_edge ( platform::Size  local_offset,
LowMemGraphBase const &  graph 
) const
protected
std::vector<platform::Size> const& utility::graph::LowMemNode::internal_get_edge_list ( ) const
inline

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

References edge_vec_.

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

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

friend class LowMemEdgeListConstIter
friend
friend class LowMemEdgeListIter
friend

Referenced by edge_list_begin(), and edge_list_end().

Member Data Documentation

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

Referenced by get_node_index().


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