Camargue
edgehash.hpp
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
6 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
7 
8 #ifndef CMR_EDGEHASH_H
9 #define CMR_EDGEHASH_H
10 
11 #include "graph.hpp"
12 #include "util.hpp"
13 
14 #include <iostream>
15 #include <memory>
16 #include <utility>
17 #include <vector>
18 
19 namespace CMR {
20 namespace util {
21 
24 class EdgeHash {
25 public:
26  EdgeHash(int size);
27  ~EdgeHash();
28 
29  EdgeHash(const EdgeHash &eh) = delete;
30  EdgeHash &operator=(const EdgeHash &eh) = delete;
31 
32  void add(int end1, int end2, int val);
33  void set(int end1, int end2, int val);
34  void erase(int end1, int end2);
35 
36  std::vector<Graph::Edge> get_all();
37  void clear();
38  int get_val(int end1, int end2);
39 
40 
41 private:
42  struct eh_impl;
43  std::unique_ptr<eh_impl> eh_pimpl;
44 };
45 
46 
47 }
48 }
49 
50 #endif
int get_val(int end1, int end2)
Get the val for an edge.
Definition: edgehash.cpp:92
Header for classes/structures/functions to work with graphs.
Hash map for node pairs representing edges.
Definition: edgehash.hpp:24
std::vector< Graph::Edge > get_all()
Get a vector of all the edges.
Definition: edgehash.cpp:70
void clear()
Clear all the edges from the hash.
Definition: edgehash.cpp:90
Definition: edgehash.cpp:18
void erase(int end1, int end2)
Delete a pair.
Definition: edgehash.cpp:65
EdgeHash(int size)
An EdgeHash for approximately size elements.
Definition: edgehash.cpp:36
Utility functions, macros, and structures.
std::unique_ptr< eh_impl > eh_pimpl
The hash table implementation.
Definition: edgehash.hpp:42
EdgeHash & operator=(const EdgeHash &eh)=delete
No copy assign.
The namespace for this project.
Definition: abc_nodesel.hpp:20
void add(int end1, int end2, int val)
Add a pair.
Definition: edgehash.cpp:47