1. Replace boost enable_if and is_base_of with those in stl
2. Removed boost header files 3. Removed testFactorGraph.cpprelease/4.3a0
							parent
							
								
									60f556e513
								
							
						
					
					
						commit
						9ba6b80f9e
					
				|  | @ -22,17 +22,16 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <boost/serialization/nvp.hpp> | ||||
| #include <boost/assign/list_inserter.hpp> | ||||
| #include <boost/bind.hpp> | ||||
| #include <boost/make_shared.hpp> | ||||
| #include <boost/utility/enable_if.hpp> | ||||
| #include <boost/type_traits.hpp> | ||||
| 
 | ||||
| #include <gtsam/base/Testable.h> | ||||
| #include <gtsam/base/FastVector.h> | ||||
| #include <gtsam/inference/Key.h> | ||||
| 
 | ||||
| #include <boost/serialization/nvp.hpp> | ||||
| #include <boost/assign/list_inserter.hpp> | ||||
| #include <boost/bind.hpp> | ||||
| #include <boost/make_shared.hpp> | ||||
| 
 | ||||
| #include <type_traits> | ||||
| #include <utility> | ||||
| 
 | ||||
| namespace gtsam { | ||||
|  | @ -153,7 +152,7 @@ namespace gtsam { | |||
| 
 | ||||
|     /** Add a factor directly using a shared_ptr */ | ||||
|     template<class DERIVEDFACTOR> | ||||
|     typename boost::enable_if<boost::is_base_of<FactorType, DERIVEDFACTOR> >::type | ||||
|     typename std::enable_if<std::is_base_of<FactorType, DERIVEDFACTOR>::value>::type | ||||
|     push_back(boost::shared_ptr<DERIVEDFACTOR> factor) { | ||||
|       factors_.push_back(boost::shared_ptr<FACTOR>(factor)); } | ||||
| 
 | ||||
|  | @ -163,19 +162,20 @@ namespace gtsam { | |||
| 
 | ||||
|     /** Emplace a factor */ | ||||
|     template<class DERIVEDFACTOR, class... Args> | ||||
|     void emplace_shared(Args&&... args) { | ||||
|     typename std::enable_if<std::is_base_of<FactorType, DERIVEDFACTOR>::value>::type | ||||
|     emplace_shared(Args&&... args) { | ||||
|         factors_.push_back(boost::make_shared<DERIVEDFACTOR>(std::forward<Args>(args)...)); | ||||
|     } | ||||
| 
 | ||||
|     /** push back many factors with an iterator over shared_ptr (factors are not copied) */ | ||||
|     template<typename ITERATOR> | ||||
|     typename boost::enable_if<boost::is_base_of<FactorType, typename ITERATOR::value_type::element_type> >::type | ||||
|     typename std::enable_if<std::is_base_of<FactorType, typename ITERATOR::value_type::element_type>::value>::type | ||||
|       push_back(ITERATOR firstFactor, ITERATOR lastFactor) { | ||||
|         factors_.insert(end(), firstFactor, lastFactor); } | ||||
| 
 | ||||
|     /** push back many factors as shared_ptr's in a container (factors are not copied) */ | ||||
|     template<typename CONTAINER> | ||||
|     typename boost::enable_if<boost::is_base_of<FactorType, typename CONTAINER::value_type::element_type> >::type | ||||
|     typename std::enable_if<std::is_base_of<FactorType, typename CONTAINER::value_type::element_type>::value>::type | ||||
|       push_back(const CONTAINER& container) { | ||||
|         push_back(container.begin(), container.end()); | ||||
|     } | ||||
|  | @ -183,22 +183,24 @@ namespace gtsam { | |||
|     /** push back a BayesTree as a collection of factors.  NOTE: This should be hidden in derived
 | ||||
|      *  classes in favor of a type-specialized version that calls this templated function. */ | ||||
|     template<class CLIQUE> | ||||
|     typename boost::enable_if<boost::is_base_of<This, typename CLIQUE::FactorGraphType> >::type | ||||
|     typename std::enable_if<std::is_base_of<This, typename CLIQUE::FactorGraphType>::value>::type | ||||
|     push_back(const BayesTree<CLIQUE>& bayesTree) { | ||||
|       bayesTree.addFactorsToGraph(*this); | ||||
|     } | ||||
| 
 | ||||
| #ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V4 | ||||
|     /** Add a factor by value, will be copy-constructed (use push_back with a shared_ptr to avoid
 | ||||
|     *  the copy). */ | ||||
|     template<class DERIVEDFACTOR> | ||||
|     typename boost::enable_if<boost::is_base_of<FactorType, DERIVEDFACTOR> >::type | ||||
|     typename std::enable_if<std::is_base_of<FactorType, DERIVEDFACTOR>::value>::type | ||||
|       push_back(const DERIVEDFACTOR& factor) { | ||||
|         factors_.push_back(boost::make_shared<DERIVEDFACTOR>(factor)); | ||||
|     } | ||||
| #endif | ||||
| 
 | ||||
|     /** push back many factors with an iterator over plain factors (factors are copied) */ | ||||
|     template<typename ITERATOR> | ||||
|     typename boost::enable_if<boost::is_base_of<FactorType, typename ITERATOR::value_type> >::type | ||||
|     typename std::enable_if<std::is_base_of<FactorType, typename ITERATOR::value_type>::value>::type | ||||
|       push_back(ITERATOR firstFactor, ITERATOR lastFactor) { | ||||
|         for (ITERATOR f = firstFactor; f != lastFactor; ++f) | ||||
|           push_back(*f); | ||||
|  | @ -206,14 +208,14 @@ namespace gtsam { | |||
| 
 | ||||
|     /** push back many factors as non-pointer objects in a container (factors are copied) */ | ||||
|     template<typename CONTAINER> | ||||
|     typename boost::enable_if<boost::is_base_of<FactorType, typename CONTAINER::value_type> >::type | ||||
|     typename std::enable_if<std::is_base_of<FactorType, typename CONTAINER::value_type>::value>::type | ||||
|       push_back(const CONTAINER& container) { | ||||
|         push_back(container.begin(), container.end()); | ||||
|     } | ||||
| 
 | ||||
|     /** Add a factor directly using a shared_ptr */ | ||||
|     template<class DERIVEDFACTOR> | ||||
|     typename boost::enable_if<boost::is_base_of<FactorType, DERIVEDFACTOR>, | ||||
|     typename std::enable_if<std::is_base_of<FactorType, DERIVEDFACTOR>::value, | ||||
|       boost::assign::list_inserter<RefCallPushBack<This> > >::type | ||||
|       operator+=(boost::shared_ptr<DERIVEDFACTOR> factor) { | ||||
|         return boost::assign::make_list_inserter(RefCallPushBack<This>(*this))(factor); | ||||
|  | @ -234,7 +236,7 @@ namespace gtsam { | |||
| 
 | ||||
|     /** Add a factor directly using a shared_ptr */ | ||||
|     template<class DERIVEDFACTOR> | ||||
|     typename boost::enable_if<boost::is_base_of<FactorType, DERIVEDFACTOR> >::type | ||||
|     typename std::enable_if<std::is_base_of<FactorType, DERIVEDFACTOR>::value>::type | ||||
|       add(boost::shared_ptr<DERIVEDFACTOR> factor) { | ||||
|         push_back(factor); | ||||
|     } | ||||
|  |  | |||
|  | @ -1,44 +0,0 @@ | |||
| /* ----------------------------------------------------------------------------
 | ||||
| 
 | ||||
|  * GTSAM Copyright 2010, Georgia Tech Research Corporation, | ||||
|  * Atlanta, Georgia 30332-0415 | ||||
|  * All Rights Reserved | ||||
|  * Authors: Frank Dellaert, et al. (see THANKS for the full author list) | ||||
| 
 | ||||
|  * See LICENSE for the license information | ||||
| 
 | ||||
|  * -------------------------------------------------------------------------- */ | ||||
| 
 | ||||
| /**
 | ||||
|  * @file    testFactorGraph.cpp | ||||
|  * @author  Yao Chen | ||||
|  */ | ||||
| 
 | ||||
| #include <gtsam/nonlinear/NonlinearFactorGraph.h> | ||||
| #include <gtsam/slam/ProjectionFactor.h> | ||||
| #include <gtsam/inference/Symbol.h> | ||||
| 
 | ||||
| #include <gtsam/base/TestableAssertions.h> | ||||
| #include <CppUnitLite/TestHarness.h> | ||||
| 
 | ||||
| using namespace std; | ||||
| using namespace gtsam; | ||||
| 
 | ||||
| 
 | ||||
| TEST(FactorGraph, testEmplaceShared) { | ||||
|     Cal3_S2::shared_ptr K(new Cal3_S2(50.0, 50.0, 0.0, 50.0, 50.0)); | ||||
|     noiseModel::Isotropic::shared_ptr measurementNoise = noiseModel::Isotropic::Sigma(2, 1.0); | ||||
|     Point2 measurement(10.0, 10.0); | ||||
| 
 | ||||
|     NonlinearFactorGraph graph; | ||||
|     graph.push_back(GenericProjectionFactor<Pose3, Point3, Cal3_S2>(measurement, measurementNoise, Symbol('x', 0), Symbol('l', 0), K)); | ||||
|     graph.emplace_shared<GenericProjectionFactor<Pose3, Point3, Cal3_S2> >(measurement, measurementNoise, Symbol('x', 0), Symbol('l', 0), K); | ||||
| 
 | ||||
|     EXPECT_LONGS_EQUAL(2, graph.size()); | ||||
|     EXPECT(graph[0]->equals(*(graph[1]))); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /* ************************************************************************* */ | ||||
| int main() { TestResult tr; return TestRegistry::runAllTests(tr); } | ||||
| /* ************************************************************************* */ | ||||
		Loading…
	
		Reference in New Issue