summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/Reference.h
blob: 3fc659beaff68ce5d5bf71e534faaf769fd19dff (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) 2002
// MutableRealms, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************

#ifndef ICE_REFERENCE_H
#define ICE_REFERENCE_H

#include <Ice/ReferenceF.h>
#include <Ice/EndpointF.h>
#include <Ice/InstanceF.h>
#include <Ice/Shared.h>

namespace IceInternal
{

class Stream;

class Reference : public Shared
{
public:

    Reference(const InstancePtr&, const std::string&,
	      const std::vector<EndpointPtr>&, const std::vector<EndpointPtr>&);
    Reference(const InstancePtr&, const std::string&);
    Reference(Stream*);

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

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

    //
    // All  members are const, because References are immutable.
    //
    const InstancePtr instance;
    const std::string identity;

    enum Mode
    {
	ModeTwoway,
	ModeOneway,
	ModeSecure,
	ModeDatagram
    };
    const Mode mode;

    const std::vector<EndpointPtr> origEndpoints; // Original endpoints
    const std::vector<EndpointPtr> endpoints; // Actual endpoints (set by a location forward)

    //
    // Get a new reference, based on the existing one, overwriting
    // certain values.
    //
    ReferencePtr changeIdentity(const std::string&) const;
    ReferencePtr changeTimeout(int) const;
    ReferencePtr changeMode(Mode) const;
    ReferencePtr changeEndpoints(const std::vector<EndpointPtr>&) const;
 
    bool operator==(const Reference&) const;
    bool operator!=(const Reference&) const;
    bool operator<(const Reference&) const;
};

}

#endif