|
From: <mk...@us...> - 2003-04-23 09:15:09
|
Update of /cvsroot/csp/APPLICATIONS/SimData/SimData
In directory sc8-pr-cvs1:/tmp/cvs-serv22187/SimData
Modified Files:
Parse.py __init__.py
Log Message:
see CHANGES.current
Index: Parse.py
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/SimData/Parse.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Parse.py 11 Apr 2003 18:06:37 -0000 1.3
--- Parse.py 23 Apr 2003 09:14:22 -0000 1.4
***************
*** 399,403 ****
def getElement(self):
! p = SimData.PointerBase()
p.setPath(self._element.encode('ascii'))
return p
--- 399,403 ----
def getElement(self):
! p = SimData.LinkBase()
p.setPath(self._element.encode('ascii'))
return p
Index: __init__.py
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/SimData/SimData/__init__.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** __init__.py 18 Mar 2003 10:04:04 -0000 1.1
--- __init__.py 23 Apr 2003 09:14:22 -0000 1.2
***************
*** 92,96 ****
self.interface_by_name[i.name] = i
def createObject(self):
! return Pointer(self._class())
# def createObject(self, disown=1):
# Reference counting the newly created object is a bit subtle.
--- 92,96 ----
self.interface_by_name[i.name] = i
def createObject(self):
! return Link(self._class())
# def createObject(self, disown=1):
# Reference counting the newly created object is a bit subtle.
***************
*** 98,107 ****
# retain ownership. The only caller of createObject(), however,
# should be the DataArchive class, which wraps the resulting
! # object in a Pointer<>. The Pointer maintains its own
# reference count and deletes the C++ object (and its associated
# Python object) when the referencecount goes to zero.
#
# Keep in mind that if you use this method elsewhere and don't
! # wrap the object in a Pointer<>, you will be responsible
# for deleting the object (which can only be done from C++).
# o = self._class()
--- 98,107 ----
# retain ownership. The only caller of createObject(), however,
# should be the DataArchive class, which wraps the resulting
! # object in a Link<>. The Link maintains its own
# reference count and deletes the C++ object (and its associated
# Python object) when the referencecount goes to zero.
#
# Keep in mind that if you use this method elsewhere and don't
! # wrap the object in a Link<>, you will be responsible
# for deleting the object (which can only be done from C++).
# o = self._class()
***************
*** 229,239 ****
from cSimData import *
! ## Specialized Pointer class for Python. This class behaves like
## Object, but automatically combines C++ and Python reference
## counting to handle object lifetime in a sane way. Both C++
! ## and Python createObject methods return Pointer class objects
## under Python, so it should never be necessary to handle a
## raw Object instance.
! class Pointer(cSimData.Object):
def __init__(self, obj):
# NOTE: skip base class __init__
--- 229,239 ----
from cSimData import *
! ## Specialized Link class for Python. This class behaves like
## Object, but automatically combines C++ and Python reference
## counting to handle object lifetime in a sane way. Both C++
! ## and Python createObject methods return Link class objects
## under Python, so it should never be necessary to handle a
## raw Object instance.
! class Link(cSimData.Object):
def __init__(self, obj):
# NOTE: skip base class __init__
***************
*** 241,247 ****
self.this = obj.this
# increase the reference count of the C++ object
! self.ptr = PointerBase(obj)
# disown the C++ object from Python, C++ reference
! # counting by PointerBase is now responsible for
# the C++ object's lifetime. when self.ptr is
# destroyed, the reference count will decrease.
--- 241,247 ----
self.this = obj.this
# increase the reference count of the C++ object
! self.ptr = LinkBase(obj)
# disown the C++ object from Python, C++ reference
! # counting by LinkBase is now responsible for
# the C++ object's lifetime. when self.ptr is
# destroyed, the reference count will decrease.
***************
*** 253,259 ****
! ## Override createObject to return a Pointer(Object)
cSimData.InterfaceProxy.createObject = \
! lambda self, method=cSimData.InterfaceProxy.createObject: Pointer(method(self))
--- 253,259 ----
! ## Override createObject to return a Link(Object)
cSimData.InterfaceProxy.createObject = \
! lambda self, method=cSimData.InterfaceProxy.createObject: Link(method(self))
|