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);
406 TypeId tid = root->GetInstanceTypeId ();
407 bool foundMatch =
false;
412 if (info.name != item && item !=
"*")
422 root->GetAttribute (info.name, ptr);
439 if (vectorChecker != 0)
444 root->GetAttribute (info.name, vector);
466 std::string::size_type next = path.find (
"/", 1);
467 if (next == std::string::npos)
471 std::string item = path.substr (1, next-1);
472 std::string pathLeft = path.substr (next, path.size ()-next);
476 for (it = container.
Begin (); it != container.
End (); ++it)
478 if (matcher.
Matches ((*it).first))
480 std::ostringstream oss;
507 void ParsePath (std::string path, std::string *root, std::string *leaf)
const;
508 typedef std::vector<Ptr<Object> >
Roots;
517 std::string::size_type slash = path.find_last_of (
"/");
519 *root = path.substr (0, slash);
520 *leaf = path.substr (slash+1, path.size ()-(slash+1));
529 std::string root, leaf;
532 container.
Set (leaf, value);
538 std::string root, leaf;
547 std::string root, leaf;
557 std::string root, leaf;
567 std::string root, leaf;
577 class LookupMatchesResolver :
public Resolver
580 LookupMatchesResolver (std::string path)
583 virtual void DoOne (
Ptr<Object> object, std::string path) {
584 m_objects.push_back (
object);
585 m_contexts.push_back (path);
587 std::vector<Ptr<Object> > m_objects;
588 std::vector<std::string> m_contexts;
589 } resolver = LookupMatchesResolver (path);
590 for (Roots::const_iterator i =
m_roots.begin (); i !=
m_roots.end (); i++)
592 resolver.Resolve (*i);
600 resolver.Resolve (0);
658 (*i)->ResetInitialValue ();
678 std::string::size_type pos = fullName.rfind (
"::");
679 if (pos == std::string::npos)
683 std::string tidName = fullName.substr (0, pos);
684 std::string paramName = fullName.substr (pos+2, fullName.size () - (pos+2));
694 if (tmp.
name == paramName)
uint32_t GetAttributeN(void) const
uint32_t GetRootNamespaceObjectN(void) const
#define NS_LOG_FUNCTION(parameters)
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...
NS_LOG_COMPONENT_DEFINE("Config")
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)
Vector::const_iterator Iterator
Base class for Callback class.
std::string GetMatchedPath(uint32_t i) const
void Disconnect(std::string name, const CallbackBase &cb)
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)
std::vector< std::string > m_workStack
#define NS_FATAL_ERROR(msg)
fatal error handling
std::map< uint32_t, Ptr< Object > >::const_iterator Iterator
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)
static uint32_t GetRegisteredN(void)
static Iterator Begin(void)
void Resolve(Ptr< Object > root)
T * PeekPointer(const Ptr< T > &p)
bool TraceDisconnectWithoutContext(std::string name, const CallbackBase &cb)
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)
void SetDefault(std::string name, const AttributeValue &value)
Ptr< Object > Get(uint32_t i) const
Iterator Begin(void) const
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)
void DisconnectWithoutContext(std::string name, const CallbackBase &cb)
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)
#define NS_LOG_DEBUG(msg)
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)
void Set(std::string name, const AttributeValue &value)
a base class which provides memory management and object aggregation
MatchContainer::Iterator Begin(void) const
contain 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)
Ptr< T > GetObject(void) const
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)