Chi-Tech
|
#include <input_parameters.h>
Public Member Functions | |
InputParameters ()=default | |
InputParameters & | operator+= (InputParameters other) |
void | SetObjectType (const std::string &obj_type) |
std::string | ObjectType () const |
void | SetClassName (const std::string &class_name) |
void | SetGeneralDescription (const std::string &description) |
std::string | GetGeneralDescription () const |
void | SetDocGroup (const std::string &doc_group) |
void | LinkParameterToBlock (const std::string ¶m_name, const std::string &block_name) |
std::string | GetParameterDocumentationLink (const std::string ¶m_name) const |
std::string | GetParameterDocString (const std::string ¶m_name) |
template<typename T > | |
void | AddOptionalParameter (const std::string &name, T value, const std::string &doc_string) |
void | AddOptionalParameterBlock (const std::string &name, const ParameterBlock &block, const std::string &doc_string) |
template<typename T > | |
void | AddOptionalParameterArray (const std::string &name, const std::vector< T > &array, const std::string &doc_string) |
void | AddOptionalParameterArray (const std::string &name, const std::vector< ParameterBlock > &array, const std::string &doc_string) |
template<typename T > | |
void | AddRequiredParameter (const std::string &name, const std::string &doc_string) |
void | AddRequiredParameterBlock (const std::string &name, const std::string &doc_string) |
void | AddRequiredParameterArray (const std::string &name, const std::string &doc_string) |
template<typename T > | |
void | ChangeExistingParamToOptional (const std::string &name, T value, const std::string &doc_string="") |
template<typename T > | |
void | ChangeExistingParamToRequired (const std::string &name, const std::string &doc_string="") |
void | AssignParameters (const ParameterBlock ¶ms) |
Assigns parameters with thorough type checks, deprecation checks, unused parameter checks. More... | |
const ParameterBlock & | ParametersAtAssignment () const |
void | MarkParamaterDeprecatedWarning (const std::string ¶m_name, const std::string &deprecation_message="") |
void | MarkParamaterDeprecatedError (const std::string ¶m_name, const std::string &deprecation_message="") |
void | MarkParamaterRenamed (const std::string ¶m_name, const std::string &renaming_description) |
void | ConstrainParameterRange (const std::string ¶m_name, AllowableRangePtr allowable_range) |
void | SetParameterTypeMismatchAllowed (const std::string ¶m_name) |
Sets a tag for the given parameter that will allow its type to be mismatched upon assignment. More... | |
void | DumpParameters () const |
Public Member Functions inherited from chi::ParameterBlock | |
void | SetBlockName (const std::string &name) |
ParameterBlock (const std::string &name="") | |
template<typename T > | |
ParameterBlock (const std::string &name, const std::vector< T > &array) | |
template<typename T > | |
ParameterBlock (const std::string &name, T value) | |
ParameterBlock (const ParameterBlock &other) | |
ParameterBlock & | operator= (const ParameterBlock &other) |
ParameterBlock (ParameterBlock &&other) noexcept | |
ParameterBlock & | operator= (ParameterBlock &&other) noexcept |
ParameterBlockType | Type () const |
bool | IsScalar () const |
std::string | TypeName () const |
std::string | Name () const |
const chi_data_types::Varying & | Value () const |
size_t | NumParameters () const |
const std::vector< ParameterBlock > & | Parameters () const |
bool | HasValue () const |
void | ChangeToArray () |
void | SetErrorOriginScope (const std::string &scope) |
std::string | GetErrorOriginScope () const |
void | RequireBlockTypeIs (ParameterBlockType type) const |
void | RequireParameterBlockTypeIs (const std::string ¶m_name, ParameterBlockType type) const |
void | RequireParameter (const std::string ¶m_name) const |
void | AddParameter (ParameterBlock block) |
template<typename T > | |
void | AddParameter (const std::string &name, T value) |
void | SortParameters () |
bool | Has (const std::string ¶m_name) const |
ParameterBlock & | GetParam (const std::string ¶m_name) |
ParameterBlock & | GetParam (size_t index) |
const ParameterBlock & | GetParam (const std::string ¶m_name) const |
const ParameterBlock & | GetParam (size_t index) const |
template<typename T > | |
T | GetValue () const |
template<typename T > | |
T | GetParamValue (const std::string ¶m_name) const |
template<typename T > | |
std::vector< T > | GetVectorValue () const |
template<typename T > | |
std::vector< T > | GetParamVectorValue (const std::string ¶m_name) const |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
void | RecursiveDumpToString (std::string &outstr, const std::string &offset="") const |
void | RecursiveDumpToJSON (std::string &outstr) const |
Static Public Member Functions | |
template<typename T > | |
static InputParameters | MakeForObject (const ParameterBlock ¶ms) |
Private Types | |
typedef std::unique_ptr< chi_data_types::AllowableRange > | AllowableRangePtr |
Private Member Functions | |
void | AddParameter (ParameterBlock block) |
template<typename T > | |
void | AddParameter (const std::string &name, T value) |
Static Private Member Functions | |
static bool | IsParameterIgnored (const std::string ¶m_name) |
Private Attributes | |
std::string | class_name_ |
std::string | doc_group_ |
std::map< std::string, InputParameterTag > | parameter_class_tags_ |
std::map< std::string, std::string > | parameter_doc_string_ |
std::map< std::string, std::string > | deprecation_warning_tags_ |
std::map< std::string, std::string > | deprecation_error_tags_ |
std::map< std::string, std::string > | renamed_error_tags_ |
std::map< std::string, bool > | type_mismatch_allowed_tags_ |
std::map< std::string, std::string > | parameter_link_ |
std::map< std::string, AllowableRangePtr > | constraint_tags_ |
std::string | general_description_ |
ParameterBlock | param_block_at_assignment_ |
Static Private Attributes | |
static const std::vector< std::string > | system_ignored_param_names_ |
Class for handling input parameters.
Definition at line 22 of file input_parameters.h.
|
private |
Definition at line 39 of file input_parameters.h.
|
default |
|
inline |
Definition at line 97 of file input_parameters.h.
void chi::InputParameters::AddOptionalParameterArray | ( | const std::string & | name, |
const std::vector< ParameterBlock > & | array, | ||
const std::string & | doc_string | ||
) |
Specialization for block type parameters.
Definition at line 187 of file input_parameters.cc.
|
inline |
Definition at line 111 of file input_parameters.h.
void chi::InputParameters::AddOptionalParameterBlock | ( | const std::string & | name, |
const ParameterBlock & | block, | ||
const std::string & | doc_string | ||
) |
Specialization for block type parameters.
Definition at line 174 of file input_parameters.cc.
|
inlineprivate |
Makes a ParameterBlock and adds it to the sub-parameters list.
Definition at line 168 of file parameter_block.h.
|
private |
Adds a parameter to the sub-parameter list.
Definition at line 165 of file paramater_block.cc.
|
inline |
Definition at line 125 of file input_parameters.h.
void chi::InputParameters::AddRequiredParameterArray | ( | const std::string & | name, |
const std::string & | doc_string | ||
) |
Specialization for array type parameters.
Definition at line 215 of file input_parameters.cc.
void chi::InputParameters::AddRequiredParameterBlock | ( | const std::string & | name, |
const std::string & | doc_string | ||
) |
Specialization for block type parameters.
Definition at line 204 of file input_parameters.cc.
void chi::InputParameters::AssignParameters | ( | const ParameterBlock & | params | ) |
Assigns parameters with thorough type checks, deprecation checks, unused parameter checks.
Returns an error string if the check has not passed. This method first checks whether all the required parameters are supplied. Then it checks that all the parameters supplied actually maps to valid parameters.
Definition at line 230 of file input_parameters.cc.
|
inline |
Definition at line 140 of file input_parameters.h.
|
inline |
Definition at line 151 of file input_parameters.h.
void chi::InputParameters::ConstrainParameterRange | ( | const std::string & | param_name, |
AllowableRangePtr | allowable_range | ||
) |
Creates a range based constraint for a given parameter.
Definition at line 407 of file input_parameters.cc.
void chi::InputParameters::DumpParameters | ( | ) | const |
Dumps the input parameters to stdout.
Definition at line 438 of file input_parameters.cc.
|
inline |
Definition at line 76 of file input_parameters.h.
std::string chi::InputParameters::GetParameterDocString | ( | const std::string & | param_name | ) |
Returns the parameter's doc string.
Definition at line 150 of file input_parameters.cc.
std::string chi::InputParameters::GetParameterDocumentationLink | ( | const std::string & | param_name | ) | const |
Gets any linkage information of a parameter.
Definition at line 139 of file input_parameters.cc.
|
staticprivate |
Determines if a parameter is ignored.
Definition at line 159 of file input_parameters.cc.
void chi::InputParameters::LinkParameterToBlock | ( | const std::string & | param_name, |
const std::string & | block_name | ||
) |
Sets a link to the documentation of a different object.
Definition at line 129 of file input_parameters.cc.
|
inlinestatic |
Definition at line 54 of file input_parameters.h.
void chi::InputParameters::MarkParamaterDeprecatedError | ( | const std::string & | param_name, |
const std::string & | deprecation_message = "" |
||
) |
Marks a parameters as deprecated and will produce an error if the parameter is specified.
Definition at line 385 of file input_parameters.cc.
void chi::InputParameters::MarkParamaterDeprecatedWarning | ( | const std::string & | param_name, |
const std::string & | deprecation_message = "" |
||
) |
Marks a parameters as deprecated but will only produce a warning.
Definition at line 373 of file input_parameters.cc.
void chi::InputParameters::MarkParamaterRenamed | ( | const std::string & | param_name, |
const std::string & | renaming_description | ||
) |
Marks a parameters as renamed and will produce an error if the parameter is specified.
Definition at line 397 of file input_parameters.cc.
std::string chi::InputParameters::ObjectType | ( | ) | const |
Returns the object type string.
Definition at line 125 of file input_parameters.cc.
InputParameters & chi::InputParameters::operator+= | ( | InputParameters | other | ) |
Definition at line 26 of file input_parameters.cc.
|
inline |
Returns the raw parameter block used at assignment. This can be used to see if a user supplied an optional parameter or not.
Definition at line 167 of file input_parameters.h.
|
inline |
Sets the class name to be applied to this object. If not used a default will be generated.
Definition at line 68 of file input_parameters.h.
|
inline |
Space separated list of doxygen group names to which this documentation should belong.
Definition at line 80 of file input_parameters.h.
|
inline |
Sets a general description of the object that should be included with the object's documentation.
Definition at line 72 of file input_parameters.h.
void chi::InputParameters::SetObjectType | ( | const std::string & | obj_type | ) |
Sets the object type string for more descriptive error messages.
Definition at line 118 of file input_parameters.cc.
void chi::InputParameters::SetParameterTypeMismatchAllowed | ( | const std::string & | param_name | ) |
Sets a tag for the given parameter that will allow its type to be mismatched upon assignment.
Useful for accepting varying datatypes or making a choice based upon the type of a parameter.
Definition at line 428 of file input_parameters.cc.
|
private |
String to represent class name. If not provided a default will be generated.
Definition at line 27 of file input_parameters.h.
|
private |
Definition at line 40 of file input_parameters.h.
|
private |
Definition at line 34 of file input_parameters.h.
|
private |
Definition at line 33 of file input_parameters.h.
|
private |
Space separated list of group names.
Definition at line 29 of file input_parameters.h.
|
private |
Definition at line 42 of file input_parameters.h.
|
private |
Definition at line 48 of file input_parameters.h.
|
private |
Definition at line 30 of file input_parameters.h.
|
private |
Definition at line 31 of file input_parameters.h.
|
private |
Definition at line 37 of file input_parameters.h.
|
private |
Definition at line 35 of file input_parameters.h.
|
staticprivate |
Parameter names to ignore when trying to assign. For now this "chi_obj_type"
Definition at line 46 of file input_parameters.h.
|
private |
Definition at line 36 of file input_parameters.h.