Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
LUPI::OptionBoolean Class Referenceabstract

#include <LUPI.hpp>

Inheritance diagram for LUPI::OptionBoolean:

Public Member Functions

 OptionBoolean (ArgumentType a_argumentType, std::string const &a_name, std::string const &a_descriptor, bool a_default)
virtual ~OptionBoolean ()=0
bool _default () const
std::string printStatus2 () const
Public Member Functions inherited from LUPI::ArgumentBase
 ArgumentBase (ArgumentType a_argumentType, std::string const &a_name, std::string const &a_descriptor, int a_minimumNeeded, int a_maximumNeeded)
virtual ~ArgumentBase ()=0
ArgumentType argumentType () const
std::string const & name () const
std::vector< std::string > const & names ()
bool hasName (std::string const &a_name) const
std::string const & descriptor () const
int minimumNeeded () const
int maximumNeeded () const
std::size_t counts () const
virtual std::string const & value (std::size_t a_index=0) const
std::vector< std::string > const & values () const
virtual bool isOptionalArgument () const
virtual bool requiresAValue () const
virtual int parse (ArgumentParser const &a_argumentParser, int a_index, int a_argc, char **a_argv)
std::string usage (bool a_requiredOption) const
void printStatus (std::string a_indent) const

Detailed Description

Base boolean class.

Definition at line 231 of file LUPI.hpp.

Constructor & Destructor Documentation

◆ OptionBoolean()

LUPI::OptionBoolean::OptionBoolean ( ArgumentType a_argumentType,
std::string const & a_name,
std::string const & a_descriptor,
bool a_default )

OptionBoolean constructor.

Parameters
a_argumentType[in] The type of argument to create.
a_name[in] The name of the argument.
a_descriptor[in] The string printed with arugment's help.
a_default[in] The default bool value.

Definition at line 249 of file LUPI_argumentParser.cc.

249 :
250 ArgumentBase( a_argumentType, a_name, a_descriptor, 0, -1 ),
251 m_default( a_default ) {
252
253}
ArgumentBase(ArgumentType a_argumentType, std::string const &a_name, std::string const &a_descriptor, int a_minimumNeeded, int a_maximumNeeded)

Referenced by LUPI::OptionFalse::OptionFalse(), and LUPI::OptionTrue::OptionTrue().

◆ ~OptionBoolean()

LUPI::OptionBoolean::~OptionBoolean ( )
pure virtual

OptionBoolean destructor.

Definition at line 259 of file LUPI_argumentParser.cc.

259 {
260
261}

Member Function Documentation

◆ _default()

bool LUPI::OptionBoolean::_default ( ) const
inline

Definition at line 240 of file LUPI.hpp.

240{ return( m_default ); }

◆ printStatus2()

std::string LUPI::OptionBoolean::printStatus2 ( ) const
virtual

Called by printStatus. This method returns a string representing this's value.

Returns
Returns a std::string instance representing the value of this.

Reimplemented from LUPI::ArgumentBase.

Definition at line 269 of file LUPI_argumentParser.cc.

269 {
270
271 bool value1 = m_default;
272 if( counts() == 0 ) value1 = !m_default;
273
274 if( value1 ) return( ": true" );
275 return( ": false" );
276}
std::size_t counts() const
Definition LUPI.hpp:214

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