diff --git a/libwccl/variables.cpp b/libwccl/variables.cpp index f7484fc8b143bd66010ec61a4921e502a092f41d..8707f3dae3cd1c523303d3062d24f77db2c4f9c2 100644 --- a/libwccl/variables.cpp +++ b/libwccl/variables.cpp @@ -22,7 +22,7 @@ struct delhelper template<typename T> void operator()(const boost::mpl::always<T>&) { - r = v.del<T>(s) || r; + r = v.del_variable<T>(s) || r; } }; } /* end anon ns */ diff --git a/libwccl/variables.h b/libwccl/variables.h index daf43539fe94fc0b693004b2a41bcfe76aa96f4f..5c9e88d00b273c66749220c129a948dd5a434356 100644 --- a/libwccl/variables.h +++ b/libwccl/variables.h @@ -339,11 +339,11 @@ public: * @returns true if the variable was removed, false otherwise */ template<typename T> - bool del(const std::string& s); + bool del_variable(const std::string& s); /** Remove a variable regardless of it's type. * - * Prefer del<T> with a concrete T as it will be faster. + * Prefer del_variable<T> with a concrete T as it will be faster. * * @returns true if the variable was removed, false otherwise */ @@ -435,7 +435,7 @@ void Variables::put(const std::string& s, const boost::shared_ptr<T>& v) { } template<typename T> inline -bool Variables::del(const std::string &s) +bool Variables::del_variable(const std::string &s) { BOOST_MPL_ASSERT(( boost::mpl::count<types, T> )); if (detail::Vmap<T>::map_.erase(s)) { @@ -448,7 +448,7 @@ bool Variables::del(const std::string &s) } template<> inline -bool Variables::del<Value>(const std::string &s) +bool Variables::del_variable<Value>(const std::string &s) { return del_any(s); } diff --git a/swig/libcclvariables.i b/swig/libcclvariables.i index 593baeb0c36c981d388f52922f505064a84de929..24d6d7493c1c93a181523a14ecc299face003d5f 100644 --- a/swig/libcclvariables.i +++ b/swig/libcclvariables.i @@ -128,14 +128,12 @@ namespace Wccl { void put_any(const std::string& s, const boost::shared_ptr<Value>& v); - /* - template<typename T> bool del(const std::string& s); - %template(del_bool) del<Bool>; - %template(del_tset) del<TSet>; - %template(del_strset) del<StrSet>; - %template(del_position) del<Position>; - %template(del_match) del<Match>; - */ + template<typename T> bool del_variable(const std::string& s); + %template(del_bool) del_variable<Bool>; + %template(del_tset) del_variable<TSet>; + %template(del_strset) del_variable<StrSet>; + %template(del_position) del_variable<Position>; + %template(del_match) del_variable<Match>; bool del_any(const std::string& s); diff --git a/tests/variables.cpp b/tests/variables.cpp index e184fa1bf21c51a871b5ac09971b49d7982a0e01..c312955335345325327c7d99330b553eed1f4a52 100644 --- a/tests/variables.cpp +++ b/tests/variables.cpp @@ -29,9 +29,9 @@ BOOST_AUTO_TEST_CASE(v_basic) b = v.get<Bool>("a"); BOOST_REQUIRE(b); BOOST_CHECK_EQUAL(b->get_value(), false); - v.del<Position>("a"); + v.del_variable<Position>("a"); BOOST_CHECK(v.get<Bool>("a")); - v.del<Bool>("a"); + v.del_variable<Bool>("a"); BOOST_CHECK(!v.get<Bool>("a")); } @@ -40,10 +40,10 @@ BOOST_AUTO_TEST_CASE(v_del_any) Variables v; v.put("a", new Bool(true)); v.put("b", new Bool(true)); - v.del<Bool>("a"); + v.del_variable<Bool>("a"); BOOST_CHECK(!v.get<Value>("a")); v.put("a", new Bool(true)); - v.del<Value>("a"); + v.del_variable<Value>("a"); BOOST_CHECK(!v.get<Value>("a")); BOOST_CHECK(v.get<Value>("b")); } @@ -136,11 +136,11 @@ BOOST_FIXTURE_TEST_CASE(set_bad, Vfix) BOOST_CHECK_THROW(v.set("p1", Bool(true)), VariableTypeMismatch); } -BOOST_FIXTURE_TEST_CASE(del, Vfix) +BOOST_FIXTURE_TEST_CASE(del_variable, Vfix) { - v.del<Bool>("b1"); + v.del_variable<Bool>("b1"); BOOST_CHECK(!v.get<Bool>("b1")); - v.del<Bool>("p2"); + v.del_variable<Bool>("p2"); BOOST_CHECK(v.get<Value>("p2")); v.del_any("p2"); BOOST_CHECK(!v.get<Value>("p2"));