// ********************************************************************** // // Copyright (c) 2003-2006 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** #ifndef ICE_LOCATOR_INFO_H #define ICE_LOCATOR_INFO_H #include #include #include #include #include #include #include namespace IceInternal { class LocatorManager : public IceUtil::Shared, public IceUtil::Mutex { public: LocatorManager(); void destroy(); // // Returns locator info for a given locator. Automatically creates // the locator info if it doesn't exist yet. // LocatorInfoPtr get(const Ice::LocatorPrx&); private: std::map _table; std::map::iterator _tableHint; std::map _locatorTables; }; class LocatorTable : public IceUtil::Shared, public IceUtil::Mutex { public: LocatorTable(); void clear(); bool getAdapterEndpoints(const std::string&, int, ::std::vector&); void addAdapterEndpoints(const std::string&, const ::std::vector&); ::std::vector removeAdapterEndpoints(const std::string&); bool getProxy(const Ice::Identity&, int, Ice::ObjectPrx&); void addProxy(const Ice::Identity&, const Ice::ObjectPrx&); Ice::ObjectPrx removeProxy(const Ice::Identity&); private: bool checkTTL(const IceUtil::Time&, int) const; std::map > > _adapterEndpointsMap; std::map > _objectMap; }; class LocatorInfo : public IceUtil::Shared, public IceUtil::Mutex { public: LocatorInfo(const Ice::LocatorPrx&, const LocatorTablePtr&); void destroy(); bool operator==(const LocatorInfo&) const; bool operator!=(const LocatorInfo&) const; bool operator<(const LocatorInfo&) const; Ice::LocatorPrx getLocator() const; Ice::LocatorRegistryPrx getLocatorRegistry(); std::vector getEndpoints(const IndirectReferencePtr&, int, bool&); void clearCache(const IndirectReferencePtr&); void clearObjectCache(const IndirectReferencePtr&); private: void trace(const std::string&, const IndirectReferencePtr&, const std::vector&); const Ice::LocatorPrx _locator; Ice::LocatorRegistryPrx _locatorRegistry; const LocatorTablePtr _table; }; } #endif