Config system implementation class. More...
Public Member Functions | |
bool | ConnectFailSafe (std::string path, const CallbackBase &cb) |
bool | ConnectWithoutContextFailSafe (std::string path, const CallbackBase &cb) |
void | Disconnect (std::string path, const CallbackBase &cb) |
void | DisconnectWithoutContext (std::string path, const CallbackBase &cb) |
Ptr< Object > | GetRootNamespaceObject (std::size_t i) const |
std::size_t | GetRootNamespaceObjectN () const |
MatchContainer | LookupMatches (std::string path) |
void | RegisterRootNamespaceObject (Ptr< Object > obj) |
void | Set (std::string path, const AttributeValue &value) |
bool | SetFailSafe (std::string path, const AttributeValue &value) |
void | UnregisterRootNamespaceObject (Ptr< Object > obj) |
Public Member Functions inherited from ns3::Singleton< ConfigImpl > | |
Singleton (const Singleton< ConfigImpl > &)=delete | |
Singleton< ConfigImpl > & | operator= (const Singleton< ConfigImpl > &)=delete |
Private Types | |
typedef std::vector< Ptr< Object > > | Roots |
Container type to hold the root Config path tokens. | |
Private Member Functions | |
void | ParsePath (std::string path, std::string *root, std::string *leaf) const |
Break a Config path into the leading path and the last leaf token. | |
Private Attributes | |
Roots | m_roots |
The list of Config path roots. | |
Additional Inherited Members | |
Static Public Member Functions inherited from ns3::Singleton< ConfigImpl > | |
static ConfigImpl * | Get () |
Get a pointer to the singleton instance. | |
Protected Member Functions inherited from ns3::Singleton< ConfigImpl > | |
Singleton () | |
Constructor. | |
virtual | ~Singleton () |
Destructor. | |
|
private |
bool ns3::Config::ConfigImpl::ConnectFailSafe | ( | std::string | path, |
const CallbackBase & | cb | ||
) |
[in] | path | A path to match trace sources. |
[in] | cb | The callback to connect to the matching trace sources. |
This function will attempt to find all trace sources which match the input path and will then connect the input callback to them in such a way that the callback will receive an extra context string upon trace event notification.
true
if any trace sources could be connected. Definition at line 751 of file config.cc.
References LookupMatches(), NS_LOG_FUNCTION, and ParsePath().
Referenced by ns3::Config::ConnectFailSafe().
bool ns3::Config::ConfigImpl::ConnectWithoutContextFailSafe | ( | std::string | path, |
const CallbackBase & | cb | ||
) |
[in] | path | A path to match trace sources. |
[in] | cb | The callback to connect to the matching trace sources. |
This function will attempt to find all trace sources which match the input path and will then connect the input callback to them. If no matching trace sources are found, this method will return false; otherwise true.
true
if any trace sources could be connected. Definition at line 722 of file config.cc.
References LookupMatches(), NS_LOG_FUNCTION, and ParsePath().
Referenced by ns3::Config::ConnectWithoutContextFailSafe().
void ns3::Config::ConfigImpl::Disconnect | ( | std::string | path, |
const CallbackBase & | cb | ||
) |
[in] | path | A path to match trace sources. |
[in] | cb | The callback to connect to the matching trace sources. |
This function undoes the work of Config::ConnectWithContext.
Definition at line 763 of file config.cc.
References LookupMatches(), NS_LOG_FUNCTION, NS_LOG_WARN, and ParsePath().
Referenced by ns3::Config::Disconnect().
void ns3::Config::ConfigImpl::DisconnectWithoutContext | ( | std::string | path, |
const CallbackBase & | cb | ||
) |
[in] | path | A path to match trace sources. |
[in] | cb | The callback to disconnect to the matching trace sources. |
This function undoes the work of Config::Connect.
Definition at line 733 of file config.cc.
References LookupMatches(), NS_LOG_FUNCTION, NS_LOG_WARN, and ParsePath().
Referenced by ns3::Config::DisconnectWithoutContext().
[in] | i | The index of the requested object. |
Definition at line 849 of file config.cc.
References m_roots, and NS_LOG_FUNCTION.
Referenced by ns3::Config::GetRootNamespaceObject().
std::size_t ns3::Config::ConfigImpl::GetRootNamespaceObjectN | ( | ) | const |
Definition at line 842 of file config.cc.
References m_roots, and NS_LOG_FUNCTION.
Referenced by ns3::Config::GetRootNamespaceObjectN().
MatchContainer ns3::Config::ConfigImpl::LookupMatches | ( | std::string | path | ) |
[in] | path | The path to perform a match against |
Definition at line 782 of file config.cc.
References m_roots, and NS_LOG_FUNCTION.
Referenced by ConnectFailSafe(), ConnectWithoutContextFailSafe(), Disconnect(), DisconnectWithoutContext(), ns3::Config::LookupMatches(), Set(), and SetFailSafe().
|
private |
Break a Config path into the leading path and the last leaf token.
[in] | path | The Config path. |
[in,out] | root | The leading part of the path, up to the final slash. |
[in,out] | leaf | The trailing part of the path. |
Definition at line 686 of file config.cc.
References NS_ASSERT, and NS_LOG_FUNCTION.
Referenced by ConnectFailSafe(), ConnectWithoutContextFailSafe(), Disconnect(), DisconnectWithoutContext(), Set(), and SetFailSafe().
[in] | obj | A new root object |
Each root object is used during path matching as the root of the path by Config::Connect, and Config::Set.
Definition at line 820 of file config.cc.
References m_roots, and NS_LOG_FUNCTION.
Referenced by ns3::Config::RegisterRootNamespaceObject().
void ns3::Config::ConfigImpl::Set | ( | std::string | path, |
const AttributeValue & | value | ||
) |
[in] | path | A path to match attributes. |
[in] | value | The value to set in all matching attributes. |
This function will attempt to find attributes which match the input path and will then set their value to the input value. If no such attributes are found, the function will throw a fatal error; use SetFailSafe if the lack of a match is to be permitted.
Definition at line 698 of file config.cc.
References LookupMatches(), NS_LOG_FUNCTION, and ParsePath().
Referenced by ns3::Config::Set().
bool ns3::Config::ConfigImpl::SetFailSafe | ( | std::string | path, |
const AttributeValue & | value | ||
) |
[in] | path | A path to match attributes. |
[in] | value | The value to set in all matching attributes. |
This function will attempt to find attributes which match the input path and will then set their value to the input value, and will return true if at least one such attribute is found.
true
if any matching attributes could be set. Definition at line 710 of file config.cc.
References LookupMatches(), NS_LOG_FUNCTION, and ParsePath().
Referenced by ns3::Config::SetFailSafe().
[in] | obj | A new root object |
This function undoes the work of Config::RegisterRootNamespaceObject.
Definition at line 827 of file config.cc.
References m_roots, and NS_LOG_FUNCTION.
Referenced by ns3::Config::UnregisterRootNamespaceObject().
|
private |
The list of Config path roots.
Definition at line 681 of file config.cc.
Referenced by GetRootNamespaceObject(), GetRootNamespaceObjectN(), LookupMatches(), RegisterRootNamespaceObject(), and UnregisterRootNamespaceObject().