|
Boost : |
From: HanF (hf_p_at_[hidden])
Date: 2002-04-19 01:45:17
Hi all,
i've some ideas for object persistence. A helper to do this is a type like
"any" called "Variant" :-)
If you trapped by the caption of this message, here are some statements:
* no additional base class for types that should be stored
* no registering nor additional type-info for those objects
* clear type requirements: such as copy-constructable
* object implememts serializing by it's self, default:
left-/right-shift op's, but configurable with member- or
function-pointer
The variant is based on wellknown publication about those types. A short
description of my idea for persistency follows (statements about "Variant"):
* no template class
* using of member templates
* has two nested types (in inheritance-relation)
* nested base class: interface "AbstractType",
required property: pure virtual clone()-method
* derived: Type<*wrapped type*>, has a
static prototype-object of wrapped type -
each construction of Type<> inserts address
it's prototype in a unique assoc. container:
map<RTTI-name, AbstractType*>, map is
hosted in AbstractType, Type<> is clone()-able
on wrapped type
* re-store: lookup the map with firstly fetched
string (RTTI-name) and let it constructing from
prototype by clone()
Known problems:
* thread safety (static's), but solveable with boost
* wishes: configurable "Variant" to minimize type requirements
if features are unused
* persistency doesn't works with wrapped pointer to object,
only available for "holding by value", but checkable with
boost
* RTTI-name aren't portable and depends from compiler and/or
bundled types (i.e. STL-types with additional defaulted template
arguments)
* all stored objects must be used in persistent programm, means
in most cases: stream must stored by this programm, cause:
it must existing a prototype (see above)
_________________________
Greetings from Weimar/Germany
Hans-Friedrich Pabst,
r.z.w. cimdata AG,
pabst_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk