24 #include "ns3/global-value.h"    25 #include "ns3/string.h"    27 #include "ns3/config.h"    52   m_os = 
new std::ofstream ();
    53   m_os->open (filename.c_str (), std::ios::out);
    62     RawTextDefaultIterator (std::ostream *os) {
    66     virtual void StartVisitTypeId (std::string name) {
    69     virtual void DoVisitAttribute (std::string name, std::string defaultValue) {
    71       *
m_os << 
"default " << m_typeId << 
"::" << name << 
" \"" << defaultValue << 
"\"" << std::endl;
    77   RawTextDefaultIterator iterator = RawTextDefaultIterator (
m_os);
    87       (*i)->GetValue (value);
    89       *
m_os << 
"global " << (*i)->GetName () << 
" \"" << value.
Get () << 
"\"" << std::endl;
    99     RawTextAttributeIterator (std::ostream *os)
   102     virtual void DoVisitAttribute (
Ptr<Object> object, std::string name) {
   104       object->GetAttribute (name, str);
   106       *
m_os << 
"value " << GetCurrentPath () << 
" \"" << str.
Get () << 
"\"" << std::endl;
   111   RawTextAttributeIterator iter = RawTextAttributeIterator (
m_os);
   134   m_is = 
new std::ifstream ();
   135   m_is->open (filename.c_str (), std::ios::in);
   140   std::string::size_type 
start = value.find (
"\"");
   141   std::string::size_type end = value.find (
"\"", 1);
   153   std::string type, name, value;
   154   *
m_is >> type >> name >> value;
   155   while (
m_is->good ())
   157       NS_LOG_DEBUG (
"type=" << type << 
", name=" << name << 
", value=" << value);
   158       value = 
Strip (value);
   159       if (type == 
"default")
   163       *
m_is >> type >> name >> value;
   172   std::string type, name, value;
   173   *
m_is >> type >> name >> value;
   174   while (
m_is->good ())
   176       NS_LOG_DEBUG (
"type=" << type << 
", name=" << name << 
", value=" << value);
   177       value = 
Strip (value);
   178       if (type == 
"global")
   182       *
m_is >> type >> name >> value;
   191   std::string type, path, value;
   192   *
m_is >> type >> path >> value;
   193   while (
m_is->good ())
   195       NS_LOG_DEBUG (
"type=" << type << 
", path=" << path << 
", value=" << value);
   196       value = 
Strip (value);
   201       *
m_is >> type >> path >> value;
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
virtual void Attributes(void)
Load or save the attributes values. 
Hold variables of type string. 
void Set(std::string path, const AttributeValue &value)
virtual void SetFilename(std::string filename)
Set the file name. 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
Vector::const_iterator Iterator
Iterator type for the list of all global values. 
virtual void SetFilename(std::string filename)
Set the file name. 
std::string Get(void) const
  
virtual ~RawTextConfigLoad()
virtual ~RawTextConfigSave()
static Iterator Begin(void)
The Begin iterator. 
virtual void Global(void)
Load or save the global values. 
std::string Strip(std::string value)
Strip out attribute value. 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
virtual void Attributes(void)
Load or save the attributes values. 
virtual void Default(void)
Load or save the default values. 
NS_LOG_LOGIC("Net device "<< nd<< " is not bridged")
void SetGlobal(std::string name, const AttributeValue &value)
static Iterator End(void)
The End iterator. 
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG. 
void SetDefault(std::string name, const AttributeValue &value)
Iterator to iterate on the values of attributes of an ns3::Object. 
Iterator to iterate on the default values of attributes of an ns3::Object. 
std::ofstream * m_os
Config store output stream. 
std::ifstream * m_is
Config store input stream. 
virtual void Global(void)
Load or save the global values. 
virtual void Default(void)
Load or save the default values.