TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Objet_a_lire.h
1/****************************************************************************
2* Copyright (c) 2026, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16
17#ifndef Objet_a_lire_included
18#define Objet_a_lire_included
19
20#include <TRUST_Deriv.h>
21#include <TRUSTArray.h>
22#include <TRUST_List.h>
23#include <ptrParam.h>
24#include <Objet_U.h>
25#include <map>
26#include <string>
27#include <functional>
28
29class Param;
30class Objet_a_lire :public Objet_U
31{
32 Declare_instanciable(Objet_a_lire);
33public:
36 };
37
38 enum Nature { OPTIONAL = 0, REQUIRED = 1 };
39
40 void set_entier(int*);
41 void set_tid(trustIdType*);
42 void set_double(double*);
43 void set_string(std::string*);
44 void set_objet(Objet_U*);
45 void set_arrofint(ArrOfInt*);
46 void set_arrofdouble(ArrOfDouble*);
47
49 void set_vec_int(std::vector<int>*);
50 void set_vec_dbl(std::vector<double>*);
51 void set_vec_str(std::vector<std::string>*);
52
53 void set_map_int(std::map<std::string, int>*);
54 void set_map_dbl(std::map<std::string, double>*);
55 void set_map_str(std::map<std::string, std::string>*);
56
57 using vec_obj_initializer_t = std::function<void(std::vector<DerObjU>&)>;
58 using map_obj_initializer_t = std::function<void(std::map<std::string, DerObjU>&)>;
61
62 template<typename _CLASSE_>
63 void set_deriv(TRUST_Deriv<_CLASSE_> *quoi, const char *prefixe)
64 {
65 obj_a_lire = quoi;
66 type = DERIV;
67 prefixe_deriv = prefixe;
68 }
69
70 Param& create_param(const char*);
71 void set_flag(bool*);
72 void set_non_std(Objet_U*);
73 ptrParam& add_dict(const char*,int, const char* =0);
75 void read(const Motcle& keyword,Entree& is);
76 void print(Sortie& s) const;
77 const Nom& get_name() const;
78 int comprend_name(Motcle& mot) const;
79 Nom get_names_message() const;
80 void set_name(const LIST(Nom)& n);
81 bool is_optional() const;
82 bool is_type_simple() const ;
83 double get_value() const;
84
85protected:
87 LIST(Nom) names;
91 trustIdType *tid_a_lire;
93 std::string *string_a_lire;
95 ArrOfInt *arrofint_a_lire;
96 ArrOfDouble *arrofdouble_a_lire;
100 LIST(ptrParam) dictionnaire_params;
103
104
105 int expected_vec_size_ = -1; // -1 means no size restriction.
106 std::vector<int>* vec_int_a_lire = nullptr;
107 std::vector<double>* vec_double_a_lire = nullptr;
108 std::vector<std::string>* vec_str_a_lire = nullptr;
110
111 std::map<std::string, int>* map_int_a_lire = nullptr;
112 std::map<std::string, double>* map_double_a_lire = nullptr;
113 std::map<std::string, std::string>* map_str_a_lire = nullptr;
115
116};
117
118#endif
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
Un tableau d'objets de la classe Motcle.
Definition Motcle.h:63
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
classe Objet_U Cette classe est la classe de base des Objets de TRUST
Definition Objet_U.h:73
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
Definition Objet_U.cpp:55
void set_map_obj_initializer(map_obj_initializer_t)
void set_objet(Objet_U *)
bool is_optional() const
void set_map_int(std::map< std::string, int > *)
void set_tid(trustIdType *)
std::string * string_a_lire
std::function< void(std::map< std::string, DerObjU > &)> map_obj_initializer_t
void set_double(double *)
void read(const Motcle &keyword, Entree &is)
double * double_a_lire
void set_vec_int(std::vector< int > *)
void set_vec_dbl(std::vector< double > *)
void set_vec_obj_initializer(vec_obj_initializer_t)
void print(Sortie &s) const
Definition Param.cpp:152
Objet_a_lire::Type type
int comprend_name(Motcle &mot) const
void set_map_str(std::map< std::string, std::string > *)
void set_arrofint(ArrOfInt *)
void set_flag(bool *)
std::vector< int > * vec_int_a_lire
void set_nature(Objet_a_lire::Nature n)
ArrOfInt * arrofint_a_lire
double get_value() const
void set_deriv(TRUST_Deriv< _CLASSE_ > *quoi, const char *prefixe)
bool * flag_a_lire
Motcle prefixe_deriv
trustIdType * tid_a_lire
void set_map_dbl(std::map< std::string, double > *)
std::map< std::string, int > * map_int_a_lire
void set_vec_expected_size(int s)
LIST(Nom) names
Motcles dictionnaire_noms
std::vector< double > * vec_double_a_lire
Objet_U * obj_a_lire
void set_arrofdouble(ArrOfDouble *)
ArrOfDouble * arrofdouble_a_lire
ArrOfInt dictionnaire_valeurs
void set_entier(int *)
std::vector< std::string > * vec_str_a_lire
LIST(ptrParam) dictionnaire_params
std::function< void(std::vector< DerObjU > &)> vec_obj_initializer_t
ptrParam & add_dict(const char *, int, const char *=0)
Nom get_names_message() const
std::map< std::string, std::string > * map_str_a_lire
void set_non_std(Objet_U *)
void set_vec_str(std::vector< std::string > *)
std::map< std::string, double > * map_double_a_lire
bool is_type_simple() const
vec_obj_initializer_t vec_obj_initializer
ptrParam param_interne
map_obj_initializer_t map_obj_initializer
void set_name(const LIST(Nom)&n)
const Nom & get_name() const
Param & create_param(const char *)
void set_string(std::string *)
Objet_U * objet_lu
Objet_a_lire::Nature nature
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
Classe de base des flux de sortie.
Definition Sortie.h:52
class Objet_a_lire : contient un nom, et une reference vers un int,double,flag,un Objet_U a lire,...
Definition ptrParam.h:27