votca 2024.2-dev
|
A graph node that will take a variety of different values. More...
#include <graphnode.h>
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, Index > | int_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) |
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.
|
default |
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.
double votca::tools::GraphNode::getDouble | ( | const std::string | str | ) |
Definition at line 156 of file graphnode.cc.
Index votca::tools::GraphNode::getInt | ( | const std::string | str | ) |
Basic getters.
Definition at line 147 of file graphnode.cc.
std::string votca::tools::GraphNode::getStr | ( | const std::string | str | ) |
Definition at line 165 of file graphnode.cc.
|
inline |
Get the string id unique to the contents of the graph node.
Definition at line 74 of file graphnode.h.
|
private |
Used to reinitialize the string id if any of the contents of the graphnode change
Definition at line 113 of file graphnode.cc.
bool votca::tools::GraphNode::operator!= | ( | const GraphNode | gn | ) | const |
Definition at line 174 of file graphnode.cc.
bool votca::tools::GraphNode::operator== | ( | const GraphNode | gn | ) | const |
Definition at line 178 of file graphnode.cc.
void votca::tools::GraphNode::setDouble | ( | const std::unordered_map< std::string, double > | double_vals | ) |
Definition at line 137 of file graphnode.cc.
void votca::tools::GraphNode::setInt | ( | const std::unordered_map< std::string, Index > | int_vals | ) |
Basic setters.
Definition at line 132 of file graphnode.cc.
void votca::tools::GraphNode::setStr | ( | const std::unordered_map< std::string, std::string > | str_vals | ) |
Definition at line 142 of file graphnode.cc.
|
friend |
Definition at line 182 of file graphnode.cc.
|
private |
Definition at line 50 of file graphnode.h.
friend votca::tools::GraphNode::GraphDistVisitor |
Definition at line 80 of file graphnode.h.
|
private |
Definition at line 49 of file graphnode.h.
|
private |
Definition at line 48 of file graphnode.h.
|
private |
Definition at line 51 of file graphnode.h.