Salome HOME
Merge from BR_V5_DEV 16Feb09
[modules/smesh.git] / src / SMESH_I / SMESH_NoteBook.hxx
1 // Copyright (C) 2008  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 // File      : SMESH_NoteBook.hxx
21 // Author    : Roman NIKOLAEV ()
22
23
24 #ifndef SMESH_NoteBook_HeaderFile
25 #define SMESH_NoteBook_HeaderFile
26
27 #include <TCollection_AsciiString.hxx>
28 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
29  
30 class _pyCommand;
31
32 #include <vector>
33 #include <string>
34
35 typedef std::vector<TCollection_AsciiString>  TState;
36 typedef std::vector<TState>                   TAllStates;
37 typedef TCollection_AsciiString _pyID;
38
39 class ObjectStates{
40   
41 public:
42   
43   ObjectStates(TCollection_AsciiString theType);
44   virtual ~ObjectStates();
45
46   void AddState(const TState &theState);
47
48   TState GetCurrectState() const;
49   TAllStates GetAllStates() const;
50   void IncrementState();
51   TCollection_AsciiString GetObjectType() const;
52
53   
54
55 private:
56   TCollection_AsciiString                   _type;
57   TAllStates                                _states;
58   int                                       _dumpstate;
59 };
60
61 class LayerDistributionStates : public ObjectStates
62 {
63 public:
64   typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TDistributionMap;
65   LayerDistributionStates();
66   virtual ~LayerDistributionStates();
67
68   void AddDistribution(const TCollection_AsciiString& theDistribution);
69   bool HasDistribution(const TCollection_AsciiString& theDistribution) const;
70
71   bool SetDistributionType(const TCollection_AsciiString& theDistribution,
72                            const TCollection_AsciiString& theType);
73   TCollection_AsciiString GetDistributionType(const TCollection_AsciiString& theDistribution) const;
74   
75 private:
76   
77   TDistributionMap _distributions;
78 };
79
80
81 class SMESH_NoteBook
82 {
83 public:
84   typedef std::map<TCollection_AsciiString,ObjectStates*> TVariablesMap;
85   typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TMeshEditorMap;
86   SMESH_NoteBook();
87   ~SMESH_NoteBook();
88   void ReplaceVariables();
89   
90   void AddCommand(const TCollection_AsciiString& theString);
91   TCollection_AsciiString GetResultScript() const;
92
93 private:
94   void InitObjectMap();
95   void ProcessLayerDistribution();
96
97   bool GetReal(const TCollection_AsciiString& theVarName, double& theValue);
98   
99 private:
100   
101   TVariablesMap _objectMap;
102   std::vector<Handle(_pyCommand)> _commands;
103   TMeshEditorMap myMeshEditors;
104 };
105
106 #endif //SMESH_NoteBook_HeaderFile