opatIO-cpp 0.3.0a
Open Parametrized Array Table
Loading...
Searching...
No Matches
indexVector.h File Reference

Header file defining the FloatIndexVector class for handling floating-point index vectors. More...

#include <stdexcept>
#include <vector>
#include <functional>

Go to the source code of this file.

Classes

class  FloatIndexVector
 
struct  std::hash< FloatIndexVector >
 

Namespaces

namespace  std
 Specialization of std::hash for FloatIndexVector.
 

Detailed Description

Header file defining the FloatIndexVector class for handling floating-point index vectors.

This class is designed to provide a robust and efficient way to handle floating-point vectors with support for hashing and precision control. It is primarily used in the OPAT library for indexing and cataloging data tables.

Design Choices:

  • Precision Control: Allows rounding of floating-point values to a specified precision for consistent hashing.
  • Hashing Support: Implements a custom hash function for use in unordered containers.
  • Flexibility: Supports initialization with or without precision and provides methods for modifying the vector.

Example Usage:

#include "indexVector.h"
int main() {
std::vector<double> vec = {1.2345, 2.3456, 3.4567};
FloatIndexVector index(vec, 2); // Initialize with precision of 2 decimal places
std::unordered_map<FloatIndexVector, std::string> map;
map[index] = "Example Data";
if (map.find(index) != map.end()) {
std::cout << "Found: " << map[index] << std::endl;
}
return 0;
}
Definition indexVector.h:38
Header file defining the FloatIndexVector class for handling floating-point index vectors.