TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Synonyme_info.h
1/****************************************************************************
2* Copyright (c) 2023, 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#ifndef Synonyme_info_included
17#define Synonyme_info_included
18
19#include <arch.h>
20
21class Objet_U;
22class Sortie;
23class Noms;
24class Nom;
25
26// The pragma is to disable -Wunused-variable with nvc++:
27// Macro to declare A and B synonyms:
28#ifdef __NVCOMPILER
29#define Add_synonym(A,B) _Pragma("diag_suppress 177") \
30const Synonyme_info name2(name2(synonym_,A),__LINE__)(B,A::info_obj.name())
31#else
32#define Add_synonym(A,B) const Synonyme_info name2(name2(synonym_,A),__LINE__)(B,A::info_obj.name())
33#endif
34
35/*! @brief Models synonym information for Objet_U objects.
36 *
37 * @sa Objet_U Nom
38 */
40{
41public:
44 Synonyme_info(const char* name, const char* org);
45
46 inline const char* org_name_() const { return org; }
47 inline const char* nom() const { return n; }
48
49 // Static methods:
50 static Sortie& hierarchie(Sortie&) ;
51 static int est_un_synonyme(const char*) ;
52
53 static const Synonyme_info * synonyme_info_from_name(const char * synonyme_name);
54 // static Objet_U* instance(const char* typ);
55 static void ajouter_synonyme(const Synonyme_info& synonyme_info);
56protected:
57
58private:
59 Synonyme_info(Synonyme_info&) {}; // Copy constructor invalid
60 Synonyme_info& operator=(Synonyme_info&); // operator= invalid
61
62
63 static void retirer_synonyme(const char *nom );
64 static int search_synonyme_info_name(const char *nom, int& index);
65
66 // The class name.
67 const char* n = "rien";
68 const char* org = "rien";
69
70 // List of Synonyme_info for classes declared by declare_base/declare_instanciable
71 // The list is sorted alphabetically (case-insensitive)
72 static const Synonyme_info** les_synonymes;
73
74 // Number of classes registered in "les_synonymes" and "synonymes_homonymes"
75 static int nb_classes;
76 // Memory size of the array "les_synonymes" and "synonymes_homonymes"
77 // (array resized in blocks)
78 static int les_synonymes_memsize;
79};
80
81#endif /* Synonyme_info_included */
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
An array of character strings (VECT(Nom)).
Definition Noms.h:26
Base class for TRUST objects (Objet_U).
Definition Objet_U.h:68
Base class for output streams.
Definition Sortie.h:52
Models synonym information for Objet_U objects.
const char * nom() const
static const Synonyme_info * synonyme_info_from_name(const char *synonyme_name)
Static method that returns a pointer to the Synonyme_info whose name is "synonyme_name".
static void ajouter_synonyme(const Synonyme_info &synonyme_info)
Static method called by Synonyme_info constructors to add a new synonym to the list of registered syn...
static int est_un_synonyme(const char *)
Tests whether a class synonym exists: if there is a class T whose Synonyme_info has.
const char * org_name_() const
static Sortie & hierarchie(Sortie &)
Writes the entire hierarchy of the considered synonym to an output stream.