Version: 6.3.1

src/SMESH_I/SMESH_NoteBook.hxx

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  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 #include <TCollection_AsciiString.hxx>
00027 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
00028  
00029 class _pyCommand;
00030 
00031 #include <vector>
00032 #include <string>
00033 
00034 typedef std::vector<TCollection_AsciiString>  TState;
00035 typedef std::vector<TState>                   TAllStates;
00036 typedef TCollection_AsciiString _pyID;
00037 
00038 class SMESH_ObjectStates{
00039   
00040 public:
00041   
00042   SMESH_ObjectStates(TCollection_AsciiString theType);
00043   virtual ~SMESH_ObjectStates();
00044 
00045   void AddState(const TState &theState);
00046 
00047   TState GetCurrectState() const;
00048   TAllStates GetAllStates() const;
00049   void IncrementState();
00050   TCollection_AsciiString GetObjectType() const;
00051 
00052   
00053 
00054 private:
00055   TCollection_AsciiString                   _type;
00056   TAllStates                                _states;
00057   int                                       _dumpstate;
00058 };
00059 
00060 class LayerDistributionStates : public SMESH_ObjectStates
00061 {
00062 public:
00063   typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TDistributionMap;
00064   LayerDistributionStates();
00065   virtual ~LayerDistributionStates();
00066 
00067   void AddDistribution(const TCollection_AsciiString& theDistribution);
00068   bool HasDistribution(const TCollection_AsciiString& theDistribution) const;
00069 
00070   bool SetDistributionType(const TCollection_AsciiString& theDistribution,
00071                            const TCollection_AsciiString& theType);
00072   TCollection_AsciiString GetDistributionType(const TCollection_AsciiString& theDistribution) const;
00073   
00074 private:
00075   
00076   TDistributionMap _distributions;
00077 };
00078 
00079 
00080 class SMESH_NoteBook
00081 {
00082 public:
00083   typedef std::map<TCollection_AsciiString,SMESH_ObjectStates*> TVariablesMap;
00084   typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TMeshEditorMap;
00085   SMESH_NoteBook();
00086   ~SMESH_NoteBook();
00087   void ReplaceVariables();
00088   
00089   void AddCommand(const TCollection_AsciiString& theString);
00090   TCollection_AsciiString GetResultScript() const;
00091 
00092 private:
00093   void InitObjectMap();
00094   void ProcessLayerDistribution();
00095 
00096   bool GetReal(const TCollection_AsciiString& theVarName, double& theValue);
00097   
00098 private:
00099   
00100   TVariablesMap _objectMap;
00101   std::vector<Handle(_pyCommand)> _commands;
00102   TMeshEditorMap myMeshEditors;
00103 };
00104 
00105 #endif //SMESH_NoteBook_HeaderFile
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS