From 5ef28f084adbd3ecce42311fedcc479c61dcda27 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 21 Feb 2008 18:35:55 +0100 Subject: [PATCH] remove old helpers --- src/core/class-value-helper.h | 96 ----------------------------------- src/core/wscript | 1 - 2 files changed, 97 deletions(-) delete mode 100644 src/core/class-value-helper.h diff --git a/src/core/class-value-helper.h b/src/core/class-value-helper.h deleted file mode 100644 index 9ff1f8cf8..000000000 --- a/src/core/class-value-helper.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef CLASS_VALUE_HELPER_H -#define CLASS_VALUE_HELPER_H - -#include "attribute.h" -#include "param-spec-helper.h" -#include "fatal-error.h" -#include - -namespace ns3 { - -template -class ClassValue : public U -{ -public: - ClassValue (const T &value) - : m_value (value) {} - - void Set (const T &v) { - m_value = v; - } - T Get (void) const { - return m_value; - } - - // inherited from AttributeValue base class - virtual Attribute Copy (void) const { - return Attribute::Create > (*this); - } - virtual std::string SerializeToString (Ptr checker) const { - std::ostringstream oss; - oss << m_value; - return oss.str (); - } - virtual bool DeserializeFromString (std::string value, Ptr checker) { - std::istringstream iss; - iss.str (value); - iss >> m_value; - return !iss.bad () && !iss.fail (); - } - - ClassValue (Attribute value) - { - ClassValue *v = value.DynCast *> (); - if (v == 0) - { - NS_FATAL_ERROR ("Unexpected type of value. Expected \""<< typeid (U).name () <<"\""); - } - m_value = v->Get (); - } - operator Attribute () const - { - return Attribute::Create > (*this); - } - -private: - T m_value; -}; - -template -T -ClassValueHelperExtractFrom (Attribute value) -{ - ClassValue *v = value.DynCast *> (); - if (v == 0) - { - NS_FATAL_ERROR ("Unexpected type of value. Expected \"" << typeid (U).name () << "\""); - } - return v->Get (); -} - -template -Attribute -ClassValueHelperConvertTo (const T *self) -{ - return Attribute::Create > (*self); -} - - -template -Ptr -MakeClassValueHelperAccessor (T1 a1) -{ - return MakeAccessorHelper > (a1); -} - - -template -Ptr -MakeClassValueHelperAccessor (T1 a1, T2 a2) -{ - return MakeAccessorHelper > (a1, a2); -} - -} // namespace ns3 - -#endif /* CLASS_VALUE_HELPER_H */ diff --git a/src/core/wscript b/src/core/wscript index 818547ce7..e027965d9 100644 --- a/src/core/wscript +++ b/src/core/wscript @@ -114,7 +114,6 @@ def build(bld): 'fp-value.h', 'enum-value.h', 'object-factory.h', - 'class-value-helper.h', 'value-helper.h', 'initial-value.h', ]