votca 2024-dev
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
votca::tools::GraphNode Class Reference

A graph node that will take a variety of different values. More...

#include <graphnode.h>

Collaboration diagram for votca::tools::GraphNode:
Collaboration graph
[legend]

Public Member Functions

 GraphNode ()=default
 
 GraphNode (const std::unordered_map< std::string, Index > int_vals, const std::unordered_map< std::string, double > double_vals, const std::unordered_map< std::string, std::string > str_vals)
 
void setInt (const std::unordered_map< std::string, Index > int_vals)
 Basic setters.
 
void setDouble (const std::unordered_map< std::string, double > double_vals)
 
void setStr (const std::unordered_map< std::string, std::string > str_vals)
 
Index getInt (const std::string str)
 Basic getters.
 
double getDouble (const std::string str)
 
std::string getStr (const std::string str)
 
std::string getStringId () const
 Get the string id unique to the contents of the graph node.
 
bool operator== (const GraphNode gn) const
 
bool operator!= (const GraphNode gn) const
 

Public Attributes

friend GraphDistVisitor
 

Private Member Functions

void initStringId_ ()
 

Private Attributes

std::string str_id_ {""}
 
std::unordered_map< std::string, Indexint_vals_
 
std::unordered_map< std::string, double > double_vals_
 
std::unordered_map< std::string, std::string > str_vals_
 

Friends

std::ostream & operator<< (std::ostream &os, const GraphNode gn)
 

Detailed Description

A graph node that will take a variety of different values.

The purpose of this object is to allow a level of flexibility when using graph type algorithms. The object uses its contents to create a string that is unique to the contents. If two nodes with the same contents are created they will be considered to be equivalent.

NOTE: It may be of interest to take a look at the the Boost property map class, which was designed for a similar purpose.

Definition at line 46 of file graphnode.h.

Constructor & Destructor Documentation

◆ GraphNode() [1/2]

votca::tools::GraphNode::GraphNode ( )
default

◆ GraphNode() [2/2]

votca::tools::GraphNode::GraphNode ( const std::unordered_map< std::string, Index int_vals,
const std::unordered_map< std::string, double >  double_vals,
const std::unordered_map< std::string, std::string >  str_vals 
)

Constructor Each map corresponds to a different content the graph node can contain.

Definition at line 123 of file graphnode.cc.

Member Function Documentation

◆ getDouble()

double votca::tools::GraphNode::getDouble ( const std::string  str)

Definition at line 156 of file graphnode.cc.

◆ getInt()

Index votca::tools::GraphNode::getInt ( const std::string  str)

Basic getters.

Definition at line 147 of file graphnode.cc.

◆ getStr()

std::string votca::tools::GraphNode::getStr ( const std::string  str)

Definition at line 165 of file graphnode.cc.

◆ getStringId()

std::string votca::tools::GraphNode::getStringId ( ) const
inline

Get the string id unique to the contents of the graph node.

Definition at line 74 of file graphnode.h.

◆ initStringId_()

void votca::tools::GraphNode::initStringId_ ( )
private

Used to reinitialize the string id if any of the contents of the graphnode change

Definition at line 113 of file graphnode.cc.

◆ operator!=()

bool votca::tools::GraphNode::operator!= ( const GraphNode  gn) const

Definition at line 174 of file graphnode.cc.

◆ operator==()

bool votca::tools::GraphNode::operator== ( const GraphNode  gn) const

Definition at line 178 of file graphnode.cc.

◆ setDouble()

void votca::tools::GraphNode::setDouble ( const std::unordered_map< std::string, double >  double_vals)

Definition at line 137 of file graphnode.cc.

◆ setInt()

void votca::tools::GraphNode::setInt ( const std::unordered_map< std::string, Index int_vals)

Basic setters.

Definition at line 132 of file graphnode.cc.

◆ setStr()

void votca::tools::GraphNode::setStr ( const std::unordered_map< std::string, std::string >  str_vals)

Definition at line 142 of file graphnode.cc.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const GraphNode  gn 
)
friend

Definition at line 182 of file graphnode.cc.

Member Data Documentation

◆ double_vals_

std::unordered_map<std::string, double> votca::tools::GraphNode::double_vals_
private

Definition at line 50 of file graphnode.h.

◆ GraphDistVisitor

friend votca::tools::GraphNode::GraphDistVisitor

Definition at line 80 of file graphnode.h.

◆ int_vals_

std::unordered_map<std::string, Index> votca::tools::GraphNode::int_vals_
private

Definition at line 49 of file graphnode.h.

◆ str_id_

std::string votca::tools::GraphNode::str_id_ {""}
private

Definition at line 48 of file graphnode.h.

◆ str_vals_

std::unordered_map<std::string, std::string> votca::tools::GraphNode::str_vals_
private

Definition at line 51 of file graphnode.h.


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