Back to index

salome-kernel  6.5.0
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
SALOME_ComponentPy.SALOME_ComponentPy_i Class Reference

define an implementation of the component interface Engines::Component More...

Inheritance diagram for SALOME_ComponentPy.SALOME_ComponentPy_i:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def ping
def setProperties
def getProperties
def destroy
def GetContainerRef
def beginService
def endService
def sendMessage
def Names
def graphName
def nodeName
def Killer
def Kill_impl
def Stop_impl
def Suspend_impl
def Resume_impl
def CpuUsed_impl
def DumpPython
def getStudyId
def hasObjectInfo
def getObjectInfo

Private Member Functions

def _get_instanceName
def _get_interfaceName

Private Attributes

 _instanceName
 _interfaceName
 _containerName
 _notif
 _myConnexionToRegistry
 _graphName
 _nodeName
 _serviceName
 _ThreadId
 _StartUsed
 _ThreadCpuUsed
 _Executed
 _contId
 _notifSupplier
 _fieldsDict

Static Private Attributes

 _orb = None
 _poa = None
list _fieldsDict = []
int _studyId = 1

Detailed Description

define an implementation of the component interface Engines::Component

Definition at line 58 of file SALOME_ComponentPy.py.


Constructor & Destructor Documentation

def SALOME_ComponentPy.SALOME_ComponentPy_i.__init__ (   self,
  orb,
  poa,
  contID,
  containerName,
  instanceName,
  interfaceName,
  notif = 0 
)

Definition at line 67 of file SALOME_ComponentPy.py.

00067 
00068                   instanceName, interfaceName, notif=0):
00069         # Notif for notification services
00070         # NOT YET IMPLEMENTED
00071         MESSAGE(  "SALOME_ComponentPy_i::__init__" + " " + str (containerName) + " " + str(instanceName) + " " + str(interfaceName) )
00072         self._orb = orb
00073         self._poa = poa
00074         self._instanceName = instanceName
00075         self._interfaceName = interfaceName
00076         self._containerName = containerName
00077         self._notif = notif
00078         self._myConnexionToRegistry = 0
00079         self._graphName = ''
00080         self._nodeName = ''
00081         self._serviceName = ''
00082         self._ThreadId = 0
00083         self._StartUsed = 0
00084         self._ThreadCpuUsed = 0
00085         self._Executed = 0
00086         self._contId = contID
00087 
00088         naming_service = SALOME_NamingServicePy_i(self._orb)
00089         myMachine=getShortHostName()
00090         Component_path = self._containerName + "/" + self._instanceName
00091         MESSAGE(  'SALOME_ComponentPy_i Register' + str( Component_path ) )
00092         id_o = poa.activate_object(self)
00093         compo_o = poa.id_to_reference(id_o)
00094         naming_service.Register(compo_o, Component_path)
00095 
00096         # Add componentinstance to registry
00097         obj = naming_service.Resolve('/Registry')
00098         if obj is None:
00099             MESSAGE(  "Registry Reference is invalid" )
00100         else:
00101             regist = obj._narrow(Registry.Components)
00102             if regist is None:
00103                 MESSAGE(  "Registry Reference is invalid" )
00104             else:
00105                 ior = orb.object_to_string(contID)
00106                 MESSAGE(  ior )
00107 
00108                 lesInfos = Identity(self._instanceName)
00109                 infos = Registry.Infos(lesInfos._name,
00110                                        lesInfos._pid,
00111                                        lesInfos._machine,
00112                                        lesInfos._adip,
00113                                        lesInfos._uid,
00114                                        lesInfos._pwname,
00115                                        int(lesInfos._tc_start),
00116                                        0,0,0,
00117                                        lesInfos._cdir,
00118                                        -1,
00119                                        ior)
00120 
00121                 res = regist.add(infos)
00122 
00123         self._notifSupplier = NOTIFICATION_Supplier_Swig(instanceName, notif)

Here is the caller graph for this function:


Member Function Documentation

Definition at line 126 of file SALOME_ComponentPy.py.

00126 
00127     def _get_instanceName(self):
00128         MESSAGE(  "SALOME_ComponentPy_i::_get_instanceName" )
00129         return self._instanceName
    

Definition at line 132 of file SALOME_ComponentPy.py.

00132 
00133     def _get_interfaceName(self):
00134         MESSAGE(  "SALOME_ComponentPy_i::_get_interfaceName" )
00135         return self._interfaceName

def SALOME_ComponentPy.SALOME_ComponentPy_i.beginService (   self,
  serviceName 
)

Reimplemented in dsccalcium.PyDSCComponent.

Definition at line 167 of file SALOME_ComponentPy.py.

00167 
00168     def beginService(self , serviceName ):
00169         MESSAGE(  "Send BeginService notification for " + str(serviceName) + " for graph/node " + str(self._graphName) + " " + str(self._nodeName) )
00170         MESSAGE(  "Component instance : " + str ( self._instanceName ) )
00171         self._serviceName = str(serviceName)
00172         self._ThreadId = get_ident()
00173         self._StartUsed = 0
00174         self._StartUsed = self.CpuUsed_impl()
00175         self._ThreadCpuUsed = 0
00176         self._Executed = 1
00177         print "beginService for ",serviceName," Component instance : ",self._instanceName
00178         MESSAGE( "SALOME_ComponentPy_i::beginService _StartUsed " + str( self._ThreadId ) + " " + str( self._StartUsed ) )
00179         for e in self._fieldsDict:
00180           key=e.key
00181           value=any.from_any(e.value)
00182           if isinstance(value,str):
00183             os.environ[key]=value
00184         

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 282 of file SALOME_ComponentPy.py.

00282 
00283     def CpuUsed_impl(self):
00284         if ( self._ThreadId | self._Executed ) :
00285             if self._ThreadId == get_ident() :
00286                 cpu = time.clock()
00287                 self._ThreadCpuUsed = cpu - self._StartUsed
00288                 MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl " + self._serviceName + " " + str( int(cpu) ) + " - " + str( self._StartUsed ) + " = " + str( self._ThreadCpuUsed ) )
00289                 return self._ThreadCpuUsed
00290             MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl " + self._serviceName + " " + str( self._ThreadCpuUsed ) )
00291             return self._ThreadCpuUsed
00292         MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl self._StartUsed " + self._serviceName + " " + str(self._StartUsed) )
00293         return 0

Here is the caller graph for this function:

Definition at line 153 of file SALOME_ComponentPy.py.

00153 
00154     def destroy(self):
00155         MESSAGE(  "SALOME_ComponentPy_i::destroy" )
00156         id = self._poa.servant_to_id(self)
00157         self._poa.deactivate_object(id)
00158         return
        
def SALOME_ComponentPy.SALOME_ComponentPy_i.DumpPython (   self,
  theStudy,
  isPublished,
  isMultiFile 
)

Definition at line 296 of file SALOME_ComponentPy.py.

00296 
00297     def DumpPython(self, theStudy, isPublished, isMultiFile):
00298         aBuffer = "\0"
00299         if isMultiFile :
00300             aBuffer = "def RebuildData(theStudy): pass\n\0"
00301         return (aBuffer, 1)

def SALOME_ComponentPy.SALOME_ComponentPy_i.endService (   self,
  serviceName 
)

Definition at line 187 of file SALOME_ComponentPy.py.

00187 
00188     def endService(self , serviceName ):
00189         MESSAGE(  "Send EndService notification for " + str( self._ThreadId ) + " " + str(serviceName) + " for graph/node " + str(self._graphName) + " " + str(self._nodeName) + " CpuUsed " + str( self.CpuUsed_impl() ) )
00190         MESSAGE(  "Component instance : " + str(self._instanceName) )
00191         print "endService for",serviceName,"Component instance :",self._instanceName,"Cpu Used:",self.CpuUsed_impl()," (s) "
00192 

Here is the call graph for this function:

Definition at line 161 of file SALOME_ComponentPy.py.

00161 
00162     def GetContainerRef(self):
00163         MESSAGE(  "SALOME_ComponentPy_i::GetContainerRef" )
00164         return self._contId._narrow(Engines.Container)
                
def SALOME_ComponentPy.SALOME_ComponentPy_i.getObjectInfo (   self,
  studyId,
  entry 
)

Definition at line 314 of file SALOME_ComponentPy.py.

00314 
00315     def getObjectInfo(self, studyId, entry):
00316         return ""
00317 

Definition at line 148 of file SALOME_ComponentPy.py.

00148 
00149     def getProperties(self):
00150         return self._fieldsDict

Definition at line 304 of file SALOME_ComponentPy.py.

00304 
00305     def getStudyId(self):
00306         return self._studyId

Definition at line 207 of file SALOME_ComponentPy.py.

00207 
00208     def graphName(self):
00209         return self._graphName

Here is the caller graph for this function:

Definition at line 309 of file SALOME_ComponentPy.py.

00309 
00310     def hasObjectInfo(self):
00311         return 0

Definition at line 233 of file SALOME_ComponentPy.py.

00233 
00234     def Kill_impl(self):
00235         MESSAGE(  "SALOME_ComponentPy_i::Kill_impl" )
00236         RetVal = 0
00237         if self._ThreadId > 0 & self._ThreadId != get_ident():
00238             RetVal = Killer(self._ThreadId,0)
00239             self._ThreadId = 0
00240         return RetVal

Here is the call graph for this function:

def SALOME_ComponentPy.SALOME_ComponentPy_i.Killer (   self,
  ThreadId,
  signum 
)

Definition at line 217 of file SALOME_ComponentPy.py.

00217 
00218     def Killer(self, ThreadId, signum):
00219         #if ThreadId > 0:
00220             #if signum == 0:
00221                 #if pthread_cancel(ThreadId): <- from C++
00222                 #   return 0
00223                 #else:
00224                 #   MESSAGE()
00225             #else:
00226                 #if pthread_kill(ThreadId): <- from C++
00227                 #   return 0
00228                 #else:
00229                 #   MESSAGE()
00230         return 1                 
    

Here is the caller graph for this function:

def SALOME_ComponentPy.SALOME_ComponentPy_i.Names (   self,
  GraphName,
  NodeName 
)

Definition at line 200 of file SALOME_ComponentPy.py.

00200 
00201     def Names(self , GraphName , NodeName ):
00202         MESSAGE(  "SALOME_ComponentPy_i::Names" + str(GraphName) + str(NodeName) )
00203         self._graphName = GraphName
00204         self._nodeName = NodeName
        

Definition at line 212 of file SALOME_ComponentPy.py.

00212 
00213     def nodeName(self):
00214         return self._nodeName

Here is the caller graph for this function:

Definition at line 138 of file SALOME_ComponentPy.py.

00138 
00139     def ping(self):
00140         MESSAGE(  "SALOME_ComponentPy_i::ping() pid " + str(os.getpid()) )
        

Definition at line 268 of file SALOME_ComponentPy.py.

00268 
00269     def Resume_impl(self):
00270         MESSAGE(  "SALOME_ComponentPy_i::Resume_impl" )
00271         global _Sleeping
00272         RetVal = 0
00273         if self._ThreadId > 0 & self._ThreadId != get_ident():
00274             if _Sleeping > 0:
00275                 _Sleeping = 0
00276                 RetVal = 1
00277             else:
00278                 RetVal = 0
00279         return RetVal

def SALOME_ComponentPy.SALOME_ComponentPy_i.sendMessage (   self,
  event_type,
  message 
)

Definition at line 195 of file SALOME_ComponentPy.py.

00195 
00196     def sendMessage(self , event_type , message ):
00197         self._notifSupplier.Send(self.graphName(), self.nodeName(), event_type, message)

Here is the call graph for this function:

Definition at line 143 of file SALOME_ComponentPy.py.

00143 
00144     def setProperties(self, dico):
00145         self._fieldsDict = dico
    

Definition at line 243 of file SALOME_ComponentPy.py.

00243 
00244     def Stop_impl(self):
00245         MESSAGE(  "SALOME_ComponentPy_i::Stop_impl" )
00246         RetVal = 0
00247         if self._ThreadId > 0 & self._ThreadId != get_ident():
00248             RetVal = Killer(self._ThreadId,0)
00249             self._ThreadId = 0
00250         return RetVal

Here is the call graph for this function:

Definition at line 253 of file SALOME_ComponentPy.py.

00253 
00254     def Suspend_impl(self):
00255         MESSAGE(  "SALOME_ComponentPy_i::Suspend_impl" )
00256         global _Sleeping
00257         RetVal = 0
00258         if self._ThreadId > 0 & self._ThreadId != get_ident():
00259             if _Sleeping > 0:
00260                 return 0
00261             else:
00262                 RetVal = Killer(self._ThreadId, signal.SIGINT)
00263                 if RetVal > 0:
00264                     _Sleeping = 1
00265         return RetVal

Here is the call graph for this function:


Member Data Documentation

Definition at line 75 of file SALOME_ComponentPy.py.

Definition at line 85 of file SALOME_ComponentPy.py.

Definition at line 84 of file SALOME_ComponentPy.py.

Definition at line 61 of file SALOME_ComponentPy.py.

Definition at line 144 of file SALOME_ComponentPy.py.

Definition at line 78 of file SALOME_ComponentPy.py.

Definition at line 73 of file SALOME_ComponentPy.py.

Definition at line 74 of file SALOME_ComponentPy.py.

Definition at line 77 of file SALOME_ComponentPy.py.

Definition at line 79 of file SALOME_ComponentPy.py.

Definition at line 76 of file SALOME_ComponentPy.py.

Definition at line 122 of file SALOME_ComponentPy.py.

Definition at line 59 of file SALOME_ComponentPy.py.

Definition at line 60 of file SALOME_ComponentPy.py.

Definition at line 80 of file SALOME_ComponentPy.py.

Definition at line 82 of file SALOME_ComponentPy.py.

Definition at line 62 of file SALOME_ComponentPy.py.

Definition at line 83 of file SALOME_ComponentPy.py.

Definition at line 81 of file SALOME_ComponentPy.py.


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