21 #ifndef __CXXGRAPH_NODE_H__
22 #define __CXXGRAPH_NODE_H__
26 #include <openssl/sha.h>
35 std::ostream &operator<<(std::ostream &os,
const Node<T> &node);
41 std::string userId =
"";
43 void setId(std::string_view);
46 Node(std::string_view,
const T &data);
48 const std::size_t &getId()
const;
49 const std::string &getUserId()
const;
50 const T &getData()
const;
52 bool operator==(
const Node<T> &b)
const;
53 bool operator<(
const Node<T> &b)
const;
54 friend std::ostream &operator<<<>(std::ostream &os,
const Node<T> &node);
67 void Node<T>::setId(std::string_view inpId)
91 this->
id = std::hash<std::string_view>{}(inpId);
96 const std::size_t &Node<T>::getId()
const
101 template <
typename T>
102 const std::string &Node<T>::getUserId()
const
107 template <
typename T>
108 const T &Node<T>::getData()
const
113 template <
typename T>
114 bool Node<T>::operator==(
const Node<T> &b)
const
116 return (this->
id == b.id && this->data == b.data);
119 template <
typename T>
120 bool Node<T>::operator<(
const Node<T> &b)
const
122 return (this->
id < b.id);
127 template <
typename T>
128 std::ostream &operator<<(std::ostream &os,
const Node<T> &node)
131 <<
" Id:\t" << node.userId <<
"\n Data:\t" << node.data <<
"\n}";