From: <ol...@us...> - 2007-03-26 01:06:38
|
Revision: 9659 http://swig.svn.sourceforge.net/swig/?rev=9659&view=rev Author: olly Date: 2007-03-25 18:06:35 -0700 (Sun, 25 Mar 2007) Log Message: ----------- Fix a couple of minor typos Modified Paths: -------------- trunk/Doc/Manual/SWIGPlus.html Modified: trunk/Doc/Manual/SWIGPlus.html =================================================================== --- trunk/Doc/Manual/SWIGPlus.html 2007-03-25 17:40:56 UTC (rev 9658) +++ trunk/Doc/Manual/SWIGPlus.html 2007-03-26 01:06:35 UTC (rev 9659) @@ -575,7 +575,7 @@ inherit from an abstract class, but don't provide definitions for all of the pure methods. </li> -<li>A default constructor is not created unless all bases classes support a +<li>A default constructor is not created unless all base classes support a default constructor. </li> @@ -1493,7 +1493,7 @@ </p> <p> SWIG treats private or protected inheritance as close to the C++ -spirit, and target language capabilities, as possible. In most of the +spirit, and target language capabilities, as possible. In most cases, this means that SWIG will parse the non-public inheritance declarations, but that will have no effect in the generated code, besides the implicit policies derived for constructor and @@ -1656,7 +1656,7 @@ This behavior resulted in huge amounts of replicated code for large class hierarchies and made it awkward to build applications spread across multiple modules (since accessor functions are duplicated in -every single module). It is also unnecessary to have such wrappers +every single module). It is also unnecessary to have such wrappers when advanced features like proxy classes are used. <b>Note:</b> Further optimizations are enabled when using the This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ol...@us...> - 2007-04-18 16:24:49
|
Revision: 9683 http://swig.svn.sourceforge.net/swig/?rev=9683&view=rev Author: olly Date: 2007-04-18 09:24:46 -0700 (Wed, 18 Apr 2007) Log Message: ----------- SWIG does now support use of some constant expressions as template parameters so update the documentation. Modified Paths: -------------- trunk/Doc/Manual/SWIGPlus.html Modified: trunk/Doc/Manual/SWIGPlus.html =================================================================== --- trunk/Doc/Manual/SWIGPlus.html 2007-04-18 09:47:01 UTC (rev 9682) +++ trunk/Doc/Manual/SWIGPlus.html 2007-04-18 16:24:46 UTC (rev 9683) @@ -2816,14 +2816,17 @@ </div> <p> -There are some restrictions on the use of non-type arguments. Specifically, -they have to be simple literals and not expressions. For example: +There are some restrictions on the use of non-type arguments. Simple literals +are supported, and so are some constant expressions. However, use of '<' +and '>' within a constant expressions currently is not supported by SWIG +('<=' and '>=' are though). For example: </p> <div class="code"> <pre> -void bar(list<int,100> *x); // OK -void bar(list<int,2*50> *x); // Illegal +void bar(list<int,100> *x); // OK +void bar(list<int,2*50> *x); // OK +void bar(list<int,(2>1 ? 100 : 50)> *x) // Not supported </pre> </div> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2007-08-15 20:36:44
|
Revision: 9899 http://swig.svn.sourceforge.net/swig/?rev=9899&view=rev Author: wsfulton Date: 2007-08-15 13:36:40 -0700 (Wed, 15 Aug 2007) Log Message: ----------- mention and public access Modified Paths: -------------- trunk/Doc/Manual/SWIGPlus.html Modified: trunk/Doc/Manual/SWIGPlus.html =================================================================== --- trunk/Doc/Manual/SWIGPlus.html 2007-08-15 05:09:02 UTC (rev 9898) +++ trunk/Doc/Manual/SWIGPlus.html 2007-08-15 20:36:40 UTC (rev 9899) @@ -46,7 +46,7 @@ <li><a href="#SWIGPlus_nn27">Comments on overloading</a> </ul> <li><a href="#SWIGPlus_nn28">Wrapping overloaded operators</a> -<li><a href="#SWIGPlus_nn29">Class extension</a> +<li><a href="#SWIGPlus_class_extension">Class extension</a> <li><a href="#SWIGPlus_nn30">Templates</a> <li><a href="#SWIGPlus_nn31">Namespaces</a> <li><a href="#SWIGPlus_renaming_templated_types_namespaces">Renaming templated types in namespaces</a> @@ -2731,7 +2731,7 @@ </li> </ul> -<H2><a name="SWIGPlus_nn29"></a>6.17 Class extension</H2> +<H2><a name="SWIGPlus_class_extension"></a>6.17 Class extension</H2> <p> @@ -2786,6 +2786,8 @@ The C++ 'this' pointer is often needed to access member variables, methods etc. The <tt>$self</tt> special variable should be used wherever you could use 'this'. The example above demonstrates this for accessing member variables. +Note that the members dereferenced by <tt>$self</tt> must be public members as the code is ultimately generated +into a global function and so will not have any access to non-public members. The implicit 'this' pointer that is present in C++ methods is not present in <tt>%extend</tt> methods. In order to access anything in the extended class or its base class, an explicit 'this' is required. The following example shows how one could access base class members: @@ -2802,8 +2804,8 @@ }; %extend Derived { virtual void method(int v) { - $self->Base::method(v); - $self->value = v; + $self->Base::method(v); // akin to this->Base::method(v); + $self->value = v; // akin to this->value = v; ... } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ol...@us...> - 2008-04-14 05:08:49
|
Revision: 10375 http://swig.svn.sourceforge.net/swig/?rev=10375&view=rev Author: olly Date: 2008-04-13 22:08:46 -0700 (Sun, 13 Apr 2008) Log Message: ----------- Fix a couple of typos Modified Paths: -------------- trunk/Doc/Manual/SWIGPlus.html Modified: trunk/Doc/Manual/SWIGPlus.html =================================================================== --- trunk/Doc/Manual/SWIGPlus.html 2008-04-14 04:57:11 UTC (rev 10374) +++ trunk/Doc/Manual/SWIGPlus.html 2008-04-14 05:08:46 UTC (rev 10375) @@ -1431,7 +1431,7 @@ </p> <p> -If <tt>Vector</tt> is defined as class in the interface, but it does not +If <tt>Vector</tt> is defined as a class in the interface, but it does not support a default constructor, SWIG changes the wrapper code by encapsulating the arguments inside a special C++ template wrapper class, through a process called the "Fulton Transform". This produces a wrapper that looks like this: @@ -1460,7 +1460,7 @@ <p> Although SWIG usually detects the classes to which the fulton transform should be applied, in some situations it's necessary to override it. That's done with -<tt>%feature("valuewrapper")</tt> and <tt>%feature("novaluewraper")</tt>: +<tt>%feature("valuewrapper")</tt> and <tt>%feature("novaluewrapper")</tt>: <div class="code"><pre> %feature("novaluewrapper") A; class A; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jas...@us...> - 2008-04-14 04:57:14
|
Revision: 10374 http://swig.svn.sourceforge.net/swig/?rev=10374&view=rev Author: jason_e_stewart Date: 2008-04-13 21:57:11 -0700 (Sun, 13 Apr 2008) Log Message: ----------- Committed Documentation patch for: [ 1941709 ] document (no)valuewrapper %features Modified Paths: -------------- trunk/Doc/Manual/SWIGPlus.html Modified: trunk/Doc/Manual/SWIGPlus.html =================================================================== --- trunk/Doc/Manual/SWIGPlus.html 2008-04-13 21:16:12 UTC (rev 10373) +++ trunk/Doc/Manual/SWIGPlus.html 2008-04-14 04:57:11 UTC (rev 10374) @@ -1431,10 +1431,10 @@ </p> <p> -If <tt>Vector</tt> is defined as class in the interface, but it does -not support a default constructor, SWIG changes the wrapper code by -encapsulating the arguments inside a special C++ template wrapper -class. This produces a wrapper that looks like this: +If <tt>Vector</tt> is defined as class in the interface, but it does not +support a default constructor, SWIG changes the wrapper code by encapsulating +the arguments inside a special C++ template wrapper class, through a process +called the "Fulton Transform". This produces a wrapper that looks like this: </p> <div class="code"> @@ -1458,6 +1458,22 @@ </p> <p> +Although SWIG usually detects the classes to which the fulton transform should +be applied, in some situations it's necessary to override it. That's done with +<tt>%feature("valuewrapper")</tt> and <tt>%feature("novaluewraper")</tt>: +<div class="code"><pre> +%feature("novaluewrapper") A; +class A; + +%feature("valuewrapper") B; +struct B { + B(); + // .... +}; +</pre></div> +</p> + +<p> <b>Note:</b> this transformation has no effect on typemaps or any other part of SWIG---it should be transparent except that you may see this code when reading the SWIG output file. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <wsf...@us...> - 2008-04-24 21:54:51
|
Revision: 10388 http://swig.svn.sourceforge.net/swig/?rev=10388&view=rev Author: wsfulton Date: 2008-04-24 14:54:46 -0700 (Thu, 24 Apr 2008) Log Message: ----------- few tweaks to valuewrapper documentation Modified Paths: -------------- trunk/Doc/Manual/SWIGPlus.html Modified: trunk/Doc/Manual/SWIGPlus.html =================================================================== --- trunk/Doc/Manual/SWIGPlus.html 2008-04-24 12:26:29 UTC (rev 10387) +++ trunk/Doc/Manual/SWIGPlus.html 2008-04-24 21:54:46 UTC (rev 10388) @@ -1458,9 +1458,10 @@ </p> <p> -Although SWIG usually detects the classes to which the fulton transform should +Although SWIG usually detects the classes to which the Fulton Transform should be applied, in some situations it's necessary to override it. That's done with -<tt>%feature("valuewrapper")</tt> and <tt>%feature("novaluewrapper")</tt>: +<tt>%feature("valuewrapper")</tt> to ensure it is used and <tt>%feature("novaluewrapper")</tt> +to ensure it is not used: </p> <div class="code"><pre> @@ -1475,6 +1476,13 @@ </pre></div> <p> +It is well worth considering turning this feature on for classes that do have a default constructor. +It will remove a redundant constructor call at the point of the variable declaration in the wrapper, +so will generate notably better performance for large objects or for classes with expensive construction. +Alternatively consider returning a reference or a pointer. +</p> + +<p> <b>Note:</b> this transformation has no effect on typemaps or any other part of SWIG---it should be transparent except that you may see this code when reading the SWIG output file. @@ -1483,7 +1491,7 @@ <p> <b> Note: </b>This template transformation is new in SWIG-1.3.11 and may be refined in -future SWIG releases. In practice, it is only necessary to do this for +future SWIG releases. In practice, it is only absolutely necessary to do this for classes that don't define a default constructor. </p> @@ -1492,11 +1500,6 @@ It is not used for C++ pointers or references. </p> -<p> -<b>Note:</b> The performance of pass-by-value is especially bad for large objects and should be avoided -if possible (consider using references instead). -</p> - <H2><a name="SWIGPlus_nn20"></a>6.13 Inheritance</H2> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |