class Context

Optional class for sharing context during the deserialization of complex trees. More...

Full namefun::Deserializer::Context
Definition#include <fun/Deserializer.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

Optional class for sharing context during the deserialization of complex trees. For example, suppose you have some child object which keeps a pointer to some other child object. At serialization time, you only want to save some string or int ID for the referenced object; at deserialization time, you need the "owner" of the referenced object in order to translate the ID into the actual referenced object. You could create your own Deserializer::Context subclass which contains a pointer or reference to the "owner" object, then pass that to pushContext() before deserializing the child objects. Inside the child object deserialization, getContext(), dynamic_cast it to your Context subclass, and (if successful) get your parent object from the Context. Back in the parent object, after deserializing all children, call popContext() to delete the Context object.

This base class is useless; it only exists so that getContext() can return a polymorphic object which you can dynamic_cast to your useful subclass.

(This whole approach could be stupid; I'm not sure yet.)

 Context (ClassLoader *cp = NULL)

Context

 ~Context ()

~Context

[virtual]

ClassLoader * getDefaultLoader ()

getDefaultLoader

[virtual]

void  setDefaultLoader (ClassLoader *c)

setDefaultLoader

[virtual]

You still own the ClassLoader.


Generated by: stephan on cheyenne on Mon Aug 11 14:06:52 2003, using kdoc 2.0a54.