summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/WellKnownObjectsManager.h
blob: 1b286c76a83b13f01f0a8e6e0adfcbf86547639e (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
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//

#ifndef ICE_GRID_WELL_KNOWN_OBJECTS_MANAGER_H
#define ICE_GRID_WELL_KNOWN_OBJECTS_MANAGER_H

#include <IceGrid/Internal.h>
#include <IceGrid/Registry.h>

namespace IceGrid
{

class Database;

class WellKnownObjectsManager
{
public:

    WellKnownObjectsManager(const std::shared_ptr<Database>&);

    void add(const std::shared_ptr<Ice::ObjectPrx>&, const std::string&);
    void addEndpoint(const std::string&, const std::shared_ptr<Ice::ObjectPrx>&);
    void finish();

    void registerAll();
    void registerAll(const std::shared_ptr<ReplicaSessionPrx>&);
    void updateReplicatedWellKnownObjects();

    std::shared_ptr<Ice::ObjectPrx> getEndpoints(const std::string&);

    std::shared_ptr<LocatorPrx> getLocator();
    std::shared_ptr<Ice::LocatorRegistryPrx> getLocatorRegistry();

private:

    bool initialized() const;

    std::shared_ptr<Ice::ObjectPrx> getWellKnownObjectReplicatedProxy(const Ice::Identity&, const std::string&);

    const std::shared_ptr<Database> _database;
    bool _initialized;

    StringObjectProxyDict _endpoints;
    ObjectInfoSeq _wellKnownObjects;

    mutable std::mutex _mutex;
};

};

#endif