Wrapped Ordering::InvertedMap

release/4.3a0
Alex Cunningham 2012-07-09 18:51:07 +00:00
parent e451a95991
commit 280bbbb54e
2 changed files with 23 additions and 7 deletions

25
gtsam.h
View File

@ -6,13 +6,16 @@
* *
* Requirements: * Requirements:
* Classes must start with an uppercase letter * Classes must start with an uppercase letter
* Only one Method/Constructor per line * - Can wrap a typedef
* Only one Method/Constructor per line, though methods/constructors can extend across multiple lines
* Methods can return * Methods can return
* - Eigen types: Matrix, Vector * - Eigen types: Matrix, Vector
* - C/C++ basic types: string, bool, size_t, size_t, double, char, unsigned char * - C/C++ basic types: string, bool, size_t, size_t, double, char, unsigned char
* - void * - void
* - Any class with which be copied with boost::make_shared() * - Any class with which be copied with boost::make_shared()
* - boost::shared_ptr of any object type * - boost::shared_ptr of any object type
* Methods cannot return
* - const references of anything
* Limitations on methods * Limitations on methods
* - Parsing does not support overloading * - Parsing does not support overloading
* - There can only be one method (static or otherwise) with a given name * - There can only be one method (static or otherwise) with a given name
@ -35,7 +38,7 @@
* Namespace usage * Namespace usage
* - Namespaces can be specified for classes in arguments and return values * - Namespaces can be specified for classes in arguments and return values
* - In each case, the namespace must be fully specified, e.g., "namespace1::namespace2::ClassName" * - In each case, the namespace must be fully specified, e.g., "namespace1::namespace2::ClassName"
* Using namespace * Using namespace: FIXME: this functionality is currently broken
* - To use a namespace (e.g., generate a "using namespace x" line in cpp files), add "using namespace x;" * - To use a namespace (e.g., generate a "using namespace x" line in cpp files), add "using namespace x;"
* - This declaration applies to all classes *after* the declaration, regardless of brackets * - This declaration applies to all classes *after* the declaration, regardless of brackets
* Includes in C++ wrappers * Includes in C++ wrappers
@ -46,14 +49,12 @@
* - Both classes and namespace accept exactly one namespace * - Both classes and namespace accept exactly one namespace
* Overriding type dependency checks * Overriding type dependency checks
* - If you are using a class 'OtherClass' not wrapped in this definition file, add "class OtherClass;" to avoid a dependency error * - If you are using a class 'OtherClass' not wrapped in this definition file, add "class OtherClass;" to avoid a dependency error
* - Limitation: this only works if the class does not need a namespace specification
*/ */
/** /**
* Status: * Status:
* - TODO: global functions * - TODO: global functions
* - TODO: default values for arguments * - TODO: default values for arguments
* - TODO: overloaded functions
* - TODO: signatures for constructors can be ambiguous if two types have the same first letter * - TODO: signatures for constructors can be ambiguous if two types have the same first letter
* - TODO: Handle gtsam::Rot3M conversions to quaternions * - TODO: Handle gtsam::Rot3M conversions to quaternions
*/ */
@ -909,8 +910,20 @@ class Ordering {
void insert(size_t key, size_t order); void insert(size_t key, size_t order);
void push_back(size_t key); void push_back(size_t key);
void permuteWithInverse(const gtsam::Permutation& inversePermutation); void permuteWithInverse(const gtsam::Permutation& inversePermutation);
// FIXME: Wrap InvertedMap as well gtsam::InvertedOrdering invert() const;
//InvertedMap invert() const; };
#include <gtsam/nonlinear/Ordering.h>
class InvertedOrdering {
InvertedOrdering();
// FIXME: add bracket operator overload
bool empty() const;
size_t size() const;
bool count(size_t index) const; // Use as a boolean function with implicit cast
void clear();
}; };
class NonlinearFactorGraph { class NonlinearFactorGraph {

View File

@ -233,7 +233,10 @@ private:
ar & BOOST_SERIALIZATION_NVP(order_); ar & BOOST_SERIALIZATION_NVP(order_);
ar & BOOST_SERIALIZATION_NVP(nVars_); ar & BOOST_SERIALIZATION_NVP(nVars_);
} }
}; }; // \class Ordering
// typedef for use with matlab
typedef Ordering::InvertedMap InvertedOrdering;
/** /**
* @class Unordered * @class Unordered