NOMAD Source  Version 4.0.0 Beta
ParameterEntry Class Reference

Parameter entry. More...

#include <ParameterEntry.hpp>

Collaboration diagram for ParameterEntry:

Public Member Functions

 ParameterEntry (const std::string &entry, bool removeComments=true)
 Constructor. More...
 
virtual ~ParameterEntry (void)
 Destructor. More...
 
const std::string & getName (void) const
 Access to the name of the parameter. More...
 
const std::list< std::string > & getValues (void) const
 Access to the parameter values. More...
 
std::string getAllValues (void) const
 
size_t getNbValues (void) const
 Access to the number of values of the parameter. More...
 
bool isOk (void) const
 Access to the _ok flag. More...
 
bool isUnique (void) const
 Access to the _unique flag. More...
 
std::shared_ptr< ParameterEntrygetNext (void) const
 Access to another ParameterEntry. More...
 
bool hasBeenInterpreted (void) const
 Access to the _hasBeenInterpreted flag. More...
 
const std::string & getParamFile (void) const
 Access to the parameter file of the parameter. More...
 
const int & getLine (void) const
 Access to the line number for this parameter in the parameter file. More...
 
void setNext (std::shared_ptr< ParameterEntry > p)
 Set the _next pointer. More...
 
void setUnique (bool u)
 Set the _unique flag. More...
 
void setHasBeenInterpreted (void)
 Set the _hasBeenInterpreted flag. to true. More...
 
void setParamFile (const std::string &paramFile)
 Set the name of the parameter file _paramFile. More...
 
void setLine (int line)
 Set the line _line for this parameter in the parameter file. More...
 
bool operator< (const ParameterEntry &p) const
 Comparison with another entry. More...
 
void display (std::ostream &out) const
 Display. More...
 

Private Attributes

std::string _name
 Name of the parameter. More...
 
std::list< std::string > _values
 List of values for the parameter. More...
 
bool _ok
 If the parameter is valid. More...
 
bool _unique
 If the parameter is unique. More...
 
std::shared_ptr< ParameterEntry_next
 Acces to the next parameter. More...
 
std::string _paramFile
 File from which this parameter was read. More...
 
int _line
 Line for this parameter in _paramFile. More...
 
bool _hasBeenInterpreted
 If the parameter has been interpreted. More...
 

Detailed Description

Parameter entry.

  • Describes the data relative to a parameter in a parameters file.
  • Objects of this class are stored in a ParameterEntries object.

Definition at line 66 of file ParameterEntry.hpp.

Constructor & Destructor Documentation

◆ ParameterEntry()

ParameterEntry::ParameterEntry ( const std::string &  entry,
bool  removeComments = true 
)
explicit

Constructor.

Ignores all entries after '#'.

Parameters
entryA string describing the parameter entry – IN.
removeCommentsA boolean equal to true if entries after '#' are ignored – IN (Opt) (default = true).

◆ ~ParameterEntry()

virtual ParameterEntry::~ParameterEntry ( void  )
inlinevirtual

Destructor.

Definition at line 95 of file ParameterEntry.hpp.

95 {}

Member Function Documentation

◆ display()

void ParameterEntry::display ( std::ostream &  out) const

Display.

Parameters
outThe std::ostream object – IN.

◆ getAllValues()

std::string ParameterEntry::getAllValues ( void  ) const

◆ getLine()

const int& ParameterEntry::getLine ( void  ) const
inline

Access to the line number for this parameter in the parameter file.

Returns
The line number at which this parameter can be found in the parameter file.

Definition at line 162 of file ParameterEntry.hpp.

162 { return _line; }

◆ getName()

const std::string& ParameterEntry::getName ( void  ) const
inline

Access to the name of the parameter.

Returns
The name.

Definition at line 105 of file ParameterEntry.hpp.

105 { return _name; }

◆ getNbValues()

size_t ParameterEntry::getNbValues ( void  ) const
inline

Access to the number of values of the parameter.

Returns
The number of values.

Definition at line 119 of file ParameterEntry.hpp.

119 { return _values.size(); }

◆ getNext()

std::shared_ptr<ParameterEntry> ParameterEntry::getNext ( void  ) const
inline

Access to another ParameterEntry.

ParameterEntry objects are stored in a ParameterEntries object. The link between elements is assumed by the _next member returned by this function.

Returns
A pointer to the next entry.

Definition at line 143 of file ParameterEntry.hpp.

143 { return _next; }

◆ getParamFile()

const std::string& ParameterEntry::getParamFile ( void  ) const
inline

Access to the parameter file of the parameter.

Returns
The parameter file where this parameter was read.

Definition at line 156 of file ParameterEntry.hpp.

156 { return _paramFile; }

◆ getValues()

const std::list<std::string>& ParameterEntry::getValues ( void  ) const
inline

Access to the parameter values.

Returns
The parameter values as a list of strings.

Definition at line 111 of file ParameterEntry.hpp.

111 { return _values; }

◆ hasBeenInterpreted()

bool ParameterEntry::hasBeenInterpreted ( void  ) const
inline

Access to the _hasBeenInterpreted flag.

Returns
A boolean equal to true if the parameter has already been interpreted.

Definition at line 150 of file ParameterEntry.hpp.

150 { return _hasBeenInterpreted; }

◆ isOk()

bool ParameterEntry::isOk ( void  ) const
inline

Access to the _ok flag.

This flag is equal to true if the parameter entry is well defined.

Returns
A boolean equal to true if the parameter is valid.

Definition at line 126 of file ParameterEntry.hpp.

126 { return _ok; }

◆ isUnique()

bool ParameterEntry::isUnique ( void  ) const
inline

Access to the _unique flag.

This flag is decided when a parameters file is read.

Returns
A boolean equal to true if the parameter is unique in a parameters file.

Definition at line 134 of file ParameterEntry.hpp.

134 { return _unique; }

◆ operator<()

bool ParameterEntry::operator< ( const ParameterEntry p) const
inline

Comparison with another entry.

The comparison is based on the parameter name.

Parameters
pThe right-hand side object – IN.
Returns
A boolean equal to true if this->_name < p._name.

Definition at line 196 of file ParameterEntry.hpp.

196 { return _name < p._name; }

◆ setHasBeenInterpreted()

void ParameterEntry::setHasBeenInterpreted ( void  )
inline

Set the _hasBeenInterpreted flag. to true.

Definition at line 181 of file ParameterEntry.hpp.

181 { _hasBeenInterpreted = true; }

◆ setLine()

void ParameterEntry::setLine ( int  line)
inline

Set the line _line for this parameter in the parameter file.

Definition at line 187 of file ParameterEntry.hpp.

187 { _line = line; }

◆ setNext()

void ParameterEntry::setNext ( std::shared_ptr< ParameterEntry p)
inline

Set the _next pointer.

Parameters
pA pointer to the next ParameterEntry to be inserted – IN.

Definition at line 172 of file ParameterEntry.hpp.

172 { _next = p; }

◆ setParamFile()

void ParameterEntry::setParamFile ( const std::string &  paramFile)
inline

Set the name of the parameter file _paramFile.

Definition at line 184 of file ParameterEntry.hpp.

184 { _paramFile = paramFile; }

◆ setUnique()

void ParameterEntry::setUnique ( bool  u)
inline

Set the _unique flag.

Parameters
uValue of the flag – IN.

Definition at line 178 of file ParameterEntry.hpp.

178 { _unique = u; }

Member Data Documentation

◆ _hasBeenInterpreted

bool ParameterEntry::_hasBeenInterpreted
private

If the parameter has been interpreted.

Definition at line 80 of file ParameterEntry.hpp.

◆ _line

int ParameterEntry::_line
private

Line for this parameter in _paramFile.

Definition at line 77 of file ParameterEntry.hpp.

◆ _name

std::string ParameterEntry::_name
private

Name of the parameter.

Definition at line 70 of file ParameterEntry.hpp.

◆ _next

std::shared_ptr<ParameterEntry> ParameterEntry::_next
private

Acces to the next parameter.

Definition at line 74 of file ParameterEntry.hpp.

◆ _ok

bool ParameterEntry::_ok
private

If the parameter is valid.

Definition at line 72 of file ParameterEntry.hpp.

◆ _paramFile

std::string ParameterEntry::_paramFile
private

File from which this parameter was read.

Definition at line 76 of file ParameterEntry.hpp.

◆ _unique

bool ParameterEntry::_unique
private

If the parameter is unique.

Definition at line 73 of file ParameterEntry.hpp.

◆ _values

std::list<std::string> ParameterEntry::_values
private

List of values for the parameter.

Definition at line 71 of file ParameterEntry.hpp.


The documentation for this class was generated from the following file:
ParameterEntry::_paramFile
std::string _paramFile
File from which this parameter was read.
Definition: ParameterEntry.hpp:76
ParameterEntry::_ok
bool _ok
If the parameter is valid.
Definition: ParameterEntry.hpp:72
ParameterEntry::_values
std::list< std::string > _values
List of values for the parameter.
Definition: ParameterEntry.hpp:71
ParameterEntry::_next
std::shared_ptr< ParameterEntry > _next
Acces to the next parameter.
Definition: ParameterEntry.hpp:74
ParameterEntry::_line
int _line
Line for this parameter in _paramFile.
Definition: ParameterEntry.hpp:77
ParameterEntry::_unique
bool _unique
If the parameter is unique.
Definition: ParameterEntry.hpp:73
ParameterEntry::_hasBeenInterpreted
bool _hasBeenInterpreted
If the parameter has been interpreted.
Definition: ParameterEntry.hpp:80
ParameterEntry::_name
std::string _name
Name of the parameter.
Definition: ParameterEntry.hpp:70