Salome HOME
PR: merge from branch BR_auto_V310 tag mergefrom_OCC_development_for_3_2_0a2_10mar06
[modules/kernel.git] / src / SALOMEDS / SALOMEDS_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/
18 //
19 #ifndef SALOMEDS_IParameters_H
20 #define SALOMEDS_IParameters_H
21
22 #include <string>
23 #include <vector>
24 #include <map>
25
26 #include "SALOMEDSClient.hxx"
27
28 /*! 
29   Class which an interface to store the parameters of the objects
30 */
31 class SALOMEDS_IParameters
32 {
33 public:
34   SALOMEDS_IParameters(const _PTR(AttributeParameter)& ap); 
35
36   virtual ~SALOMEDS_IParameters();
37
38   /*!
39     Appends a string value to a named list. 
40     Returns a number of the added value.
41     Note: the name of the list MUST be unique
42    */
43   virtual int append(const std::string& listName, const std::string& value); 
44
45   /*!
46     Returns a number elements in the list
47    */
48   virtual int nbValues(const std::string& listName);
49
50   /*!
51     Returns a list of values in the list
52    */
53   virtual std::vector<std::string> getValues(const std::string& listName);
54
55   /*!
56     Returns a value with given %index, where %index is in range [0:nbValues-1]
57    */
58   virtual std::string getValue(const std::string& listName, int index);
59
60   /*!
61     Returns a list all entries lists
62    */
63   virtual std::vector<std::string> getLists();
64
65   /*!
66     Sets a new named parameter value for the given entry
67    */
68   virtual void setParameter(const std::string& entry, const std::string& parameterName, const std::string& value);
69
70   /*!
71     Gets a named parameter value for the given entry
72    */
73   virtual std::string getParameter(const std::string& entry, const std::string& parameterName);
74
75   /*!
76     Returns all parameter names of the given entry
77    */
78   virtual std::vector<std::string> getAllParameterNames(const std::string& entry);
79
80   /*!
81     Returns all parameter  values of the given entry
82    */
83   virtual std::vector<std::string> getAllParameterValues(const std::string& entry);
84
85   /*!
86     Returns a number of parameters of the given entry
87    */
88   virtual int getNbParameters(const std::string& entry);
89
90   /*!
91     Returns a list all entries 
92    */
93   virtual std::vector<std::string> getEntries();
94
95   /*!
96     Sets a global named property value
97    */
98   virtual void setProperty(const std::string& name, const std::string& value);
99
100   /*!
101     Gets a value of global named property
102    */
103   virtual std::string getProperty(const std::string& name);
104
105   /*!
106     Returns a list all properties 
107    */
108   virtual std::vector<std::string> getProperties();
109
110   /*!
111     Breaks a value string in two parts which is divided by %separator.
112     If fromEnd is True the search of separator starts from the end of the string
113    */
114   virtual std::vector<std::string> parseValue(const std::string& value, const char separator, bool fromEnd = true);
115
116
117   /*!
118     Returns encoded entry that is a relative entry for the component
119    */
120   virtual std::string encodeEntry(const std::string& entry, const std::string& compName);
121
122   /*!
123     Returns decoded entry that is an absolute entry
124    */
125   virtual std::string decodeEntry(const std::string& entry);
126
127   /*!
128     Enables/Disables the dumping visual parameters
129    */
130   static void setDumpPython(_PTR(Study) study, const std::string& theID = "");
131
132   /*!
133     Returns whether there is the dumping visual parameters
134    */
135   static bool isDumpPython(_PTR(Study) study, const std::string& theID = "");  
136
137   /*!
138     Returns a default name of the component where the visula parameters are stored.
139   */
140   static std::string getDefaultVisualComponent();
141
142 private:
143   _PTR(AttributeParameter) _ap;
144   _PTR(Study) _study;
145   std::map<std::string, std::string> _compNames;
146 };
147
148
149 #endif