Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/smesh.git] / src / SMESH_I / SMESH_PythonDump.hxx
1 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
3 // 
4 //  This library is free software; you can redistribute it and/or 
5 //  modify it under the terms of the GNU Lesser General Public 
6 //  License as published by the Free Software Foundation; either 
7 //  version 2.1 of the License. 
8 // 
9 //  This library is distributed in the hope that it will be useful, 
10 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 //  Lesser General Public License for more details. 
13 // 
14 //  You should have received a copy of the GNU Lesser General Public 
15 //  License along with this library; if not, write to the Free Software 
16 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
17 // 
18 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
19
20 #ifndef _SMESH_PYTHONDUMP_HXX_
21 #define _SMESH_PYTHONDUMP_HXX_
22
23 #include <SALOMEconfig.h>
24 #include CORBA_SERVER_HEADER(SMESH_Mesh)
25 #include CORBA_SERVER_HEADER(SALOMEDS)
26
27 #include <sstream>
28
29 class SMESH_Gen_i;
30 class SMESH_MeshEditor_i;
31 class TCollection_AsciiString;
32
33 namespace SMESH
34 {
35   class FilterLibrary_i;
36   class FilterManager_i;
37   class Filter_i;
38   class Functor_i;
39
40   class TPythonDump
41   {
42     std::ostringstream myStream;
43     static size_t myCounter;
44   public:
45     TPythonDump();
46     virtual ~TPythonDump();
47     
48     TPythonDump& 
49     operator<<(long int theArg);
50
51     TPythonDump& 
52     operator<<(int theArg);
53
54     TPythonDump& 
55     operator<<(double theArg);
56
57     TPythonDump& 
58     operator<<(float theArg);
59
60     TPythonDump& 
61     operator<<(const void* theArg);
62
63     TPythonDump& 
64     operator<<(const char* theArg);
65
66     TPythonDump& 
67     operator<<(const SMESH::ElementType& theArg);
68
69     TPythonDump& 
70     operator<<(const SMESH::long_array& theArg);
71
72     TPythonDump& 
73     operator<<(const SMESH::double_array& theArg);
74
75     TPythonDump& 
76     operator<<(SALOMEDS::SObject_ptr theArg);
77
78     TPythonDump& 
79     operator<<(CORBA::Object_ptr theArg);
80
81     TPythonDump& 
82     operator<<(SMESH::FilterLibrary_i* theArg);
83
84     TPythonDump& 
85     operator<<(SMESH::FilterManager_i* theArg);
86
87     TPythonDump& 
88     operator<<(SMESH::Filter_i* theArg);
89
90     TPythonDump& 
91     operator<<(SMESH::Functor_i* theArg);
92
93     TPythonDump& 
94     operator<<(SMESH_Gen_i* theArg);
95
96     TPythonDump& 
97     operator<<(SMESH_MeshEditor_i* theArg);
98
99     TPythonDump& 
100     operator<<(SMESH::MED_VERSION theArg);
101
102     TPythonDump&
103     operator<<(const SMESH::AxisStruct & theAxis);
104
105     TPythonDump&
106     operator<<(const SMESH::DirStruct & theDir);
107
108     TPythonDump&
109     operator<<(const TCollection_AsciiString & theArg);
110
111     static char* SMESHGenName() { return "smeshgen"; }
112     static char* MeshEditorName() { return "mesh_editor"; }
113
114     /*!
115      * \brief Return marker of long string literal beginning
116       * \param type - a name of functionality producing the string literal 
117       * \retval TCollection_AsciiString - the marker string to be written into
118       * a raw python script
119      */
120     static TCollection_AsciiString LongStringStart(const char* type);
121     /*!
122      * \brief Return marker of long string literal end
123       * \retval TCollection_AsciiString - the marker string to be written into
124       * a raw python script
125      */
126     static TCollection_AsciiString LongStringEnd();
127     /*!
128      * \brief Cut out a long string literal from a string
129       * \param theText - text possibly containing string literals
130       * \param theFrom - position in the text to search from
131       * \param theLongString - the retrieved literal
132       * \param theStringType - a name of functionality produced the literal
133       * \retval bool - true if a string literal found
134      * 
135      * The literal is removed from theText; theFrom points position right after
136      * the removed literal
137      */
138     static bool  CutoutLongString( TCollection_AsciiString & theText,
139                                    int                     & theFrom,
140                                    TCollection_AsciiString & theLongString,
141                                    TCollection_AsciiString & theStringType);
142   };
143 }
144
145
146 #endif