summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Reference.h
blob: 85670a396f1629f055a067417c7be7bdb4b929af (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// **********************************************************************
//
// Copyright (c) 2002
// Mutable Realms, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************

#ifndef ICE_REFERENCE_H
#define ICE_REFERENCE_H

#include <IceUtil/Shared.h>
#include <Ice/ReferenceF.h>
#include <Ice/ReferenceFactoryF.h>
#include <Ice/EndpointF.h>
#include <Ice/InstanceF.h>
#include <Ice/RouterF.h>
#include <Ice/LocatorF.h>
#include <Ice/RouterInfoF.h>
#include <Ice/LocatorInfoF.h>
#include <Ice/ObjectAdapterF.h>
#include <Ice/Identity.h>

namespace IceInternal
{

class BasicStream;

class Reference : public ::IceUtil::Shared
{
public:

    enum Mode
    {
	ModeTwoway,
	ModeOneway,
	ModeBatchOneway,
	ModeDatagram,
	ModeBatchDatagram,
	ModeLast = ModeBatchDatagram
    };

    bool operator==(const Reference&) const;
    bool operator!=(const Reference&) const;
    bool operator<(const Reference&) const;

    //
    // Marshal the reference
    //
    void streamWrite(BasicStream*) const;

    //
    // Convert the reference to its string form
    //
    std::string toString() const;

    //
    // All  members are const, because References are immutable.
    //
    const InstancePtr instance;
    const Ice::Identity identity;
    const std::vector<std::string> facet;
    const Mode mode;
    const bool secure;
    const bool compress;
    const std::string adapterId;
    const std::vector<EndpointPtr> endpoints;
    const RouterInfoPtr routerInfo; // Null if no router is used.
    const LocatorInfoPtr locatorInfo; // Null if no locator is used.
    const Ice::ObjectAdapterPtr reverseAdapter; // For reverse communications using the adapter's incoming connections.
    const Ice::Int hashValue;

    //
    // Get a new reference, based on the existing one, overwriting
    // certain values.
    //
    ReferencePtr changeIdentity(const Ice::Identity&) const;
    ReferencePtr changeFacet(const std::vector<std::string>&) const;
    ReferencePtr changeTimeout(int) const;
    ReferencePtr changeMode(Mode) const;
    ReferencePtr changeSecure(bool) const;
    ReferencePtr changeCompress(bool) const;
    ReferencePtr changeAdapterId(const std::string&) const;
    ReferencePtr changeEndpoints(const std::vector<EndpointPtr>&) const;
    ReferencePtr changeRouter(const ::Ice::RouterPrx&) const;
    ReferencePtr changeLocator(const ::Ice::LocatorPrx&) const;
    ReferencePtr changeDefault() const;
 
private:

    Reference(const InstancePtr&, const Ice::Identity&, const std::vector<std::string>&, Mode, bool, bool,
	      const std::string&, const std::vector<EndpointPtr>&,
	      const RouterInfoPtr&, const LocatorInfoPtr&,
	      const Ice::ObjectAdapterPtr&);
    friend class ReferenceFactory;
};

}

#endif