28#include "ns3/core-config.h"
96 std::string where =
"argument";
118 <<
": initial value cannot be set using attributes");
124 NS_LOG_DEBUG(
"trying to set from environment variable NS_ATTRIBUTE_DEFAULT");
130 value = Create<StringValue>(val);
141 where =
"initial value";
195 bool ok = accessor->Set(
this, *v);
208 "Attribute name=" << name <<
" does not exist for this object: tid=" << tid.
GetName());
213 "Attribute name=" << name <<
" is not settable for this object: tid=" << tid.
GetName());
217 NS_FATAL_ERROR(
"Attribute name=" << name <<
" could not be set for this object: tid="
248 "Attribute name=" << name <<
" does not exist for this object: tid=" << tid.
GetName());
253 "Attribute name=" << name <<
" is not gettable for this object: tid=" << tid.
GetName());
255 bool ok = info.
accessor->Get(
this, value);
264 <<
": input value is not a string");
271 <<
": could not get value");
290 bool ok = info.
accessor->Get(
this, value);
320 bool ok = accessor->ConnectWithoutContext(
this, cb);
334 bool ok = accessor->Connect(
this, context, cb);
348 bool ok = accessor->DisconnectWithoutContext(
this, cb);
362 bool ok = accessor->Disconnect(
this, context, cb);
NS_ASSERT() and NS_ASSERT_MSG() macro definitions.
ns3::AttributeConstructionList declaration.
List of Attribute name, value and checker triples used to construct Objects.
Ptr< AttributeValue > Find(Ptr< const AttributeChecker > checker) const
Find an Attribute in the list from its AttributeChecker.
Hold a value for an Attribute.
Base class for Callback class.
static KeyFoundType Get(const std::string &envvar, const std::string &key="", const std::string &delim=";")
Get the value corresponding to a key from an environment variable.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
bool TraceDisconnect(std::string name, std::string context, const CallbackBase &cb)
Disconnect from a TraceSource a Callback previously connected with a context.
static TypeId GetObjectIid()
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly.
bool TraceDisconnectWithoutContext(std::string name, const CallbackBase &cb)
Disconnect from a TraceSource a Callback previously connected without a context.
virtual TypeId GetInstanceTypeId() const =0
Get the most derived TypeId for this Object.
void ConstructSelf(const AttributeConstructionList &attributes)
Complete construction of ObjectBase; invoked by derived classes.
virtual ~ObjectBase()
Virtual destructor.
bool GetAttributeFailSafe(std::string name, AttributeValue &value) const
Get the value of an attribute without raising errors.
virtual void NotifyConstructionCompleted()
Notifier called once the ObjectBase is fully constructed.
static TypeId GetTypeId()
Get the type ID.
bool SetAttributeFailSafe(std::string name, const AttributeValue &value)
Set a single attribute without raising errors.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
bool TraceConnect(std::string name, std::string context, const CallbackBase &cb)
Connect a TraceSource to a Callback with a context.
bool DoSet(Ptr< const AttributeAccessor > spec, Ptr< const AttributeChecker > checker, const AttributeValue &value)
Attempt to set the value referenced by the accessor spec to a valid value according to the checker,...
Smart pointer class similar to boost::intrusive_ptr.
Hold variables of type string.
void Set(const std::string &value)
Set the value.
a unique identifier for an interface.
@ ATTR_GET
The attribute can be read.
@ ATTR_SET
The attribute can be written.
@ ATTR_CONSTRUCT
The attribute can be written at construction-time.
std::string GetAttributeFullName(std::size_t i) const
Get the Attribute name by index.
std::size_t GetAttributeN() const
Get the number of attributes.
TypeId GetParent() const
Get the parent of this TypeId.
TypeId SetGroupName(std::string groupName)
Set the group name.
Ptr< const TraceSourceAccessor > LookupTraceSourceByName(std::string name) const
Find a TraceSource by name.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
TypeId::AttributeInformation GetAttribute(std::size_t i) const
Get Attribute information by index.
bool LookupAttributeByName(std::string name, AttributeInformation *info) const
Find an Attribute by name, retrieving the associated AttributeInformation.
std::string GetName() const
Get the name.
Class Environment declaration.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
U * PeekPointer(const Ptr< U > &p)
ns3::ObjectBase declaration and NS_OBJECT_ENSURE_REGISTERED() macro definition.
ns3::StringValue attribute value declarations.
ns3::TraceSourceAccessor and ns3::MakeTraceSourceAccessor declarations.