Replace boost::bimap

release/4.3a0
Frank Dellaert 2023-02-05 19:56:10 -08:00
parent 0ee985b629
commit 438e29353d
2 changed files with 14 additions and 13 deletions

View File

@ -44,7 +44,7 @@ void MetisIndex::augment(const FACTORGRAPH& factors) {
for(const Key& key: *factors[i]) {
keySet.insert(keySet.end(), key); // Keep a track of all unique keys
if (intKeyBMap_.left.find(key) == intKeyBMap_.left.end()) {
intKeyBMap_.insert(bm_type::value_type(key, keyCounter));
intKeyBMap_.insert(key, keyCounter);
keyCounter++;
}
}

View File

@ -22,17 +22,9 @@
#include <gtsam/base/types.h>
#include <gtsam/base/timing.h>
// Boost bimap generates many ugly warnings in CLANG
#ifdef __clang__
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wredeclared-class-member"
#endif
#include <boost/bimap.hpp>
#ifdef __clang__
# pragma clang diagnostic pop
#endif
#include <vector>
#include <map>
#include <unordered_map>
namespace gtsam {
/**
@ -45,12 +37,21 @@ namespace gtsam {
class GTSAM_EXPORT MetisIndex {
public:
typedef std::shared_ptr<MetisIndex> shared_ptr;
typedef boost::bimap<Key, int32_t> bm_type;
private:
// Stores Key <-> integer value relationship
struct BiMap {
std::map<Key, int32_t> left;
std::unordered_map<int32_t, Key> right;
void insert(const Key& left_value, const int32_t& right_value) {
left[left_value] = right_value;
right[right_value] = left_value;
}
};
std::vector<int32_t> xadj_; // Index of node's adjacency list in adj
std::vector<int32_t> adj_; // Stores ajacency lists of all nodes, appended into a single vector
boost::bimap<Key, int32_t> intKeyBMap_; // Stores Key <-> integer value relationship
BiMap intKeyBMap_; // Stores Key <-> integer value relationship
size_t nKeys_;
public: