Salome HOME
Merging from V3_2_6pre4
[modules/kernel.git] / src / SALOMEDSImpl / SALOMEDSImpl_IParameters.hxx
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
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 #ifndef SALOMEDSImpl_IParameters_H
20 #define SALOMEDSImpl_IParameters_H
21
22 #include <string>
23 #include <vector>
24 #include <map>
25
26 #include "SALOMEDSImpl_AttributeParameter.hxx"
27 #include "SALOMEDSImpl_Study.hxx"
28
29 /*! 
30   Class which an interface to store the parameters of the objects
31 */
32 class Standard_EXPORT SALOMEDSImpl_IParameters
33 {
34 public:
35   SALOMEDSImpl_IParameters(const Handle(SALOMEDSImpl_AttributeParameter)& ap); 
36
37   virtual ~SALOMEDSImpl_IParameters();
38
39   /*!
40     Appends a string value to a named list. 
41     Returns a number of the added value.
42     Note: the name of the list MUST be unique
43    */
44   virtual int append(const std::string& listName, const std::string& value); 
45
46   /*!
47     Returns a number elements in the list
48    */
49   virtual int nbValues(const std::string& listName);
50
51   /*!
52     Returns a list of values in the list
53    */
54   virtual std::vector<std::string> getValues(const std::string& listName);
55
56   /*!
57     Returns a value with given %index, where %index is in range [0:nbValues-1]
58    */
59   virtual std::string getValue(const std::string& listName, int index);
60
61   /*!
62     Returns a list all entries lists
63    */
64   virtual std::vector<std::string> getLists();
65
66   /*!
67     Sets a new named parameter value for the given entry
68    */
69   virtual void setParameter(const std::string& entry, const std::string& parameterName, const std::string& value);
70
71   /*!
72     Gets a named parameter value for the given entry
73    */
74   virtual std::string getParameter(const std::string& entry, const std::string& parameterName);
75
76   /*!
77     Returns all parameter names of the given entry
78    */
79   virtual std::vector<std::string> getAllParameterNames(const std::string& entry);
80
81   /*!
82     Returns all parameter  values of the given entry
83    */
84   virtual std::vector<std::string> getAllParameterValues(const std::string& entry);
85
86   /*!
87     Returns a number of parameters of the given entry
88    */
89   virtual int getNbParameters(const std::string& entry);
90
91   /*!
92     Returns a list all entries 
93    */
94   virtual std::vector<std::string> getEntries();
95
96   /*!
97     Sets a global named property value
98    */
99   virtual void setProperty(const std::string& name, const std::string& value);
100
101   /*!
102     Gets a value of global named property
103    */
104   virtual std::string getProperty(const std::string& name);
105
106   /*!
107     Returns a list all properties 
108    */
109   virtual std::vector<std::string> getProperties();
110
111   /*!
112     Returns decoded entry that is an absolute entry
113    */
114   virtual std::string decodeEntry(const std::string& entry);
115
116
117   /*!
118     Returns whether there is the dumping visual parameters
119    */
120   static bool isDumpPython(const Handle(SALOMEDSImpl_Study)& study, const string& theID = "");  
121
122   /*!
123     Returns an ID of the last save point
124   */
125   static int getLastSavePoint(const Handle(SALOMEDSImpl_Study)& study, const std::string& theID = "");
126
127   /*!
128     Returns a Python script for the study, which sets up visual parameters
129   */
130   static std::string getStudyScript(const Handle(SALOMEDSImpl_Study)& study, int savePoint, const std::string& theID = "");
131
132   /*!
133     Returns a default Python script that set ups visual parameters for the given module
134     shift is a string that contain spaces to make valid Python script indentaion
135   */
136   static std::string getDefaultScript(const Handle(SALOMEDSImpl_Study)& study, 
137                                       const std::string& moduleName, 
138                                       const std::string& shift,
139                                       const std::string& theID = "");
140
141   /*!
142     Returns a default name of the component where the visula parameters are stored.
143   */
144   static std::string getDefaultVisualComponent();
145
146 private:
147   Handle(SALOMEDSImpl_AttributeParameter) _ap;
148   Handle(SALOMEDSImpl_Study) _study;
149   std::map<std::string, std::string> _compNames;
150 };
151
152
153 #endif