HOWTO use the ConfigStore: Difference between revisions
Jump to navigation
Jump to search
Nicolabaldo (talk | contribs) (New page: ==File-based ConfigStore== You need your simulation program to be written like this: <pre> int main (...) { CommandLine cmd; cmd.Parse (...); ConfigStore config; config.ConfigureE...) |
m (add command line to read in a config file) |
||
(One intermediate revision by one other user not shown) | |||
Line 8: | Line 8: | ||
ConfigStore config; | ConfigStore config; | ||
config. | config.ConfigureDefaults (); | ||
... topology creation | ... topology creation | ||
config. | config.ConfigureAttributes (); | ||
Simulator::Run (); | Simulator::Run (); | ||
Line 21: | Line 21: | ||
<pre> | <pre> | ||
./waf --run "scratch/myprogram --ns3::ConfigStore::Mode=Save --ns3::ConfigStore::Filename=config.txt" | ./waf --run "scratch/myprogram --ns3::ConfigStore::Mode=Save --ns3::ConfigStore::Filename=config.txt" | ||
</pre> | |||
and to read in a configuration | |||
<pre> | |||
./waf --run "scratch/myprogram --ns3::ConfigStore::Mode=Load --ns3::ConfigStore::FileFormat==RawText --ns3::ConfigStore::Filename=config.txt" | |||
</pre> | </pre> | ||
Latest revision as of 20:34, 21 September 2016
File-based ConfigStore
You need your simulation program to be written like this:
int main (...) { CommandLine cmd; cmd.Parse (...); ConfigStore config; config.ConfigureDefaults (); ... topology creation config.ConfigureAttributes (); Simulator::Run (); }
then run your simulation program with the following parameters to save a plain text file (in this example, config.txt):
./waf --run "scratch/myprogram --ns3::ConfigStore::Mode=Save --ns3::ConfigStore::Filename=config.txt"
and to read in a configuration
./waf --run "scratch/myprogram --ns3::ConfigStore::Mode=Load --ns3::ConfigStore::FileFormat==RawText --ns3::ConfigStore::Filename=config.txt"
GtkConfigStore
You need your simulation program to be written like this:
int main (...) { ... topology creation GtkConfigStore configstore; configstore.ConfigureAttributes(); Simulator::Run (); }
Then before the simulation runs a window will pop up allowing you to browse Object attributes and to save/load the configuration.