Skip to content
Snippets Groups Projects
Commit c15e3fc3 authored by Adam Wardynski's avatar Adam Wardynski
Browse files

Use the new cloning and clearing from Variables.

parent 7b5e7e3a
No related branches found
No related tags found
No related merge requests found
...@@ -47,7 +47,6 @@ protected: ...@@ -47,7 +47,6 @@ protected:
* Represents a parsed WCCL functional operator that returns a value of given type. * 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 * @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. * 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> template <class T>
class Operator : public FunctionalOperator class Operator : public FunctionalOperator
...@@ -295,7 +294,7 @@ Operator<T>& Operator<T>::operator=(const Operator& other) { ...@@ -295,7 +294,7 @@ Operator<T>& Operator<T>::operator=(const Operator& other) {
BOOST_ASSERT(other.function_body_); BOOST_ASSERT(other.function_body_);
BOOST_ASSERT(other.variables_); BOOST_ASSERT(other.variables_);
function_body_.reset(other.function_body_); function_body_.reset(other.function_body_);
variables_.reset(new Variables(other.variables_)); variables_.reset(other.variables_->clone());
return *this; return *this;
} }
......
...@@ -122,8 +122,6 @@ public: ...@@ -122,8 +122,6 @@ public:
* Also, derived classes that have clone() method copy the values * Also, derived classes that have clone() method copy the values
* as well, but a class may provide convenience method clone_clean() * as well, but a class may provide convenience method clone_clean()
* in case you want to get a clean state. * 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(); void clean();
...@@ -155,7 +153,7 @@ protected: ...@@ -155,7 +153,7 @@ protected:
inline inline
ParsedExpression::ParsedExpression(const Variables &variables) 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) { ...@@ -204,8 +202,7 @@ void ParsedExpression::set(const std::string& var_name, const T& value) {
inline inline
void ParsedExpression::clean() void ParsedExpression::clean()
{ {
//TODO - imlement this. The Variables object doesn't really variables_->reset_values();
//provide a way to do that atm so it should be changed
} }
inline inline
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment