1 // 2 // Copyright (c) ZeroC, Inc. All rights reserved. 3 // 4 5 #ifndef ICE_SERVANT_MANAGER_H 6 #define ICE_SERVANT_MANAGER_H 7 8 #include <IceUtil/Shared.h> 9 #include <IceUtil/Mutex.h> 10 #include <Ice/ServantManagerF.h> 11 #include <Ice/InstanceF.h> 12 #include <Ice/ServantLocatorF.h> 13 #include <Ice/Identity.h> 14 #include <Ice/FacetMap.h> 15 16 namespace Ice 17 { 18 19 class ObjectAdapterI; 20 21 } 22 23 namespace IceInternal 24 { 25 26 class ServantManager : public IceUtil::Shared, public IceUtil::Mutex 27 { 28 public: 29 30 void addServant(const Ice::ObjectPtr&, const Ice::Identity&, const std::string&); 31 void addDefaultServant(const Ice::ObjectPtr&, const std::string&); 32 Ice::ObjectPtr removeServant(const Ice::Identity&, const std::string&); 33 Ice::ObjectPtr removeDefaultServant(const std::string&); 34 Ice::FacetMap removeAllFacets(const Ice::Identity&); 35 Ice::ObjectPtr findServant(const Ice::Identity&, const std::string&) const; 36 Ice::ObjectPtr findDefaultServant(const std::string&) const; 37 Ice::FacetMap findAllFacets(const Ice::Identity&) const; 38 bool hasServant(const Ice::Identity&) const; 39 40 void addServantLocator(const Ice::ServantLocatorPtr& locator, const std::string&); 41 Ice::ServantLocatorPtr removeServantLocator(const std::string&); 42 Ice::ServantLocatorPtr findServantLocator(const std::string&) const; 43 44 private: 45 46 ServantManager(const InstancePtr&, const std::string&); 47 ~ServantManager(); 48 void destroy(); 49 friend class Ice::ObjectAdapterI; 50 51 InstancePtr _instance; 52 53 const std::string _adapterName; 54 55 typedef std::map<Ice::Identity, Ice::FacetMap> ServantMapMap; 56 typedef std::map<std::string, Ice::ObjectPtr> DefaultServantMap; 57 58 ServantMapMap _servantMapMap; 59 mutable ServantMapMap::iterator _servantMapMapHint; 60 61 DefaultServantMap _defaultServantMap; 62 63 std::map<std::string, Ice::ServantLocatorPtr> _locatorMap; 64 mutable std::map<std::string, Ice::ServantLocatorPtr>::iterator _locatorMapHint; 65 }; 66 67 } 68 69 #endif 70