diff --git a/src/core/object.cc b/src/core/object.cc index d85be6e1f..0bf29ae40 100644 --- a/src/core/object.cc +++ b/src/core/object.cc @@ -23,6 +23,10 @@ #include "singleton.h" #include "trace-resolver.h" #include "value.h" +#include "uint-value.h" +#include "int-value.h" +#include "fp-value.h" +#include "enum-value.h" #include "log.h" #include #include @@ -929,6 +933,27 @@ Object::Set (std::string name, PValue value) } return DoSet (info.spec, value); } +bool +Object::SetUint (std::string name, uint64_t value) +{ + return Set (name, UintValue (value)); +} +bool +Object::SetInt (std::string name, int64_t value) +{ + return Set (name, IntValue (value)); +} +bool +Object::SetFp (std::string name, double value) +{ + return Set (name, FpValue (value)); +} +bool +Object::SetEnum (std::string name, int value) +{ + return Set (name, EnumValue (value)); +} + bool Object::Get (std::string name, std::string &value) const { @@ -970,6 +995,31 @@ Object::Get (std::string name) const } return value; } +uint64_t +Object::GetUint (std::string name) const +{ + UintValue value = Get (name); + return value.Get (); +} +int64_t +Object::GetInt (std::string name) const +{ + IntValue value = Get (name); + return value.Get (); +} +double +Object::GetFp (std::string name) const +{ + FpValue value = Get (name); + return value.Get (); +} +int +Object::GetEnum (std::string name) const +{ + EnumValue value = Get (name); + return value.Get (); +} + Ptr Object::DoGetObject (TypeId tid) const diff --git a/src/core/object.h b/src/core/object.h index 79fadb993..8b8c2fb7c 100644 --- a/src/core/object.h +++ b/src/core/object.h @@ -350,6 +350,12 @@ public: * Set a single parameter. */ bool Set (std::string name, PValue value); + + bool SetUint (std::string name, uint64_t value); + bool SetInt (std::string name, int64_t value); + bool SetFp (std::string name, double value); + bool SetEnum (std::string name, int value); + /** * \param name the name of the parameter to read * \param value a reference to the string where the value of the @@ -365,6 +371,11 @@ public: */ PValue Get (std::string name) const; + uint64_t GetUint (std::string name) const; + int64_t GetInt (std::string name) const; + double GetFp (std::string name) const; + int GetEnum (std::string name) const; + /** * Increment the reference count. This method should not be called * by user code. Object instances are expected to be used in conjunction