// // Copyright (c) ZeroC, Inc. All rights reserved. // #ifndef ICE_GRID_OBJECTCACHE_H #define ICE_GRID_OBJECTCACHE_H #include #include #include namespace IceGrid { class ObjectCache; class ObjectEntry { public: ObjectEntry(const ObjectInfo&, const std::string&, const std::string&); std::shared_ptr getProxy() const; std::string getType() const; std::string getApplication() const; std::string getServer() const; const ObjectInfo& getObjectInfo() const; bool canRemove(); private: const ObjectInfo _info; const std::string _application; const std::string _server; }; class ObjectCache : public Cache { public: ObjectCache(const std::shared_ptr&); void add(const ObjectInfo&, const std::string&, const std::string&); std::shared_ptr get(const Ice::Identity&) const; void remove(const Ice::Identity&); std::vector> getObjectsByType(const std::string&); ObjectInfoSeq getAll(const std::string&); ObjectInfoSeq getAllByType(const std::string&); const std::shared_ptr& getCommunicator() const { return _communicator; } private: class TypeEntry { public: void add(const std::shared_ptr&); bool remove(const std::shared_ptr&); const std::vector>& getObjects() const { return _objects; } private: std::vector> _objects; }; const std::shared_ptr _communicator; std::map _types; }; }; #endif