From: Nick Ambrose (nick_at_[hidden])
Date: 2000-01-11 19:41:37
I actually wrote (and used) a similar system for use with a database
We were convering a database to a set of flattened files for (supposedly)
faster access to data and custom queries that were difficult to formulate as
It was required to attach objects of essentially arbitrary type to any item
in the database.
To achieve this, i used a class called "attribute" which essentially had a
SetValue/GetValue and stored an internal std::string
on set, I serialized into the string, on get i serialized out of the string.
There were two versions of get/set - one that used operator << >> and
another that allowed a user to pass in a specific conversion function.
This allowed you to serialize in as one type and serialize out as basically
any other type you wanted to - the main problem I had with it was the total
disrespect for the type-system - i.e. there seemed (to me at the time) to be
no way of accidentally reading something from an incompatible object and
ending up with garbage. Maybe there is a decent way to prevent this, I don't
know. Unfortunately, I don't have the code anymore (my previous employer
owns it now I guess) but it was interesting for sure.
Beman Dawes wrote:
> A while ago Kevlin Henney sent me a clever idea for a stream_cast
> template which supports conversions to and from heterogeneous types
> via a stream.
> I asked him for some documentation and a sample program, which he has
> now provided. They are posted in the eGroups vault at
> Kevlin writes, "It is currently in experimental phase, and I would
> very much
> appreciate your initial thoughts on it."
> PS. Let's continue experimenting with the eGroups vault to post
> files for comments which are too big or otherwise unsuited to attach
> or include in email messages. Using the vault cuts a bottleneck
> (me!) out of the process.
> Tired of the same old games?
> Play the most popular gameshows online by the co-creator of Jeopardy
> At BoxerJam.comJoin now and enter to win $1000 cash
> -- 20 megs of disk space in your group's Document Vault
> -- http://www.egroups.com/docvault/boost/?m=1
-- Nick Ambrose Senior Software Engineer Ixia Communications, Inc. <mailto:nick_at_[hidden]> (818) 871-1800 x160 http://www.ixia.com Ixia... When the test really counts.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk