Salome HOME
c94c54bd920a02cf0b0524d9ebdcef897b8c4de9
[modules/hexablock.git] / src / HEXABLOCK / HexWitness.hxx
1
2 // Class : Enregistrement des dianostics
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 __WITNESS_H_
24 #define __WITNESS_H_
25
26 #define  Mess   el_root->glob->mess << Begin
27 #define  Follow el_root->glob->mess
28
29 #include "hexa_base.hxx"
30
31 BEGIN_NAMESPACE_HEXA
32
33 const std::string Begin (" **** ");
34
35 class DumpStudy;
36 class Witness
37 {
38 public :
39    Witness ();
40    void     setDump (DumpStudy* dd)      { dump_study = dd                ; }
41    void     raz ()                       { mess_state = NoMessage         ; }
42    bool     hasMessage ()                { return mess_state != NoMessage ; }
43    TabText& getMessage ();
44    int      sizeofMessage  ();
45    cpchar   getLine (int nro);
46    void     printMessage ();
47
48    Witness& operator << (int      val);
49    Witness& operator << (double   val);
50    Witness& operator << (cpchar   val);
51    Witness& operator << (rcstring val);
52    Witness& operator << (EltBase* val);
53
54 private :
55    void openMessage  ();
56    void closeMessage () {};
57    void pushLine     ();
58
59 private :
60    TabText      bla_bla;
61    std::string  curr_line; 
62    int          w_status;
63    int          nbr_lines;
64    enum EnumMessage { NoMessage, MessOpen, MessClosed }  mess_state;
65    bool         line_open;
66    DumpStudy*   dump_study;
67 };
68 END_NAMESPACE_HEXA
69 #endif