48 const std::vector<std::string> &contexts,
50 : m_objects (objects),
51 m_contexts (contexts),
108 for (uint32_t i = 0; i <
m_objects.size (); ++i)
112 object->TraceConnect (name, ctx, cb);
131 for (uint32_t i = 0; i <
m_objects.size (); ++i)
135 object->TraceDisconnect (name, ctx, cb);
155 bool Matches (uint32_t i)
const;
163 : m_element (element)
176 std::string::size_type tmp;
178 if (tmp != std::string::npos)
180 std::string left =
m_element.substr (0, tmp-0);
197 std::string::size_type leftBracket =
m_element.find (
"[");
198 std::string::size_type rightBracket =
m_element.find (
"]");
199 std::string::size_type dash =
m_element.find (
"-");
200 if (leftBracket == 0 && rightBracket ==
m_element.size () - 1 &&
201 dash > leftBracket && dash < rightBracket)
203 std::string lowerBound =
m_element.substr (leftBracket + 1, dash - (leftBracket + 1));
204 std::string upperBound =
m_element.substr (dash + 1, rightBracket - (dash + 1));
209 i >= min && i <= max)
235 std::istringstream iss;
238 return !iss.bad () && !iss.fail ();
276 std::string::size_type tmp =
m_path.find (
"/");
282 tmp =
m_path.find_last_of (
"/");
283 if (tmp != (
m_path.size () - 1))
303 std::string fullPath =
"/";
306 fullPath += *i +
"/";
325 std::string::size_type next = path.find (
"/", 1);
327 if (next == std::string::npos)
343 std::string item = path.substr (1, next-1);
344 std::string pathLeft = path.substr (next, path.size ()-next);
355 std::string::size_type offset = path.find (
"/Names");
371 Ptr<Object> namedObject = Names::Find<Object> (root, item);
374 NS_LOG_DEBUG (
"Name system resolved item = " << item <<
" to " << namedObject);
392 std::string::size_type dollarPos = item.find (
"$");
396 std::string tidString = item.substr (1, item.size () - 1);
413 TypeId nextTid = root->GetInstanceTypeId ();
414 bool foundMatch =
false;
424 if (info.name != item && item !=
"*")
434 root->GetAttribute (info.name, ptr);
451 if (vectorChecker != 0)
456 root->GetAttribute (info.name, vector);
466 }
while (nextTid != tid);
482 std::string::size_type next = path.find (
"/", 1);
483 if (next == std::string::npos)
487 std::string item = path.substr (1, next-1);
488 std::string pathLeft = path.substr (next, path.size ()-next);
492 for (it = container.
Begin (); it != container.
End (); ++it)
494 if (matcher.
Matches ((*it).first))
496 std::ostringstream oss;
523 void ParsePath (std::string path, std::string *root, std::string *leaf)
const;
524 typedef std::vector<Ptr<Object> >
Roots;
533 std::string::size_type slash = path.find_last_of (
"/");
535 *root = path.substr (0, slash);
536 *leaf = path.substr (slash+1, path.size ()-(slash+1));
545 std::string root, leaf;
548 container.
Set (leaf, value);
554 std::string root, leaf;
563 std::string root, leaf;
573 std::string root, leaf;
583 std::string root, leaf;
593 class LookupMatchesResolver :
public Resolver
596 LookupMatchesResolver (std::string path)
599 virtual void DoOne (
Ptr<Object> object, std::string path) {
600 m_objects.push_back (
object);
601 m_contexts.push_back (path);
603 std::vector<Ptr<Object> > m_objects;
604 std::vector<std::string> m_contexts;
605 } resolver = LookupMatchesResolver (path);
606 for (Roots::const_iterator i =
m_roots.begin (); i !=
m_roots.end (); i++)
608 resolver.Resolve (*i);
616 resolver.Resolve (0);
674 (*i)->ResetInitialValue ();
694 std::string::size_type pos = fullName.rfind (
"::");
695 if (pos == std::string::npos)
699 std::string tidName = fullName.substr (0, pos);
700 std::string paramName = fullName.substr (pos+2, fullName.size () - (pos+2));
710 if (tmp.
name == paramName)
uint32_t GetAttributeN(void) const
uint32_t GetRootNamespaceObjectN(void) const
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
ns3::Singleton declaration and template implementation.
bool SetDefaultFailSafe(std::string fullName, const AttributeValue &value)
void DisconnectWithoutContext(std::string path, const CallbackBase &cb)
void Set(std::string path, const AttributeValue &value)
bool SetGlobalFailSafe(std::string name, const AttributeValue &value)
void UnregisterRootNamespaceObject(Ptr< Object > obj)
Hold a value for an Attribute.
void DoResolve(std::string path, Ptr< Object > root)
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
U * PeekPointer(const Ptr< U > &p)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
TypeId GetParent(void) const
Vector::const_iterator Iterator
Base class for Callback class.
std::string GetMatchedPath(uint32_t i) const
void Disconnect(std::string name, const CallbackBase &cb)
void DisconnectWithoutContext(std::string path, const CallbackBase &cb)
#define NS_FATAL_ERROR(msg)
Fatal error handling.
static bool LookupByNameFailSafe(std::string name, TypeId *tid)
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
std::vector< Ptr< Object > > Roots
Declaration of the various ns3::Config functions and classes.
static T * Get(void)
Get a pointer to the singleton instance.
void RegisterRootNamespaceObject(Ptr< Object > obj)
std::vector< std::string > m_workStack
std::map< uint32_t, Ptr< Object > >::const_iterator Iterator
Iterator type for traversing this container.
void UnregisterRootNamespaceObject(Ptr< Object > obj)
MatchContainer::Iterator End(void) const
virtual void DoOne(Ptr< Object > object, std::string path)=0
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Config::MatchContainer LookupMatches(std::string path)
void ConnectWithoutContext(std::string name, const CallbackBase &cb)
ObjectPtrContainer attribute value declarations and template implementations.
static uint32_t GetRegisteredN(void)
static Iterator Begin(void)
Ptr< Object > GetRootNamespaceObject(uint32_t i)
void Resolve(Ptr< Object > root)
AttributeChecker implementation for ObjectPtrContainerValue.
bool TraceDisconnectWithoutContext(std::string name, const CallbackBase &cb)
Disconnect from a TraceSource a Callback previously connected without a context.
static TypeId GetRegistered(uint32_t i)
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
static void Bind(std::string name, const AttributeValue &value)
void ParsePath(std::string path, std::string *root, std::string *leaf) const
uint32_t GetRootNamespaceObjectN(void)
void Connect(std::string path, const CallbackBase &cb)
void Connect(std::string path, const CallbackBase &cb)
void DoResolveOne(Ptr< Object > object)
uint32_t GetN(void) const
void Disconnect(std::string path, const CallbackBase &cb)
void DoArrayResolve(std::string path, const ObjectPtrContainerValue &vector)
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr.
Ptr< Object > Get(uint32_t i) const
Iterator Begin(void) const
Get an iterator to the first Object.
ns3::GlobalValue declaration.
hold a set of objects which match a specific search string.
std::vector< Ptr< Object > > m_objects
void Connect(std::string name, const CallbackBase &cb)
void Reset(void)
Reset the initial value of every attribute as well as the value of every global to what they were bef...
bool SetAttributeInitialValue(uint32_t i, Ptr< const AttributeValue > initialValue)
Config::MatchContainer LookupMatches(std::string path)
ns3::Object class declaration, which is the root of the Object hierarchy and Aggregation.
void DisconnectWithoutContext(std::string name, const CallbackBase &cb)
AttributeChecker implementation for PointerValue.
void SetGlobal(std::string name, const AttributeValue &value)
std::vector< std::string > m_contexts
static Iterator End(void)
static bool BindFailSafe(std::string name, const AttributeValue &value)
void RegisterRootNamespaceObject(Ptr< Object > obj)
Iterator End(void) const
Get an iterator to the past-the-end Object.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void SetDefault(std::string name, const AttributeValue &value)
bool Matches(uint32_t i) const
void Set(std::string path, const AttributeValue &value)
Declaration of class ns3::Names.
std::vector< Ptr< Object > >::const_iterator Iterator
std::string GetResolvedPath(void) const
bool StringToUint32(std::string str, uint32_t *value) const
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
void Set(std::string name, const AttributeValue &value)
A base class which provides memory management and object aggregation.
MatchContainer::Iterator Begin(void) const
Container for a set of ns3::Object pointers.
ArrayMatcher(std::string element)
struct TypeId::AttributeInformation GetAttribute(uint32_t i) const
Ptr< Object > GetRootNamespaceObject(uint32_t i) const
void Disconnect(std::string path, const CallbackBase &cb)
std::string GetPath(void) const
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
Pointer attribute value declarations and template implementations.
a unique identifier for an interface.
Resolver(std::string path)
static TypeId LookupByName(std::string name)