From: stephan b. <sg...@us...> - 2004-12-26 06:09:20
|
Update of /cvsroot/pclasses/pclasses2/src/s11n/io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18900/src/s11n/io Modified Files: serializers.h Log Message: Removed unnecessary serializer_plugin_manager. Now uses Factory's aliasing support to map the cookie and short-form alias. Index: serializers.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/src/s11n/io/serializers.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- serializers.h 26 Dec 2004 04:04:32 -0000 1.1 +++ serializers.h 26 Dec 2004 06:09:11 -0000 1.2 @@ -19,55 +19,6 @@ namespace s11n { namespace io { - template <typename NodeType> - class serializer_plugin_manager : - public ::P::Plugin::PluginManager< data_node_serializer< NodeType > > - { - public: - serializer_plugin_manager(){} - virtual ~serializer_plugin_manager(){} - - }; - } // P::s11n::io - } // P::s11n - - namespace Hook - { - /** - This hook will cause calls to Factory::instance() to return - a serializer_plugin_manager instance in disguise. - */ - template < typename NodeT > - struct FactoryInstanceHook< ::P::Factory< ::P::s11n::io::data_node_serializer<NodeT>, ::P::Sharing::FactoryContext, std::string > > - { - typedef ::P::Factory< ::P::s11n::io::data_node_serializer<NodeT>, ::P::Sharing::FactoryContext, std::string > FactoryType; - typedef ::P::s11n::io::serializer_plugin_manager< NodeT > RealFactoryType; - typedef FactoryInstanceHook<FactoryType> ThisType; - - /** - Initializes the passed-in factory. i.e., it does - nothing. It's here for demonstration purposes. - */ - void operator()( FactoryType & ) throw() - { - CERR << "Initializing a PluginManager instance() we hacked in via FactoryInstanceHook!\n"; - } - - /** - The default implementation returns a shared Factory object. - THIS type's operator() will be called on the factory immediately - after creating the factory. - */ - static FactoryType & instance() - { - typedef ::P::Phoenix<RealFactoryType, ::P::Sharing::FactoryContext, ThisType > PHX; - return PHX::instance(); - } - }; - - } // P::Hook - - namespace s11n { namespace io { /** Populates target list with the names of registered @@ -164,27 +115,21 @@ // CERR << "FIXME: register_serializer() not yet fixed to work with P::Factory.\n"; // return; -#define PM pluginManager< BaseST >() +#define PM ::P::Plugin::pluginManager< BaseST >() #define FACCREATE ::P::Hook::FactoryCreateHook<BaseST,ST>::create - using namespace ::P::Plugin; static bool inited = false; if( ! inited && (inited=true) ) { - PM.searchPath().addExtension( "_serializer.so" ); - PM.searchPath().addExtension( "_serializer.dll" ); - // cllite::class_path().add_extension( "_serializer.so" ); - // cllite::class_path().add_extension( "_serializer.dll" ); + std::string ext = std::string("_serializer.") + ::P::System::SharedLib::extension(); + PM.searchPath().addExtension( ext ); } CERR << "register_serializer(" << classname << ","<<alias<<")\n"; PM.registerFactory( classname, FACCREATE ); - PM.registerFactory( alias, FACCREATE ); - PM.registerFactory( ST().magic_cookie(), FACCREATE ); + PM.alias( alias, classname ); + PM.alias( ST().magic_cookie(), classname ); #undef PM #undef FACCREATE -// ::P::s11n::cl::classloader_register< BaseST, ST >( classname ); -// ::P::s11n::cl::classloader< BaseST >().alias( alias, classname ); -// ::P::s11n::cl::classloader< BaseST >().alias( ST().magic_cookie(), classname ); } /** @@ -197,7 +142,6 @@ s11n::io::data_node_serializer<NodeT> * create_serializer( const std::string & classname ) { - // typedef serializer_plugin_manager<NodeT> SPM; try { CERR << "create_serializer("<<classname<<") trying plugin manager...\n"; |