From d3473afa23b56a2c3299e2c53a1feddeefe31481 Mon Sep 17 00:00:00 2001 From: Joel de Guzman Date: Wed, 27 Aug 2003 12:10:49 +0000 Subject: [PATCH] Take 2 [SVN r19805] --- doc/v2/def_visitor.html | 146 +++++++++++++++++----------------------- 1 file changed, 60 insertions(+), 86 deletions(-) diff --git a/doc/v2/def_visitor.html b/doc/v2/def_visitor.html index 26b3bee0..63d01b58 100644 --- a/doc/v2/def_visitor.html +++ b/doc/v2/def_visitor.html @@ -21,109 +21,83 @@

Contents

+ +
+
Introduction +
Classes +
-
Introduction - -
Classes - -
-
-
Class def_visitor
- Class def_visitor synopsis -
-
- -
-
-
Class my_def_visitor - -
-
-
Class my_def_visitor synopsis - -
Class my_def_visitor observer functions - -
-
- - -
Example +
Class def_visitor +
Class def_visitor + synopsis
+
Class def_visitor + requirements
+
+
Example

Introduction

-

<boost/python/def_visitor.hpp> provides a generic visitation - interface through which the class_ def - member functionality can be extended non-intrusively to avoid cluttering the - class_ interface. It declares the def_visitor<T> - class template, which is parameterized on the derived type T, which - provides the actual def functionality through its visit member - functions.

Classes

+ +

<boost/python/def_visitor.hpp> provides a generic visitation + interface through which the class_ def member + functionality can be extended non-intrusively to avoid cluttering the class_ + interface. It declares the def_visitor<T> class template, + which is parameterized on the derived type DerivedVisitor, which provides + the actual def functionality through its visit member functions. +

Classes

Class template def_visitor<DerivedVisitor>

-

The class def_visitor is a base class paramaterized by its derived class. - The def_visitor class is a protocol class. It's derived class, - DerivedVisitor, is expected to have a member function visit. The def_visitor - class is never instantiated directly. Instead, an instance of its subclass, - DerivedVisitor,  is passed on as an argument to the - class_ def member function.

-Class def_visitor synopsis

+ +

The class def_visitor is a base class paramaterized by its derived class. The + def_visitor class is a protocol class. Its derived class, DerivedVisitor, is + expected to have a member function visit. The def_visitor class is never instantiated + directly. Instead, an instance of its subclass, DerivedVisitor,  is passed + on as an argument to the class_ def member function. +

+Class def_visitor synopsis

namespace boost { namespace python {
 
     template <class DerivedVisitor>
     class def_visitor {};
 }
-

Class my_def_visitor

+

def_visitor requirements

-

A prototypical derived class of def_visitor. This client supplied class - is expected to

-

Class my_def_visitor synopsis

-
class my_def_visitor : boost::python::def_visitor<my_def_visitor>
-{
-    friend class def_visitor_access;
-
-    template <class classT>
-    void visit(classT& c) const;
-
-    template <class classT, class OptionalArgs>
-    void visit(classT& c, char const* name, OptionalArgs const& options) const;
-};
-
- -

Class my_def_visitor - observer functions

-
template <class classT>
-void visit(classT& c) const;
-
-
Requires: c is an instance of a class_  - being wrapped to Python. This is a client supplied function. -
Effects: A call to c.def(visitor), where c is a class_ instance and - visitor is a def_visitor derived class forwards to this visitor's visit member - function. -
Rationale: Allows my_def_visitor to non-intrusively add functionality - to the class_ def member function. -
- -
template <class classT, class OptionalArgs>
-void visit(classT& c, char const* name, OptionalArgs const& options) const;
-
-
Requires: c is an instance of a class_  - being wrapped to Python. name is a client supplied name. This is a client - supplied function. -
Effects: A call to c.def(name, visitor) or c.def(name, visitor, options), - where c is a class_ instance, visitor is a def_visitor derived class and options - are context specific optional arguments, forwards to this visitor's visit - member function. -
Rationale: Allows my_def_visitor to non-intrusively add functionality - to the class_ def member function. -
+ + + + + + + + + + + + + + + + + + + + +
ExpressionReturn TypeRequirementsEffects
visitor.visit(cls)voidcls is an instance of a class_  being wrapped + to Python. visitor is a def_visitor derived class.A call to cls.def(visitor) forwards to this member function.
visitor.visit(cls, name, options)voidcls is a class_ instance, name is a C string. visitor is a def_visitor + derived class. options is a context specific optional argument.A call to cls.def(name, visitor) or cls.def(name, visitor, options) forwards + to this member function.

Example