Add const accessor for functor wrapped by auto/numeric-diff objects

- The intended use-case for these accessors is in client code tests to
  support verification of the configuration with which cost functions
  were constructed.

Change-Id: Ib77afa6409804ba7f724138f579e0c51b154f5ad
diff --git a/include/ceres/autodiff_cost_function.h b/include/ceres/autodiff_cost_function.h
index 207f0a4..993daf1 100644
--- a/include/ceres/autodiff_cost_function.h
+++ b/include/ceres/autodiff_cost_function.h
@@ -215,6 +215,8 @@
         jacobians);
   };
 
+  const CostFunctor & functor() const { return *functor_; }
+
  private:
   std::unique_ptr<CostFunctor> functor_;
   Ownership ownership_;
diff --git a/include/ceres/autodiff_first_order_function.h b/include/ceres/autodiff_first_order_function.h
index b98d845..d0280b0 100644
--- a/include/ceres/autodiff_first_order_function.h
+++ b/include/ceres/autodiff_first_order_function.h
@@ -142,6 +142,8 @@
 
   int NumParameters() const override { return kNumParameters; }
 
+  const FirstOrderFunctor & functor() const { return *functor_; }
+
  private:
   std::unique_ptr<FirstOrderFunctor> functor_;
 };
diff --git a/include/ceres/autodiff_local_parameterization.h b/include/ceres/autodiff_local_parameterization.h
index d694376..4ca4a50 100644
--- a/include/ceres/autodiff_local_parameterization.h
+++ b/include/ceres/autodiff_local_parameterization.h
@@ -143,6 +143,8 @@
   int GlobalSize() const override { return kGlobalSize; }
   int LocalSize() const override { return kLocalSize; }
 
+  const Functor & functor() const { return *functor_; }
+
  private:
   std::unique_ptr<Functor> functor_;
 };
diff --git a/include/ceres/autodiff_manifold.h b/include/ceres/autodiff_manifold.h
index 8a7601f..9673533 100644
--- a/include/ceres/autodiff_manifold.h
+++ b/include/ceres/autodiff_manifold.h
@@ -173,6 +173,8 @@
 
   bool MinusJacobian(const double* x, double* jacobian) const override;
 
+  const Functor & functor() const { return *functor_; }
+
  private:
   std::unique_ptr<Functor> functor_;
 };
diff --git a/include/ceres/numeric_diff_cost_function.h b/include/ceres/numeric_diff_cost_function.h
index cf7971c..43fe768 100644
--- a/include/ceres/numeric_diff_cost_function.h
+++ b/include/ceres/numeric_diff_cost_function.h
@@ -246,6 +246,8 @@
     return true;
   }
 
+  const CostFunctor & functor() const { return *functor_; }
+
  private:
   std::unique_ptr<CostFunctor> functor_;
   Ownership ownership_;
diff --git a/include/ceres/numeric_diff_first_order_function.h b/include/ceres/numeric_diff_first_order_function.h
index 8663835..cd24c96 100644
--- a/include/ceres/numeric_diff_first_order_function.h
+++ b/include/ceres/numeric_diff_first_order_function.h
@@ -151,6 +151,8 @@
 
   int NumParameters() const override { return kNumParameters; }
 
+  const FirstOrderFunctor & functor() const { return *functor_; }
+
  private:
   std::unique_ptr<FirstOrderFunctor> functor_;
   Ownership ownership_;