diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-07-08 13:47:30 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-07-08 13:47:30 +0000 |
commit | 99894938dbde9a0bb10fc1998d9863cae52b8977 (patch) | |
tree | 5b68e52e9a62792f11d8a4e2c844d394cd39f496 /cpp/src/IceGrid/ObjectCache.h | |
parent | Fixed Ice interoperability issue (diff) | |
download | ice-99894938dbde9a0bb10fc1998d9863cae52b8977.tar.bz2 ice-99894938dbde9a0bb10fc1998d9863cae52b8977.tar.xz ice-99894938dbde9a0bb10fc1998d9863cae52b8977.zip |
More adapter replication changes.
Diffstat (limited to 'cpp/src/IceGrid/ObjectCache.h')
-rw-r--r-- | cpp/src/IceGrid/ObjectCache.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/cpp/src/IceGrid/ObjectCache.h b/cpp/src/IceGrid/ObjectCache.h new file mode 100644 index 00000000000..ab0467a71bb --- /dev/null +++ b/cpp/src/IceGrid/ObjectCache.h @@ -0,0 +1,71 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2005 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_GRID_OBJECTCACHE_H +#define ICE_GRID_OBJECTCACHE_H + +#include <IceUtil/Mutex.h> +#include <IceUtil/Shared.h> +#include <Ice/CommunicatorF.h> +#include <IceGrid/Cache.h> + +namespace IceGrid +{ + +class ObjectCache; + +class ServerEntry; +typedef IceUtil::Handle<ServerEntry> ServerEntryPtr; + +class ObjectEntry; +typedef IceUtil::Handle<ObjectEntry> ObjectEntryPtr; + +class ObjectEntry : public IceUtil::Shared +{ +public: + + ObjectEntry(Cache<Ice::Identity, ObjectEntry>&, const Ice::Identity&); + + void set(const Ice::CommunicatorPtr&, const std::string&, const ObjectDescriptor&); + Ice::ObjectPrx getProxy() const; + std::string getAdapterId() const; + const ObjectInfo& getObjectInfo() const; + std::string getType() const; + + bool canRemove(); + +private: + + ObjectInfo _info; + std::string _adapterId; +}; +typedef IceUtil::Handle<ObjectEntry> ObjectEntryPtr; + +class ObjectCache : public Cache<Ice::Identity, ObjectEntry> +{ +public: + + ObjectCache(const Ice::CommunicatorPtr&); + + void add(const std::string&, const ObjectDescriptor&); + ObjectEntryPtr get(const Ice::Identity&) const; + ObjectEntryPtr remove(const Ice::Identity&); + + Ice::ObjectProxySeq getObjectsWithType(const std::string&); + ObjectInfoSeq getAll(const std::string&); + +private: + + const Ice::CommunicatorPtr _communicator; + std::map<std::string, std::set<Ice::Identity> > _types; +}; + +}; + +#endif |