42 const std::vector<std::string> &contexts,
44 : m_objects (objects),
45 m_contexts (contexts),
102 for (uint32_t i = 0; i <
m_objects.size (); ++i)
106 object->TraceConnect (name, ctx, cb);
125 for (uint32_t i = 0; i <
m_objects.size (); ++i)
129 object->TraceDisconnect (name, ctx, cb);
149 bool Matches (uint32_t i)
const;
157 : m_element (element)
170 std::string::size_type tmp;
172 if (tmp != std::string::npos)
174 std::string left =
m_element.substr (0, tmp-0);
191 std::string::size_type leftBracket =
m_element.find (
"[");
192 std::string::size_type rightBracket =
m_element.find (
"]");
193 std::string::size_type dash =
m_element.find (
"-");
194 if (leftBracket == 0 && rightBracket ==
m_element.size () - 1 &&
195 dash > leftBracket && dash < rightBracket)
197 std::string lowerBound =
m_element.substr (leftBracket + 1, dash - (leftBracket + 1));
198 std::string upperBound =
m_element.substr (dash + 1, rightBracket - (dash + 1));
203 i >= min && i <= max)
229 std::istringstream iss;
232 return !iss.bad () && !iss.fail ();
270 std::string::size_type tmp =
m_path.find (
"/");
276 tmp =
m_path.find_last_of (
"/");
277 if (tmp != (
m_path.size () - 1))
297 std::string fullPath =
"/";
300 fullPath += *i +
"/";
319 std::string::size_type next = path.find (
"/", 1);
321 if (next == std::string::npos)
337 std::string item = path.substr (1, next-1);
338 std::string pathLeft = path.substr (next, path.size ()-next);
349 std::string::size_type offset = path.find (
"/Names");
365 Ptr<Object> namedObject = Names::Find<Object> (root, item);
368 NS_LOG_DEBUG (
"Name system resolved item = " << item <<
" to " << namedObject);
386 std::string::size_type dollarPos = item.find (
"$");
390 std::string tidString = item.substr (1, item.size () - 1);
407 TypeId nextTid = root->GetInstanceTypeId ();
408 bool foundMatch =
false;
418 if (info.name != item && item !=
"*")
428 root->GetAttribute (info.name, ptr);
445 if (vectorChecker != 0)
450 root->GetAttribute (info.name, vector);
460 }
while (nextTid != tid);
476 std::string::size_type next = path.find (
"/", 1);
477 if (next == std::string::npos)
481 std::string item = path.substr (1, next-1);
482 std::string pathLeft = path.substr (next, path.size ()-next);
486 for (it = container.
Begin (); it != container.
End (); ++it)
488 if (matcher.
Matches ((*it).first))
490 std::ostringstream oss;
517 void ParsePath (std::string path, std::string *root, std::string *leaf)
const;
518 typedef std::vector<Ptr<Object> >
Roots;
527 std::string::size_type slash = path.find_last_of (
"/");
529 *root = path.substr (0, slash);
530 *leaf = path.substr (slash+1, path.size ()-(slash+1));
539 std::string root, leaf;
542 container.
Set (leaf, value);
548 std::string root, leaf;
557 std::string root, leaf;
567 std::string root, leaf;
577 std::string root, leaf;
587 class LookupMatchesResolver :
public Resolver
590 LookupMatchesResolver (std::string path)
593 virtual void DoOne (
Ptr<Object> object, std::string path) {
594 m_objects.push_back (
object);
595 m_contexts.push_back (path);
597 std::vector<Ptr<Object> > m_objects;
598 std::vector<std::string> m_contexts;
599 } resolver = LookupMatchesResolver (path);
600 for (Roots::const_iterator i =
m_roots.begin (); i !=
m_roots.end (); i++)
602 resolver.Resolve (*i);
610 resolver.Resolve (0);
668 (*i)->ResetInitialValue ();
688 std::string::size_type pos = fullName.rfind (
"::");
689 if (pos == std::string::npos)
693 std::string tidName = fullName.substr (0, pos);
694 std::string paramName = fullName.substr (pos+2, fullName.size () - (pos+2));
704 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.
void DisconnectWithoutContext(std::string path, 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...
Hold a value for an Attribute.
void DoResolve(std::string path, Ptr< Object > root)
void Disconnect(std::string path, const CallbackBase &cb)
#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)
#define NS_FATAL_ERROR(msg)
Fatal error handling.
static bool LookupByNameFailSafe(std::string name, TypeId *tid)
void UnregisterRootNamespaceObject(Ptr< Object > obj)
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
void Set(std::string path, const AttributeValue &value)
std::vector< Ptr< Object > > Roots
Ptr< Object > GetRootNamespaceObject(uint32_t i)
void Connect(std::string path, const CallbackBase &cb)
static T * Get(void)
Get a pointer to the singleton instance.
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)
bool SetDefaultFailSafe(std::string fullName, const AttributeValue &value)
Config::MatchContainer LookupMatches(std::string path)
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)
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)
static void Bind(std::string name, const AttributeValue &value)
void ParsePath(std::string path, std::string *root, std::string *leaf) const
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.
void SetDefault(std::string name, const AttributeValue &value)
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.
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 RegisterRootNamespaceObject(Ptr< Object > obj)
bool SetAttributeInitialValue(uint32_t i, Ptr< const AttributeValue > initialValue)
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.
bool SetGlobalFailSafe(std::string name, const AttributeValue &value)
void DisconnectWithoutContext(std::string path, const CallbackBase &cb)
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.
bool Matches(uint32_t i) const
void Set(std::string path, const AttributeValue &value)
std::vector< Ptr< Object > >::const_iterator Iterator
std::string GetResolvedPath(void) const
uint32_t GetRootNamespaceObjectN(void)
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
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.
void SetGlobal(std::string name, const AttributeValue &value)
void ConnectWithoutContext(std::string path, const CallbackBase &cb)
Resolver(std::string path)
static TypeId LookupByName(std::string name)