Salome HOME
7452072486345fff7b6761e9561690e91324128e
[modules/eficas.git] / src / EFICAS / EFICAS.py
1 import EFICAS_ORB__POA
2
3 import SALOMEDS__POA
4
5 import SALOME_ComponentPy
6
7
8
9
10
11 class SALOME_DriverPy_i(SALOMEDS__POA.Driver):
12     """
13     Python implementation of generic SALOMEDS driver.
14     Should be inherited by any Python module's engine
15     to provide persistence mechanism.
16     """
17     def __init__ (self, componentDataType):
18         print "SALOME_DriverPy.__init__: ",componentDataType
19         self._ComponentDataType = componentDataType
20
21     def IORToLocalPersistentID(self, theSObject, IORString, isMultiFile, isASCII):
22         return theSObject.GetID()
23
24     def LocalPersistentIDToIOR(self, theSObject, PersistentID, isMultiFile, isASCII):
25         return ""
26
27     def ComponentDataType(self):
28         return self._ComponentDataType
29
30     def Save(self, theComponent, theURL, isMultiFile):
31         return 'Rien'
32
33     def SaveASCII(self, theComponent, theURL, isMultiFile):
34         return self.Save(theComponent, theURL, isMultiFile)
35
36     def Load(self, theComponent, theStream, theURL, isMultiFile):
37         return 1
38
39     def LoadASCII(self, theComponent, theStream, theURL, isMultiFile):
40         return self.Load(theComponent, theStream, theURL, isMultiFile)
41
42     def Close(self, theComponent):
43         pass
44
45     def CanPublishInStudy(self, theIOR):
46         return 0
47
48     def PublishInStudy(self, theStudy, theSObject, theObject, theName):
49         return None
50
51     def CanCopy(self, theObject):
52         return 0
53
54
55
56 class EFICAS(EFICAS_ORB__POA.EFICAS_Gen,
57               SALOME_ComponentPy.SALOME_ComponentPy_i,
58               SALOME_DriverPy_i ):
59     """
60         Pour etre un composant SALOME cette classe Python
61         doit avoir le nom du composant et heriter de la
62         classe EFICAS_Gen issue de la compilation de l'idl
63         par omniidl et de la classe SALOME_ComponentPy_i
64         qui porte les services generaux d'un composant SALOME
65     """
66     def __init__ (self, orb, poa, contID, containerName, instanceName, 
67                   interfaceName):
68         print "EFICAS.__init__: ",containerName,' ',instanceName
69         SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa,
70                     contID, containerName,instanceName, interfaceName, 0 )
71         SALOME_DriverPy_i.__init__( self, 'OTHER' )                    
72         # On stocke dans l'attribut _naming_service, une reference sur
73         # le Naming Service CORBA
74         self._naming_service=SALOME_ComponentPy.SALOME_NamingServicePy_i(self._orb)
75
76
77