Version: 8.3.0
SMESH_PythonDump.hxx
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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 _SMESH_PYTHONDUMP_HXX_
24 #define _SMESH_PYTHONDUMP_HXX_
25 
26 #include "SMESH.hxx"
27 
28 #include <SALOMEconfig.h>
29 #include CORBA_SERVER_HEADER(SMESH_Mesh)
30 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
31 #include CORBA_SERVER_HEADER(GEOM_Gen)
32 #include CORBA_SERVER_HEADER(SALOMEDS)
33 
34 #include <TCollection_AsciiString.hxx>
35 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
36 
37 #include <sstream>
38 #include <vector>
39 #include <set>
40 #include <list>
41 
42 class SMESH_Gen_i;
43 class SMESH_MeshEditor_i;
44 
45 // ===========================================================================================
51 // ===========================================================================================
52 
54 {
55 public:
67  static void
68  ConvertScript(std::list< TCollection_AsciiString >& theScriptLines,
69  Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
70  Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
71  std::set< TCollection_AsciiString >& theRemovedObjIDs,
72  SALOMEDS::Study_ptr& theStudy,
73  const bool theHistoricalDump);
74 
79  static const char* SmeshpyName() { return "smesh"; }
80  static const char* GenName() { return "smesh"; }
81 };
82 
83 namespace SMESH
84 {
85  class FilterLibrary_i;
86  class FilterManager_i;
87  class Filter_i;
88  class Functor_i;
89  class Measurements_i;
90 
91  // ===========================================================================================
97  // ===========================================================================================
98 
100  {
101  std::vector< std::string > myVals;
102  bool myIsList;
103  TVar(CORBA::Double value);
104  TVar(CORBA::Long value);
105  TVar(CORBA::Short value);
106  TVar(const SMESH::double_array& value);
107  // string used to temporary quote variable names in order
108  // not to confuse variables with string arguments
109  static char Quote() { return '$'; }
110  // string preceding an entry of object storing the attribute holding var names
111  static const char* ObjPrefix() { return " # OBJ: "; }
112  };
113 
114  // ===========================================================================================
118  // ===========================================================================================
119 
121  {
122  std::ostringstream myStream;
123  static size_t myCounter;
124  int myVarsCounter; // counts stored TVar's
125  public:
126  TPythonDump();
127  virtual ~TPythonDump();
128 
129  TPythonDump&
130  operator<<(const TVar& theVariableValue);
131 
132  TPythonDump&
133  operator<<(long int theArg);
134 
135  TPythonDump&
136  operator<<(int theArg);
137 
138  TPythonDump&
139  operator<<(double theArg);
140 
141  TPythonDump&
142  operator<<(float theArg);
143 
144  TPythonDump&
145  operator<<(const void* theArg);
146 
147  TPythonDump&
148  operator<<(const char* theArg);
149 
150  TPythonDump&
151  operator<<(const SMESH::ElementType& theArg);
152 
153  TPythonDump&
154  operator<<(const SMESH::GeometryType& theArg);
155 
156  TPythonDump&
157  operator<<(const SMESH::EntityType& theArg);
158 
159  TPythonDump&
160  operator<<(const SMESH::long_array& theArg);
161 
162  TPythonDump&
163  operator<<(const SMESH::double_array& theArg);
164 
165  TPythonDump&
166  operator<<(const SMESH::string_array& theArg);
167 
168  TPythonDump&
169  operator<<(const SMESH::nodes_array& theArg);
170 
171  TPythonDump&
172  operator<<(SMESH::SMESH_Hypothesis_ptr theArg);
173 
174  TPythonDump&
175  operator<<(SMESH::SMESH_IDSource_ptr theArg);
176 
177  TPythonDump&
178  operator<<(SALOMEDS::SObject_ptr theArg);
179 
180  TPythonDump&
181  operator<<(CORBA::Object_ptr theArg);
182 
183  TPythonDump&
185 
186  TPythonDump&
188 
189  TPythonDump&
190  operator<<(SMESH::Filter_i* theArg);
191 
192  TPythonDump&
193  operator<<(SMESH::Functor_i* theArg);
194 
195  TPythonDump&
197 
198  TPythonDump&
199  operator<<(SMESH_Gen_i* theArg);
200 
201  TPythonDump&
203 
204  TPythonDump&
206 
207  TPythonDump&
208  operator<<(const SMESH::AxisStruct & theAxis);
209 
210  TPythonDump&
211  operator<<(const SMESH::DirStruct & theDir);
212 
213  TPythonDump&
214  operator<<(const SMESH::PointStruct & P);
215 
216  TPythonDump&
217  operator<<(const TCollection_AsciiString & theArg);
218 
219  TPythonDump&
220  operator<<(const SMESH::ListOfGroups& theList);
221 
222  TPythonDump&
223  operator<<(const SMESH::ListOfGroups * theList);
224 
225  TPythonDump&
226  operator<<(const GEOM::ListOfGO& theList);
227 
228  TPythonDump&
229  operator<<(const GEOM::ListOfGBO& theList);
230 
231  TPythonDump&
232  operator<<(const SMESH::ListOfIDSources& theList);
233 
234  TPythonDump&
236 
237  TPythonDump&
238  operator<<(const std::string& theArg);
239 
240  static const char* SMESHGenName() { return "smeshgen"; }
241  static const char* MeshEditorName() { return "mesh_editor"; }
242  static const char* NotPublishedObjectName();
243 
250  static TCollection_AsciiString LongStringStart(const char* type);
256  static TCollection_AsciiString LongStringEnd();
268  static bool CutoutLongString( TCollection_AsciiString & theText,
269  int & theFrom,
270  TCollection_AsciiString & theLongString,
271  TCollection_AsciiString & theStringType);
272  };
273 }
274 
275 #endif