1 // 2 // Copyright (c) ZeroC, Inc. All rights reserved. 3 // 4 5 #ifndef ICE_PLUGIN_MANAGER_I_H 6 #define ICE_PLUGIN_MANAGER_I_H 7 8 #include <Ice/Plugin.h> 9 #include <Ice/InstanceF.h> 10 #include <Ice/CommunicatorF.h> 11 #include <Ice/DynamicLibraryF.h> 12 #include <Ice/BuiltinSequences.h> 13 #include <IceUtil/Mutex.h> 14 #include <map> 15 16 namespace Ice 17 { 18 19 typedef Ice::Plugin* (*PluginFactory)(const ::Ice::CommunicatorPtr&, const std::string&, const ::Ice::StringSeq&); 20 21 class PluginManagerI : public PluginManager, public IceUtil::Mutex 22 { 23 public: 24 25 static void registerPluginFactory(const std::string&, PluginFactory, bool); 26 27 virtual void initializePlugins(); 28 virtual StringSeq getPlugins() ICE_NOEXCEPT; 29 virtual PluginPtr getPlugin(const std::string&); 30 virtual void addPlugin(const std::string&, const PluginPtr&); 31 virtual void destroy() ICE_NOEXCEPT; 32 PluginManagerI(const CommunicatorPtr&, const IceInternal::DynamicLibraryListPtr&); 33 34 private: 35 36 friend class IceInternal::Instance; 37 38 void loadPlugins(int&, const char*[]); 39 void loadPlugin(const std::string&, const std::string&, StringSeq&); 40 41 PluginPtr findPlugin(const std::string&) const; 42 43 CommunicatorPtr _communicator; 44 IceInternal::DynamicLibraryListPtr _libraries; 45 46 struct PluginInfo 47 { 48 std::string name; 49 PluginPtr plugin; 50 }; 51 typedef std::vector<PluginInfo> PluginInfoList; 52 53 PluginInfoList _plugins; 54 bool _initialized; 55 static const char * const _kindOfObject; 56 }; 57 typedef IceUtil::Handle<PluginManagerI> PluginManagerIPtr; 58 59 } 60 61 #endif 62