--- a/samples/main-default-value.cc Mon Jul 23 14:01:43 2007 +0200
+++ b/samples/main-default-value.cc Mon Jul 23 14:13:03 2007 +0200
@@ -14,8 +14,8 @@
// value of the default parameter. Then as other code require the values of
// the defaults, they query them with GetValue() to get the present value.
static BooleanDefaultValue defaultTestBool1 ("testBool1", "helpBool", true);
-static IntegerDefaultValue<int> defaultTestInt1 ("testInt1", "helpInt1", 33);
-static IntegerDefaultValue<uint32_t> defaultTestInt2 ("testInt2", "helpInt2", 47);
+static NumericDefaultValue<int> defaultTestInt1 ("testInt1", "helpInt1", 33);
+static NumericDefaultValue<uint32_t> defaultTestInt2 ("testInt2", "helpInt2", 47);
//
// This test class demonstrates the declaration of variables that
--- a/src/applications/onoff-application.cc Mon Jul 23 14:01:43 2007 +0200
+++ b/src/applications/onoff-application.cc Mon Jul 23 14:13:03 2007 +0200
@@ -41,7 +41,7 @@
static DataRateDefaultValue g_defaultRate ("OnOffApplicationDataRate",
"The data rate in on state for OnOffApplication",
DataRate ("500kb/s"));
-static IntegerDefaultValue<uint32_t> g_defaultSize ("OnOffApplicationPacketSize",
+static NumericDefaultValue<uint32_t> g_defaultSize ("OnOffApplicationPacketSize",
"The size of packets sent in on state for OnOffApplication",
512, 1);
// Constructors
--- a/src/core/default-value.cc Mon Jul 23 14:01:43 2007 +0200
+++ b/src/core/default-value.cc Mon Jul 23 14:13:03 2007 +0200
@@ -374,7 +374,7 @@
ok = false;
}
- IntegerDefaultValue<int> i ("test-i", "help-i", -1);
+ NumericDefaultValue<int> i ("test-i", "help-i", -1);
if (i.GetValue () != -1)
{
ok = false;
@@ -393,17 +393,20 @@
{
ok = false;
}
- IntegerDefaultValue<uint32_t> ui32 ("test-ui32", "help-ui32", 10);
+ NumericDefaultValue<uint32_t> ui32 ("test-ui32", "help-ui32", 10);
if (ui32.GetType () != "uint32_t(0:4294967295)")
{
ok = false;
}
- IntegerDefaultValue<char> c ("test-c", "help-c", 10);
+ NumericDefaultValue<char> c ("test-c", "help-c", 10);
if (c.GetValue () != 10)
{
ok = false;
}
Bind ("test-c", "257");
+ NumericDefaultValue<float> x ("test-x", "help-x", 10.0);
+ NumericDefaultValue<double> y ("test-y", "help-y", 10.0);
+
EnumDefaultValue<enum MyEnum> e ("test-e", "help-e",
MY_ENUM_C, "C",
--- a/src/core/default-value.h Mon Jul 23 14:01:43 2007 +0200
+++ b/src/core/default-value.h Mon Jul 23 14:13:03 2007 +0200
@@ -119,7 +119,7 @@
};
/**
- * \brief An Integer variable for ns3::Bind
+ * \brief An Numeric variable for ns3::Bind
* \ingroup config
*
* Every instance of this type is automatically
@@ -127,7 +127,7 @@
* by ns3::Bind.
*/
template <typename T>
-class IntegerDefaultValue : public DefaultValueBase
+class NumericDefaultValue : public DefaultValueBase
{
public:
/**
@@ -141,7 +141,7 @@
* of values which can be stored and retrieved from the underlying
* type.
*/
- IntegerDefaultValue (std::string name,
+ NumericDefaultValue (std::string name,
std::string help,
T defaultValue);
/**
@@ -153,7 +153,7 @@
* \param minValue the minimum value which can be set
* in this variable
*/
- IntegerDefaultValue (std::string name,
+ NumericDefaultValue (std::string name,
std::string help,
T defaultValue,
T minValue);
@@ -169,7 +169,7 @@
* \param maxValue the maximum value which can be set in this
* variable.
*/
- IntegerDefaultValue (std::string name,
+ NumericDefaultValue (std::string name,
std::string help,
T defaultValue,
T minValue,
@@ -335,7 +335,7 @@
template <typename T>
-IntegerDefaultValue<T>::IntegerDefaultValue (std::string name,
+NumericDefaultValue<T>::NumericDefaultValue (std::string name,
std::string help,
T defaultValue)
: DefaultValueBase (name, help),
@@ -348,7 +348,7 @@
NS_ASSERT (m_minValue < m_maxValue);
}
template <typename T>
-IntegerDefaultValue<T>::IntegerDefaultValue (std::string name,
+NumericDefaultValue<T>::NumericDefaultValue (std::string name,
std::string help,
T defaultValue,
T minValue)
@@ -364,7 +364,7 @@
m_defaultValue >= m_minValue);
}
template <typename T>
-IntegerDefaultValue<T>::IntegerDefaultValue (std::string name,
+NumericDefaultValue<T>::NumericDefaultValue (std::string name,
std::string help,
T defaultValue,
T minValue,
@@ -383,7 +383,7 @@
template <typename T>
void
-IntegerDefaultValue<T>::SetValue (T v)
+NumericDefaultValue<T>::SetValue (T v)
{
NS_ASSERT (v <= m_maxValue &&
v >= m_minValue);
@@ -392,14 +392,14 @@
template <typename T>
T
-IntegerDefaultValue<T>::GetValue (void) const
+NumericDefaultValue<T>::GetValue (void) const
{
return m_value;
}
template <typename T>
bool
-IntegerDefaultValue<T>::DoParseValue (const std::string &value)
+NumericDefaultValue<T>::DoParseValue (const std::string &value)
{
std::istringstream iss;
iss.str (value);
@@ -414,7 +414,7 @@
template <typename T>
std::string
-IntegerDefaultValue<T>::DoGetType (void) const
+NumericDefaultValue<T>::DoGetType (void) const
{
std::ostringstream oss;
oss << TypeNameGet<T> () << "("
@@ -425,7 +425,7 @@
template <typename T>
std::string
-IntegerDefaultValue<T>::DoGetDefaultValue (void) const
+NumericDefaultValue<T>::DoGetDefaultValue (void) const
{
std::ostringstream oss;
oss << m_defaultValue;
--- a/src/core/type-name.cc Mon Jul 23 14:01:43 2007 +0200
+++ b/src/core/type-name.cc Mon Jul 23 14:13:03 2007 +0200
@@ -19,6 +19,8 @@
DEF_TYPE (int16_t);
DEF_TYPE (int32_t);
DEF_TYPE (int64_t);
+DEF_TYPE (float);
+DEF_TYPE (double);
}//namespace ns3
--- a/src/core/type-name.h Mon Jul 23 14:01:43 2007 +0200
+++ b/src/core/type-name.h Mon Jul 23 14:13:03 2007 +0200
@@ -26,6 +26,8 @@
DEF_TYPE (int16_t);
DEF_TYPE (int32_t);
DEF_TYPE (int64_t);
+DEF_TYPE (float);
+DEF_TYPE (double);
#undef DEF_TYPE