remove need for boost
parent
4a7064e8b0
commit
704f3c907c
|
@ -18,12 +18,9 @@
|
||||||
|
|
||||||
#include <gtsam/geometry/Pose2.h>
|
#include <gtsam/geometry/Pose2.h>
|
||||||
|
|
||||||
#include <boost/algorithm/string/classification.hpp>
|
|
||||||
#include <boost/algorithm/string/split.hpp>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
using namespace gtsam;
|
using namespace gtsam;
|
||||||
using namespace boost::algorithm;
|
|
||||||
|
|
||||||
using symbol_shorthand::X;
|
using symbol_shorthand::X;
|
||||||
|
|
||||||
|
@ -40,6 +37,20 @@ const double kPoseNoiseConstant = kPoseNoiseModel->negLogConstant();
|
||||||
class City10000Dataset {
|
class City10000Dataset {
|
||||||
std::ifstream in_;
|
std::ifstream in_;
|
||||||
|
|
||||||
|
/// Read a `line` from the dataset, separated by the `delimiter`.
|
||||||
|
std::vector<std::string> readLine(const std::string& line,
|
||||||
|
const std::string& delimiter = " ") const {
|
||||||
|
std::vector<std::string> parts;
|
||||||
|
auto start = 0U;
|
||||||
|
auto end = line.find(delimiter);
|
||||||
|
while (end != std::string::npos) {
|
||||||
|
parts.push_back(line.substr(start, end - start));
|
||||||
|
start = end + delimiter.length();
|
||||||
|
end = line.find(delimiter, start);
|
||||||
|
}
|
||||||
|
return parts;
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
City10000Dataset(const std::string& filename) : in_(filename) {
|
City10000Dataset(const std::string& filename) : in_(filename) {
|
||||||
if (!in_.is_open()) {
|
if (!in_.is_open()) {
|
||||||
|
@ -50,8 +61,7 @@ class City10000Dataset {
|
||||||
/// Parse line from file
|
/// Parse line from file
|
||||||
std::pair<std::vector<Pose2>, std::pair<size_t, size_t>> parseLine(
|
std::pair<std::vector<Pose2>, std::pair<size_t, size_t>> parseLine(
|
||||||
const std::string& line) const {
|
const std::string& line) const {
|
||||||
std::vector<std::string> parts;
|
std::vector<std::string> parts = readLine(line);
|
||||||
split(parts, line, is_any_of(" "));
|
|
||||||
|
|
||||||
size_t keyS = stoi(parts[1]);
|
size_t keyS = stoi(parts[1]);
|
||||||
size_t keyT = stoi(parts[3]);
|
size_t keyT = stoi(parts[3]);
|
||||||
|
|
Loading…
Reference in New Issue