From ad4b0fff565fb36c827f20357de54255dc365d3d Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 17 Apr 2001 19:55:11 +0000 Subject: [PATCH] moved from branch ralf_grosse_kunstleve to trunk [SVN r9825] --- doc/pickle.html | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/doc/pickle.html b/doc/pickle.html index 842112d3..994a78ab 100644 --- a/doc/pickle.html +++ b/doc/pickle.html @@ -227,11 +227,38 @@ Both __getinitargs__ and __getstate__ are not defined.
-

Example

+

Examples

-An example that shows how to configure pickle support is available in the -boost/lib/python/example directory -(getting_started3.cpp). +There are three files in boost/libs/python/example that +show how so provide pickle support. + +

pickle1.cpp

+ + The C++ class in this example can be fully restored by passing the + appropriate argument to the constructor. Therefore it is sufficient + to define the pickle interface method __getinitargs__. + +

pickle2.cpp

+ + The C++ class in this example contains member data that cannot be + restored by any of the constructors. Therefore it is necessary to + provide the __getstate__/__setstate__ pair of + pickle interface methods. + +

+ For simplicity, the __dict__ is not included in the result + of __getstate__. This is not generally recommended, but a + valid approach if it is anticipated that the object's + __dict__ will always be empty. Note that the safety guards + will catch the cases where this assumption is violated. + +

pickle3.cpp

+ + This example is similar to pickle2.cpp. However, the + object's __dict__ is included in the result of + __getstate__. This requires more code but is unavoidable + if the object's __dict__ is not always empty.
© Copyright Ralf W. Grosse-Kunstleve 2001. Permission to copy, @@ -241,5 +268,5 @@ is" without express or implied warranty, and with no claim as to its suitability for any purpose.

-Updated: March 10, 2001 +Updated: March 21, 2001