Back to index

salome-kernel  6.5.0
Public Member Functions | Private Attributes
KERNEL_PY.iparameters.IParameters Class Reference

List of all members.

Public Member Functions

def __init__
def clear
def append
def nbValues
def getValues
def getLists
def setParameter
def getParameter
def getAllParameterNames
def getAllParameterValues
def getNbParameters
def getEntries
def setProperty
def getProperty
def getProperties
def parseValue
def setDumpPython
def isDumpPython

Private Attributes

 _ap

Detailed Description

Interface IParameters was designed to provide a common way to set up
named parameters. The interface is initialized by AttributeParameter that
is used as a container of stored data.
The interface supports 3 types of named parameters:
1. Named list - a named list consists of string values.
   One can append value to list (method 'append'), get a number of values
   in the list (method 'nbValues'), get all values of the given list
   (method 'getValues') and get names of all created named lists.
2. Parameters - that is a set of named string values associated with some named
   entity. Parameter consists of tree elements: entity name, a parameter name
   and a parameter value. Thus for one named entity there are an arbitrary number
   of pair 'name parameter : value'.
   One can add a new parameter to entry (method 'setParameter'), get a value of
   a given named parameter of the given entry (method 'getParameter'), get a number
   of parameters of the given entry (method 'getNbParameters'), get all names of
   parameters for the given entry (method 'getAllParameterNames'), get all
   values of parameters for the entry (method 'getAllParameterValues') and get all
   stored entries (method 'getEntries')
3. Property - a property has a name and a string value.
   One can set property (method 'setProperty'), getProperty (method 'getProperty') and
   get a list of all stored properties (method 'getProperties').

Note:   
      Methods not mentioned above are private and is not supposed to be used
      by module's developers.

Definition at line 53 of file iparameters.py.


Constructor & Destructor Documentation

def KERNEL_PY.iparameters.IParameters.__init__ (   self,
  attributeParameter,
  clr = False 
)
Initializes the instance. If clr parameter is True, all IAPP attribute values are cleared.

Definition at line 82 of file iparameters.py.

00082 
00083     def __init__(self, attributeParameter, clr=False):
00084         """Initializes the instance. If clr parameter is True, all IAPP attribute values are cleared."""
00085         self._ap = attributeParameter
00086         if ( clr ): self.clear()
00087         pass
       

Member Function Documentation

def KERNEL_PY.iparameters.IParameters.append (   self,
  listName,
  value 
)
Appends a value to the named list

Definition at line 92 of file iparameters.py.

00092 
00093     def append(self, listName, value):
00094         """Appends a value to the named list"""
00095         if self._ap is None: return -1
00096         v = []
00097         if self._ap.IsSet(listName, PT_STRARRAY) == 0:
00098             if self._ap.IsSet(_AP_LISTS_LIST_, PT_STRARRAY) == 0: self._ap.SetStrArray(_AP_LISTS_LIST_, v);
00099             if listName != _AP_ENTRIES_LIST_ and listName != _AP_PROPERTIES_LIST_:
00100                 self.append(_AP_LISTS_LIST_, listName)
00101                 pass
00102             self._ap.SetStrArray(listName, v)
00103             pass
00104         
00105         v = self._ap.GetStrArray(listName)
00106         v.append(value)
00107         self._ap.SetStrArray(listName, v)
00108         return (len(v)-1)
    

Here is the call graph for this function:

Here is the caller graph for this function:

Clear parameters

Definition at line 88 of file iparameters.py.

00088 
00089     def clear(self):
00090         """Clear parameters"""
00091        self._ap.Clear()

Here is the caller graph for this function:

Returns all parameter names of the given entry

Definition at line 159 of file iparameters.py.

00159 
00160     def getAllParameterNames(self, entry):
00161         """Returns all parameter names of the given entry"""
00162         v = []
00163         names = []
00164         if self._ap is None: return v
00165         if self._ap.IsSet(entry, PT_STRARRAY) == 0: return v
00166         v = self._ap.GetStrArray(entry)
00167         length = len(v)
00168         i = 0
00169         while i<length:
00170             names.append(v[i])
00171             i+=2
00172             pass
00173         
00174         return names

Returns all parameter values of the given entry

Definition at line 175 of file iparameters.py.

00175 
00176     def getAllParameterValues(self, entry):
00177         """Returns all parameter values of the given entry"""
00178         v = []
00179         values = []
00180         if self._ap is None: return v
00181         if self._ap.IsSet(entry, PT_STRARRAY) == 0: return v
00182         v = self._ap.GetStrArray(entry)
00183         length = len(v)
00184         i = 1
00185         while i<length:
00186             values.append(v[i]+1)
00187             i+=2
00188             pass
00189         
00190         return values

Returns all entries

Definition at line 197 of file iparameters.py.

00197 
00198     def getEntries(self):
00199         """Returns all entries"""
00200         v = []
00201         if self._ap is None: return v
00202         if self._ap.IsSet(_AP_ENTRIES_LIST_, PT_STRARRAY) == 0: return v
00203         return self._ap.GetStrArray(_AP_ENTRIES_LIST_)

Returns a list of named lists' names

Definition at line 123 of file iparameters.py.

00123 
00124     def getLists(self):
00125         """Returns a list of named lists' names"""
00126         v = []
00127         if self._ap is None: return v
00128         if self._ap.IsSet(_AP_LISTS_LIST_, PT_STRARRAY) == 0: return v
00129         return self._ap.GetStrArray(_AP_LISTS_LIST_)

Returns a number of parameters of the entry

Definition at line 191 of file iparameters.py.

00191 
00192     def getNbParameters(self, entry):
00193         """Returns a number of parameters of the entry"""
00194         if self._ap is None: return -1
00195         if self._ap.IsSet(entry, PT_STRARRAY) == 0: return -1
00196         return len(self._ap.GetStrArray(entry))/2

def KERNEL_PY.iparameters.IParameters.getParameter (   self,
  entry,
  parameterName 
)
Returns a value of the named parameter for the entry

Definition at line 145 of file iparameters.py.

00145 
00146     def getParameter(self, entry, parameterName):
00147         """Returns a value of the named parameter for the entry"""
00148         if self._ap is None: return ""
00149         if self._ap.IsSet(entry, PT_STRARRAY) == 0: return ""
00150         v = self._ap.GetStrArray(entry)
00151         length = len(v);
00152         i = 0
00153         while i<length:
00154             if v[i] == parameterName: return v[i+1]
00155             i+=1
00156             pass
00157         
00158         return ""

Returns all propetries

Definition at line 219 of file iparameters.py.

00219 
00220     def getProperties(self):
00221         """Returns all propetries"""
00222         v = []
00223         if self._ap is None: return v
00224         if self._ap.IsSet(_AP_PROPERTIES_LIST_, PT_STRARRAY) == 0: return v
00225         return self._ap.GetStrArray(_AP_PROPERTIES_LIST_)

Returns a value of the named property

Definition at line 213 of file iparameters.py.

00213 
00214     def getProperty(self, name):
00215         """Returns a value of the named property"""
00216         if self._ap is None: return ""
00217         if self._ap.IsSet(name, PT_STRING) == 0: return ""
00218         return self._ap.GetString(name)

def KERNEL_PY.iparameters.IParameters.getValues (   self,
  listName 
)
Returns a list of values in the named list

Definition at line 116 of file iparameters.py.

00116 
00117     def getValues(self, listName):
00118         """Returns a list of values in the named list"""
00119         v = []
00120         if self._ap is None: return v
00121         if self._ap.IsSet(listName, PT_STRARRAY) == 0: return v
00122         return self._ap.GetStrArray(listName)

Returns whether there is the dumping to Python

Definition at line 249 of file iparameters.py.

00249 
00250     def isDumpPython(self):
00251         """Returns whether there is the dumping to Python"""
00252         if self._ap is None: return 0
00253         if self._ap.IsSet(_AP_DUMP_PYTHON_, PT_BOOLEAN) == 0: return 0
00254         return self._ap.GetBool(_AP_DUMP_PYTHON_)

def KERNEL_PY.iparameters.IParameters.nbValues (   self,
  listName 
)
Returns a number of values in the named list

Definition at line 109 of file iparameters.py.

00109 
00110     def nbValues(self, listName):
00111         """Returns a number of values in the named list"""
00112         if self._ap is None: return -1
00113         if self._ap.IsSet(listName, PT_STRARRAY) == 0: return 0
00114         v = self._ap.GetStrArray(listName)
00115         return len(v)

def KERNEL_PY.iparameters.IParameters.parseValue (   self,
  value,
  separator,
  fromEnd 
)
Breaks a value string in two parts which is divided by separator.

Definition at line 226 of file iparameters.py.

00226 
00227     def parseValue(self, value, separator, fromEnd):
00228         """Breaks a value string in two parts which is divided by separator."""
00229         v = []
00230         pos = - 1
00231         if fromEnd == 1: pos = value.rfind(separator)
00232         else: pos = value.find(separator)
00233 
00234         if pos < 0: 
00235             v.append(value)
00236             return v
00237         
00238         part1 = value[0:pos]
00239         part2 = value[pos+1:len(value)]
00240         v.append(part1)
00241         v.append(part2)
00242         return v

def KERNEL_PY.iparameters.IParameters.setDumpPython (   self,
  isDumping 
)
Enables/Disables the dumping to Python

Definition at line 243 of file iparameters.py.

00243 
00244     def setDumpPython(self, isDumping):
00245         """Enables/Disables the dumping to Python"""
00246         if self._ap is None: return
00247         _ap.SetBool(_AP_DUMP_PYTHON_, isDumping)
00248         pass

def KERNEL_PY.iparameters.IParameters.setParameter (   self,
  entry,
  parameterName,
  value 
)
Sets a value of the named parameter for the entry

Definition at line 130 of file iparameters.py.

00130 
00131     def setParameter(self, entry, parameterName, value):
00132         """Sets a value of the named parameter for the entry"""
00133         if self._ap is None: return
00134         v = []
00135         if self._ap.IsSet(entry, PT_STRARRAY) ==0: 
00136             self.append(_AP_ENTRIES_LIST_, entry) #Add the entry to the internal list of entries
00137             self._ap.SetStrArray(entry, v)
00138             pass
00139         
00140         v = self._ap.GetStrArray(entry)
00141         v.append(parameterName)
00142         v.append(value)
00143         self._ap.SetStrArray(entry, v)
00144         pass

Here is the call graph for this function:

def KERNEL_PY.iparameters.IParameters.setProperty (   self,
  name,
  value 
)
Sets a property value

Definition at line 204 of file iparameters.py.

00204 
00205     def setProperty(self, name, value):
00206         """Sets a property value"""
00207         if self._ap is None: return
00208         if self._ap.IsSet(name, PT_STRING) == 0: 
00209             self.append(_AP_PROPERTIES_LIST_, name) #Add the property to the internal list of properties
00210             pass
00211         self._ap.SetString(name, value)
00212         pass

Here is the call graph for this function:


Member Data Documentation

Definition at line 84 of file iparameters.py.


The documentation for this class was generated from the following file: