19#include <TRUSTTabs_forward.h>
20#include <Objet_a_lire.h>
123 Param(
const char * owner_name);
443 void ajouter_flag(
const char * keyword,
const bool* value);
488 void ajouter_condition(
const char* condition,
const char* message,
const char* name = 0);
599 inline const LIST(
Nom)& get_list_mots_lus()
const {
return list_parametre_lu_; }
640 LIST(
Nom) list_message_erreur_conditions_;
641 LIST(
Nom) list_nom_conditions_;
654 auto ptr =
const_cast<std::vector<TRUST_Deriv<T>
>*>(quoi);
656 std::string attr_name = mot;
657 std::string prop = proprietaire_.getString();
661 auto vec_initializer = [ptr, attr_name, prop](std::vector<DerObjU>& vec)
663 for (
const auto& ref: vec)
666 if (sub_type(T, ref.valeur()))
668 const T& cast_obj = ref_cast(T, ref.valeur());
669 ptr->push_back(cast_obj);
673 Cerr <<
"When reading '" << prop <<
"'" << finl;
674 Cerr <<
"In keyword '" << attr_name <<
"', wrong type in vector:" << finl;
675 Cerr <<ref.valeur().le_type() <<
" is not a subtype of " << T::info_obj.name() << finl;
692 auto ptr =
const_cast<std::map<std::string, TRUST_Deriv<T>
>*>(quoi);
695 std::string attr_name = mot;
696 std::string prop = proprietaire_.getString();
699 auto map_initializer = [ptr, attr_name, prop](std::map<std::string, DerObjU>& map)
701 for (
const auto& key_to_objU: map)
703 const auto& key = key_to_objU.first;
704 const auto& objU = key_to_objU.second;
705 if (sub_type(T, objU.valeur()))
707 const T& cast_obj = ref_cast(T, objU.valeur());
708 (*ptr)[key] = cast_obj;
710 (*ptr)[key]->nommer(key);
714 Cerr <<
"When reading '" << prop <<
"'" << finl;
715 Cerr <<
"In keyword '" << attr_name <<
"', wrong type at key " << key << finl;
716 Cerr <<objU.valeur().le_type() <<
" is not a subtype of " << T::info_obj.name() << finl;
Class defining operators and methods for all reading operation in an input flow (file,...
A character string (Nom) in uppercase.
class Nom: a character string for naming TRUST objects.
Base class for TRUST objects (Objet_U).
void set_map_obj_initializer(map_obj_initializer_t)
void set_vec_obj_initializer(vec_obj_initializer_t)
void set_nature(Objet_a_lire::Nature n)
void set_vec_expected_size(int s)
Helper class to factorize the readOn method of Objet_U classes.
void supprimer_condition(const char *name)
Remove a previously-registered condition from this Param.
void ajouter_double(const char *c, const double *val, Param::Nature nat=Param::OPTIONAL)
Alias of ajouter(const char*, const double*, Nature).
Param(const char *owner_name)
Build a Param that will parse the parameters of an object named owner_name.
const LIST(Nom) &get_list_mots_lus() const
List of keywords that have actually been read from the input.
void ajouter_flag(const char *keyword, const bool *value)
Register a boolean flag whose mere presence switches it to true.
Param & dictionnaire_param(const char *option_name, int value)
Same as dictionnaire, but also attaches a nested Param block that will be read when this option is se...
Objet_a_lire & create_or_get_objet_a_lire(const char *keyword)
Look up (or create) the Objet_a_lire associated with a keyword string.
void ajouter_arr_size_predefinie(const char *keyword, const ArrOfInt *value, Param::Nature nat=Param::OPTIONAL)
Register an ArrOfInt whose size has already been fixed.
void print(Sortie &s) const
Print the current state of the registered parameters as a { ... } block.
void dictionnaire(const char *option_name, int value)
Add an (option name, integer value) entry to the dictionary attached to a previously registered integ...
int lire_sans_accolade(Entree &is)
Read all required keywords in the order they were registered, without enclosing braces.
void ajouter_condition(const char *condition, const char *message, const char *name=0)
Declare a post-read logical condition that must hold on the parameter values.
int read(Entree &is, int with_acco=1)
Low-level entry point used by lire_avec_accolades_depuis.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
int check()
Validate that every required keyword was read and every condition holds.
void ajouter_objet(const char *c, const Objet_U *obj, Param::Nature nat=Param::OPTIONAL)
Alias of ajouter(const char*, const Objet_U*, Nature).
void ajouter_int(const char *c, const int *val, Param::Nature nat=Param::OPTIONAL)
Alias of ajouter(const char*, const int*, Nature).
Nature
Whether a registered parameter must be present in the input or may be omitted.
void ajouter_non_std(const char *keyword, const Objet_U *value, Param::Nature nat=Param::OPTIONAL)
Register a keyword handled by Objet_U::lire_motcle_non_standard.
int lire_avec_accolades_depuis(Entree &is)
Parse the parameter block { ... } from is.
void supprimer(const char *keyword)
Remove a previously-registered keyword from this Param.
Param()
Default-constructed Param with no owner; only for derived classes.
Param & ajouter_param(const char *keyword, Param::Nature nat=Param::OPTIONAL)
Register a nested Param block and return a reference to it so it can be populated in turn.
int lire_avec_accolades(Entree &is)
Alias of lire_avec_accolades_depuis.
double get_value(const Nom &mot_lu) const
Retrieve the value of a simple-type parameter by its value_of_<keyword> name.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Base class for output streams.
ptrParam class: contains a name and a reference to an int, double, flag, an Objet_U to read,...