|
|
| 776 |
return Singleton<ConfigImpl>::Get ()->GetRootNamespaceObject (i); |
776 |
return Singleton<ConfigImpl>::Get ()->GetRootNamespaceObject (i); |
| 777 |
} |
777 |
} |
| 778 |
|
778 |
|
|
|
779 |
std::string GetDefault (const std::string attributePath) |
| 780 |
{ |
| 781 |
NS_LOG_FUNCTION (attributePath); |
| 782 |
// Attribute name is last token |
| 783 |
size_t colon = attributePath.rfind ("::"); |
| 784 |
const std::string typeName = attributePath.substr (0, colon); |
| 785 |
NS_LOG_DEBUG ("typeName: '" << typeName << "', colon: " << colon); |
| 786 |
|
| 787 |
TypeId tid; |
| 788 |
if (!TypeId::LookupByNameFailSafe (typeName, &tid)) |
| 789 |
{ |
| 790 |
NS_FATAL_ERROR ("Unknown type=" << typeName); |
| 791 |
} |
| 792 |
|
| 793 |
const std::string attrName = attributePath.substr (colon + 2); |
| 794 |
struct TypeId::AttributeInformation info; |
| 795 |
if (!tid.LookupAttributeByName (attrName, &info)) |
| 796 |
{ |
| 797 |
NS_FATAL_ERROR ("Attribute not found: " << attributePath); |
| 798 |
} |
| 799 |
|
| 800 |
std::string defValue = info.initialValue->SerializeToString (info.checker); |
| 801 |
|
| 802 |
return defValue; |
| 803 |
} |
| 804 |
|
| 779 |
} // namespace Config |
805 |
} // namespace Config |
| 780 |
|
806 |
|
| 781 |
} // namespace ns3 |
807 |
} // namespace ns3 |