Salome HOME
Merging with WPdev
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
19
20 #ifndef _SMESH_PYTHONDUMP_HXX_
21 #define _SMESH_PYTHONDUMP_HXX_
22
23 #include "SMESH.hxx"
24
25 #include <SALOMEconfig.h>
26 #include CORBA_SERVER_HEADER(SMESH_Mesh)
27 #include CORBA_SERVER_HEADER(SALOMEDS)
28
29 #include <sstream>
30
31 class SMESH_Gen_i;
32 class SMESH_MeshEditor_i;
33 class TCollection_AsciiString;
34
35 namespace SMESH
36 {
37   class FilterLibrary_i;
38   class FilterManager_i;
39   class Filter_i;
40   class Functor_i;
41
42   class SMESH_I_EXPORT TPythonDump
43   {
44     std::ostringstream myStream;
45     static size_t myCounter;
46   public:
47     TPythonDump();
48     virtual ~TPythonDump();
49     
50     TPythonDump& 
51     operator<<(long int theArg);
52
53     TPythonDump& 
54     operator<<(int theArg);
55
56     TPythonDump& 
57     operator<<(double theArg);
58
59     TPythonDump& 
60     operator<<(float theArg);
61
62     TPythonDump& 
63     operator<<(const void* theArg);
64
65     TPythonDump& 
66     operator<<(const char* theArg);
67
68     TPythonDump& 
69     operator<<(const SMESH::ElementType& theArg);
70
71     TPythonDump& 
72     operator<<(const SMESH::long_array& theArg);
73
74     TPythonDump& 
75     operator<<(const SMESH::double_array& theArg);
76
77     TPythonDump& 
78     operator<<(SALOMEDS::SObject_ptr theArg);
79
80     TPythonDump& 
81     operator<<(CORBA::Object_ptr theArg);
82
83     TPythonDump& 
84     operator<<(SMESH::FilterLibrary_i* theArg);
85
86     TPythonDump& 
87     operator<<(SMESH::FilterManager_i* theArg);
88
89     TPythonDump& 
90     operator<<(SMESH::Filter_i* theArg);
91
92     TPythonDump& 
93     operator<<(SMESH::Functor_i* theArg);
94
95     TPythonDump& 
96     operator<<(SMESH_Gen_i* theArg);
97
98     TPythonDump& 
99     operator<<(SMESH_MeshEditor_i* theArg);
100
101     TPythonDump& 
102     operator<<(SMESH::MED_VERSION theArg);
103
104     TPythonDump&
105     operator<<(const SMESH::AxisStruct & theAxis);
106
107     TPythonDump&
108     operator<<(const SMESH::DirStruct & theDir);
109
110     TPythonDump&
111     operator<<(const TCollection_AsciiString & theArg);
112
113     static char* SMESHGenName() { return "smeshgen"; }
114     static char* MeshEditorName() { return "mesh_editor"; }
115
116     /*!
117      * \brief Return marker of long string literal beginning
118       * \param type - a name of functionality producing the string literal 
119       * \retval TCollection_AsciiString - the marker string to be written into
120       * a raw python script
121      */
122     static TCollection_AsciiString LongStringStart(const char* type);
123     /*!
124      * \brief Return marker of long string literal end
125       * \retval TCollection_AsciiString - the marker string to be written into
126       * a raw python script
127      */
128     static TCollection_AsciiString LongStringEnd();
129     /*!
130      * \brief Cut out a long string literal from a string
131       * \param theText - text possibly containing string literals
132       * \param theFrom - position in the text to search from
133       * \param theLongString - the retrieved literal
134       * \param theStringType - a name of functionality produced the literal
135       * \retval bool - true if a string literal found
136      * 
137      * The literal is removed from theText; theFrom points position right after
138      * the removed literal
139      */
140     static bool  CutoutLongString( TCollection_AsciiString & theText,
141                                    int                     & theFrom,
142                                    TCollection_AsciiString & theLongString,
143                                    TCollection_AsciiString & theStringType);
144   };
145 }
146
147
148 #endif