--- a/src/common/data-rate.h Thu Feb 21 18:46:48 2008 +0100
+++ b/src/common/data-rate.h Thu Feb 21 18:54:02 2008 +0100
@@ -28,7 +28,7 @@
#include "ns3/nstime.h"
#include "ns3/default-value.h"
#include "ns3/attribute.h"
-#include "ns3/value-helper.h"
+#include "ns3/attribute-helper.h"
namespace ns3 {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/core/attribute-helper.h Thu Feb 21 18:54:02 2008 +0100
@@ -0,0 +1,121 @@
+#ifndef VALUE_HELPER_H
+#define VALUE_HELPER_H
+
+#include "attribute-accessor-helper.h"
+#include <sstream>
+#include "fatal-error.h"
+
+#define ATTRIBUTE_ACCESSOR_DEFINE(type) \
+ class type##Accessor : public AttributeAccessor {}; \
+ template <typename T1> \
+ Ptr<const AttributeAccessor> Make##type##Accessor (T1 a1) \
+ { \
+ return MakeAccessorHelper<type##Accessor,type##Value> (a1); \
+ } \
+ template <typename T1, typename T2> \
+ Ptr<const AttributeAccessor> Make##type##Accessor (T1 a1, T2 a2) \
+ { \
+ return MakeAccessorHelper<type##Accessor,type##Value> (a1, a2); \
+ }
+
+#define ATTRIBUTE_VALUE_DEFINE(type) \
+ class type##Value : public AttributeValue \
+ { \
+ public: \
+ type##Value (const type &value); \
+ void Set (const type &value); \
+ type Get (void) const; \
+ virtual Attribute Copy (void) const; \
+ virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const; \
+ virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker); \
+ type##Value (Attribute value); \
+ operator Attribute () const; \
+ private: \
+ type m_value; \
+ };
+
+#define ATTRIBUTE_CONVERTER_DEFINE(type) \
+ type (Attribute value); \
+ operator Attribute () const;
+
+#define ATTRIBUTE_CHECKER_DEFINE(type) \
+ Ptr<const AttributeChecker> Make##type##Checker (void); \
+
+#define ATTRIBUTE_VALUE_IMPLEMENT(type) \
+ type##Value::type##Value (const type &value) \
+ : m_value (value) {} \
+ void type##Value::Set (const type &v) { \
+ m_value = v; \
+ } \
+ type type##Value::Get (void) const { \
+ return m_value; \
+ } \
+ Attribute \
+ type##Value::Copy (void) const { \
+ return Attribute::Create<type##Value> (*this); \
+ } \
+ std::string \
+ type##Value::SerializeToString (Ptr<const AttributeChecker> checker) const { \
+ std::ostringstream oss; \
+ oss << m_value; \
+ return oss.str (); \
+ } \
+ bool \
+ type##Value::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker) { \
+ std::istringstream iss; \
+ iss.str (value); \
+ iss >> m_value; \
+ return !iss.bad () && !iss.fail (); \
+ } \
+ type##Value::type##Value (Attribute value) \
+ { \
+ type##Value *v = value.DynCast<type##Value *> (); \
+ if (v == 0) \
+ { \
+ NS_FATAL_ERROR ("Unexpected type of value. Expected \"" << #type << "Value\""); \
+ } \
+ m_value = v->Get (); \
+ } \
+ type##Value::operator Attribute () const \
+ { \
+ return Attribute::Create<type##Value> (*this); \
+ }
+
+#define ATTRIBUTE_CHECKER_IMPLEMENT(type) \
+ Ptr<const AttributeChecker> Make##type##Checker (void) \
+ { \
+ return MakeSimpleAttributeChecker<type##Value> (); \
+ } \
+
+#define ATTRIBUTE_CONVERTER_IMPLEMENT(type) \
+ type::type (Attribute value) \
+ { \
+ const type##Value *v = value.DynCast<const type##Value *> (); \
+ if (v == 0) \
+ { \
+ NS_FATAL_ERROR ("Unexpected type of value. Expected \"" << #type << "Value\""); \
+ } \
+ *this = v->Get (); \
+ } \
+ type::operator Attribute () const \
+ { \
+ return Attribute::Create<type##Value> (*this); \
+ }
+
+
+#define VALUE_HELPER_HEADER_1(type) \
+ ATTRIBUTE_CONVERTER_DEFINE (type)
+
+#define VALUE_HELPER_HEADER_2(type) \
+ ATTRIBUTE_VALUE_DEFINE (type); \
+ ATTRIBUTE_ACCESSOR_DEFINE (type); \
+ ATTRIBUTE_CHECKER_DEFINE (type);
+
+#define VALUE_HELPER_CPP(type) \
+ ATTRIBUTE_CHECKER_IMPLEMENT (type); \
+ ATTRIBUTE_CONVERTER_IMPLEMENT (type); \
+ ATTRIBUTE_VALUE_IMPLEMENT (type);
+
+
+
+#endif /* VALUE_HELPER_H */
--- a/src/core/boolean-value.h Thu Feb 21 18:46:48 2008 +0100
+++ b/src/core/boolean-value.h Thu Feb 21 18:54:02 2008 +0100
@@ -2,7 +2,7 @@
#define BOOLEAN_VALUE_H
#include "attribute.h"
-#include "value-helper.h"
+#include "attribute-helper.h"
namespace ns3 {
--- a/src/core/fp-value.h Thu Feb 21 18:46:48 2008 +0100
+++ b/src/core/fp-value.h Thu Feb 21 18:54:02 2008 +0100
@@ -2,7 +2,7 @@
#define FP_VALUE_H
#include "attribute.h"
-#include "value-helper.h"
+#include "attribute-helper.h"
#include <stdint.h>
namespace ns3 {
--- a/src/core/int-value.h Thu Feb 21 18:46:48 2008 +0100
+++ b/src/core/int-value.h Thu Feb 21 18:54:02 2008 +0100
@@ -2,7 +2,7 @@
#define INTEGER_H
#include "attribute.h"
-#include "value-helper.h"
+#include "attribute-helper.h"
#include <stdint.h>
namespace ns3 {
--- a/src/core/random-variable.h Thu Feb 21 18:46:48 2008 +0100
+++ b/src/core/random-variable.h Thu Feb 21 18:54:02 2008 +0100
@@ -27,7 +27,7 @@
#include <istream>
#include <ostream>
#include "attribute.h"
-#include "value-helper.h"
+#include "attribute-helper.h"
/**
* \ingroup core
--- a/src/core/uint-value.h Thu Feb 21 18:46:48 2008 +0100
+++ b/src/core/uint-value.h Thu Feb 21 18:54:02 2008 +0100
@@ -2,7 +2,7 @@
#define UINTEGER_H
#include "attribute.h"
-#include "value-helper.h"
+#include "attribute-helper.h"
#include <stdint.h>
namespace ns3 {
--- a/src/core/value-helper.h Thu Feb 21 18:46:48 2008 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-#ifndef VALUE_HELPER_H
-#define VALUE_HELPER_H
-
-#include "attribute-accessor-helper.h"
-#include <sstream>
-#include "fatal-error.h"
-
-#define ATTRIBUTE_ACCESSOR_DEFINE(type) \
- class type##Accessor : public AttributeAccessor {}; \
- template <typename T1> \
- Ptr<const AttributeAccessor> Make##type##Accessor (T1 a1) \
- { \
- return MakeAccessorHelper<type##Accessor,type##Value> (a1); \
- } \
- template <typename T1, typename T2> \
- Ptr<const AttributeAccessor> Make##type##Accessor (T1 a1, T2 a2) \
- { \
- return MakeAccessorHelper<type##Accessor,type##Value> (a1, a2); \
- }
-
-#define ATTRIBUTE_VALUE_DEFINE(type) \
- class type##Value : public AttributeValue \
- { \
- public: \
- type##Value (const type &value); \
- void Set (const type &value); \
- type Get (void) const; \
- virtual Attribute Copy (void) const; \
- virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const; \
- virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker); \
- type##Value (Attribute value); \
- operator Attribute () const; \
- private: \
- type m_value; \
- };
-
-#define ATTRIBUTE_CONVERTER_DEFINE(type) \
- type (Attribute value); \
- operator Attribute () const;
-
-#define ATTRIBUTE_CHECKER_DEFINE(type) \
- Ptr<const AttributeChecker> Make##type##Checker (void); \
-
-#define ATTRIBUTE_VALUE_IMPLEMENT(type) \
- type##Value::type##Value (const type &value) \
- : m_value (value) {} \
- void type##Value::Set (const type &v) { \
- m_value = v; \
- } \
- type type##Value::Get (void) const { \
- return m_value; \
- } \
- Attribute \
- type##Value::Copy (void) const { \
- return Attribute::Create<type##Value> (*this); \
- } \
- std::string \
- type##Value::SerializeToString (Ptr<const AttributeChecker> checker) const { \
- std::ostringstream oss; \
- oss << m_value; \
- return oss.str (); \
- } \
- bool \
- type##Value::DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker) { \
- std::istringstream iss; \
- iss.str (value); \
- iss >> m_value; \
- return !iss.bad () && !iss.fail (); \
- } \
- type##Value::type##Value (Attribute value) \
- { \
- type##Value *v = value.DynCast<type##Value *> (); \
- if (v == 0) \
- { \
- NS_FATAL_ERROR ("Unexpected type of value. Expected \"" << #type << "Value\""); \
- } \
- m_value = v->Get (); \
- } \
- type##Value::operator Attribute () const \
- { \
- return Attribute::Create<type##Value> (*this); \
- }
-
-#define ATTRIBUTE_CHECKER_IMPLEMENT(type) \
- Ptr<const AttributeChecker> Make##type##Checker (void) \
- { \
- return MakeSimpleAttributeChecker<type##Value> (); \
- } \
-
-#define ATTRIBUTE_CONVERTER_IMPLEMENT(type) \
- type::type (Attribute value) \
- { \
- const type##Value *v = value.DynCast<const type##Value *> (); \
- if (v == 0) \
- { \
- NS_FATAL_ERROR ("Unexpected type of value. Expected \"" << #type << "Value\""); \
- } \
- *this = v->Get (); \
- } \
- type::operator Attribute () const \
- { \
- return Attribute::Create<type##Value> (*this); \
- }
-
-
-#define VALUE_HELPER_HEADER_1(type) \
- ATTRIBUTE_CONVERTER_DEFINE (type)
-
-#define VALUE_HELPER_HEADER_2(type) \
- ATTRIBUTE_VALUE_DEFINE (type); \
- ATTRIBUTE_ACCESSOR_DEFINE (type); \
- ATTRIBUTE_CHECKER_DEFINE (type);
-
-#define VALUE_HELPER_CPP(type) \
- ATTRIBUTE_CHECKER_IMPLEMENT (type); \
- ATTRIBUTE_CONVERTER_IMPLEMENT (type); \
- ATTRIBUTE_VALUE_IMPLEMENT (type);
-
-
-
-#endif /* VALUE_HELPER_H */
--- a/src/core/wscript Thu Feb 21 18:46:48 2008 +0100
+++ b/src/core/wscript Thu Feb 21 18:54:02 2008 +0100
@@ -114,7 +114,7 @@
'fp-value.h',
'enum-value.h',
'object-factory.h',
- 'value-helper.h',
+ 'attribute-helper.h',
'initial-value.h',
]
--- a/src/mobility/rectangle.h Thu Feb 21 18:46:48 2008 +0100
+++ b/src/mobility/rectangle.h Thu Feb 21 18:54:02 2008 +0100
@@ -21,7 +21,7 @@
#define RECTANGLE_H
#include "ns3/attribute.h"
-#include "ns3/value-helper.h"
+#include "ns3/attribute-helper.h"
namespace ns3 {
--- a/src/mobility/vector.h Thu Feb 21 18:46:48 2008 +0100
+++ b/src/mobility/vector.h Thu Feb 21 18:54:02 2008 +0100
@@ -21,7 +21,7 @@
#define VECTOR_H
#include "ns3/attribute.h"
-#include "ns3/value-helper.h"
+#include "ns3/attribute-helper.h"
namespace ns3 {
--- a/src/node/address.h Thu Feb 21 18:46:48 2008 +0100
+++ b/src/node/address.h Thu Feb 21 18:54:02 2008 +0100
@@ -4,7 +4,7 @@
#include <stdint.h>
#include <ostream>
#include "ns3/attribute.h"
-#include "ns3/value-helper.h"
+#include "ns3/attribute-helper.h"
namespace ns3 {
--- a/src/node/mac48-address.h Thu Feb 21 18:46:48 2008 +0100
+++ b/src/node/mac48-address.h Thu Feb 21 18:54:02 2008 +0100
@@ -23,7 +23,7 @@
#include <stdint.h>
#include <ostream>
#include "ns3/attribute.h"
-#include "ns3/value-helper.h"
+#include "ns3/attribute-helper.h"
namespace ns3 {
--- a/src/simulator/nstime.h Thu Feb 21 18:46:48 2008 +0100
+++ b/src/simulator/nstime.h Thu Feb 21 18:54:02 2008 +0100
@@ -22,7 +22,7 @@
#include "ns3/assert.h"
#include "ns3/attribute.h"
-#include "ns3/value-helper.h"
+#include "ns3/attribute-helper.h"
#include <stdint.h>
#include <math.h>
#include <ostream>