Store and load simulation attribute configuration. More...
#include <config-store.h>
Public Member Functions | |
virtual TypeId | GetInstanceTypeId (void) const |
ConfigStore () | |
void | Configure (void) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::ConfigStore. | |
Private Member Functions | |
void | LoadFrom (std::string filename) |
void | StoreTo (std::string filename) |
Private Attributes | |
std::string | m_loadFilename |
std::string | m_storeFilename |
Store and load simulation attribute configuration.
While it is possible to generate a sample config file and lightly edit it to change a couple of values, there are cases where this process will not work because the same value on the same object can appear multiple times in the same automatically-generated configuration file under different configuration paths.
As such, the best way to use this class is to use it to generate an initial configuration file, extract from that configuration file only the strictly necessary elements, and move these minimal elements to a new configuration file which can then safely be edited. Another option is to use the ns3::GtkConfigStore class which will allow you to edit the parameters and will generate configuration files where all the instances of the same parameter are changed.
Definition at line 26 of file config-store.h.
ns3::ConfigStore::ConfigStore | ( | ) |
Definition at line 44 of file config-store.cc.
References ns3::ObjectBase::ConstructSelf().
void ns3::ConfigStore::Configure | ( | void | ) |
Depending on which attribute was set:
Definition at line 75 of file config-store.cc.
References LoadFrom(), m_loadFilename, m_storeFilename, and StoreTo().
TypeId ns3::ConfigStore::GetInstanceTypeId | ( | void | ) | const [virtual] |
This method is typically implemented by ns3::Object::GetInstanceTypeId but some classes which derive from ns3::ObjectBase directly have to implement it themselves.
Implements ns3::ObjectBase.
Definition at line 38 of file config-store.cc.
References GetTypeId().
TypeId ns3::ConfigStore::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::ConfigStore.
Attributes defined for this type:
No TraceSources defined for this type.
Reimplemented from ns3::ObjectBase.
Definition at line 20 of file config-store.cc.
References m_loadFilename, m_storeFilename, and ns3::TypeId::SetParent().
Referenced by GetInstanceTypeId().
void ns3::ConfigStore::LoadFrom | ( | std::string | filename | ) | [private] |
Definition at line 50 of file config-store.cc.
References NS_LOG_DEBUG, and ns3::Config::Set().
Referenced by Configure().
void ns3::ConfigStore::StoreTo | ( | std::string | filename | ) | [private] |
Definition at line 63 of file config-store.cc.
References ns3::TextFileAttributeIterator::Save().
Referenced by Configure().
std::string ns3::ConfigStore::m_loadFilename [private] |
Definition at line 45 of file config-store.h.
Referenced by Configure(), and GetTypeId().
std::string ns3::ConfigStore::m_storeFilename [private] |
Definition at line 46 of file config-store.h.
Referenced by Configure(), and GetTypeId().