00001 #ifndef CONFIG_STORE_H 00002 #define CONFIG_STORE_H 00003 00004 #include "ns3/object-base.h" 00005 00006 namespace ns3 { 00007 00008 /** 00009 * \brief Store and load simulation attribute configuration 00010 * 00011 * While it is possible to generate a sample config file and lightly 00012 * edit it to change a couple of values, there are cases where this 00013 * process will not work because the same value on the same object 00014 * can appear multiple times in the same automatically-generated 00015 * configuration file under different configuration paths. 00016 * 00017 * As such, the best way to use this class is to use it to generate 00018 * an initial configuration file, extract from that configuration 00019 * file only the strictly necessary elements, and move these minimal 00020 * elements to a new configuration file which can then safely 00021 * be edited. Another option is to use the ns3::GtkConfigStore class 00022 * which will allow you to edit the parameters and will generate 00023 * configuration files where all the instances of the same parameter 00024 * are changed. 00025 */ 00026 class ConfigStore : public ObjectBase 00027 { 00028 public: 00029 static TypeId GetTypeId (void); 00030 virtual TypeId GetInstanceTypeId (void) const; 00031 00032 ConfigStore (); 00033 00034 /** 00035 * Depending on which attribute was set: 00036 * - Store simulation configuration in file and exit 00037 * - Load simulation configuration from file and proceed. 00038 */ 00039 void Configure (void); 00040 00041 private: 00042 void LoadFrom (std::string filename); 00043 void StoreTo (std::string filename); 00044 00045 std::string m_loadFilename; 00046 std::string m_storeFilename; 00047 }; 00048 00049 } // namespace ns3 00050 00051 #endif /* CONFIG_STORE_H */