macro-ify

This commit is contained in:
Mathieu Lacage
2008-02-15 05:38:29 +01:00
parent e94efb4a11
commit 25bb76ce20
11 changed files with 64 additions and 202 deletions

View File

@@ -125,6 +125,8 @@ DoParse (const std::string s, uint64_t *v)
namespace ns3 {
VALUE_HELPER_CPP (DataRate);
DataRate::DataRate ()
: m_bps (0)
{}
@@ -173,15 +175,6 @@ uint64_t DataRate::GetBitRate() const
return m_bps;
}
DataRate::DataRate (PValue value)
{
*this = ClassValueHelperExtractFrom<DataRate,DataRateValue> (value);
}
DataRate::operator PValue () const
{
return ClassValueHelperConvertTo<DataRate,DataRateValue> (this);
}
DataRate MakeDataRate (std::string rate)
{
uint64_t bps;

View File

@@ -28,7 +28,7 @@
#include "ns3/nstime.h"
#include "ns3/default-value.h"
#include "ns3/value.h"
#include "ns3/class-value-helper.h"
#include "ns3/value-helper.h"
namespace ns3 {
@@ -80,9 +80,8 @@ public:
* \return The underlying bitrate in bits per second
*/
uint64_t GetBitRate() const;
DataRate (PValue value);
operator PValue () const;
VALUE_HELPER_HEADER_1 (DataRate);
private:
uint64_t m_bps;
static uint64_t Parse(const std::string);
@@ -93,16 +92,7 @@ DataRate MakeDataRate (std::string rate);
std::ostream &operator << (std::ostream &os, const DataRate &rate);
std::istream &operator >> (std::istream &is, DataRate &rate);
class DataRateValue : public Value {};
class DataRateParamSpec : public ParamSpec {};
template <typename T1>
Ptr<ParamSpec>
MakeDataRateParamSpec (T1 a1, DataRate initialValue);
template <typename T1, typename T2>
Ptr<ParamSpec>
MakeDataRateParamSpec (T1 a1, T2 a2, DataRate initialValue);
VALUE_HELPER_HEADER_2 (DataRate);
/**
* \param lhs
@@ -130,24 +120,4 @@ private:
} //namespace ns3
namespace ns3 {
template <typename T1>
Ptr<ParamSpec>
MakeDataRateParamSpec (T1 a1, DataRate initialValue)
{
return MakeClassValueHelperParamSpec<DataRate,DataRateValue,DataRateParamSpec>
(a1, initialValue);
}
template <typename T1, typename T2>
Ptr<ParamSpec>
MakeDataRateParamSpec (T1 a1, T2 a2, DataRate initialValue)
{
return MakeClassValueHelperParamSpec<DataRate,DataRateValue,DataRateParamSpec>
(a1, a2, initialValue);
}
} // namespace ns3
#endif /* DATA_RATE_H */