shadow->proxy terminlogy update
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10398 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
41220df85b
commit
76eaea911b
21 changed files with 26 additions and 27 deletions
|
|
@ -163,7 +163,7 @@ example.cvar.Shapes_nshapes = 13 # Set a static data member
|
|||
|
||||
<ul>
|
||||
<li>This low-level interface is not the only way to handle C++ code.
|
||||
Shadow classes provide a much higher-level interface.
|
||||
Proxy classes provide a much higher-level interface.
|
||||
|
||||
<p>
|
||||
<li>SWIG *does* know how to properly perform upcasting of objects in
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# file: runme.py
|
||||
|
||||
# This file illustrates the shadow-class C++ interface generated
|
||||
# This file illustrates the proxy class C++ interface generated
|
||||
# by SWIG.
|
||||
|
||||
import example
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
/* This is a rather sophisticated example that illustrates exception handling,
|
||||
templates, and shadow classes.
|
||||
templates, and proxy classes.
|
||||
|
||||
(i) The %exception directive is used to attach exception handlers
|
||||
to specific methods.
|
||||
|
||||
(ii) Exception classes are automatically converted to shadow class
|
||||
(ii) Exception classes are automatically converted to proxy class
|
||||
objects.
|
||||
|
||||
(iii) The %template directive is used to expand the templates
|
||||
|
|
@ -63,13 +63,13 @@
|
|||
constructor is being called.
|
||||
|
||||
(2) The SWIG_NewPointerObj() call automatically wraps the exception object
|
||||
into a shadow class. The SWIGTYPE_p_FullError is the type-descriptor
|
||||
into a proxy class. The SWIGTYPE_p_FullError is the type-descriptor
|
||||
used for type checking. The "1" indicates that Python will have
|
||||
ownership of the resulting object.
|
||||
|
||||
(3) The PyErr_SetObject call sets the Python exception. However,
|
||||
the SWIGTYPE_p_FullError->clientdata reference may not be
|
||||
obvious. This is actually the Python shadow class object
|
||||
obvious. This is actually the Python proxy class object
|
||||
for FullError. Recall that in Python, exceptions are defined
|
||||
as classes. Therefore, this works perfectly as the argument to
|
||||
PyErr_SetObject()! A neat trick perhaps.
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ print "----------------------"
|
|||
# EmployeeList as an Employee*. Previously, Python resolved the call
|
||||
# immediately in CEO, but now Python thinks the object is an instance of
|
||||
# class Employee (actually EmployeePtr). So the call passes through the
|
||||
# Employee shadow class and on to the C wrappers and C++ director,
|
||||
# Employee proxy class and on to the C wrappers and C++ director,
|
||||
# eventually ending up back at the CEO implementation of getPosition().
|
||||
# The call to getTitle() for item 3 runs the C++ Employee::getTitle()
|
||||
# method, which in turn calls getPosition(). This virtual method call
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
# file: runme.py
|
||||
|
||||
# This file illustrates the manipulation of C++ references in Python
|
||||
# This uses the low-level interface. Shadow classes work differently.
|
||||
|
||||
import example
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>SWIG:Examples:python:shadow</title>
|
||||
<title>SWIG:Examples:python:proxy</title>
|
||||
</head>
|
||||
|
||||
<body bgcolor="#ffffff">
|
||||
|
||||
|
||||
<tt>SWIG/Examples/python/shadow/</tt>
|
||||
<tt>SWIG/Examples/python/proxy/</tt>
|
||||
<hr>
|
||||
|
||||
<H2>Wrapping a simple C++ class</H2>
|
||||
|
||||
<p>
|
||||
This example illustrates the wrapping of some C++ classes by shadow classes.
|
||||
This example illustrates the wrapping of some C++ classes by proxy classes.
|
||||
|
||||
<hr>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# file: runme.py
|
||||
|
||||
# This file illustrates the shadow-class C++ interface generated
|
||||
# This file illustrates the proxy class C++ interface generated
|
||||
# by SWIG.
|
||||
|
||||
import example
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# file: runme.py
|
||||
|
||||
# This file illustrates the shadow-class C++ interface generated
|
||||
# This file illustrates the proxy class C++ interface generated
|
||||
# by SWIG.
|
||||
|
||||
import example
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class CEO(example.Manager):
|
|||
return "CEO"
|
||||
def __del__(self):
|
||||
print "CEO.__del__(),", self.getName()
|
||||
# for shadow class extensions that are not "disowned" and
|
||||
# for proxy class extensions that are not "disowned" and
|
||||
# define a __del__ method, it is very important to call the
|
||||
# base class __del__. otherwise the c++ objects will never
|
||||
# be deleted.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue