25 #include "ns3/core-config.h"
100 char *envVar = getenv (
"NS_ATTRIBUTE_DEFAULT");
103 std::string env = std::string (envVar);
104 std::string::size_type cur = 0;
105 std::string::size_type next = 0;
106 while (next != std::string::npos)
108 next = env.find (
";", cur);
109 std::string tmp = std::string (env, cur, next-cur);
110 std::string::size_type equal = tmp.find (
"=");
111 if (equal != std::string::npos)
113 std::string name = tmp.substr (0, equal);
114 std::string value = tmp.substr (equal+1, tmp.size () - equal - 1);
120 info.
name <<
"\" from env var");
136 info.
name <<
"\" from initial value.");
155 bool ok = accessor->Set (
this, *v);
165 if (!tid.LookupAttributeByName (name, &info))
167 NS_FATAL_ERROR (
"Attribute name="<<name<<
" does not exist for this object: tid="<<tid.GetName ());
172 NS_FATAL_ERROR (
"Attribute name="<<name<<
" is not settable for this object: tid="<<tid.GetName ());
176 NS_FATAL_ERROR (
"Attribute name="<<name<<
" could not be set for this object: tid="<<tid.GetName ());
185 if (!tid.LookupAttributeByName (name, &info))
203 if (!tid.LookupAttributeByName (name, &info))
205 NS_FATAL_ERROR (
"Attribute name="<<name<<
" does not exist for this object: tid="<<tid.GetName ());
210 NS_FATAL_ERROR (
"Attribute name="<<name<<
" is not gettable for this object: tid="<<tid.GetName ());
212 bool ok = info.
accessor->Get (
this, value);
220 NS_FATAL_ERROR (
"Attribute name="<<name<<
" tid="<<tid.GetName () <<
": input value is not a string");
226 NS_FATAL_ERROR (
"Attribute name="<<name<<
" tid="<<tid.GetName () <<
": could not get value");
228 str->
Set (v->SerializeToString (info.
checker));
238 if (!tid.LookupAttributeByName (name, &info))
247 bool ok = info.
accessor->Get (
this, value);
263 str->
Set (v->SerializeToString (info.
checker));
277 bool ok = accessor->ConnectWithoutContext (
this, cb);
290 bool ok = accessor->Connect (
this, context, cb);
303 bool ok = accessor->DisconnectWithoutContext (
this, cb);
316 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)
hold variables of type string
void Set(const std::string &value)
Hold a value for an Attribute.
#define NS_LOG_COMPONENT_DEFINE(name)
TypeId GetParent(void) const
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
static TypeId GetTypeId(void)
#define NS_LOG_FUNCTION_NOARGS()
#define NS_FATAL_ERROR(msg)
fatal error handling
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)
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
T * PeekPointer(const Ptr< T > &p)
virtual void NotifyConstructionCompleted(void)
static TypeId GetObjectIid(void)
bool TraceDisconnectWithoutContext(std::string name, const CallbackBase &cb)
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
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)