A Discrete-Event Network Simulator
API
raw-text-config.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 INRIA
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Mathieu Lacage <mathieu.lacage@cutebugs.net>
19  */
20 
21 #ifndef RAW_TEXT_CONFIG_H
22 #define RAW_TEXT_CONFIG_H
23 
24 #include <string>
25 #include <fstream>
26 #include "file-config.h"
27 
28 namespace ns3 {
29 
36 {
37 public:
39  virtual ~RawTextConfigSave ();
40  // Inherited
41  virtual void SetFilename (std::string filename);
42  virtual void Default (void);
43  virtual void Global (void);
44  virtual void Attributes (void);
45 private:
47  std::ofstream *m_os;
48 };
49 
56 {
57 public:
59  virtual ~RawTextConfigLoad ();
60  // Inherited
61  virtual void SetFilename (std::string filename);
62  virtual void Default (void);
63  virtual void Global (void);
64  virtual void Attributes (void);
65 private:
78  virtual bool ParseLine (const std::string &line, std::string &type, std::string &name, std::string &value);
79 
85  std::string Strip (std::string value);
87  std::ifstream *m_is;
88 };
89 
90 } // namespace ns3
91 
92 #endif /* RAW_TEXT_CONFIG_H */
ns3::RawTextConfigLoad::RawTextConfigLoad
RawTextConfigLoad()
default constructor
Definition: raw-text-config.cc:185
file-config.h
ns3::RawTextConfigLoad::Global
virtual void Global(void)
Load or save the global values.
Definition: raw-text-config.cc:244
ns3::RawTextConfigSave::Global
virtual void Global(void)
Load or save the global values.
Definition: raw-text-config.cc:118
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::RawTextConfigSave::Attributes
virtual void Attributes(void)
Load or save the attributes values.
Definition: raw-text-config.cc:130
ns3::RawTextConfigSave::m_os
std::ofstream * m_os
Config store output stream.
Definition: raw-text-config.h:47
ns3::RawTextConfigSave
A class to enable saving of configuration store in a raw text file.
Definition: raw-text-config.h:36
ns3::RawTextConfigSave::SetFilename
virtual void SetFilename(std::string filename)
Set the file name.
Definition: raw-text-config.cc:54
ns3::RawTextConfigLoad::SetFilename
virtual void SetFilename(std::string filename)
Set the file name.
Definition: raw-text-config.cc:201
ns3::RawTextConfigLoad
A class to enable loading of configuration store from a raw text file.
Definition: raw-text-config.h:56
ns3::RawTextConfigLoad::Attributes
virtual void Attributes(void)
Load or save the attributes values.
Definition: raw-text-config.cc:269
ns3::RawTextConfigSave::~RawTextConfigSave
virtual ~RawTextConfigSave()
destructor
Definition: raw-text-config.cc:43
ns3::RawTextConfigLoad::m_is
std::ifstream * m_is
Config store input stream.
Definition: raw-text-config.h:87
ns3::RawTextConfigLoad::~RawTextConfigLoad
virtual ~RawTextConfigLoad()
destructor
Definition: raw-text-config.cc:190
ns3::RawTextConfigLoad::Default
virtual void Default(void)
Load or save the default values.
Definition: raw-text-config.cc:219
ns3::FileConfig
base class for ConfigStore classes using files
Definition: file-config.h:34
ns3::RawTextConfigSave::RawTextConfigSave
RawTextConfigSave()
default constructor
Definition: raw-text-config.cc:38
ns3::RawTextConfigSave::Default
virtual void Default(void)
Load or save the default values.
Definition: raw-text-config.cc:61
ns3::RawTextConfigLoad::Strip
std::string Strip(std::string value)
Strip out attribute value.
Definition: raw-text-config.cc:208
ns3::RawTextConfigLoad::ParseLine
virtual bool ParseLine(const std::string &line, std::string &type, std::string &name, std::string &value)
Parse (potentially multi-) line configs into type, name, and values.
Definition: raw-text-config.cc:295