18#include "ns3/core-module.h"
74 TypeId(
"ns3::FormattingTestObject")
76 .AddConstructor<FormattingTestObject>()
77 .AddAttribute(
"OnTime",
78 "A RandomVariableStream used to pick the duration of the 'On' state.",
79 StringValue(
"ns3::ConstantRandomVariable[Constant=1.0]"),
81 MakePointerChecker<RandomVariableStream>());
92 return m_testVariable;
129 m_factory.Set(name, value);
135 return m_factory.Create();
141main(
int argc,
char* argv[])
145 obj->SetAttribute(
"OnTime",
StringValue(
"ns3::UniformRandomVariable"));
146 obj->SetAttribute(
"OnTime",
StringValue(
"ns3::UniformRandomVariable[Min=0.]"));
147 obj->SetAttribute(
"OnTime",
StringValue(
"ns3::UniformRandomVariable[Min=0.|Max=1.]"));
148 obj->SetAttribute(
"OnTime",
StringValue(
"ns3::UniformRandomVariable[Min=50.|Max=100.]"));
157 uniformStream->GetAttribute(
"Min", val);
159 uniformStream->GetAttribute(
"Max", val);
177 FormattingTestObjectHelper formattingHelper;
178 formattingHelper.SetAttribute(
"OnTime",
179 StringValue(
"ns3::UniformRandomVariable[Min=30.|Max=60.0]"));
195 Ptr<Object> outputObj = formattingHelper.CreateFromFactory();
198 rvStream = fto->GetTestVariable();
202 uniformStream->GetAttribute(
"Min", val);
204 uniformStream->GetAttribute(
"Max", val);
Hold a value for an Attribute.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Instantiate subclasses of ns3::Object.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
Hold variables of type string.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#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.