Salome HOME
Update copyright
[modules/smesh.git] / src / SMESH_I / SMESH_NoteBook.hxx
1 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // File      : SMESH_NoteBook.hxx
21 // Author    : Roman NIKOLAEV ()
22 //
23 #ifndef SMESH_NoteBook_HeaderFile
24 #define SMESH_NoteBook_HeaderFile
25
26 #include <TCollection_AsciiString.hxx>
27 #include <Resource_DataMapOfAsciiStringAsciiString.hxx>
28  
29 class _pyCommand;
30
31 #include <vector>
32 #include <string>
33
34 typedef std::vector<TCollection_AsciiString>  TState;
35 typedef std::vector<TState>                   TAllStates;
36 typedef TCollection_AsciiString _pyID;
37
38 class SMESH_ObjectStates{
39   
40 public:
41   
42   SMESH_ObjectStates(TCollection_AsciiString theType);
43   virtual ~SMESH_ObjectStates();
44
45   void AddState(const TState &theState);
46
47   TState GetCurrectState() const;
48   TAllStates GetAllStates() const;
49   void IncrementState();
50   TCollection_AsciiString GetObjectType() const;
51
52   
53
54 private:
55   TCollection_AsciiString                   _type;
56   TAllStates                                _states;
57   int                                       _dumpstate;
58 };
59
60 class LayerDistributionStates : public SMESH_ObjectStates
61 {
62 public:
63   typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TDistributionMap;
64   LayerDistributionStates();
65   virtual ~LayerDistributionStates();
66
67   void AddDistribution(const TCollection_AsciiString& theDistribution);
68   bool HasDistribution(const TCollection_AsciiString& theDistribution) const;
69
70   bool SetDistributionType(const TCollection_AsciiString& theDistribution,
71                            const TCollection_AsciiString& theType);
72   TCollection_AsciiString GetDistributionType(const TCollection_AsciiString& theDistribution) const;
73   
74 private:
75   
76   TDistributionMap _distributions;
77 };
78
79
80 class SMESH_NoteBook
81 {
82 public:
83   typedef std::map<TCollection_AsciiString,SMESH_ObjectStates*> TVariablesMap;
84   typedef std::map<TCollection_AsciiString,TCollection_AsciiString> TMeshEditorMap;
85   SMESH_NoteBook();
86   ~SMESH_NoteBook();
87   void ReplaceVariables();
88   
89   void AddCommand(const TCollection_AsciiString& theString);
90   TCollection_AsciiString GetResultScript() const;
91
92 private:
93   void InitObjectMap();
94   void ProcessLayerDistribution();
95
96   bool GetReal(const TCollection_AsciiString& theVarName, double& theValue);
97   
98 private:
99   
100   TVariablesMap _objectMap;
101   std::vector<Handle(_pyCommand)> _commands;
102   TMeshEditorMap myMeshEditors;
103 };
104
105 #endif //SMESH_NoteBook_HeaderFile