Salome HOME
updated copyright message
[modules/gui.git] / tools / CurvePlot / src / python / model / Model.py
1 # Copyright (C) 2016-2023  CEA/DEN, EDF 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, or (at your option) any later version.
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 class Model(object):
21     START_ID = -1
22   
23     @classmethod
24     def __GenerateID(cls):
25         cls.START_ID += 1
26         return cls.START_ID
27
28     def __init__( self, controller ):
29         """Constructor"""
30     
31         self._name = None
32         self._controller = controller
33         self._id = self.__GenerateID()  # A unique ID for this class of object
34     
35     def getID(self):
36         return self._id
37       
38     def getController(self):
39         """
40         :returns: Controller -- This model's controller.
41         """
42         return self._controller
43     
44     def setController(self, controller):
45         """
46         Sets the controller of this model.
47         
48         :param controller: Controller -- The controller of the model.
49         
50         """
51         self._controller = controller
52     
53     def notifyChange( self, what="" ) :
54         """
55         Notifies the controller that this model's data has changed.
56         """
57         if self._controller != None:
58             self._controller.notify(self, what)
59     
60     def updateTimeStamps (self, modifiesList):
61         raise NotImplementedError
62
63 pass