diff --git a/libwccl/ops/operator.h b/libwccl/ops/operator.h index 1d2920d237204fada27a615e5118c5d01a49b218..61d1d8807e34263e2255a619fee0882020d70c7d 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 c4174d9e9145c49d806b550e2e39f25f6d06054c..d8e1526b2c41511e0088292683ad07dd9614f362 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