Skip to content

Commit 3ab3f46

Browse files
authored
Merge pull request #822 from borglab/feature/wrap-multiple-interfaces
Break interface file into multiple files
2 parents 740c9c6 + 6db646d commit 3ab3f46

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+5623
-5309
lines changed

.github/workflows/build-python.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,20 @@ jobs:
1919
# Github Actions requires a single row to be added to the build matrix.
2020
# See https://help.github.com/en/articles/workflow-syntax-for-github-actions.
2121
name: [
22-
# ubuntu-18.04-gcc-5, #TODO Enable once the Python wrapper is optimized for memory
22+
ubuntu-18.04-gcc-5,
2323
ubuntu-18.04-gcc-9,
2424
ubuntu-18.04-clang-9,
2525
macOS-10.15-xcode-11.3.1,
26-
# ubuntu-18.04-gcc-5-tbb,
26+
ubuntu-18.04-gcc-5-tbb,
2727
]
2828

29-
#TODO update wrapper to prevent OOM
30-
# build_type: [Debug, Release]
31-
build_type: [Release]
29+
build_type: [Debug, Release]
3230
python_version: [3]
3331
include:
34-
# - name: ubuntu-18.04-gcc-5
35-
# os: ubuntu-18.04
36-
# compiler: gcc
37-
# version: "5"
32+
- name: ubuntu-18.04-gcc-5
33+
os: ubuntu-18.04
34+
compiler: gcc
35+
version: "5"
3836

3937
- name: ubuntu-18.04-gcc-9
4038
os: ubuntu-18.04
@@ -46,7 +44,7 @@ jobs:
4644
compiler: clang
4745
version: "9"
4846

49-
#NOTE temporarily added this as it is a required check.
47+
# NOTE temporarily added this as it is a required check.
5048
- name: ubuntu-18.04-clang-9
5149
os: ubuntu-18.04
5250
compiler: clang
@@ -59,11 +57,11 @@ jobs:
5957
compiler: xcode
6058
version: "11.3.1"
6159

62-
# - name: ubuntu-18.04-gcc-5-tbb
63-
# os: ubuntu-18.04
64-
# compiler: gcc
65-
# version: "5"
66-
# flag: tbb
60+
- name: ubuntu-18.04-gcc-5-tbb
61+
os: ubuntu-18.04
62+
compiler: gcc
63+
version: "5"
64+
flag: tbb
6765

6866
steps:
6967
- name: Checkout

gtsam/base/base.i

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
//*************************************************************************
2+
// base
3+
//*************************************************************************
4+
5+
namespace gtsam {
6+
7+
#include <gtsam/geometry/Cal3Bundler.h>
8+
#include <gtsam/geometry/Cal3DS2.h>
9+
#include <gtsam/geometry/Cal3Fisheye.h>
10+
#include <gtsam/geometry/Cal3Unified.h>
11+
#include <gtsam/geometry/Cal3_S2.h>
12+
#include <gtsam/geometry/CalibratedCamera.h>
13+
#include <gtsam/geometry/EssentialMatrix.h>
14+
#include <gtsam/geometry/Point2.h>
15+
#include <gtsam/geometry/Point3.h>
16+
#include <gtsam/geometry/Pose2.h>
17+
#include <gtsam/geometry/Pose3.h>
18+
#include <gtsam/geometry/Rot2.h>
19+
#include <gtsam/geometry/Rot3.h>
20+
#include <gtsam/geometry/StereoPoint2.h>
21+
#include <gtsam/navigation/ImuBias.h>
22+
23+
// #####
24+
25+
#include <gtsam/base/debug.h>
26+
bool isDebugVersion();
27+
28+
#include <gtsam/base/DSFMap.h>
29+
class IndexPair {
30+
IndexPair();
31+
IndexPair(size_t i, size_t j);
32+
size_t i() const;
33+
size_t j() const;
34+
};
35+
36+
// template<KEY = {gtsam::IndexPair}>
37+
// class DSFMap {
38+
// DSFMap();
39+
// KEY find(const KEY& key) const;
40+
// void merge(const KEY& x, const KEY& y);
41+
// std::map<KEY, Set> sets();
42+
// };
43+
44+
class IndexPairSet {
45+
IndexPairSet();
46+
// common STL methods
47+
size_t size() const;
48+
bool empty() const;
49+
void clear();
50+
51+
// structure specific methods
52+
void insert(gtsam::IndexPair key);
53+
bool erase(gtsam::IndexPair key); // returns true if value was removed
54+
bool count(gtsam::IndexPair key) const; // returns true if value exists
55+
};
56+
57+
class IndexPairVector {
58+
IndexPairVector();
59+
IndexPairVector(const gtsam::IndexPairVector& other);
60+
61+
// common STL methods
62+
size_t size() const;
63+
bool empty() const;
64+
void clear();
65+
66+
// structure specific methods
67+
gtsam::IndexPair at(size_t i) const;
68+
void push_back(gtsam::IndexPair key) const;
69+
};
70+
71+
gtsam::IndexPairVector IndexPairSetAsArray(gtsam::IndexPairSet& set);
72+
73+
class IndexPairSetMap {
74+
IndexPairSetMap();
75+
// common STL methods
76+
size_t size() const;
77+
bool empty() const;
78+
void clear();
79+
80+
// structure specific methods
81+
gtsam::IndexPairSet at(gtsam::IndexPair& key);
82+
};
83+
84+
class DSFMapIndexPair {
85+
DSFMapIndexPair();
86+
gtsam::IndexPair find(const gtsam::IndexPair& key) const;
87+
void merge(const gtsam::IndexPair& x, const gtsam::IndexPair& y);
88+
gtsam::IndexPairSetMap sets();
89+
};
90+
91+
#include <gtsam/base/Matrix.h>
92+
bool linear_independent(Matrix A, Matrix B, double tol);
93+
94+
#include <gtsam/base/Value.h>
95+
virtual class Value {
96+
// No constructors because this is an abstract class
97+
98+
// Testable
99+
void print(string s = "") const;
100+
101+
// Manifold
102+
size_t dim() const;
103+
};
104+
105+
#include <gtsam/base/GenericValue.h>
106+
template <T = {Vector, Matrix, gtsam::Point2, gtsam::Point3, gtsam::Rot2,
107+
gtsam::Rot3, gtsam::Pose2, gtsam::Pose3, gtsam::StereoPoint2,
108+
gtsam::Cal3_S2, gtsam::Cal3DS2, gtsam::Cal3Bundler,
109+
gtsam::Cal3Fisheye, gtsam::Cal3Unified, gtsam::EssentialMatrix,
110+
gtsam::CalibratedCamera, gtsam::imuBias::ConstantBias}>
111+
virtual class GenericValue : gtsam::Value {
112+
void serializable() const;
113+
};
114+
115+
} // namespace gtsam

gtsam/base/utilities.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#pragma once
2+
3+
namespace gtsam {
4+
/**
5+
* For Python __str__().
6+
* Redirect std cout to a string stream so we can return a string representation
7+
* of an object when it prints to cout.
8+
* https://stackoverflow.com/questions/5419356/redirect-stdout-stderr-to-a-string
9+
*/
10+
struct RedirectCout {
11+
/// constructor -- redirect stdout buffer to a stringstream buffer
12+
RedirectCout() : ssBuffer_(), coutBuffer_(std::cout.rdbuf(ssBuffer_.rdbuf())) {}
13+
14+
/// return the string
15+
std::string str() const {
16+
return ssBuffer_.str();
17+
}
18+
19+
/// destructor -- redirect stdout buffer to its original buffer
20+
~RedirectCout() {
21+
std::cout.rdbuf(coutBuffer_);
22+
}
23+
24+
private:
25+
std::stringstream ssBuffer_;
26+
std::streambuf* coutBuffer_;
27+
};
28+
29+
}

gtsam/geometry/SimpleCamera.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <gtsam/geometry/BearingRange.h>
2222
#include <gtsam/geometry/Cal3Bundler.h>
2323
#include <gtsam/geometry/Cal3DS2.h>
24+
#include <gtsam/geometry/Cal3Fisheye.h>
2425
#include <gtsam/geometry/Cal3Unified.h>
2526
#include <gtsam/geometry/Cal3Fisheye.h>
2627
#include <gtsam/geometry/Cal3_S2.h>

0 commit comments

Comments
 (0)