solver  1.0
Functions
Utils.h File Reference

Various auxiliary functions used across the program. More...

#include <map>
#include <string>
#include <typeinfo>
#include <type_traits>
#include <utility>
#include <vector>
#include <stdint.h>
#include "SolverConfig.h"
#include "Shared/Exceptions.h"
+ Include dependency graph for Utils.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<class C >
C::mapped_type getValue (const C &m, const typename C::key_type &key, std::string calledFrom)
 
template<class C >
void setValueHelper (C &m, const typename C::key_type &key, const typename C::mapped_type &value, std::string calledFrom)
 
template<class C , class T = typename C::mapped_type>
void setValue (C &m, const typename C::key_type &key, const typename std::enable_if< std::is_pointer< T >::value, T >::type &value, std::string calledFrom)
 
template<class C , class T = typename C::mapped_type>
void setValue (C &m, const typename C::key_type &key, const typename std::enable_if<!std::is_pointer< T >::value, T >::type &value, std::string calledFrom)
 
uint64_t pack (const uint32_t &v1, const uint32_t &v2)
 It packs two uint32_t numbers to uint64_t data type. More...
 
std::pair< uint32_t, uint32_t > unpack (const uint64_t &v)
 It unpacks two uint32_t numbers from uint64_t data type. More...
 
template<class C >
uint64_t hashOW (const C &v)
 It calculates a hash of the container, the order of elements influences (Order Wise) the hash value. More...
 
template<class C >
uintptr_t hashEW (const C &v)
 It calculates a hash of the container, the order of elements does not influence (Element Wise) the hash value. More...
 
bool fileExists (const std::string &pathToFile)
 It checks the existence of the file. More...
 

Detailed Description

Various auxiliary functions used across the program.

Author
Libor Bukata
See also
safe access to associative containers, calculation of hashes

Definition in file Utils.h.

Function Documentation

bool fileExists ( const std::string &  pathToFile)

It checks the existence of the file.

Parameters
pathToFilePath to a file.
Returns
True if the file exists, otherwise false.

Definition at line 85 of file Utils.cpp.

uint64_t pack ( const uint32_t &  v1,
const uint32_t &  v2 
)

It packs two uint32_t numbers to uint64_t data type.

Parameters
v1,v2The first and second number, respectively.
Returns
Both the numbers packed into the one with double width.

Definition at line 26 of file Utils.cpp.

std::pair<uint32_t, uint32_t> unpack ( const uint64_t &  v)

It unpacks two uint32_t numbers from uint64_t data type.

Parameters
vUnsigned integer (uint64_t) containing two packed uint32_t numbers.
Returns
A pair with the unpacked uint32_t numbers.

Definition at line 32 of file Utils.cpp.