votca 2024-dev
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
votca::tools::OptionsHandler Class Reference

#include <optionshandler.h>

Collaboration diagram for votca::tools::OptionsHandler:
Collaboration graph
[legend]

Public Member Functions

 OptionsHandler (std::string defaults_path)
 
Property ProcessUserInput (const Property &user_input, const std::string &calcname) const
 Load the default options and merge them with the user input.
 
Property CalculatorOptions (const std::string &calcname) const
 Resolve links and return all the options of a calculator.
 
void setAdditionalChoices (std::vector< std::string > choices)
 Allows to bypass the choice evaluation for a specific calculator.
 

Private Member Functions

void ResolveLinks (tools::Property &prop) const
 Resolves "link" attribute in the Property by filling in defaults. Already existing tags are not overwritten.
 
Property LoadDefaults (const std::string &calculatorname) const
 Loads default options stored in defaults_path_.
 
void CheckUserInput (const Property &user_input, const Property &defaults) const
 Checks if all keywords in user_input (apart from sections named "unchecked") have corresponding keys in defaults.
 
void CheckRequired (const Property &options) const
 Checks that all options with default="REQUIRED" are filled in.
 
void RemoveOptional (Property &options) const
 Removes tags which have no value and default="OPTIONAL".
 
void InjectDefaultsAsValues (Property &options) const
 
void CheckChoices (const Property &options) const
 
void CleanAttributes (Property &options, const std::vector< std::string > &attributes) const
 
void OverwriteDefaultsWithUserInput (const Property &p, Property &defaults) const
 
void RecursivelyCheckOptions (const Property &p) const
 
bool IsValidOption (const Property &prop, const std::vector< std::string > &choices) const
 

Static Private Member Functions

static std::vector< std::string > GetPropertyChoices (const Property &p)
 

Private Attributes

std::string defaults_path_
 
std::vector< std::string > additional_choices_ {}
 
std::vector< std::string > reserved_keywords_ {"OPTIONAL", "REQUIRED"}
 

Detailed Description

Definition at line 27 of file optionshandler.h.

Constructor & Destructor Documentation

◆ OptionsHandler()

votca::tools::OptionsHandler::OptionsHandler ( std::string  defaults_path)
inline

Definition at line 29 of file optionshandler.h.

Member Function Documentation

◆ CalculatorOptions()

Property votca::tools::OptionsHandler::CalculatorOptions ( const std::string &  calcname) const

Resolve links and return all the options of a calculator.

Definition at line 121 of file optionshandler.cc.

◆ CheckChoices()

void votca::tools::OptionsHandler::CheckChoices ( const Property options) const
private

◆ CheckRequired()

void votca::tools::OptionsHandler::CheckRequired ( const Property options) const
private

Checks that all options with default="REQUIRED" are filled in.

Definition at line 98 of file optionshandler.cc.

◆ CheckUserInput()

void votca::tools::OptionsHandler::CheckUserInput ( const Property user_input,
const Property defaults 
) const
private

Checks if all keywords in user_input (apart from sections named "unchecked") have corresponding keys in defaults.

Definition at line 82 of file optionshandler.cc.

◆ CleanAttributes()

void votca::tools::OptionsHandler::CleanAttributes ( Property options,
const std::vector< std::string > &  attributes 
) const
private

Definition at line 128 of file optionshandler.cc.

◆ GetPropertyChoices()

std::vector< std::string > votca::tools::OptionsHandler::GetPropertyChoices ( const Property p)
staticprivate

Definition at line 226 of file optionshandler.cc.

◆ InjectDefaultsAsValues()

void votca::tools::OptionsHandler::InjectDefaultsAsValues ( Property options) const
private

Definition at line 150 of file optionshandler.cc.

◆ IsValidOption()

bool votca::tools::OptionsHandler::IsValidOption ( const Property prop,
const std::vector< std::string > &  choices 
) const
private

Definition at line 270 of file optionshandler.cc.

◆ LoadDefaults()

Property votca::tools::OptionsHandler::LoadDefaults ( const std::string &  calculatorname) const
private

Loads default options stored in defaults_path_.

Definition at line 141 of file optionshandler.cc.

◆ OverwriteDefaultsWithUserInput()

void votca::tools::OptionsHandler::OverwriteDefaultsWithUserInput ( const Property p,
Property defaults 
) const
private

Definition at line 165 of file optionshandler.cc.

◆ ProcessUserInput()

Property votca::tools::OptionsHandler::ProcessUserInput ( const Property user_input,
const std::string &  calcname 
) const

Load the default options and merge them with the user input.

Defaults are overwritten with user input

Definition at line 67 of file optionshandler.cc.

◆ RecursivelyCheckOptions()

void votca::tools::OptionsHandler::RecursivelyCheckOptions ( const Property p) const
private

Definition at line 240 of file optionshandler.cc.

◆ RemoveOptional()

void votca::tools::OptionsHandler::RemoveOptional ( Property options) const
private

Removes tags which have no value and default="OPTIONAL".

Definition at line 110 of file optionshandler.cc.

◆ ResolveLinks()

void votca::tools::OptionsHandler::ResolveLinks ( tools::Property prop) const
private

Resolves "link" attribute in the Property by filling in defaults. Already existing tags are not overwritten.

Definition at line 39 of file optionshandler.cc.

◆ setAdditionalChoices()

void votca::tools::OptionsHandler::setAdditionalChoices ( std::vector< std::string >  choices)
inline

Allows to bypass the choice evaluation for a specific calculator.

Definition at line 49 of file optionshandler.h.

Member Data Documentation

◆ additional_choices_

std::vector<std::string> votca::tools::OptionsHandler::additional_choices_ {}
private

Definition at line 99 of file optionshandler.h.

◆ defaults_path_

std::string votca::tools::OptionsHandler::defaults_path_
private

Definition at line 97 of file optionshandler.h.

◆ reserved_keywords_

std::vector<std::string> votca::tools::OptionsHandler::reserved_keywords_ {"OPTIONAL", "REQUIRED"}
private

Definition at line 100 of file optionshandler.h.


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