]> SALOME platform Git repositories - modules/eficas.git/blob - src/EFICAS/EFICAS.py
Salome HOME
Merge branch 'master' of https://git.forge.pleiade.edf.fr/git/eficas.module-eficas
[modules/eficas.git] / src / EFICAS / EFICAS.py
1 # Copyright (C) 2001-2019  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 # -*- coding: utf-8 -*-
20
21 import EFICAS_ORB__POA
22 import SALOMEDS__POA
23 import SALOME_ComponentPy
24
25 class SALOME_DriverPy_i(SALOMEDS__POA.Driver):
26     """
27     Python implementation of generic SALOMEDS driver.
28     Should be inherited by any Python module's engine
29     to provide persistence mechanism.
30     """
31     def __init__ (self, componentDataType):
32         print ("SALOME_DriverPy.__init__: ", componentDataType)
33         self._ComponentDataType = componentDataType
34
35     def IORToLocalPersistentID(self, theSObject, IORString, isMultiFile, isASCII):
36         return theSObject.GetID()
37
38     def LocalPersistentIDToIOR(self, theSObject, PersistentID, isMultiFile, isASCII):
39         return ""
40
41     def ComponentDataType(self):
42         return self._ComponentDataType
43
44     def Save(self, theComponent, theURL, isMultiFile):
45         return 'Rien'
46
47     def SaveASCII(self, theComponent, theURL, isMultiFile):
48         return self.Save(theComponent, theURL, isMultiFile)
49
50     def Load(self, theComponent, theStream, theURL, isMultiFile):
51         return 1
52
53     def LoadASCII(self, theComponent, theStream, theURL, isMultiFile):
54         return self.Load(theComponent, theStream, theURL, isMultiFile)
55
56     def Close(self, theComponent):
57         pass
58
59     def CanPublishInStudy(self, theIOR):
60         return 0
61
62     def PublishInStudy(self, theStudy, theSObject, theObject, theName):
63         return None
64
65     def CanCopy(self, theObject):
66         return 0
67
68
69
70 class EFICAS(EFICAS_ORB__POA.EFICAS_Gen,
71         SALOME_ComponentPy.SALOME_ComponentPy_i,
72         SALOME_DriverPy_i ):
73     """
74         Pour etre un composant SALOME cette classe Python
75         doit avoir le nom du composant et heriter de la
76         classe EFICAS_Gen issue de la compilation de l'idl
77         par omniidl et de la classe SALOME_ComponentPy_i
78         qui porte les services generaux d'un composant SALOME
79     """
80     def __init__ (self, orb, poa, contID, containerName, instanceName, 
81                   interfaceName):
82         print ("EFICAS.__init__: ", containerName,' ', instanceName)
83         SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa,
84                     contID, containerName,instanceName, interfaceName )
85         SALOME_DriverPy_i.__init__( self, 'OTHER' )                    
86         # On stocke dans l'attribut _naming_service, une reference sur
87         # le Naming Service CORBA
88         self._naming_service=SALOME_ComponentPy.SALOME_NamingServicePy_i(self._orb)