16#ifndef TRUST_Deriv_included
17#define TRUST_Deriv_included
19#include <Objet_U_ptr.h>
57#define DERIV(_TYPE_) \
58 static_assert(false, "The old DERIV MACRO is now deprecated. Please use OWN_PTR instead.")
60#define OWN_PTR(_TYPE_) TRUST_Deriv<_TYPE_>
62template<
typename _CLASSE_>
85 if (objet) pointeur_ = (_CLASSE_*) objet;
86 else pointeur_ =
nullptr;
90 _CLASSE_ *pointeur_ =
nullptr;
92 int reprendre(
Entree&)
override {
return -100; }
93 int sauvegarder(
Sortie&)
const override {
return -100; }
110 assert(pointeur_ !=
nullptr);
119 assert(pointeur_ !=
nullptr);
128 assert(pointeur_ !=
nullptr);
135 assert(pointeur_ !=
nullptr);
142 if (pointeur_ != (&t))
152 if (pointeur_ != t.pointeur_)
160 operator const _CLASSE_& ()
const {
return valeur(); }
161 operator _CLASSE_& () {
return valeur(); }
165 const Type_info * type_info = _CLASSE_::info();
178 if (strcmp(msg,
"??") != 0)
181 if (strcmp(b,
"??") != 0)
191 if (strcmp(msg,
"??") != 0)
192 Cerr <<
valeur().que_suis_je() << finl;
242 assert(pointeur_ !=
nullptr);
249 assert(pointeur_ !=
nullptr);
256 assert(pointeur_ !=
nullptr);
Class defining operators and methods for all reading operation in an input flow (file,...
class Nom: a character string for naming TRUST objects.
Objet_U * get_Objet_U_ptr_check() const
Checks if the pointer is valid.
virtual void set_Objet_U_ptr(Objet_U *)
Makes *this point to the object *ptr. The address may be null (null pointer).
void recopie(const Objet_U &)
Duplicates the Objet_U obj and then changes the pointer to this copy.
Objet_U_ptr(const Objet_U_ptr &)=delete
Objet_U * typer(const char *nom_type)
Tries to create an instance of type "type".
Base class for TRUST objects (Objet_U).
int numero() const
Returns the index of the object in Memoire::data.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Base class for output streams.
Class TRUST_Deriv_Objet_U is almost identical to TRUST_Deriv<Objet_U>, except that it does not contai...
int sauvegarder(Sortie &os) const override
Saves an Objet_U to an output stream. Virtual method to override.
int reprendre(Entree &is) override
Restores an Objet_U from an input stream. Virtual method to override.
const Type_info & get_info_ptr() const override
Objet_U * operator->() const
const Objet_U & valeur() const
const TRUST_Deriv_Objet_U & operator=(const Objet_U &t)
void deplace(TRUST_Deriv_Objet_U &deriv_obj)
void set_Objet_U_ptr(Objet_U *objet) override
Makes *this point to the object *ptr. The address may be null (null pointer).
int duplique() const override
const _CLASSE_ & valeur() const
Sortie & printOn(Sortie &os) const override
Writes the object to an output stream. Virtual method to override.
TRUST_Deriv(const TRUST_Deriv &t)
const _CLASSE_ * operator->() const
const TRUST_Deriv & operator=(const _CLASSE_ &t)
Entree & typer_lire_simple(Entree &is, const char *msg="??")
Entree & typer_lire(Entree &is, const char *b="??", const char *msg="??")
unsigned taille_memoire() const override
const TRUST_Deriv & operator=(const TRUST_Deriv &t)
void set_Objet_U_ptr(Objet_U *objet) override
Makes *this point to the object *ptr. The address may be null (null pointer).
Entree & readOn(Entree &is) override
Reads an Objet_U from an input stream. Virtual method to override.
const Type_info & get_info_ptr() const override
TRUST_Deriv(const _CLASSE_ &t)
Models type information for Objet_U objects.