Added a default implementation of clone() for nonlinear factor so not all subclasses need to implement clone(). Default implementation throws an exception.

release/4.3a0
Alex Cunningham 2012-05-25 14:12:28 +00:00
parent 451dd5ef1b
commit 421a0725dd
1 changed files with 7 additions and 1 deletions

View File

@ -157,8 +157,14 @@ public:
/** /**
* Creates a shared_ptr clone of the factor - needs to be specialized to allow * Creates a shared_ptr clone of the factor - needs to be specialized to allow
* for subclasses * for subclasses
*
* By default, throws exception if subclass does not implement the function.
*/ */
virtual shared_ptr clone() const =0; virtual shared_ptr clone() const {
// TODO: choose better exception to throw here
throw std::runtime_error("NonlinearFactor::clone(): Attempting to clone factor with no clone() implemented!");
return shared_ptr();
}
/** /**
* Creates a shared_ptr clone of the factor with different keys using * Creates a shared_ptr clone of the factor with different keys using