25 #include "ns3/core-config.h"
101 char *envVar = getenv (
"NS_ATTRIBUTE_DEFAULT");
104 std::string env = std::string (envVar);
105 std::string::size_type cur = 0;
106 std::string::size_type next = 0;
107 while (next != std::string::npos)
109 next = env.find (
";", cur);
110 std::string tmp = std::string (env, cur, next-cur);
111 std::string::size_type equal = tmp.find (
"=");
112 if (equal != std::string::npos)
114 std::string name = tmp.substr (0, equal);
115 std::string value = tmp.substr (equal+1, tmp.size () - equal - 1);
121 info.
name <<
"\" from env var");
137 info.
name <<
"\" from initial value.");
156 bool ok = accessor->Set (
this, *v);
166 if (!tid.LookupAttributeByName (name, &info))
168 NS_FATAL_ERROR (
"Attribute name="<<name<<
" does not exist for this object: tid="<<tid.GetName ());
173 NS_FATAL_ERROR (
"Attribute name="<<name<<
" is not settable for this object: tid="<<tid.GetName ());
177 NS_FATAL_ERROR (
"Attribute name="<<name<<
" could not be set for this object: tid="<<tid.GetName ());
186 if (!tid.LookupAttributeByName (name, &info))
204 if (!tid.LookupAttributeByName (name, &info))
206 NS_FATAL_ERROR (
"Attribute name="<<name<<
" does not exist for this object: tid="<<tid.GetName ());
211 NS_FATAL_ERROR (
"Attribute name="<<name<<
" is not gettable for this object: tid="<<tid.GetName ());
213 bool ok = info.
accessor->Get (
this, value);
221 NS_FATAL_ERROR (
"Attribute name="<<name<<
" tid="<<tid.GetName () <<
": input value is not a string");
227 NS_FATAL_ERROR (
"Attribute name="<<name<<
" tid="<<tid.GetName () <<
": could not get value");
229 str->
Set (v->SerializeToString (info.
checker));
239 if (!tid.LookupAttributeByName (name, &info))
248 bool ok = info.
accessor->Get (
this, value);
264 str->
Set (v->SerializeToString (info.
checker));
278 bool ok = accessor->ConnectWithoutContext (
this, cb);
291 bool ok = accessor->Connect (
this, context, cb);
304 bool ok = accessor->DisconnectWithoutContext (
this, cb);
317 bool ok = accessor->Disconnect (
this, context, cb);
uint32_t GetAttributeN(void) const
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
virtual ~ObjectBase()
Virtual destructor.
hold variables of type string
void Set(const std::string &value)
Hold a value for an Attribute.
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
TypeId GetParent(void) const
Base class for Callback class.
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
static TypeId GetTypeId(void)
Get the type ID.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
The attribute can be written at construction-time.
NS_LOG_COMPONENT_DEFINE("ObjectBase")
#define NS_FATAL_ERROR(msg)
fatal error handling
The attribute can be read.
Ptr< AttributeValue > Find(Ptr< const AttributeChecker > checker) const
Ptr< const TraceSourceAccessor > LookupTraceSourceByName(std::string name) const
bool TraceDisconnect(std::string name, std::string context, const CallbackBase &cb)
T * PeekPointer(const Ptr< T > &p)
virtual void NotifyConstructionCompleted(void)
This method is invoked once all member attributes have been initialized.
static TypeId GetObjectIid(void)
bool TraceDisconnectWithoutContext(std::string name, const CallbackBase &cb)
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
The attribute can be written.
void ConstructSelf(const AttributeConstructionList &attributes)
std::string GetName(void) const
void GetAttribute(std::string name, AttributeValue &value) const
bool DoSet(Ptr< const AttributeAccessor > spec, Ptr< const AttributeChecker > checker, const AttributeValue &value)
virtual TypeId GetInstanceTypeId(void) const =0
#define NS_LOG_DEBUG(msg)
bool TraceConnect(std::string name, std::string context, const CallbackBase &cb)
std::string GetAttributeFullName(uint32_t i) const
bool GetAttributeFailSafe(std::string name, AttributeValue &attribute) const
struct TypeId::AttributeInformation GetAttribute(uint32_t i) const
void SetAttribute(std::string name, const AttributeValue &value)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)