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

#include <LUPI.hpp>

Inheritance diagram for LUPI::OptionStore:

Public Member Functions

 OptionStore (std::string const &a_name, std::string const &a_descriptor="", int a_minimumNeeded=0, int a_maximumNeeded=-1)
 ~OptionStore ()
std::string const & value (std::size_t a_index=0) const
bool requiresAValue () const
void printStatus3 (std::string const &a_indent) 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
std::vector< std::string > const & values () const
virtual bool isOptionalArgument () 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

An option with a value. If multiple options with the same name are entered, only the last vluae entered if returned by the value() method.

Definition at line 291 of file LUPI.hpp.

Constructor & Destructor Documentation

◆ OptionStore()

LUPI::OptionStore::OptionStore ( std::string const & a_name,
std::string const & a_descriptor = "",
int a_minimumNeeded = 0,
int a_maximumNeeded = -1 )

OptionStore constructor.

Parameters
a_name[in] The name of the argument.
a_descriptor[in] The string printed with arugment's help.
a_minimumNeeded[in] Not used. Will probably be deprecated.
a_maximumNeeded[in] Not used. Will probably be deprecated.

Definition at line 354 of file LUPI_argumentParser.cc.

354 :
355 ArgumentBase( ArgumentType::Store, a_name, a_descriptor, 0, -1 ) {
356
357}
ArgumentBase(ArgumentType a_argumentType, std::string const &a_name, std::string const &a_descriptor, int a_minimumNeeded, int a_maximumNeeded)

◆ ~OptionStore()

LUPI::OptionStore::~OptionStore ( )
inline

Definition at line 295 of file LUPI.hpp.

295{ }

Member Function Documentation

◆ printStatus3()

void LUPI::OptionStore::printStatus3 ( std::string const & a_indent) const
virtual

Prints the value for this. Called by printStatus.

Parameters
a_indent[in] The amount of indentation to start the first line with.

Reimplemented from LUPI::ArgumentBase.

Definition at line 381 of file LUPI_argumentParser.cc.

381 {
382
383 if( counts( ) > 0 ) std::cout << a_indent << value( ) << std::endl;
384}
std::size_t counts() const
Definition LUPI.hpp:214
std::string const & value(std::size_t a_index=0) const

◆ requiresAValue()

bool LUPI::OptionStore::requiresAValue ( ) const
inlinevirtual

Reimplemented from LUPI::ArgumentBase.

Definition at line 298 of file LUPI.hpp.

298{ return( true ); }

◆ value()

std::string const & LUPI::OptionStore::value ( std::size_t a_index = 0) const
virtual

Returns the value of

Parameters
a_index[in] This argument is not used. The last value entered is always returned.
Returns
Returns the last value entered or executes a throw if option not entered.

Reimplemented from LUPI::ArgumentBase.

Definition at line 367 of file LUPI_argumentParser.cc.

367 {
368
369 a_index = values( ).size( );
370 if( a_index != 0 ) --a_index;
371
372 return ArgumentBase::value( a_index );
373}
std::vector< std::string > const & values() const
Definition LUPI.hpp:217
virtual std::string const & value(std::size_t a_index=0) const

Referenced by printStatus3().


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