Salome HOME
Updated copyright comment
[modules/hexablock.git] / src / HEXABLOCK / HexDumpStudy.hxx
1
2 // Class : Ecriture d'un dump python
3
4 // Copyright (C) 2009-2024  CEA, EDF
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #ifndef __DUMP_STUDY_H_
24 #define __DUMP_STUDY_H_
25
26 #include "hexa_base.hxx"
27 #include <map>
28
29 #if defined WIN32
30 #pragma warning ( disable: 4251 )
31 #endif
32
33 BEGIN_NAMESPACE_HEXA
34
35 #define DumpStart0(p) bool actif=el_root->glob->dump.start(this, p)
36 #define DumpStart(p,args) bool actif=el_root->glob->dump.start(this, p); if (actif)  el_root->glob->dump << args
37 #define DumpEnd       el_root->glob->dump.close (actif)
38 #define DumpReturn(v) el_root->glob->dump.close (actif,v)
39
40 #define DumpLock    bool actif=el_root->glob->dump.lock ()
41 #define DumpRestore            el_root->glob->dump.restore (actif)
42
43 class Witness;
44 class HexaExport DumpStudy
45 {
46 public :
47     DumpStudy ();
48     void setWitness (Witness* temoin)       { witness = temoin ; }
49
50     DumpStudy& operator << (int      val);
51     DumpStudy& operator << (double   val);
52     DumpStudy& operator << (cpchar   val);
53     DumpStudy& operator << (EltBase* elt);
54     DumpStudy& operator << (Edges&   elt);
55     DumpStudy& operator << (Quads&   elt);
56     DumpStudy& operator << (Hexas&   elt);
57     DumpStudy& operator << (RealVector& elt);
58
59     bool start (EltBase* obj, cpchar method);
60     bool start (cpchar   obj, cpchar method, bool razmess=true);
61     void close (bool reactive);
62     void close (bool reactive, EltBase* retour);
63     void close (bool reactive, int      retour);
64     void close (bool reactive, double   retour);
65
66     bool lock ();
67     void restore  (bool reactive);
68     void getBegin (std::string& begin);
69
70 private :
71    cpchar findName   (EltBase* elt);
72    void addArgVector (EnumElt type, TabElts& table);
73    void addArgument  (cpchar  arg);
74    void addArgument  (std::string& arg) { addArgument (arg.c_str()) ; }
75    void declareVectors ();
76    void addVector (cpchar name);
77    void majVector (cpchar value);
78    void closeVector ();
79
80 private :
81    std::map    <EltBase*, std::string> map_name;
82    std::vector <std::string>           tab_declar;
83
84    int    tab_count [EL_MAXI];
85    std::string curr_vector;
86    int    nbr_values;
87
88    FILE*    fic_dump;
89    std::string   this_name;
90    std::string   right_part;
91    bool     is_open;
92    int      nbr_nulls;
93    int      nbr_args;
94    Witness* witness;
95 };
96 END_NAMESPACE_HEXA
97 #endif