summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ReferenceFactory.h
blob: e687c956255709de48aae6d3e8d1ac8a853904cc (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
78
79
80
81
82
83
84
// **********************************************************************
//
// Copyright (c) 2003-2007 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_REFERENCE_FACTORY_H
#define ICE_REFERENCE_FACTORY_H

#include <IceUtil/Shared.h>
#include <IceUtil/Mutex.h>
#include <Ice/ReferenceFactoryF.h>
#include <Ice/Reference.h> // For Reference::Mode
#include <Ice/ConnectionIF.h>

namespace IceInternal
{

class ReferenceFactory : public ::IceUtil::Shared, public ::IceUtil::Mutex
{
public:

    //
    // Make a polymorphic copy of a reference.
    //
    ReferencePtr copy(const Reference* r) const;

    //
    // Create a direct reference.
    //
    ReferencePtr create(const ::Ice::Identity&, const SharedContextPtr&, const ::std::string&,
                        Reference::Mode, bool, bool, const ::std::vector<EndpointIPtr>&,
                        const RouterInfoPtr&, bool, bool, Ice::EndpointSelectionType, bool);
    //
    // Create an indirect reference.
    //
    ReferencePtr create(const ::Ice::Identity&, const SharedContextPtr&, const ::std::string&,
                        Reference::Mode, bool, bool, const ::std::string&,
                        const RouterInfoPtr&, const LocatorInfoPtr&, bool, bool, Ice::EndpointSelectionType, bool, int);
    //
    // Create a fixed reference.
    //
    ReferencePtr create(const ::Ice::Identity&, const SharedContextPtr&, const ::std::string&,
                        Reference::Mode, const ::std::vector< ::Ice::ConnectionIPtr>&);

    //
    // Create a reference from a string.
    //
    ReferencePtr create(const ::std::string&);

    //
    // Create a reference from a property set.
    //
    ReferencePtr createFromProperties(const ::std::string&);

    //
    // Create a reference by unmarshaling it from a stream.
    //
    ReferencePtr create(const ::Ice::Identity&, BasicStream*);

    void setDefaultRouter(const ::Ice::RouterPrx&);
    ::Ice::RouterPrx getDefaultRouter() const;

    void setDefaultLocator(const ::Ice::LocatorPrx&);
    ::Ice::LocatorPrx getDefaultLocator() const;

private:

    ReferenceFactory(const InstancePtr&, const ::Ice::CommunicatorPtr&);
    void destroy();
    friend class Instance;

    InstancePtr _instance;
    ::Ice::CommunicatorPtr _communicator;
    ::Ice::RouterPrx _defaultRouter;
    ::Ice::LocatorPrx _defaultLocator;
};

}

#endif