Salome HOME
bd58813fb82c100beb6add6e5e72754498d4e851
[modules/hexablock.git] / src / HEXABLOCK / HexDumpStudy.hxx
1
2 // Class : Ecriture d'un dump python
3
4 // Copyright (C) 2009-2013  CEA/DEN, EDF R&D
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.
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/ 
21 // or email : webmaster.salome@opencascade.com
22
23 #ifndef __DUMP_STUDY_H_
24 #define __DUMP_STUDY_H_
25
26 #include "hexa_base.hxx"
27 #include <map>
28
29 BEGIN_NAMESPACE_HEXA
30
31
32 #define DumpStart0(p) bool actif=el_root->glob->dump.start(this, p)
33 #define DumpStart(p,args) bool actif=el_root->glob->dump.start(this, p); if (actif)  el_root->glob->dump << args
34 #define DumpEnd       el_root->glob->dump.close (actif)
35 #define DumpReturn(v) el_root->glob->dump.close (actif,v)
36
37 #define DumpLock    bool actif=el_root->glob->dump.lock ()
38 #define DumpRestore            el_root->glob->dump.restore (actif)
39
40 class Witness;
41 class DumpStudy
42 {
43 public :
44     DumpStudy ();
45     void setWitness (Witness* temoin)       { witness = temoin ; }
46
47     DumpStudy& operator << (int      val);
48     DumpStudy& operator << (double   val);
49     DumpStudy& operator << (cpchar   val);
50     DumpStudy& operator << (EltBase* elt);
51     DumpStudy& operator << (Edges&   elt);
52     DumpStudy& operator << (Quads&   elt);
53     DumpStudy& operator << (Hexas&   elt);
54     DumpStudy& operator << (RealVector& elt);
55
56     bool start (EltBase* obj, cpchar method);
57     bool start (cpchar   obj, cpchar method, bool razmess=true);
58     void close (bool reactive);
59     void close (bool reactive, EltBase* retour);
60     void close (bool reactive, int      retour);
61     void close (bool reactive, double   retour);
62
63     bool lock ();
64     void restore  (bool reactive);
65     void getBegin (string& begin);
66
67 private :
68    cpchar findName   (EltBase* elt);
69    void addArgVector (EnumElt type, TabElts& table);
70    void addArgument  (cpchar  arg);
71    void addArgument  (string& arg) { addArgument (arg.c_str()) ; }
72    void declareVectors ();
73    void addVector (cpchar name);
74    void majVector (cpchar value);
75    void closeVector ();
76
77 private :
78    std::map    <EltBase*, std::string> map_name;
79    std::vector <std::string>           tab_declar;
80
81    int    tab_count [EL_MAXI];
82    string curr_vector;
83    int    nbr_values;
84
85    FILE*    fic_dump;
86    string   this_name;
87    string   right_part;
88    bool     is_open;
89    int      nbr_nulls;
90    int      nbr_args;
91    Witness* witness;
92 };
93 END_NAMESPACE_HEXA
94 #endif