A Discrete-Event Network Simulator
API
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ns3::NamesPriv Class Reference

The singleton root Names object. More...

+ Inheritance diagram for ns3::NamesPriv:

Public Member Functions

 NamesPriv ()
 Constructor. More...
 
 ~NamesPriv ()
 Destructor. More...
 
bool Add (std::string name, Ptr< Object > object)
 Internal implementation for Names::Add(std::string,Ptr<Object>) More...
 
bool Add (std::string path, std::string name, Ptr< Object > object)
 Internal implementation for Names::Add(std::string,std::string,Ptr<Object>) More...
 
bool Add (Ptr< Object > context, std::string name, Ptr< Object > object)
 Internal implementation for Names::Add(Ptr<Object>,std::string,Ptr<Object>) More...
 
void Clear (void)
 Internal implementation for Names::Clear() More...
 
Ptr< ObjectFind (std::string path)
 Internal implementation for ns3::Names::Find(std::string) More...
 
Ptr< ObjectFind (std::string path, std::string name)
 Internal implementation for ns3::Names::Find(std::string,std::string) More...
 
Ptr< ObjectFind (Ptr< Object > context, std::string name)
 Internal implementation for ns3::Names::Find(Ptr<Object>,std::string) More...
 
std::string FindName (Ptr< Object > object)
 Internal implementation for Names::FindName() More...
 
std::string FindPath (Ptr< Object > object)
 Internal implementation of Names::FindPath() More...
 
bool Rename (std::string oldpath, std::string newname)
 Internal implementation for Names::Rename(std::string,std::string) More...
 
bool Rename (std::string path, std::string oldname, std::string newname)
 Internal implementation for Names::Rename(std::string,std::string,std::string) More...
 
bool Rename (Ptr< Object > context, std::string oldname, std::string newname)
 Internal implementation for Names::Rename(Ptr<Object>,std::string,std::string) More...
 

Private Member Functions

bool IsDuplicateName (NameNode *node, std::string name)
 Check if a name already exists as a child of a NameNode. More...
 
NameNodeIsNamed (Ptr< Object > object)
 Check if an object has a name. More...
 

Private Attributes

std::map< Ptr< Object >, NameNode * > m_objectMap
 Map from object pointers to their NameNodes. More...
 
NameNode m_root
 The root NameNode. More...
 

Friends

class Names
 

Additional Inherited Members

- Static Public Member Functions inherited from ns3::Singleton< NamesPriv >
static NamesPrivGet (void)
 Get a pointer to the singleton instance. More...
 

Detailed Description

The singleton root Names object.

Definition at line 120 of file names.cc.

Constructor & Destructor Documentation

◆ NamesPriv()

ns3::NamesPriv::NamesPriv ( )

Constructor.

Definition at line 278 of file names.cc.

References ns3::NameNode::m_name, ns3::NameNode::m_object, ns3::NameNode::m_parent, m_root, and NS_LOG_FUNCTION.

◆ ~NamesPriv()

ns3::NamesPriv::~NamesPriv ( )

Destructor.

Definition at line 287 of file names.cc.

References Clear(), ns3::NameNode::m_name, m_root, and NS_LOG_FUNCTION.

Member Function Documentation

◆ Add() [1/3]

bool ns3::NamesPriv::Add ( std::string  name,
Ptr< Object object 
)

Internal implementation for Names::Add(std::string,Ptr<Object>)

Parameters
[in]nameThe name of the object you want to associate; which may be prepended with a path to that object.
[in]objectA smart pointer to the object itself.
Returns
true if the object was named successfully.

Definition at line 317 of file names.cc.

References NS_ASSERT_MSG(), and NS_LOG_FUNCTION.

Referenced by ns3::Names::Add(), and Add().

◆ Add() [2/3]

bool ns3::NamesPriv::Add ( std::string  path,
std::string  name,
Ptr< Object object 
)

Internal implementation for Names::Add(std::string,std::string,Ptr<Object>)

Parameters
[in]pathA path name describing a previously named object under which you want this new name to be defined.
[in]nameThe name of the object you want to associate.
[in]objectA smart pointer to the object itself.
Returns
true if the object was named successfully.

Definition at line 379 of file names.cc.

References Add(), Find(), and NS_LOG_FUNCTION.

◆ Add() [3/3]

bool ns3::NamesPriv::Add ( Ptr< Object context,
std::string  name,
Ptr< Object object 
)

Internal implementation for Names::Add(Ptr<Object>,std::string,Ptr<Object>)

Parameters
[in]contextA smart pointer to an object that is used in place of the path under which you want this new name to be defined.
[in]nameThe name of the object you want to associate.
[in]objectA smart pointer to the object itself.
Returns
true if the object was named successfully.

Definition at line 390 of file names.cc.

References IsDuplicateName(), IsNamed(), ns3::NameNode::m_nameMap, m_objectMap, m_root, NS_ASSERT_MSG(), NS_LOG_FUNCTION, and NS_LOG_LOGIC().

◆ Clear()

void ns3::NamesPriv::Clear ( void  )

◆ Find() [1/3]

Ptr< Object > ns3::NamesPriv::Find ( std::string  path)

Internal implementation for ns3::Names::Find(std::string)

Parameters
[in]pathA string containing a name space path used to locate the object.
Returns
A smart pointer to the named object converted to the requested type.

Definition at line 593 of file names.cc.

References ns3::NameNode::m_nameMap, m_root, NS_ASSERT_MSG(), NS_LOG_FUNCTION, and NS_LOG_LOGIC().

Referenced by Add(), Find(), ns3::Names::FindInternal(), and Rename().

◆ Find() [2/3]

Ptr< Object > ns3::NamesPriv::Find ( std::string  path,
std::string  name 
)

Internal implementation for ns3::Names::Find(std::string,std::string)

Parameters
[in]pathA path name describing a previously named object under which you want to look for the specified name.
[in]nameA string containing a name to search for.
Returns
A smart pointer to the named object converted to the requested type.

Definition at line 687 of file names.cc.

References Find(), and NS_LOG_FUNCTION.

◆ Find() [3/3]

Ptr< Object > ns3::NamesPriv::Find ( Ptr< Object context,
std::string  name 
)

Internal implementation for ns3::Names::Find(Ptr<Object>,std::string)

Parameters
[in]contextA smart pointer to an object that is used in place of the path under which you want this new name to be defined.
[in]nameA string containing a name to search for.
Returns
A smart pointer to the named object converted to the requested type.

Definition at line 699 of file names.cc.

References IsNamed(), ns3::NameNode::m_nameMap, m_root, NS_LOG_FUNCTION, and NS_LOG_LOGIC().

◆ FindName()

std::string ns3::NamesPriv::FindName ( Ptr< Object object)

Internal implementation for Names::FindName()

Parameters
[in]objectA smart pointer to an object for which you want to find its name.
Returns
A string containing the name of the object if found, otherwise the empty string.

Definition at line 547 of file names.cc.

References m_objectMap, NS_LOG_FUNCTION, and NS_LOG_LOGIC().

Referenced by ns3::Names::FindName().

◆ FindPath()

std::string ns3::NamesPriv::FindPath ( Ptr< Object object)

Internal implementation of Names::FindPath()

Parameters
[in]objectA smart pointer to an object for which you want to find its fullname.
Returns
A string containing the name path of the object, otherwise the empty string.

Definition at line 565 of file names.cc.

References ns3::NameNode::m_name, m_objectMap, ns3::NameNode::m_parent, NS_ASSERT_MSG(), NS_LOG_FUNCTION, and NS_LOG_LOGIC().

Referenced by ns3::Names::FindPath().

◆ IsDuplicateName()

bool ns3::NamesPriv::IsDuplicateName ( NameNode node,
std::string  name 
)
private

Check if a name already exists as a child of a NameNode.

Parameters
[in]nodeThe node to search.
[in]nameThe name to search for.
Returns
true if name already exists as a child of node.

Definition at line 752 of file names.cc.

References ns3::NameNode::m_nameMap, NS_LOG_FUNCTION, and NS_LOG_LOGIC().

Referenced by Add(), and Rename().

◆ IsNamed()

NameNode * ns3::NamesPriv::IsNamed ( Ptr< Object object)
private

Check if an object has a name.

Parameters
[in]objectThe object to check.
Returns
The corresponding NameNode, if it exists.

Definition at line 734 of file names.cc.

References m_objectMap, NS_LOG_FUNCTION, and NS_LOG_LOGIC().

Referenced by Add(), Find(), and Rename().

◆ Rename() [1/3]

bool ns3::NamesPriv::Rename ( std::string  oldpath,
std::string  newname 
)

Internal implementation for Names::Rename(std::string,std::string)

Parameters
[in]oldpathThe current path name to the object you want to change.
[in]newnameThe new name of the object you want to change.
Returns
true if the object was renamed successfully.

Definition at line 425 of file names.cc.

References NS_ASSERT_MSG(), and NS_LOG_FUNCTION.

Referenced by Rename().

◆ Rename() [2/3]

bool ns3::NamesPriv::Rename ( std::string  path,
std::string  oldname,
std::string  newname 
)

Internal implementation for Names::Rename(std::string,std::string,std::string)

Parameters
[in]pathA path name describing a previously named object under which you want this name change to occur (cf. directory).
[in]oldnameThe currently defined name of the object.
[in]newnameThe new name you want the object to have.
Returns
true if the object was renamed successfully.

Definition at line 489 of file names.cc.

References Find(), NS_LOG_FUNCTION, and Rename().

◆ Rename() [3/3]

bool ns3::NamesPriv::Rename ( Ptr< Object context,
std::string  oldname,
std::string  newname 
)

Internal implementation for Names::Rename(Ptr<Object>,std::string,std::string)

Parameters
[in]contextA smart pointer to an object that is used in place of the path under which you want this new name to be defined.
[in]oldnameThe current shortname of the object you want to change.
[in]newnameThe new shortname of the object you want to change.
Returns
true if the object was renamed successfully.

Definition at line 500 of file names.cc.

References IsDuplicateName(), IsNamed(), ns3::NameNode::m_name, ns3::NameNode::m_nameMap, m_root, NS_ASSERT_MSG(), NS_LOG_FUNCTION, and NS_LOG_LOGIC().

Friends And Related Function Documentation

◆ Names

friend class Names
friend

Definition at line 253 of file names.cc.

Member Data Documentation

◆ m_objectMap

std::map<Ptr<Object>, NameNode *> ns3::NamesPriv::m_objectMap
private

Map from object pointers to their NameNodes.

Definition at line 275 of file names.cc.

Referenced by Add(), Clear(), FindName(), FindPath(), and IsNamed().

◆ m_root

NameNode ns3::NamesPriv::m_root
private

The root NameNode.

Definition at line 272 of file names.cc.

Referenced by Add(), Clear(), Find(), NamesPriv(), Rename(), and ~NamesPriv().


The documentation for this class was generated from the following file: