Camargue
Classes | Public Member Functions | Private Attributes | List of all members
CMR::util::EdgeHash Class Reference

Hash map for node pairs representing edges. More...

#include <edgehash.hpp>

Classes

struct  eh_impl
 

Public Member Functions

 EdgeHash (int size)
 An EdgeHash for approximately size elements.
 
 EdgeHash (const EdgeHash &eh)=delete
 No copy constructor.
 
EdgeHashoperator= (const EdgeHash &eh)=delete
 No copy assign.
 
void add (int end1, int end2, int val)
 Add a pair. More...
 
void set (int end1, int end2, int val)
 Set val for existing pair. More...
 
void erase (int end1, int end2)
 Delete a pair. More...
 
std::vector< Graph::Edgeget_all ()
 Get a vector of all the edges.
 
void clear ()
 Clear all the edges from the hash.
 
int get_val (int end1, int end2)
 Get the val for an edge.
 

Private Attributes

std::unique_ptr< eh_impleh_pimpl
 The hash table implementation. More...
 

Detailed Description

Hash map for node pairs representing edges.

Remarks
A wrapper to Concorde's CCutil_edgehash.

Member Function Documentation

void CMR::util::EdgeHash::add ( int  end1,
int  end2,
int  val 
)

Add a pair.

Add the edge with endpoints end1 and end2 to the EdgeHash, with lookup value set to val.

void CMR::util::EdgeHash::erase ( int  end1,
int  end2 
)

Delete a pair.

Erase the edge with endpoints end1 end2 from the EdgeHash.

Remarks
we ignore errors from Concorde, hence do not consider it an error to erase no element from an empty hash, or to attempt to erase an element which was not there in the first place.
void CMR::util::EdgeHash::set ( int  end1,
int  end2,
int  val 
)

Set val for existing pair.

If the edge with endpoints end1 end2 is already in the EdgeHash, set its value to val.

Member Data Documentation

std::unique_ptr<eh_impl> CMR::util::EdgeHash::eh_pimpl
private

The hash table implementation.

Pimpl idiom firewall.


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