From c15e3fc38a1cbbd64b53ebb2ab369a628a026496 Mon Sep 17 00:00:00 2001
From: Adam Wardynski <award@.(B-4.4.46a)>
Date: Mon, 29 Nov 2010 15:26:40 +0100
Subject: [PATCH] Use the new cloning and clearing from Variables.

---
 libwccl/ops/operator.h         | 3 +--
 libwccl/ops/parsedexpression.h | 7 ++-----
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/libwccl/ops/operator.h b/libwccl/ops/operator.h
index 1d2920d..61d1d88 100644
--- a/libwccl/ops/operator.h
+++ b/libwccl/ops/operator.h
@@ -47,7 +47,6 @@ protected:
  * Represents a parsed WCCL functional operator that returns a value of given type.
  * @note The class methods are not thread-safe, but you can use clone method
  * to acquire a separate copy of the Operator, and the copy can be used concurrently.
- * @todo need to change copying of Variables once a clone method is available for them.
  */
 template <class T>
 class Operator : public FunctionalOperator
@@ -295,7 +294,7 @@ Operator<T>& Operator<T>::operator=(const Operator& other) {
 	BOOST_ASSERT(other.function_body_);
 	BOOST_ASSERT(other.variables_);
 	function_body_.reset(other.function_body_);
-	variables_.reset(new Variables(other.variables_));
+	variables_.reset(other.variables_->clone());
 	return *this;
 }
 
diff --git a/libwccl/ops/parsedexpression.h b/libwccl/ops/parsedexpression.h
index c4174d9..d8e1526 100644
--- a/libwccl/ops/parsedexpression.h
+++ b/libwccl/ops/parsedexpression.h
@@ -122,8 +122,6 @@ public:
 	 * Also, derived classes that have clone() method copy the values
 	 * as well, but a class may provide convenience method clone_clean()
 	 * in case you want to get a clean state.
-	 * @todo It needs implementing, currently it is a no-op, because
-	 * Variables object doesn't really provide means to do it yet
 	 */
 	void clean();
 
@@ -155,7 +153,7 @@ protected:
 
 inline
 ParsedExpression::ParsedExpression(const Variables &variables)
-	: variables_(boost::make_shared<Variables>(variables))
+	: variables_(variables.clone())
 {
 }
 
@@ -204,8 +202,7 @@ void ParsedExpression::set(const std::string& var_name, const T& value) {
 inline
 void ParsedExpression::clean()
 {
-	//TODO - imlement this. The Variables object doesn't really
-	//provide a way to do that atm so it should be changed
+	variables_->reset_values();
 }
 
 inline
-- 
GitLab