add Value support to Address
This commit is contained in:
@@ -107,6 +107,16 @@ Address::Register (void)
|
||||
return type;
|
||||
}
|
||||
|
||||
Address::Address (PValue value)
|
||||
{
|
||||
*this = ClassValueHelperExtractFrom<Address,AddressValue> (value);
|
||||
}
|
||||
Address::operator PValue () const
|
||||
{
|
||||
return ClassValueHelperConvertTo<Address,AddressValue> (this);
|
||||
}
|
||||
|
||||
|
||||
bool operator == (const Address &a, const Address &b)
|
||||
{
|
||||
NS_ASSERT (a.m_type == b.m_type ||
|
||||
@@ -159,6 +169,12 @@ std::ostream& operator<< (std::ostream& os, const Address & address)
|
||||
return os;
|
||||
}
|
||||
|
||||
std::istream& operator>> (std::istream& is, Address & address)
|
||||
{
|
||||
// XXX: need to be able to parse this.
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <ostream>
|
||||
#include "ns3/value.h"
|
||||
#include "ns3/class-value-helper.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
@@ -151,6 +153,9 @@ public:
|
||||
* \returns a new type id.
|
||||
*/
|
||||
static uint8_t Register (void);
|
||||
|
||||
Address (PValue value);
|
||||
operator PValue () const;
|
||||
private:
|
||||
friend bool operator == (const Address &a, const Address &b);
|
||||
friend bool operator < (const Address &a, const Address &b);
|
||||
@@ -165,6 +170,40 @@ bool operator == (const Address &a, const Address &b);
|
||||
bool operator != (const Address &a, const Address &b);
|
||||
bool operator < (const Address &a, const Address &b);
|
||||
std::ostream& operator<< (std::ostream& os, const Address & address);
|
||||
std::istream& operator>> (std::istream& is, Address & address);
|
||||
|
||||
class AddressValue : public Value {};
|
||||
class AddressParamSpec : public ParamSpec {};
|
||||
|
||||
template <typename T1>
|
||||
Ptr<ParamSpec>
|
||||
MakeAddressParamSpec (T1 a1, Address initialValue);
|
||||
|
||||
template <typename T1, typename T2>
|
||||
Ptr<ParamSpec>
|
||||
MakeAddressParamSpec (T1 a1, T2 a2, Address initialValue);
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
template <typename T1>
|
||||
Ptr<ParamSpec>
|
||||
MakeAddressParamSpec (T1 a1, Address initialValue)
|
||||
{
|
||||
return MakeClassValueHelperParamSpec<Address,AddressValue,AddressParamSpec>
|
||||
(a1, initialValue);
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
Ptr<ParamSpec>
|
||||
MakeAddressParamSpec (T1 a1, T2 a2, Address initialValue)
|
||||
{
|
||||
return MakeClassValueHelperParamSpec<Address,AddressValue,AddressParamSpec>
|
||||
(a1, a2, initialValue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user