break up preamble and specializations so there are no duplicate includes
							parent
							
								
									9bafebb521
								
							
						
					
					
						commit
						f33e6a801f
					
				|  | @ -1,30 +0,0 @@ | |||
| /* Please refer to: https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `PYBIND11_MAKE_OPAQUE` will mark the type as "opaque" for the pybind11 automatic STL binding, | ||||
|  * such that the raw objects can be accessed in Python. Without this they will be automatically | ||||
|  * converted to a Python object, and all mutations on Python side will not be reflected on C++. | ||||
|  */ | ||||
| #ifdef GTSAM_ALLOCATOR_TBB | ||||
| PYBIND11_MAKE_OPAQUE(std::vector<gtsam::Key, tbb::tbb_allocator<gtsam::Key>>); | ||||
| #else | ||||
| PYBIND11_MAKE_OPAQUE(std::vector<gtsam::Key>); | ||||
| #endif | ||||
| PYBIND11_MAKE_OPAQUE(std::vector<gtsam::Point2, Eigen::aligned_allocator<gtsam::Point2> >); | ||||
| PYBIND11_MAKE_OPAQUE(gtsam::Point3Pairs); | ||||
| PYBIND11_MAKE_OPAQUE(gtsam::Pose3Pairs); | ||||
| PYBIND11_MAKE_OPAQUE(std::vector<gtsam::Pose3>); | ||||
| PYBIND11_MAKE_OPAQUE(std::vector<boost::shared_ptr<gtsam::BetweenFactor<gtsam::Pose3> > >); | ||||
| PYBIND11_MAKE_OPAQUE(std::vector<boost::shared_ptr<gtsam::BetweenFactor<gtsam::Pose2> > >); | ||||
| PYBIND11_MAKE_OPAQUE(std::vector<gtsam::IndexPair>); | ||||
| PYBIND11_MAKE_OPAQUE(gtsam::CameraSet<gtsam::PinholeCamera<gtsam::Cal3Bundler> >); | ||||
| PYBIND11_MAKE_OPAQUE(gtsam::CameraSet<gtsam::PinholeCamera<gtsam::Cal3_S2> >); | ||||
| PYBIND11_MAKE_OPAQUE(std::vector<gtsam::Matrix>); // JacobianVector
 | ||||
| 
 | ||||
| // TODO(fan): This is to fix the Argument-dependent lookup (ADL) of std::pair. We should find a way to NOT do this.
 | ||||
| namespace std { | ||||
|   using gtsam::operator<<; | ||||
| } | ||||
|  | @ -0,0 +1,16 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `PYBIND11_MAKE_OPAQUE` will mark the type as "opaque" for the pybind11 | ||||
|  * automatic STL binding, such that the raw objects can be accessed in Python. | ||||
|  * Without this they will be automatically converted to a Python object, and all | ||||
|  * mutations on Python side will not be reflected on C++. | ||||
|  */ | ||||
| 
 | ||||
| PYBIND11_MAKE_OPAQUE(std::vector<gtsam::IndexPair>); | ||||
| 
 | ||||
| PYBIND11_MAKE_OPAQUE(std::vector<gtsam::Matrix>);  // JacobianVector
 | ||||
|  | @ -0,0 +1,21 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `PYBIND11_MAKE_OPAQUE` will mark the type as "opaque" for the pybind11 | ||||
|  * automatic STL binding, such that the raw objects can be accessed in Python. | ||||
|  * Without this they will be automatically converted to a Python object, and all | ||||
|  * mutations on Python side will not be reflected on C++. | ||||
|  */ | ||||
| 
 | ||||
| PYBIND11_MAKE_OPAQUE( | ||||
|     std::vector<gtsam::Point2, Eigen::aligned_allocator<gtsam::Point2>>); | ||||
| PYBIND11_MAKE_OPAQUE(gtsam::Point3Pairs); | ||||
| PYBIND11_MAKE_OPAQUE(gtsam::Pose3Pairs); | ||||
| PYBIND11_MAKE_OPAQUE(std::vector<gtsam::Pose3>); | ||||
| PYBIND11_MAKE_OPAQUE( | ||||
|     gtsam::CameraSet<gtsam::PinholeCamera<gtsam::Cal3Bundler>>); | ||||
| PYBIND11_MAKE_OPAQUE(gtsam::CameraSet<gtsam::PinholeCamera<gtsam::Cal3_S2>>); | ||||
|  | @ -0,0 +1,17 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `PYBIND11_MAKE_OPAQUE` will mark the type as "opaque" for the pybind11 | ||||
|  * automatic STL binding, such that the raw objects can be accessed in Python. | ||||
|  * Without this they will be automatically converted to a Python object, and all | ||||
|  * mutations on Python side will not be reflected on C++. | ||||
|  */ | ||||
| #ifdef GTSAM_ALLOCATOR_TBB | ||||
| PYBIND11_MAKE_OPAQUE(std::vector<gtsam::Key, tbb::tbb_allocator<gtsam::Key>>); | ||||
| #else | ||||
| PYBIND11_MAKE_OPAQUE(std::vector<gtsam::Key>); | ||||
| #endif | ||||
|  | @ -0,0 +1,12 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `PYBIND11_MAKE_OPAQUE` will mark the type as "opaque" for the pybind11 | ||||
|  * automatic STL binding, such that the raw objects can be accessed in Python. | ||||
|  * Without this they will be automatically converted to a Python object, and all | ||||
|  * mutations on Python side will not be reflected on C++. | ||||
|  */ | ||||
|  | @ -0,0 +1,18 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `PYBIND11_MAKE_OPAQUE` will mark the type as "opaque" for the pybind11 | ||||
|  * automatic STL binding, such that the raw objects can be accessed in Python. | ||||
|  * Without this they will be automatically converted to a Python object, and all | ||||
|  * mutations on Python side will not be reflected on C++. | ||||
|  */ | ||||
| 
 | ||||
| // TODO(fan): This is to fix the Argument-dependent lookup (ADL) of std::pair.
 | ||||
| // We should find a way to NOT do this.
 | ||||
| namespace std { | ||||
| using gtsam::operator<<; | ||||
| } | ||||
|  | @ -0,0 +1,12 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `PYBIND11_MAKE_OPAQUE` will mark the type as "opaque" for the pybind11 | ||||
|  * automatic STL binding, such that the raw objects can be accessed in Python. | ||||
|  * Without this they will be automatically converted to a Python object, and all | ||||
|  * mutations on Python side will not be reflected on C++. | ||||
|  */ | ||||
|  | @ -0,0 +1,12 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `PYBIND11_MAKE_OPAQUE` will mark the type as "opaque" for the pybind11 | ||||
|  * automatic STL binding, such that the raw objects can be accessed in Python. | ||||
|  * Without this they will be automatically converted to a Python object, and all | ||||
|  * mutations on Python side will not be reflected on C++. | ||||
|  */ | ||||
|  | @ -0,0 +1,12 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `PYBIND11_MAKE_OPAQUE` will mark the type as "opaque" for the pybind11 | ||||
|  * automatic STL binding, such that the raw objects can be accessed in Python. | ||||
|  * Without this they will be automatically converted to a Python object, and all | ||||
|  * mutations on Python side will not be reflected on C++. | ||||
|  */ | ||||
|  | @ -0,0 +1,17 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `PYBIND11_MAKE_OPAQUE` will mark the type as "opaque" for the pybind11 | ||||
|  * automatic STL binding, such that the raw objects can be accessed in Python. | ||||
|  * Without this they will be automatically converted to a Python object, and all | ||||
|  * mutations on Python side will not be reflected on C++. | ||||
|  */ | ||||
| 
 | ||||
| PYBIND11_MAKE_OPAQUE( | ||||
|     std::vector<boost::shared_ptr<gtsam::BetweenFactor<gtsam::Pose3> > >); | ||||
| PYBIND11_MAKE_OPAQUE( | ||||
|     std::vector<boost::shared_ptr<gtsam::BetweenFactor<gtsam::Pose2> > >); | ||||
|  | @ -0,0 +1,12 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `PYBIND11_MAKE_OPAQUE` will mark the type as "opaque" for the pybind11 | ||||
|  * automatic STL binding, such that the raw objects can be accessed in Python. | ||||
|  * Without this they will be automatically converted to a Python object, and all | ||||
|  * mutations on Python side will not be reflected on C++. | ||||
|  */ | ||||
|  | @ -1,35 +0,0 @@ | |||
| /* Please refer to: https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `PYBIND11_MAKE_OPAQUE` will mark the type as "opaque" for the pybind11 automatic STL binding, | ||||
|  * such that the raw objects can be accessed in Python. Without this they will be automatically | ||||
|  * converted to a Python object, and all mutations on Python side will not be reflected on C++. | ||||
|  * | ||||
|  * `py::bind_vector` and similar machinery gives the std container a Python-like interface, but | ||||
|  * without the `<pybind11/stl.h>` copying mechanism. Combined with `PYBIND11_MAKE_OPAQUE` this | ||||
|  * allows the types to be modified with Python, and saves one copy operation. | ||||
|  */ | ||||
| #ifdef GTSAM_ALLOCATOR_TBB | ||||
| py::bind_vector<std::vector<gtsam::Key, tbb::tbb_allocator<gtsam::Key> > >(m_, "KeyVector"); | ||||
| py::implicitly_convertible<py::list, std::vector<gtsam::Key, tbb::tbb_allocator<gtsam::Key> > >(); | ||||
| #else | ||||
| py::bind_vector<std::vector<gtsam::Key> >(m_, "KeyVector"); | ||||
| py::implicitly_convertible<py::list, std::vector<gtsam::Key> >(); | ||||
| #endif | ||||
| 
 | ||||
| py::bind_vector<std::vector<gtsam::Point2, Eigen::aligned_allocator<gtsam::Point2> > >(m_, "Point2Vector"); | ||||
| py::bind_vector<std::vector<gtsam::Point3Pair> >(m_, "Point3Pairs"); | ||||
| py::bind_vector<std::vector<gtsam::Pose3Pair> >(m_, "Pose3Pairs"); | ||||
| py::bind_vector<std::vector<gtsam::Pose3> >(m_, "Pose3Vector"); | ||||
| py::bind_vector<std::vector<boost::shared_ptr<gtsam::BetweenFactor<gtsam::Pose3> > > >(m_, "BetweenFactorPose3s"); | ||||
| py::bind_vector<std::vector<boost::shared_ptr<gtsam::BetweenFactor<gtsam::Pose2> > > >(m_, "BetweenFactorPose2s"); | ||||
| py::bind_vector<std::vector<gtsam::BinaryMeasurement<gtsam::Unit3> > >(m_, "BinaryMeasurementsUnit3"); | ||||
| py::bind_map<gtsam::IndexPairSetMap>(m_, "IndexPairSetMap"); | ||||
| py::bind_vector<gtsam::IndexPairVector>(m_, "IndexPairVector"); | ||||
| py::bind_map<gtsam::KeyPairDoubleMap>(m_, "KeyPairDoubleMap"); | ||||
| py::bind_vector<gtsam::CameraSet<gtsam::PinholeCamera<gtsam::Cal3_S2> > >(m_, "CameraSetCal3_S2"); | ||||
| py::bind_vector<gtsam::CameraSet<gtsam::PinholeCamera<gtsam::Cal3Bundler> > >(m_, "CameraSetCal3Bundler"); | ||||
| py::bind_vector<std::vector<gtsam::Matrix> >(m_, "JacobianVector"); | ||||
|  | @ -0,0 +1,17 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `py::bind_vector` and similar machinery gives the std container a Python-like | ||||
|  * interface, but without the `<pybind11/stl.h>` copying mechanism. Combined | ||||
|  * with `PYBIND11_MAKE_OPAQUE` this allows the types to be modified with Python, | ||||
|  * and saves one copy operation. | ||||
|  */ | ||||
| 
 | ||||
| py::bind_map<gtsam::IndexPairSetMap>(m_, "IndexPairSetMap"); | ||||
| py::bind_vector<gtsam::IndexPairVector>(m_, "IndexPairVector"); | ||||
| 
 | ||||
| py::bind_vector<std::vector<gtsam::Matrix> >(m_, "JacobianVector"); | ||||
|  | @ -0,0 +1,23 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `py::bind_vector` and similar machinery gives the std container a Python-like | ||||
|  * interface, but without the `<pybind11/stl.h>` copying mechanism. Combined | ||||
|  * with `PYBIND11_MAKE_OPAQUE` this allows the types to be modified with Python, | ||||
|  * and saves one copy operation. | ||||
|  */ | ||||
| 
 | ||||
| py::bind_vector< | ||||
|     std::vector<gtsam::Point2, Eigen::aligned_allocator<gtsam::Point2>>>( | ||||
|     m_, "Point2Vector"); | ||||
| py::bind_vector<std::vector<gtsam::Point3Pair>>(m_, "Point3Pairs"); | ||||
| py::bind_vector<std::vector<gtsam::Pose3Pair>>(m_, "Pose3Pairs"); | ||||
| py::bind_vector<std::vector<gtsam::Pose3>>(m_, "Pose3Vector"); | ||||
| py::bind_vector<gtsam::CameraSet<gtsam::PinholeCamera<gtsam::Cal3_S2>>>( | ||||
|     m_, "CameraSetCal3_S2"); | ||||
| py::bind_vector<gtsam::CameraSet<gtsam::PinholeCamera<gtsam::Cal3Bundler>>>( | ||||
|     m_, "CameraSetCal3Bundler"); | ||||
|  | @ -0,0 +1,20 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `py::bind_vector` and similar machinery gives the std container a Python-like | ||||
|  * interface, but without the `<pybind11/stl.h>` copying mechanism. Combined | ||||
|  * with `PYBIND11_MAKE_OPAQUE` this allows the types to be modified with Python, | ||||
|  * and saves one copy operation. | ||||
|  */ | ||||
| 
 | ||||
| #ifdef GTSAM_ALLOCATOR_TBB | ||||
| py::bind_vector<std::vector<gtsam::Key, tbb::tbb_allocator<gtsam::Key> > >(m_, "KeyVector"); | ||||
| py::implicitly_convertible<py::list, std::vector<gtsam::Key, tbb::tbb_allocator<gtsam::Key> > >(); | ||||
| #else | ||||
| py::bind_vector<std::vector<gtsam::Key> >(m_, "KeyVector"); | ||||
| py::implicitly_convertible<py::list, std::vector<gtsam::Key> >(); | ||||
| #endif | ||||
|  | @ -0,0 +1,12 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `py::bind_vector` and similar machinery gives the std container a Python-like | ||||
|  * interface, but without the `<pybind11/stl.h>` copying mechanism. Combined | ||||
|  * with `PYBIND11_MAKE_OPAQUE` this allows the types to be modified with Python, | ||||
|  * and saves one copy operation. | ||||
|  */ | ||||
|  | @ -0,0 +1,12 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `py::bind_vector` and similar machinery gives the std container a Python-like | ||||
|  * interface, but without the `<pybind11/stl.h>` copying mechanism. Combined | ||||
|  * with `PYBIND11_MAKE_OPAQUE` this allows the types to be modified with Python, | ||||
|  * and saves one copy operation. | ||||
|  */ | ||||
|  | @ -0,0 +1,12 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `py::bind_vector` and similar machinery gives the std container a Python-like | ||||
|  * interface, but without the `<pybind11/stl.h>` copying mechanism. Combined | ||||
|  * with `PYBIND11_MAKE_OPAQUE` this allows the types to be modified with Python, | ||||
|  * and saves one copy operation. | ||||
|  */ | ||||
|  | @ -0,0 +1,12 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `py::bind_vector` and similar machinery gives the std container a Python-like | ||||
|  * interface, but without the `<pybind11/stl.h>` copying mechanism. Combined | ||||
|  * with `PYBIND11_MAKE_OPAQUE` this allows the types to be modified with Python, | ||||
|  * and saves one copy operation. | ||||
|  */ | ||||
|  | @ -0,0 +1,16 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `py::bind_vector` and similar machinery gives the std container a Python-like | ||||
|  * interface, but without the `<pybind11/stl.h>` copying mechanism. Combined | ||||
|  * with `PYBIND11_MAKE_OPAQUE` this allows the types to be modified with Python, | ||||
|  * and saves one copy operation. | ||||
|  */ | ||||
| 
 | ||||
| py::bind_vector<std::vector<gtsam::BinaryMeasurement<gtsam::Unit3> > >( | ||||
|     m_, "BinaryMeasurementsUnit3"); | ||||
| py::bind_map<gtsam::KeyPairDoubleMap>(m_, "KeyPairDoubleMap"); | ||||
|  | @ -0,0 +1,19 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `py::bind_vector` and similar machinery gives the std container a Python-like | ||||
|  * interface, but without the `<pybind11/stl.h>` copying mechanism. Combined | ||||
|  * with `PYBIND11_MAKE_OPAQUE` this allows the types to be modified with Python, | ||||
|  * and saves one copy operation. | ||||
|  */ | ||||
| 
 | ||||
| py::bind_vector< | ||||
|     std::vector<boost::shared_ptr<gtsam::BetweenFactor<gtsam::Pose3> > > >( | ||||
|     m_, "BetweenFactorPose3s"); | ||||
| py::bind_vector< | ||||
|     std::vector<boost::shared_ptr<gtsam::BetweenFactor<gtsam::Pose2> > > >( | ||||
|     m_, "BetweenFactorPose2s"); | ||||
|  | @ -0,0 +1,12 @@ | |||
| /* Please refer to:
 | ||||
|  * https://pybind11.readthedocs.io/en/stable/advanced/cast/stl.html
 | ||||
|  * These are required to save one copy operation on Python calls. | ||||
|  * | ||||
|  * NOTES | ||||
|  * ================= | ||||
|  * | ||||
|  * `py::bind_vector` and similar machinery gives the std container a Python-like | ||||
|  * interface, but without the `<pybind11/stl.h>` copying mechanism. Combined | ||||
|  * with `PYBIND11_MAKE_OPAQUE` this allows the types to be modified with Python, | ||||
|  * and saves one copy operation. | ||||
|  */ | ||||
		Loading…
	
		Reference in New Issue