19 #include "ns3/core-module.h" 55 static TypeId GetTypeId (
void);
70 FormattingTestObject::GetTypeId (
void)
74 .AddConstructor<FormattingTestObject> ()
75 .AddAttribute (
"OnTime",
"A RandomVariableStream used to pick the duration of the 'On' state.",
76 StringValue (
"ns3::ConstantRandomVariable[Constant=1.0]"),
78 MakePointerChecker <RandomVariableStream>())
83 FormattingTestObject::FormattingTestObject ()
88 FormattingTestObject::GetTestVariable (
void)
const 90 return m_testVariable;
108 void SetAttribute (std::string name,
const AttributeValue &value);
118 FormattingTestObjectHelper::FormattingTestObjectHelper ()
120 m_factory.
SetTypeId (FormattingTestObject::GetTypeId ());
124 FormattingTestObjectHelper::SetAttribute (std::string name,
const AttributeValue &value)
126 m_factory.Set (name, value);
130 FormattingTestObjectHelper::CreateFromFactory (
void)
132 return m_factory.Create ();
139 main (
int argc,
char *argv[])
143 obj->SetAttribute (
"OnTime",
StringValue (
"ns3::UniformRandomVariable"));
144 obj->SetAttribute (
"OnTime",
StringValue (
"ns3::UniformRandomVariable[Min=0.]"));
145 obj->SetAttribute (
"OnTime",
StringValue (
"ns3::UniformRandomVariable[Min=0.|Max=1.]"));
146 obj->SetAttribute (
"OnTime",
StringValue (
"ns3::UniformRandomVariable[Min=50.|Max=100.]"));
176 FormattingTestObjectHelper formattingHelper;
177 formattingHelper.SetAttribute (
"OnTime",
StringValue (
"ns3::UniformRandomVariable[Min=30.|Max=60.0]"));
190 Ptr<Object> outputObj = formattingHelper.CreateFromFactory ();
193 rvStream = fto->GetTestVariable ();
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
Hold variables of type string.
Hold a value for an Attribute.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Instantiate subclasses of ns3::Object.
A base class which provides memory management and object aggregation.
This class can be used to hold variables of floating point type such as 'double' or 'float'...
a unique identifier for an interface.
void GetAttribute(std::string name, AttributeValue &value) const
Get the value of an attribute, raising fatal errors if unsuccessful.
TypeId SetParent(TypeId tid)
Set the parent TypeId.