A Discrete-Event Network Simulator
API
ns3::RawTextConfigLoad Class Reference

A class to enable loading of configuration store from a raw text file. More...

#include "raw-text-config.h"

+ Inheritance diagram for ns3::RawTextConfigLoad:
+ Collaboration diagram for ns3::RawTextConfigLoad:

Public Member Functions

 RawTextConfigLoad ()
 default constructor More...
 
virtual ~RawTextConfigLoad ()
 destructor More...
 
virtual void Attributes (void)
 Load or save the attributes values. More...
 
virtual void Default (void)
 Load or save the default values. More...
 
virtual void Global (void)
 Load or save the global values. More...
 
virtual void SetFilename (std::string filename)
 Set the file name. More...
 
- Public Member Functions inherited from ns3::FileConfig
virtual ~FileConfig ()
 
void SetSaveDeprecated (bool saveDeprecated)
 Set if to save deprecated attributes. More...
 

Private Member Functions

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. More...
 
std::string Strip (std::string value)
 Strip out attribute value. More...
 

Private Attributes

std::ifstream * m_is
 Config store input stream. More...
 

Additional Inherited Members

- Protected Attributes inherited from ns3::FileConfig
bool m_saveDeprecated
 save deprecated attributes More...
 

Detailed Description

A class to enable loading of configuration store from a raw text file.

Definition at line 55 of file raw-text-config.h.

Constructor & Destructor Documentation

◆ RawTextConfigLoad()

ns3::RawTextConfigLoad::RawTextConfigLoad ( )

default constructor

Definition at line 185 of file raw-text-config.cc.

References NS_LOG_FUNCTION.

◆ ~RawTextConfigLoad()

ns3::RawTextConfigLoad::~RawTextConfigLoad ( )
virtual

destructor

Definition at line 190 of file raw-text-config.cc.

References m_is, and NS_LOG_FUNCTION.

Member Function Documentation

◆ Attributes()

void ns3::RawTextConfigLoad::Attributes ( void  )
virtual

Load or save the attributes values.

Implements ns3::FileConfig.

Definition at line 269 of file raw-text-config.cc.

References m_is, NS_LOG_DEBUG, NS_LOG_FUNCTION, ParseLine(), ns3::Config::Set(), and Strip().

Referenced by ns3::load_clicked_attribute().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Default()

void ns3::RawTextConfigLoad::Default ( void  )
virtual

Load or save the default values.

Implements ns3::FileConfig.

Definition at line 219 of file raw-text-config.cc.

References m_is, NS_LOG_DEBUG, NS_LOG_FUNCTION, ParseLine(), ns3::Config::SetDefault(), and Strip().

Referenced by ns3::load_clicked_default().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Global()

void ns3::RawTextConfigLoad::Global ( void  )
virtual

Load or save the global values.

Implements ns3::FileConfig.

Definition at line 244 of file raw-text-config.cc.

References m_is, NS_LOG_DEBUG, NS_LOG_FUNCTION, ParseLine(), ns3::Config::SetGlobal(), and Strip().

+ Here is the call graph for this function:

◆ ParseLine()

bool ns3::RawTextConfigLoad::ParseLine ( const std::string &  line,
std::string &  type,
std::string &  name,
std::string &  value 
)
privatevirtual

Parse (potentially multi-) line configs into type, name, and values.

This will return false for blank lines, comments (lines beginning with '#'), and incomplete entries. An entry is considered complete when a type and name have been found and the value contains two delimiting quotation marks '"'.

Parameters
linethe config file line
typethe config type {default, global, value}
namethe config attribute name
valuethe value to set
Returns
true if all of type, name, and value parsed; false otherwise

Definition at line 295 of file raw-text-config.cc.

References NS_LOG_FUNCTION.

Referenced by Attributes(), Default(), and Global().

+ Here is the caller graph for this function:

◆ SetFilename()

void ns3::RawTextConfigLoad::SetFilename ( std::string  filename)
virtual

Set the file name.

Parameters
filenamethe filename

Implements ns3::FileConfig.

Definition at line 201 of file raw-text-config.cc.

References m_is, and NS_LOG_FUNCTION.

Referenced by ns3::load_clicked_attribute(), and ns3::load_clicked_default().

+ Here is the caller graph for this function:

◆ Strip()

std::string ns3::RawTextConfigLoad::Strip ( std::string  value)
private

Strip out attribute value.

Parameters
valuethe input string
Returns
the updated string

Definition at line 208 of file raw-text-config.cc.

References NS_ABORT_MSG_IF, NS_LOG_FUNCTION, and visualizer.core::start().

Referenced by Attributes(), Default(), and Global().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_is

std::ifstream* ns3::RawTextConfigLoad::m_is
private

Config store input stream.

Definition at line 87 of file raw-text-config.h.

Referenced by ~RawTextConfigLoad(), Attributes(), Default(), Global(), and SetFilename().


The documentation for this class was generated from the following files: