Salome HOME
Merge V8_4_BR branch.
[modules/kernel.git] / src / KERNEL_PY / kernel / enumerate.py
index dc445740ad9760b69d0d6b0dc8ba6051591c59a6..e6fdff96c7a88af34ecfa9e67ae1d7b236676a81 100644 (file)
@@ -1,10 +1,10 @@
 # -*- coding: iso-8859-1 -*-
-# Copyright (C) 2010-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2010-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
+## \defgroup enumerate enumerate
+#  \{ 
+#  \details Emulates a C-like enum for python
+#  \}
+
 __author__ = "gboulant"
 __date__ = "$1 avr. 2010 09:08:02$"
 
+## This class emulates a C-like enum for python. It is initialized with a list
+#  of strings to be used as the enum symbolic keys. The enum values are automatically
+#  generated as sequencing integer starting at the specified offset value.
+#  \ingroup enumerate
 class Enumerate(object):
     """
     This class emulates a C-like enum for python. It is initialized with a list
     of strings to be used as the enum symbolic keys. The enum values are automatically
     generated as sequencing integer starting at the specified offset value.
     """
+    
+    ## Canonical constructor.
+    #  \param keys a list of string to be used as the enum symbolic keys. The enum values
+    #  are automatically generated as a sequence of integers starting at the specified
+    #  offset value.
     def __init__(self, keys, offset=0):
         """
         Canonical constructor
@@ -40,6 +54,8 @@ class Enumerate(object):
             setattr(self, key, value)
             self._dict_keynumbers[key] = value
 
+    ## Return true if this enumerate contains the specified key string
+    #  \param key a key string to test
     def contains(self, key):
         """
         Return true if this enumerate contains the specified key string
@@ -47,6 +63,9 @@ class Enumerate(object):
         """
         return (key in self._dict_keynumbers.keys())
 
+    ## Returns true if the specified integer value is defined as an identifier
+    #  in this enumarate.
+    #  \param value a value to test
     def isValid(self, value):
         """
         Returns true if the specified integer value is defined as an identifier
@@ -55,6 +74,7 @@ class Enumerate(object):
         """
         return (value in self._dict_keynumbers.values())
 
+    ## Returns the list of keys in this enumerate.
     def listkeys(self):
         """
         Returns the list of keys in this enumerate.
@@ -63,6 +83,7 @@ class Enumerate(object):
         list.sort()
         return list
 
+    ## Returns the list of values specified to initiate this enumerate.
     def listvalues(self):
         """
         Returns the list of values specified to initiate this enumerate.
@@ -71,6 +92,8 @@ class Enumerate(object):
         list.sort()
         return list
 
+    ## Returns the symbolic key string associated to the specified identifier value.
+    #  \param value an integer value whose associated key string is requested.
     def keyOf(self, value):
         """
         Returns the symbolic key string associated to the specified identifier