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
|
|
@ -1,6 +1,6 @@
|
|||
This directory contains examples for CHICKEN.
|
||||
|
||||
class -- illustrates the shadow-class C++ interface
|
||||
class -- illustrates the proxy class C++ interface
|
||||
constants -- handling #define and %constant literals
|
||||
egg -- examples of building chicken extension libraries
|
||||
multimap -- typemaps with multiple sub-types
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
;; This file illustrates the shadow C++ interface generated
|
||||
;; This file illustrates the proxy C++ interface generated
|
||||
;; by SWIG.
|
||||
|
||||
(load-library 'example "class_proxy.so")
|
||||
|
|
|
|||
|
|
@ -145,10 +145,10 @@ Shape.setNshapes(13); // Set a static data member
|
|||
<h2>General Comments</h2>
|
||||
|
||||
<ul>
|
||||
<li>This high-level interface using shadow classes is not the only way to handle C++ code.
|
||||
<li>This high-level interface using proxy classes is not the only way to handle C++ code.
|
||||
A low level interface using c functions to access member variables and member functions is the alternative SWIG
|
||||
approach. This entails passing around the c pointer or c++ 'this' pointer and as such it is not difficult to crash the JVM.
|
||||
The abstraction of the underlying pointer by the java shadow classes far better fits the java programming paradigm.
|
||||
The abstraction of the underlying pointer by the java proxy classes far better fits the java programming paradigm.
|
||||
|
||||
<p>
|
||||
<li>SWIG *does* know how to properly perform upcasting of objects in an inheritance
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# file: runme.m
|
||||
|
||||
# This file illustrates the shadow-class C++ interface generated
|
||||
# This file illustrates the proxy class C++ interface generated
|
||||
# by SWIG.
|
||||
|
||||
example
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ printf("----------------------\n");
|
|||
# EmployeeList as an Employee*. Previously, Octave resolved the call
|
||||
# immediately in CEO, but now Octave 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
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ $example::Shapes_nshapes = 13; # Set a static data member
|
|||
<h2>General Comments</h2>
|
||||
|
||||
<ul>
|
||||
<li>This low-level interface is not the only way to handle C++ code. Shadow classes
|
||||
<li>This low-level interface is not the only way to handle C++ code. Proxy classes
|
||||
provide a much higher-level interface.
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use Inline SWIG => <<"END_CODE", SWIG_ARGS => '-c++ -shadow', CC => 'g++', LD=>'g++';
|
||||
use Inline SWIG => <<"END_CODE", SWIG_ARGS => '-c++ -proxy', CC => 'g++', LD=>'g++';
|
||||
class Foo {
|
||||
public:
|
||||
int meaning() { return 42; };
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# file: runme.pl
|
||||
|
||||
# This file illustrates the manipulation of C++ references in Perl.
|
||||
# This uses the low-level interface. Shadow classes work differently.
|
||||
# This uses the low-level interface. Proxy classes work differently.
|
||||
|
||||
use example;
|
||||
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ approach would be to write a helper function like this:
|
|||
</blockquote>
|
||||
|
||||
<p>
|
||||
<li>If you use shadow classes and are careful, the SWIG generated wrappers can automatically
|
||||
<li>If you use proxy classes and are careful, the SWIG generated wrappers can automatically
|
||||
clean up the result of return-by-reference when the scripting variable goes out of scope.
|
||||
|
||||
<p>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
# This file illustrates the manipulation of C++ references in Php.
|
||||
# This uses the low-level interface. Shadow classes work differently.
|
||||
# This uses the low-level interface. Proxy classes work differently.
|
||||
|
||||
require "example.php";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
# This file illustrates the manipulation of C++ references in Php.
|
||||
# This uses the low-level interface. Shadow classes work differently.
|
||||
# This uses the low-level interface. Proxy classes work differently.
|
||||
|
||||
require "example.php";
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ Shapes.nshapes = 13 # Set a static data member
|
|||
<ul>
|
||||
<li>Ruby module of SWIG differs from other language modules in wrapping C++
|
||||
interfaces. They provides lower-level interfaces and optional higher-level
|
||||
interfaces know as shadow classes. Ruby module needs no such redundancy
|
||||
interfaces know as proxy classes. Ruby module needs no such redundancy
|
||||
due to Ruby's sophisticated extension API.
|
||||
|
||||
<p>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue