Virtual destructor
							parent
							
								
									68d26ad2af
								
							
						
					
					
						commit
						41a1aab0e2
					
				|  | @ -60,7 +60,9 @@ private: | |||
| public: | ||||
| 
 | ||||
|   // Expressions wrap trees of functions that can evaluate their own derivatives.
 | ||||
|   // The meta-functions below provide a handy to specify the type of those functions
 | ||||
|   // The meta-functions below are useful to specify the type of those functions.
 | ||||
|   // Example, a function taking a camera and a 3D point and yielding a 2D point:
 | ||||
|   //   Expression<Point2>::BinaryFunction<SimpleCamera,Point3>::type
 | ||||
|   template<class A1> | ||||
|   struct UnaryFunction { | ||||
|     typedef boost::function< | ||||
|  | @ -135,6 +137,10 @@ public: | |||
|           typename MakeOptionalJacobian<T, A3>::type) const, | ||||
|       const Expression<A2>& expression2, const Expression<A3>& expression3); | ||||
| 
 | ||||
|   /// Destructor
 | ||||
|   virtual ~Expression() { | ||||
|   } | ||||
| 
 | ||||
|   /// Return keys that play in this expression
 | ||||
|   std::set<Key> keys() const; | ||||
| 
 | ||||
|  |  | |||
|  | @ -129,6 +129,10 @@ class ConstantExpression: public ExpressionNode<T> { | |||
| 
 | ||||
| public: | ||||
| 
 | ||||
|   /// Destructor
 | ||||
|   virtual ~ConstantExpression() { | ||||
|   } | ||||
| 
 | ||||
|   /// Return value
 | ||||
|   virtual T value(const Values& values) const { | ||||
|     return constant_; | ||||
|  | @ -154,12 +158,15 @@ class LeafExpression: public ExpressionNode<T> { | |||
|   LeafExpression(Key key) : | ||||
|       key_(key) { | ||||
|   } | ||||
|   // todo: do we need a virtual destructor here too?
 | ||||
| 
 | ||||
|   friend class Expression<T> ; | ||||
| 
 | ||||
| public: | ||||
| 
 | ||||
|   /// Destructor
 | ||||
|   virtual ~LeafExpression() { | ||||
|   } | ||||
| 
 | ||||
|   /// Return keys that play in this expression
 | ||||
|   virtual std::set<Key> keys() const { | ||||
|     std::set<Key> keys; | ||||
|  | @ -205,18 +212,23 @@ class UnaryExpression: public ExpressionNode<T> { | |||
|   boost::shared_ptr<ExpressionNode<A1> > expression1_; | ||||
|   Function function_; | ||||
| 
 | ||||
| public: | ||||
| 
 | ||||
|   /// Constructor with a unary function f, and input argument e1
 | ||||
|   UnaryExpression(Function f, const Expression<A1>& e1) : | ||||
|       expression1_(e1.root()), function_(f) { | ||||
|     ExpressionNode<T>::traceSize_ = upAligned(sizeof(Record)) + e1.traceSize(); | ||||
|   } | ||||
| 
 | ||||
|   friend class Expression<T> ; | ||||
| 
 | ||||
| public: | ||||
| 
 | ||||
|   /// Destructor
 | ||||
|   virtual ~UnaryExpression() { | ||||
|   } | ||||
| 
 | ||||
|   /// Return value
 | ||||
|   virtual T value(const Values& values) const { | ||||
|     using boost::none; | ||||
|     return function_(expression1_->value(values), none); | ||||
|     return function_(expression1_->value(values), boost::none); | ||||
|   } | ||||
| 
 | ||||
|   /// Return keys that play in this expression
 | ||||
|  | @ -300,8 +312,6 @@ class BinaryExpression: public ExpressionNode<T> { | |||
|   boost::shared_ptr<ExpressionNode<A2> > expression2_; | ||||
|   Function function_; | ||||
| 
 | ||||
| public: | ||||
| 
 | ||||
|   /// Constructor with a binary function f, and two input arguments
 | ||||
|   BinaryExpression(Function f, const Expression<A1>& e1, | ||||
|       const Expression<A2>& e2) : | ||||
|  | @ -310,8 +320,15 @@ public: | |||
|         upAligned(sizeof(Record)) + e1.traceSize() + e2.traceSize(); | ||||
|   } | ||||
| 
 | ||||
|   friend class Expression<T> ; | ||||
|   friend class ::ExpressionFactorBinaryTest; | ||||
| 
 | ||||
| public: | ||||
| 
 | ||||
|   /// Destructor
 | ||||
|   virtual ~BinaryExpression() { | ||||
|   } | ||||
| 
 | ||||
|   /// Return value
 | ||||
|   virtual T value(const Values& values) const { | ||||
|     using boost::none; | ||||
|  | @ -394,8 +411,6 @@ class TernaryExpression: public ExpressionNode<T> { | |||
|   boost::shared_ptr<ExpressionNode<A3> > expression3_; | ||||
|   Function function_; | ||||
| 
 | ||||
| public: | ||||
| 
 | ||||
|   /// Constructor with a ternary function f, and two input arguments
 | ||||
|   TernaryExpression(Function f, const Expression<A1>& e1, | ||||
|       const Expression<A2>& e2, const Expression<A3>& e3) : | ||||
|  | @ -405,6 +420,14 @@ public: | |||
|         e1.traceSize() + e2.traceSize() + e3.traceSize(); | ||||
|   } | ||||
| 
 | ||||
|   friend class Expression<T> ; | ||||
| 
 | ||||
| public: | ||||
| 
 | ||||
|   /// Destructor
 | ||||
|   virtual ~TernaryExpression() { | ||||
|   } | ||||
| 
 | ||||
|   /// Return value
 | ||||
|   virtual T value(const Values& values) const { | ||||
|     using boost::none; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue