From: stephan b. <sg...@us...> - 2004-12-26 07:52:16
|
Update of /cvsroot/pclasses/pclasses2/src/s11n In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2695/src/s11n Added Files: SIO.cpp SIO.h Log Message: egg --- NEW FILE: SIO.h --- #ifndef p_SIO_H_INCLUDED #define p_SIO_H_INCLUDED 1 //////////////////////////////////////////////////////////////////////// // SIO.h: // Author: stephan beal <st...@s1...> // License: Public Domain // // This header is intended to provide the standard P::s11n interface, // in particular the client-side interface. // //////////////////////////////////////////////////////////////////////// #include <string> #include <pclasses/Plugin/Plugin.h> #include <pclasses/s11n/s11n.h> #include <pclasses/s11n/io/serializers.h> namespace P { /** The SIO namespace encapsulates the entire client-side s11n-related API. Clients using s11n proxies and implementing serialization code may need to use the classes in the P::s11n as well. */ namespace SIO { /** The concrete "data node" type used by serialization operations. Node that it is considered poor form to use an S11nNode's API directly, as it's type and interface may change. The only guaranty the S11nNode's API guarantees is that NodeTraits::funcs(S11nNode &...) operations will work as expected. More clearly: use NodeTraits to manipulate and query nodes, not the node API directly. In fact s11n_node's useful API is all private, so you CAN'T touch it without going through NodeTraits. :) Gotcha! */ typedef ::P::s11n::s11n_node S11nNode; /** NodeTraits are used to get information from S11nNode. */ typedef ::P::s11n::node_traits<S11nNode> NodeTraits; /** The parent type of Serializers supported by this interface. */ typedef ::P::s11n::io::data_node_serializer<S11nNode> SerializerInterface; /** A plugin manager type for loading SerializerInterface objects. */ typedef ::P::Plugin::PluginManager<SerializerInterface> SerializerPluginManager; /** See ::P::s11n::serialize(). */ template <typename SerializableT> bool serialize( S11nNode & dest, const SerializableT & src ) { return ::P::s11n::serialize<S11nNode,SerializableT>( dest, src ); } /** See ::P::s11n::derialize(). */ template <typename SerializableType> SerializableType * deserialize( const S11nNode & src ) { return ::P::s11n::deserialize<S11nNode,SerializableType>( src ); } /** See ::P::s11n::deserialize(). */ template <typename DeserializableT> bool deserialize( const S11nNode & src, DeserializableT & target ) { return ::P::s11n::deserialize<S11nNode,DeserializableT>( src, target ); } /** See ::P::s11n::serialize_subnode(). */ template <typename SerializableType> bool serializeSubnode( S11nNode & dest, const std::string & subnodename, const SerializableType & src ) { return ::P::s11n::serialize_subnode<S11nNode,SerializableType>( dest, subnodename, src ); } /** See ::P::s11n::deserialize_subnode(). */ template <typename DeserializableT> DeserializableT * deserializeSubnode( const S11nNode & src, const std::string & subnodename ) { return ::P::s11n::deserialize_subnode<S11nNode,DeserializableT>( src, subnodename ); } /** See ::P::s11n::deserialize_subnode(). */ template <typename DeserializableT> bool deserializeSubnode( const S11nNode & src, const std::string & subnodename, DeserializableT & target ) { return ::P::s11n::deserialize_subnode<S11nNode,DeserializableT>( src, subnodename, target ); } /** See ::P::s11n::io::load_node(). */ S11nNode * loadNode( std::istream & src ); /** See ::P::s11n::io::load_node(src). */ S11nNode * loadNode( const std::string & src ); /** See ::P::s11n::io::load_serializable(). */ template <typename SerializableType> SerializableType * loadSerializable( std::istream & src ) { return ::P::s11n::io::load_serializable<S11nNode,SerializableType>( src ); } } // namespace SIO } // namespace P #endif // p_SIO_H_INCLUDED --- NEW FILE: SIO.cpp --- #include "SIO.h" namespace P { /** */ namespace SIO { S11nNode * loadNode( std::istream & src ) { return ::P::s11n::io::load_node<S11nNode>( src ); } S11nNode * loadNode( const std::string & src ) { return ::P::s11n::io::load_node<S11nNode>( src ); } }} // P::SIO |