--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/core/class-value-helper.h Wed Feb 13 22:39:17 2008 +0100
@@ -0,0 +1,96 @@
+#ifndef CLASS_VALUE_HELPER_H
+#define CLASS_VALUE_HELPER_H
+
+#include "value.h"
+#include "param-spec-helper.h"
+#include "fatal-error.h"
+#include <sstream>
+
+namespace ns3 {
+
+template <typename T, typename U>
+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 Value base class
+ virtual PValue Copy (void) const {
+ return PValue::Create<ClassValue<T,U> > (*this);
+ }
+ virtual std::string SerializeToString (Ptr<const ParamSpec> spec) const {
+ std::ostringstream oss;
+ oss << m_value;
+ return oss.str ();
+ }
+ virtual bool DeserializeFromString (std::string value, Ptr<const ParamSpec> spec) {
+ std::istringstream iss;
+ iss.str (value);
+ iss >> m_value;
+ return !iss.bad () && !iss.fail ();
+ }
+
+ ClassValue (PValue value)
+ {
+ ClassValue<T,U> *v = value.DynCast<ClassValue<T,U> *> ();
+ if (v == 0)
+ {
+ NS_FATAL_ERROR ("Unexpected type of value. Expected \""<< typeid (U).name () <<"\"");
+ }
+ m_value = v->Get ();
+ }
+ operator PValue () const
+ {
+ return PValue::Create<ClassValue<T,U> > (*this);
+ }
+
+private:
+ T m_value;
+};
+
+template <typename T,typename U>
+T
+ClassValueHelperExtractFrom (PValue value)
+{
+ ClassValue<T,U> *v = value.DynCast<ClassValue<T,U> *> ();
+ if (v == 0)
+ {
+ NS_FATAL_ERROR ("Unexpected type of value. Expected \"" << typeid (U).name () << "\"");
+ }
+ return v->Get ();
+}
+
+template <typename T,typename U>
+PValue
+ClassValueHelperConvertTo (const T *self)
+{
+ return PValue::Create<ClassValue<T,U> > (*self);
+}
+
+
+template <typename T, typename U, typename T1>
+Ptr<ParamSpec>
+MakeClassValueHelperParamSpec (T1 a1, const T &initialValue)
+{
+ return MakeParamSpecHelper (a1, ClassValue<T,U> (initialValue));
+}
+
+
+template <typename T, typename U, typename T1, typename T2>
+Ptr<ParamSpec>
+MakeClassValueHelperParamSpec (T1 a1, T2 a2, const T &initialValue)
+{
+ return MakeParamSpecHelper (a1, a2, ClassValue<T,U> (initialValue));
+}
+
+} // namespace ns3
+
+#endif /* CLASS_VALUE_HELPER_H */
--- a/src/core/random-variable.cc Wed Feb 13 21:00:33 2008 +0100
+++ b/src/core/random-variable.cc Wed Feb 13 22:39:17 2008 +0100
@@ -300,18 +300,13 @@
return m_variable;
}
RandomVariable::RandomVariable (PValue value)
+ : m_variable (0)
{
- const RandomVariableValue *v = value.DynCast<const RandomVariableValue *> ();
- if (v == 0)
- {
- NS_FATAL_ERROR ("assigning non-RandomVariable value to RandomVariable value.");
- }
- m_variable = v->Get ().m_variable->Copy ();
-
+ *this = ClassValueHelperExtractFrom<RandomVariable,RandomVariableValue> (value);
}
RandomVariable::operator PValue () const
{
- return PValue::Create<RandomVariableValue> (*this);
+ return ClassValueHelperConvertTo<RandomVariable,RandomVariableValue> (this);
}
@@ -1597,76 +1592,53 @@
}
-RandomVariableValue::RandomVariableValue (RandomVariable variable)
- : m_variable (variable)
-{}
-void
-RandomVariableValue::Set (RandomVariable variable)
-{
- m_variable = variable;
-}
-RandomVariable
-RandomVariableValue::Get (void) const
+std::ostream &operator << (std::ostream &os, const RandomVariable &var)
{
- return m_variable;
-}
-
-PValue
-RandomVariableValue::Copy (void) const
-{
- return PValue::Create<RandomVariableValue> (m_variable);
-}
-std::string
-RandomVariableValue::SerializeToString (Ptr<const ParamSpec> spec) const
-{
- std::ostringstream oss;
- RandomVariableBase *base = m_variable.Peek ();
+ RandomVariableBase *base = var.Peek ();
ConstantVariableImpl *constant = dynamic_cast<ConstantVariableImpl *> (base);
if (constant != 0)
{
- oss << "Constant:" << constant->GetValue ();
- return oss.str ();
+ os << "Constant:" << constant->GetValue ();
+ return os;
}
UniformVariableImpl *uniform = dynamic_cast<UniformVariableImpl *> (base);
if (uniform != 0)
{
- oss << "Uniform:" << uniform->GetMin () << ":" << uniform->GetMax ();
- return oss.str ();
+ os << "Uniform:" << uniform->GetMin () << ":" << uniform->GetMax ();
+ return os;
}
// XXX: support other distributions
- return "";
+ os.setstate (std::ios_base::badbit);
+ return os;
}
-bool
-RandomVariableValue::DeserializeFromString (std::string value, Ptr<const ParamSpec> spec)
+std::istream &operator >> (std::istream &is, RandomVariable &var)
{
+ std::string value;
+ is >> value;
std::string::size_type tmp;
tmp = value.find (":");
if (tmp == std::string::npos)
{
- return false;
+ is.setstate (std::ios_base::badbit);
+ return is;
}
std::string type = value.substr (0, tmp);
if (value == "Constant")
{
- // XXX
- return true;
+ // XXX parse
+ var = ConstantVariable ();
}
else if (value == "Uniform")
{
- // XXX
- return true;
+ // XXX parse
+ var = UniformVariable ();
}
- // XXX: support other distributions.
- return false;
+ else
+ {
+ // XXX: support other distributions.
+ }
+ return is;
}
-RandomVariableValue::RandomVariableValue (PValue value)
- : m_variable (value)
-{}
-RandomVariableValue::operator PValue () const
-{
- return m_variable;
-}
-
--- a/src/core/random-variable.h Wed Feb 13 21:00:33 2008 +0100
+++ b/src/core/random-variable.h Wed Feb 13 22:39:17 2008 +0100
@@ -24,7 +24,10 @@
#include <vector>
#include <algorithm>
#include <stdint.h>
+#include <istream>
+#include <ostream>
#include "value.h"
+#include "class-value-helper.h"
/**
* \ingroup core
@@ -166,6 +169,9 @@
private:
friend class RandomVariableValue;
+ friend std::ostream &operator << (std::ostream &os, const RandomVariable &var);
+ friend std::istream &operator >> (std::istream &os, RandomVariable &var);
+
RandomVariableBase *m_variable;
protected:
RandomVariable (const RandomVariableBase &variable);
@@ -655,23 +661,11 @@
static double GetSingleValue(double s, double l, double mean);
};
-
-class RandomVariableValue : public Value
-{
-public:
- RandomVariableValue (RandomVariable variable);
- void Set (RandomVariable variable);
- RandomVariable Get (void) const;
+std::ostream &operator << (std::ostream &os, const RandomVariable &var);
+std::istream &operator >> (std::istream &os, RandomVariable &var);
- virtual PValue Copy (void) const;
- virtual std::string SerializeToString (Ptr<const ParamSpec> spec) const;
- virtual bool DeserializeFromString (std::string value, Ptr<const ParamSpec> spec);
- RandomVariableValue (PValue value);
- operator PValue () const;
-private:
- RandomVariable m_variable;
-};
+class RandomVariableValue : public Value {};
template <typename T1>
Ptr<ParamSpec> MakeRandomVariableParamSpec (T1 a1,
@@ -690,14 +684,14 @@
Ptr<ParamSpec> MakeRandomVariableParamSpec (T1 a1,
RandomVariable initialValue)
{
- return MakeParamSpecHelper (a1, RandomVariableValue (initialValue));
+ return MakeClassValueHelperParamSpec<RandomVariable, RandomVariableValue> (a1, initialValue);
}
template <typename T1, typename T2>
Ptr<ParamSpec> MakeRandomVariableParamSpec (T1 a1, T2 a2,
RandomVariable initialValue)
{
- return MakeParamSpecHelper (a1, a2, RandomVariableValue (initialValue));
+ return MakeClassValueHelperParamSpec<RandomVariable, RandomVariableValue> (a1, a2, initialValue);
}
--- a/src/core/wscript Wed Feb 13 21:00:33 2008 +0100
+++ b/src/core/wscript Wed Feb 13 22:39:17 2008 +0100
@@ -113,5 +113,6 @@
'fp-value.h',
'enum-value.h',
'object-factory.h',
+ 'class-value-helper.h',
]
--- a/src/mobility/rectangle.cc Wed Feb 13 21:00:33 2008 +0100
+++ b/src/mobility/rectangle.cc Wed Feb 13 22:39:17 2008 +0100
@@ -121,102 +121,31 @@
Rectangle::Rectangle (PValue value)
{
- const RectangleValue *v = value.DynCast<const RectangleValue *> ();
- if (v == 0)
- {
- NS_FATAL_ERROR ("expecting value of type Rectangle.");
- }
- *this = v->Get ();
+ *this = ClassValueHelperExtractFrom<Rectangle,RectangleValue> (value);
}
Rectangle::operator PValue () const
{
- return PValue::Create<RectangleValue> (*this);
-}
-
-
-
-RectangleValue::RectangleValue (const Rectangle &rectangle)
- : m_rectangle (rectangle)
-{}
-
-void
-RectangleValue::Set (const Rectangle &v)
-{
- m_rectangle = v;
-}
-Rectangle
-RectangleValue::Get (void) const
-{
- return m_rectangle;
+ return ClassValueHelperConvertTo<Rectangle,RectangleValue> (this);
}
-PValue
-RectangleValue::Copy (void) const
-{
- return PValue::Create<RectangleValue> (*this);
-}
-std::string
-RectangleValue::SerializeToString (Ptr<const ParamSpec> spec) const
-{
- std::ostringstream oss;
- oss << m_rectangle.xMin << "|" << m_rectangle.xMax << "|" << m_rectangle.yMin << "|" << m_rectangle.yMax;
- return oss.str ();
-}
-void
-RectangleValue::ReadAsDouble (std::string value, double &v, bool &ok)
-{
- std::istringstream iss;
- iss.str (value);
- double local;
- iss >> local;
- bool good = !iss.bad () && !iss.fail ();
- if (good)
- {
- v = local;
- }
- else
- {
- ok = false;
- }
-}
-bool
-RectangleValue::DeserializeFromString (std::string value, Ptr<const ParamSpec> spec)
+std::ostream &
+operator << (std::ostream &os, const Rectangle &rectangle)
{
- bool ok = true;
- std::istringstream iss;
- iss.str (value);
- std::string::size_type cur = 0, next = 0;
- next = value.find ("|", cur);
- if (next == std::string::npos)
+ os << rectangle.xMin << "|" << rectangle.xMax << "|" << rectangle.yMin << "|" << rectangle.yMax;
+ return os;
+}
+std::istream &
+operator >> (std::istream &is, Rectangle &rectangle)
+ {
+ char c1, c2, c3;
+ is >> rectangle.xMin >> c1 >> rectangle.xMax >> c2 >> rectangle.yMin >> c3 >> rectangle.yMax;
+ if (c1 != '|' ||
+ c2 != '|' ||
+ c3 != '|')
{
- return false;
- }
- ReadAsDouble (value.substr (cur, next-cur), m_rectangle.xMin, ok);
- cur = next + 1;
- next = value.find ("|", cur);
- if (next == std::string::npos)
- {
- return false;
+ is.setstate (std::ios_base::failbit);
}
- ReadAsDouble (value.substr (cur, next-cur), m_rectangle.xMax, ok);
- cur = next + 1;
- next = value.find ("|", cur);
- if (next == std::string::npos)
- {
- return false;
- }
- ReadAsDouble (value.substr (cur, next-cur), m_rectangle.yMin, ok);
- cur = next + 1;
- ReadAsDouble (value.substr (cur, value.size ()-cur), m_rectangle.yMax, ok);
- return ok;
-}
-
-RectangleValue::RectangleValue (PValue value)
- : m_rectangle (value)
-{}
-RectangleValue::operator PValue () const
-{
- return m_rectangle;
+ return is;
}
--- a/src/mobility/rectangle.h Wed Feb 13 21:00:33 2008 +0100
+++ b/src/mobility/rectangle.h Wed Feb 13 22:39:17 2008 +0100
@@ -21,7 +21,7 @@
#define RECTANGLE_H
#include "ns3/value.h"
-#include "ns3/param-spec-helper.h"
+#include "ns3/class-value-helper.h"
namespace ns3 {
@@ -66,26 +66,11 @@
operator PValue () const;
};
-class RectangleValue : public Value
-{
-public:
- RectangleValue (const Rectangle &rectangle);
-
- void Set (const Rectangle &v);
- Rectangle Get (void) const;
+std::ostream &operator << (std::ostream &os, const Rectangle &rectangle);
+std::istream &operator >> (std::istream &is, Rectangle &rectangle);
- // inherited from Parameter base class
- virtual PValue Copy (void) const;
- virtual std::string SerializeToString (Ptr<const ParamSpec> spec) const;
- virtual bool DeserializeFromString (std::string value, Ptr<const ParamSpec> spec);
- RectangleValue (PValue value);
- operator PValue () const;
-
-private:
- void ReadAsDouble (std::string value, double &v, bool &ok);
- Rectangle m_rectangle;
-};
+class RectangleValue : public Value {};
template <typename T1>
Ptr<ParamSpec> MakeRectangleParamSpec (T1 a1,
@@ -102,13 +87,13 @@
Ptr<ParamSpec> MakeRectangleParamSpec (T1 a1,
Rectangle initialValue)
{
- return MakeParamSpecHelper (a1, RectangleValue (initialValue));
+ return MakeClassValueHelperParamSpec<Rectangle,RectangleValue> (a1, initialValue);
}
template <typename T1, typename T2>
Ptr<ParamSpec> MakeRectangleParamSpec (T1 a1, T2 a2,
Rectangle initialValue)
{
- return MakeParamSpecHelper (a1, a2, RectangleValue (initialValue));
+ return MakeClassValueHelperParamSpec<Rectangle,RectangleValue> (a1, a2, initialValue);
}
} // namespace ns3
--- a/src/mobility/vector.cc Wed Feb 13 21:00:33 2008 +0100
+++ b/src/mobility/vector.cc Wed Feb 13 22:39:17 2008 +0100
@@ -39,16 +39,11 @@
Vector::Vector (PValue value)
{
- const VectorValue *v = value.DynCast<const VectorValue *> ();
- if (v == 0)
- {
- NS_FATAL_ERROR ("Expected value of type Vector");
- }
- *this = v->Get ();
+ *this = ClassValueHelperExtractFrom<Vector,VectorValue> (value);
}
Vector::operator PValue () const
{
- return PValue::Create<VectorValue> (*this);
+ return ClassValueHelperConvertTo<Vector,VectorValue> (this);
}
@@ -62,49 +57,21 @@
return distance;
}
-
-
-VectorValue::VectorValue (const Vector &vector)
- : m_vector (vector)
-{}
-
-void
-VectorValue::Set (const Vector &vector)
+std::ostream &operator << (std::ostream &os, const Vector &vector)
+{
+ os << vector.x << ":" << vector.y << ":" << vector.z;
+ return os;
+}
+std::istream &operator >> (std::istream &is, Vector &vector)
{
- m_vector = vector;
-}
-Vector
-VectorValue::Get (void) const
-{
- return m_vector;
+ char c1, c2;
+ is >> vector.x >> c1 >> vector.y >> c2 >> vector.z;
+ if (c1 != ':' ||
+ c2 != ':')
+ {
+ is.setstate (std::ios_base::failbit);
+ }
+ return is;
}
-PValue
-VectorValue::Copy (void) const
-{
- return PValue::Create<VectorValue> (*this);
-}
-std::string
-VectorValue::SerializeToString (Ptr<const ParamSpec> spec) const
-{
- std::ostringstream oss;
- oss << m_vector.x << ":" << m_vector.y << ":" << m_vector.z;
- return oss.str ();
-}
-bool
-VectorValue::DeserializeFromString (std::string value, Ptr<const ParamSpec> spec)
-{
- // XXX implement parsing
- return false;
-}
-
-VectorValue::VectorValue (PValue value)
- : m_vector (value)
-{}
-VectorValue::operator PValue () const
-{
- return m_vector;
-}
-
-
} // namespace ns3
--- a/src/mobility/vector.h Wed Feb 13 21:00:33 2008 +0100
+++ b/src/mobility/vector.h Wed Feb 13 22:39:17 2008 +0100
@@ -21,7 +21,7 @@
#define VECTOR_H
#include "ns3/value.h"
-#include "ns3/param-spec-helper.h"
+#include "ns3/class-value-helper.h"
namespace ns3 {
@@ -64,23 +64,10 @@
double CalculateDistance (const Vector &a, const Vector &b);
-class VectorValue : public Value
-{
-public:
- VectorValue (const Vector &vector);
-
- void Set (const Vector &vector);
- Vector Get (void) const;
+class VectorValue : public Value {};
- virtual PValue Copy (void) const;
- virtual std::string SerializeToString (Ptr<const ParamSpec> spec) const;
- virtual bool DeserializeFromString (std::string value, Ptr<const ParamSpec> spec);
-
- VectorValue (PValue value);
- operator PValue () const;
-private:
- Vector m_vector;
-};
+std::ostream &operator << (std::ostream &os, const Vector &vector);
+std::istream &operator >> (std::istream &is, Vector &vector);
template <typename T1>
Ptr<ParamSpec>
@@ -99,7 +86,7 @@
Ptr<ParamSpec>
MakeVectorParamSpec (T1 a1, const Vector &initialValue)
{
- return MakeParamSpecHelper (a1, VectorValue (initialValue));
+ return MakeClassValueHelperParamSpec<Vector,VectorValue> (a1, initialValue);
}
template <typename T1, typename T2>
@@ -107,7 +94,7 @@
MakeVectorParamSpec (T1 a1, T2 a2,
const Vector &initialValue)
{
- return MakeParamSpecHelper (a1, a2, VectorValue (initialValue));
+ return MakeClassValueHelperParamSpec<Vector,VectorValue> (a1, a2, initialValue);
}
} // namespace ns3
--- a/src/simulator/nstime.h Wed Feb 13 21:00:33 2008 +0100
+++ b/src/simulator/nstime.h Wed Feb 13 22:39:17 2008 +0100
@@ -22,7 +22,7 @@
#include "ns3/assert.h"
#include "ns3/value.h"
-#include "ns3/param-spec-helper.h"
+#include "ns3/class-value-helper.h"
#include <stdint.h>
#include <math.h>
#include <ostream>
@@ -520,7 +520,8 @@
typedef TimeUnit<1> Time;
-std::ostream& operator<< (std::ostream& os, Time const& time);
+std::ostream& operator<< (std::ostream& os, const Time & time);
+std::istream& operator>> (std::istream& is, Time & time);
/**
* \brief create ns3::Time instances in units of seconds.
@@ -669,24 +670,7 @@
typedef TimeUnit<2> TimeSquare;
-class TimeValue : public Value
-{
-public:
- TimeValue (Time time);
-
- void Set (Time time);
- Time Get (void) const;
-
- // inherited from Value base class.
- virtual PValue Copy (void) const;
- virtual std::string SerializeToString (Ptr<const ParamSpec> spec) const;
- virtual bool DeserializeFromString (std::string value, Ptr<const ParamSpec> spec);
-
- TimeValue (PValue value);
- operator PValue () const;
-private:
- Time m_time;
-};
+class TimeValue : public Value {};
template <typename T1>
Ptr<ParamSpec> MakeTimeParamSpec (T1 a1,
@@ -704,14 +688,14 @@
Ptr<ParamSpec> MakeTimeParamSpec (T1 a1,
Time initialValue)
{
- return MakeParamSpecHelper (a1, TimeValue (initialValue));
+ return MakeClassValueHelperParamSpec<Time,TimeValue> (a1, initialValue);
}
template <typename T1, typename T2>
Ptr<ParamSpec> MakeTimeParamSpec (T1 a1, T2 a2,
Time initialValue)
{
- return MakeParamSpecHelper (a1, a2, TimeValue (initialValue));
+ return MakeClassValueHelperParamSpec<Time,TimeValue> (a1, a2, initialValue);
}
--- a/src/simulator/time.cc Wed Feb 13 21:00:33 2008 +0100
+++ b/src/simulator/time.cc Wed Feb 13 22:39:17 2008 +0100
@@ -189,7 +189,7 @@
std::ostream&
-operator<< (std::ostream& os, Time const& time)
+operator<< (std::ostream& os, const Time & time)
{
std::string unit;
switch (TimeStepPrecision::Get ()) {
@@ -215,6 +215,60 @@
os << time.GetTimeStep () << unit;
return os;
}
+std::istream& operator>> (std::istream& is, Time & time)
+{
+ std::string value;
+ is >> value;
+ std::string::size_type n = value.find_first_not_of("0123456789.");
+ if (n == std::string::npos)
+ {
+ is.setstate (std::ios_base::failbit);
+ return is;
+ }
+ std::string trailer = value.substr(n, value.size ()-1-n);
+ std::istringstream iss;
+ iss.str (value.substr(0, n));
+
+ if (trailer == std::string("s"))
+ {
+ double v;
+ iss >> v;
+ time = Seconds (v);
+ return is;
+ }
+ uint64_t integer;
+ iss >> integer;
+ if (is.bad () || is.fail ())
+ {
+ is.setstate (std::ios_base::failbit);
+ }
+ else if (trailer == std::string("ms"))
+ {
+ time = MilliSeconds (integer);
+ }
+ else if (trailer == std::string("us"))
+ {
+ time = MicroSeconds (integer);
+ }
+ else if (trailer == std::string("ns"))
+ {
+ time = NanoSeconds (integer);
+ }
+ else if (trailer == std::string("ps"))
+ {
+ time = PicoSeconds (integer);
+ }
+ else if (trailer == std::string("fs"))
+ {
+ time = FemtoSeconds (integer);
+ }
+ else
+ {
+ is.setstate (std::ios_base::failbit);
+ // XXX: problem ?
+ }
+ return is;
+}
Time Seconds (double seconds)
{
@@ -244,16 +298,11 @@
TimeUnit<1>::TimeUnit (PValue value)
{
- const TimeValue *v = value.DynCast<const TimeValue *> ();
- if (v == 0)
- {
- NS_FATAL_ERROR ("Expected value of type TimeValue.");
- }
- *this = v->Get ();
+ *this = ClassValueHelperExtractFrom<Time,TimeValue> (value);
}
TimeUnit<1>::operator PValue () const
{
- return PValue::Create<TimeValue> (*this);
+ return ClassValueHelperConvertTo<Time,TimeValue> (this);
}
Time MilliSeconds (uint64_t ms)
@@ -284,93 +333,6 @@
return TimeStep(ts);
}
-TimeValue::TimeValue (const Time time)
- : m_time (time)
-{}
-void
-TimeValue::Set (Time time)
-{
- m_time = time;
-}
-Time
-TimeValue::Get (void) const
-{
- return m_time;
-}
-PValue
-TimeValue::Copy (void) const
-{
- return PValue::Create<TimeValue> (*this);
-}
-std::string
-TimeValue::SerializeToString (Ptr<const ParamSpec> spec) const
-{
- std::ostringstream oss;
- oss << m_time.GetSeconds () << "s";
- return oss.str ();
-}
-bool
-TimeValue::DeserializeFromString (std::string value, Ptr<const ParamSpec> spec)
-{
- std::string::size_type n = value.find_first_not_of("0123456789.");
- if (n == std::string::npos)
- {
- return false;
- }
- std::string trailer = value.substr(n, value.size ()-1-n);
- std::istringstream iss;
- iss.str (value.substr(0, n));
-
- if (trailer == std::string("s"))
- {
- double v;
- iss >> v;
- m_time = Seconds (v);
- return !iss.bad () && !iss.fail ();
- }
- uint64_t integer;
- iss >> integer;
- if (iss.bad () || iss.fail ())
- {
- return false;
- }
- if (trailer == std::string("ms"))
- {
- m_time = MilliSeconds (integer);
- return true;
- }
- if (trailer == std::string("us"))
- {
- m_time = MicroSeconds (integer);
- return true;
- }
- if (trailer == std::string("ns"))
- {
- m_time = NanoSeconds (integer);
- return true;
- }
- if (trailer == std::string("ps"))
- {
- m_time = PicoSeconds (integer);
- return true;
- }
- if (trailer == std::string("fs"))
- {
- m_time = FemtoSeconds (integer);
- return true;
- }
- return false;
-}
-
-TimeValue::TimeValue (PValue value)
- : m_time (value)
-{}
-
-TimeValue::operator PValue () const
-{
- return m_time;
-}
-
/*
* The timestep value passed to this function must be of the precision