diff --git a/doc/v2/def_visitor.html b/doc/v2/def_visitor.html new file mode 100644 index 00000000..fa39b8a6 --- /dev/null +++ b/doc/v2/def_visitor.html @@ -0,0 +1,163 @@ + + + + + +
|
+ |
+ Boost.Python+ +Header <boost/python/def_visitor.hpp>+ |
def_visitordef_visitor synopsis
+ my_def_visitor
+
+ <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.
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.
def_visitor synopsisnamespace boost { namespace python {
+
+ template <class DerivedVisitor>
+ class def_visitor {};
+}
+
+
+def_visitorA prototypical derived class of def_visitor. This client supplied class + is expected to
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;
+ };
+
+
+ my_def_visitor
+ observer functionstemplate <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 : boost::python::def_visitor<my_def_visitor>
+ {
+ friend class def_visitor_access;
+
+ template <class classT>
+ void visit(classT& c) const
+ {
+ c
+ .def("foo", &my_def_visitor::foo)
+ .def("bar", &my_def_visitor::bar)
+ ;
+ }
+
+ static void foo(object self);
+ static void bar(object self);
+ };
+
+ class X {/*...*/};
+
+ BOOST_PYTHON_MODULE(my_ext)
+ {
+ class_<X>("X")
+ .def(my_def_visitor())
+ ;
+ }
+
+ Revised + 27 August, 2003 +
+ + +© Copyright Joel de Guzman 2003. All Rights Reserved. \ No newline at end of file