Back to index

salome-smesh  6.5.0
SMESH_PythonDump.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #ifndef _SMESH_PYTHONDUMP_HXX_
00024 #define _SMESH_PYTHONDUMP_HXX_
00025 
00026 #include "SMESH.hxx"
00027 
00028 #include <SALOMEconfig.h>
00029 #include CORBA_SERVER_HEADER(SMESH_Mesh)
00030 #include CORBA_SERVER_HEADER(SALOMEDS)
00031 
00032 #include <sstream>
00033 #include <vector>
00034 
00035 class SMESH_Gen_i;
00036 class SMESH_MeshEditor_i;
00037 class TCollection_AsciiString;
00038 class Resource_DataMapOfAsciiStringAsciiString;
00039 
00040 // ===========================================================================================
00046 // ===========================================================================================
00047 
00048 class SMESH_2smeshpy
00049 {
00050 public:
00060   static TCollection_AsciiString
00061   ConvertScript(const TCollection_AsciiString&            theScript,
00062                 Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
00063                 Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
00064                 SALOMEDS::Study_ptr&                      theStudy,
00065                 const bool                                theHistoricalDump);
00066 
00071   static const char* SmeshpyName() { return "smesh"; }
00072   static const char* GenName() { return "smesh"; }
00073 };
00074 
00075 namespace SMESH
00076 {
00077   class FilterLibrary_i;
00078   class FilterManager_i;
00079   class Filter_i;
00080   class Functor_i;
00081   class Measurements_i;
00082 
00083   // ===========================================================================================
00089   // ===========================================================================================
00090 
00091   struct SMESH_I_EXPORT TVar
00092   {
00093     std::vector< std::string > myVals;
00094     TVar(CORBA::Double value);
00095     TVar(CORBA::Long   value);
00096     TVar(CORBA::Short  value);
00097     TVar(const SMESH::double_array& value);
00098     // string used to temporary quote variable names in order
00099     // not to confuse variables with string arguments
00100     static char Quote() { return '$'; }
00101   };
00102 
00103   // ===========================================================================================
00107   // ===========================================================================================
00108 
00109   class SMESH_I_EXPORT TPythonDump
00110   {
00111     std::ostringstream myStream;
00112     static size_t      myCounter;
00113     int                myVarsCounter; // counts stored TVar's
00114   public:
00115     TPythonDump();
00116     virtual ~TPythonDump();
00117 
00118     TPythonDump&
00119     operator<<(const TVar& theVariableValue);
00120 
00121     TPythonDump&
00122     operator<<(long int theArg);
00123 
00124     TPythonDump&
00125     operator<<(int theArg);
00126 
00127     TPythonDump&
00128     operator<<(double theArg);
00129 
00130     TPythonDump&
00131     operator<<(float theArg);
00132 
00133     TPythonDump&
00134     operator<<(const void* theArg);
00135 
00136     TPythonDump&
00137     operator<<(const char* theArg);
00138 
00139     TPythonDump&
00140     operator<<(const SMESH::ElementType& theArg);
00141 
00142     TPythonDump&
00143     operator<<(const SMESH::GeometryType& theArg);
00144 
00145     TPythonDump&
00146     operator<<(const SMESH::long_array& theArg);
00147 
00148     TPythonDump&
00149     operator<<(const SMESH::double_array& theArg);
00150 
00151     TPythonDump&
00152     operator<<(const SMESH::string_array& theArg);
00153 
00154     TPythonDump&
00155     operator<<(SMESH::SMESH_Hypothesis_ptr theArg);
00156 
00157     TPythonDump&
00158     operator<<(SMESH::SMESH_IDSource_ptr theArg);
00159 
00160     TPythonDump&
00161     operator<<(SALOMEDS::SObject_ptr theArg);
00162 
00163     TPythonDump&
00164     operator<<(CORBA::Object_ptr theArg);
00165 
00166     TPythonDump&
00167     operator<<(SMESH::FilterLibrary_i* theArg);
00168 
00169     TPythonDump&
00170     operator<<(SMESH::FilterManager_i* theArg);
00171 
00172     TPythonDump&
00173     operator<<(SMESH::Filter_i* theArg);
00174 
00175     TPythonDump&
00176     operator<<(SMESH::Functor_i* theArg);
00177 
00178     TPythonDump&
00179     operator<<(SMESH::Measurements_i* theArg);
00180 
00181     TPythonDump&
00182     operator<<(SMESH_Gen_i* theArg);
00183 
00184     TPythonDump&
00185     operator<<(SMESH_MeshEditor_i* theArg);
00186 
00187     TPythonDump&
00188     operator<<(SMESH::MED_VERSION theArg);
00189 
00190     TPythonDump&
00191     operator<<(const SMESH::AxisStruct & theAxis);
00192 
00193     TPythonDump&
00194     operator<<(const SMESH::DirStruct & theDir);
00195 
00196     TPythonDump&
00197     operator<<(const SMESH::PointStruct & P);
00198 
00199     TPythonDump&
00200     operator<<(const TCollection_AsciiString & theArg);
00201 
00202     TPythonDump&
00203     operator<<(const SMESH::ListOfGroups& theList);
00204 
00205     TPythonDump&
00206     operator<<(const SMESH::ListOfGroups * theList);
00207 
00208     TPythonDump&
00209     operator<<(const SMESH::ListOfIDSources& theList);
00210 
00211     static const char* SMESHGenName() { return "smeshgen"; }
00212     static const char* MeshEditorName() { return "mesh_editor"; }
00213 
00220     static TCollection_AsciiString LongStringStart(const char* type);
00226     static TCollection_AsciiString LongStringEnd();
00238     static bool  CutoutLongString( TCollection_AsciiString & theText,
00239                                    int                     & theFrom,
00240                                    TCollection_AsciiString & theLongString,
00241                                    TCollection_AsciiString & theStringType);
00242   };
00243 }
00244 
00245 #endif