From: stephan b. <st...@s1...> - 2004-12-28 04:31:25
|
Yo! Before i finally get to sleep: i just added a feature to SIO which uses one of s11n's least-known features: the ability to work with arbitrary "data node" types. That is, it can de/serialize using an arbitrary container type for serialized data. We use a node_traits<> type to achieve the node type transparency for the core. Anyway: i took SimplePropertyStore and extended it: P::SIO::S11nNode. i simply had to swap out a typedef in SIO to make that the new framework-supported node type. Client code doesn't need to change to see such a node-swap: test/s11nTest.cpp, which is a fully-functional SIO client, worked as-is. It did of course need a recompile to get the new class. Strangely enough: s11n_node is a direct descendant, code-wise, of property_store, which is the class i refactored to make SimplePropertyStore... which i then subclassed to make S11nNode... by copy/pasting the missing functions from s11n_node. Talk about code re-use ;). This was mainly an experiment, in any case. There is a valid reason *not* to implement a custom data node type, and that is efficiency: s11n::s11n_node is not polymorphic, whereas S11nNode is. Since an arbitrary number of nodes can be created for any given tree of data, a monomorphic type is probably notably more efficient. (i've tested with up to 57k nodes. Theoretically the RAM and system pointer size determine the limits.) -- ----- st...@s1... http://s11n.net "...pleasure is a grace and is not obedient to the commands of the will." -- Alan W. Watts |