Back to index

salome-smesh  6.5.0
SMESH_NoteBook.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // File      : SMESH_NoteBook.hxx
00021 // Author    : Roman NIKOLAEV ()
00022 //
00023 #ifndef SMESH_NoteBook_HeaderFile
00024 #define SMESH_NoteBook_HeaderFile
00025 
00026 // All this stuff is obsolete since issue 0021308:
00027 // "Remove hard-coded dependency of the external mesh plugins from the SMESH module"
00028 // is implemented (Mar 2012). It is kept for backward compatibility only.
00029 
00030 #include <TCollection_AsciiString.hxx>
00031 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
00032  
00033 class _pyCommand;
00034 
00035 #include <vector>
00036 #include <string>
00037 
00038 typedef std::vector<TCollection_AsciiString>  TState;
00039 typedef std::vector<TState>                   TAllStates;
00040 typedef TCollection_AsciiString               _pyID;
00041 
00042 class SMESH_ObjectStates{
00043   
00044 public:
00045   
00046   SMESH_ObjectStates(TCollection_AsciiString theType);
00047   virtual ~SMESH_ObjectStates();
00048 
00049   void AddState(const TState &theState);
00050 
00051   TState GetCurrectState() const;
00052   TAllStates GetAllStates() const;
00053   void IncrementState();
00054   TCollection_AsciiString GetObjectType() const;
00055 
00056   
00057 
00058 private:
00059   TCollection_AsciiString                   _type;
00060   TAllStates                                _states;
00061   int                                       _dumpstate;
00062 };
00063 
00064 class LayerDistributionStates : public SMESH_ObjectStates
00065 {
00066 public:
00067   typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TDistributionMap;
00068   LayerDistributionStates();
00069   virtual ~LayerDistributionStates();
00070 
00071   void AddDistribution(const TCollection_AsciiString& theDistribution);
00072   bool HasDistribution(const TCollection_AsciiString& theDistribution) const;
00073 
00074   bool SetDistributionType(const TCollection_AsciiString& theDistribution,
00075                            const TCollection_AsciiString& theType);
00076   TCollection_AsciiString GetDistributionType(const TCollection_AsciiString& theDistribution) const;
00077   
00078 private:
00079   
00080   TDistributionMap _distributions;
00081 };
00082 
00083 
00084 class SMESH_NoteBook
00085 {
00086 public:
00087   typedef std::map<TCollection_AsciiString,SMESH_ObjectStates*> TVariablesMap;
00088   typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TMeshEditorMap;
00089   SMESH_NoteBook();
00090   ~SMESH_NoteBook();
00091   void ReplaceVariables();
00092   
00093   void AddCommand(const TCollection_AsciiString& theString);
00094   TCollection_AsciiString GetResultScript() const;
00095 
00096 private:
00097   void InitObjectMap();
00098   void ProcessLayerDistribution();
00099 
00100   bool GetReal(const TCollection_AsciiString& theVarName, double& theValue);
00101   
00102 private:
00103   
00104   TVariablesMap _objectMap;
00105   std::vector<Handle(_pyCommand)> _commands;
00106   TMeshEditorMap myMeshEditors;
00107 };
00108 
00109 #endif //SMESH_NoteBook_HeaderFile