114 os << i->name <<
"=" << i->value->SerializeToString (i->checker);
127 std::string::size_type lbracket, rbracket;
128 lbracket = v.find (
"[");
129 rbracket = v.find (
"]");
130 if (lbracket == std::string::npos && rbracket == std::string::npos)
135 if (lbracket == std::string::npos || rbracket == std::string::npos)
139 NS_ASSERT (lbracket != std::string::npos);
140 NS_ASSERT (rbracket != std::string::npos);
141 std::string tid = v.substr (0, lbracket);
142 std::string parameters = v.substr (lbracket+1,rbracket-(lbracket+1));
144 std::string::size_type cur;
146 while (cur != parameters.size ())
148 std::string::size_type equal = parameters.find (
"=", cur);
149 if (equal == std::string::npos)
151 is.setstate (std::ios_base::failbit);
156 std::string name = parameters.substr (cur, equal-cur);
160 is.setstate (std::ios_base::failbit);
165 std::string::size_type next = parameters.find (
"|", cur);
167 if (next == std::string::npos)
169 value = parameters.substr (equal+1, parameters.size () - (equal+1));
170 cur = parameters.size ();
174 value = parameters.substr (equal+1, next - (equal+1));
181 is.setstate (std::ios_base::failbit);
std::istream & operator>>(std::istream &is, Angles &a)
initialize a struct Angles from input
Callback< ObjectBase * > GetConstructor(void) const
Get the constructor callback.
std::string GetName(void) const
Get the name.
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void Construct(const AttributeConstructionList &attributes)
Initialize all member variables registered as Attributes of this TypeId.
AttributeConstructionList m_parameters
The list of attributes and values to be used in constructing objects by this factory.
Hold a value for an Attribute.
#define ATTRIBUTE_HELPER_CPP(type)
Define the attribute value, accessor and checkers for class type.
ns3::ObjectFactory class declaration.
#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.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Anchor the ns-3 type and attribute system.
bool LookupAttributeByName(std::string name, struct AttributeInformation *info) const
Find an Attribute by name, retrieving the associated AttributeInformation.
ObjectFactory()
Default constructor.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
virtual Ptr< AttributeValue > Copy(void) const =0
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of this Object.
TypeId GetTypeId(void) const
Get the TypeId which will be created by this ObjectFactory.
std::list< struct Item >::const_iterator CIterator
Iterator type.
Instantiate subclasses of ns3::Object.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
virtual bool DeserializeFromString(std::string value, Ptr< const AttributeChecker > checker)=0
CIterator End(void) const
A base class which provides memory management and object aggregation.
TypeId m_tid
The TypeId this factory will create.
void Add(std::string name, Ptr< const AttributeChecker > checker, Ptr< AttributeValue > value)
Add an Attribute to the list.
a unique identifier for an interface.
static TypeId LookupByName(std::string name)
Get a TypeId by name.
CIterator Begin(void) const