blob: a0b3f01bf257644d55bc6674574ac478650ebd43 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
#ifndef ICE_GRID_OBJECTCACHE_H
#define ICE_GRID_OBJECTCACHE_H
#include <Ice/CommunicatorF.h>
#include <IceGrid/Cache.h>
#include <IceGrid/Internal.h>
namespace IceGrid
{
class ObjectCache;
class ObjectEntry
{
public:
ObjectEntry(const ObjectInfo&, const std::string&, const std::string&);
std::shared_ptr<Ice::ObjectPrx> 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<Ice::Identity, ObjectEntry>
{
public:
ObjectCache(const std::shared_ptr<Ice::Communicator>&);
void add(const ObjectInfo&, const std::string&, const std::string&);
std::shared_ptr<ObjectEntry> get(const Ice::Identity&) const;
void remove(const Ice::Identity&);
std::vector<std::shared_ptr<ObjectEntry>> getObjectsByType(const std::string&);
ObjectInfoSeq getAll(const std::string&);
ObjectInfoSeq getAllByType(const std::string&);
const std::shared_ptr<Ice::Communicator>& getCommunicator() const { return _communicator; }
private:
class TypeEntry
{
public:
void add(const std::shared_ptr<ObjectEntry>&);
bool remove(const std::shared_ptr<ObjectEntry>&);
const std::vector<std::shared_ptr<ObjectEntry>>& getObjects() const { return _objects; }
private:
std::vector<std::shared_ptr<ObjectEntry>> _objects;
};
const std::shared_ptr<Ice::Communicator> _communicator;
std::map<std::string, TypeEntry> _types;
};
};
#endif
|