summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/optional/TestI.cpp
blob: 4e7251af4100c2ffff36b49ab40949ee9f89853b (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
// **********************************************************************
//
// Copyright (c) 2003-2012 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.
//
// **********************************************************************

#include <Ice/Ice.h>
#include <TestI.h>

using namespace Test;
using namespace IceUtil;
using namespace Ice;
using namespace std;

InitialI::InitialI()
{
}

void
InitialI::shutdown(const Current& current)
{
    current.adapter->getCommunicator()->shutdown();
}

ObjectPtr
InitialI::pingPong(const ObjectPtr& obj, const Current&)
{
    return obj;
}


void
InitialI::opOptionalException(const Optional<Int>& a, 
                              const Optional<string>& b, 
                              const Optional<OneOptionalPtr>& o,
                              const Ice::Current&)
{
    OptionalException ex;
    ex.a = a;
    ex.b = b;
    ex.o = o;
    throw ex;
}

Optional<Byte> 
InitialI::opByte(const Optional<Byte>& p1, Optional<Byte>& p3, const Current&)
{
    p3 = p1;
    return p1;
}

Optional<Long> 
InitialI::opLong(const Optional<Long>& p1, Optional<Long>& p3, const Current&)
{
    p3 = p1;
    return p1;
}

Optional<string> 
InitialI::opString(const Optional<string>& p1, Optional<string>& p3, const Current&)
{
    p3 = p1;
    return p1;
}

Optional<OneOptionalPtr> 
InitialI::opOneOptional(const Optional<OneOptionalPtr>& p1, Optional<OneOptionalPtr>& p3, const Current&)
{
    p3 = p1;
    return p1;
}

Optional<OneOptionalPrx> 
InitialI::opOneOptionalProxy(const Optional<OneOptionalPrx>& p1, Optional<OneOptionalPrx>& p3, const Current&)
{
    p3 = p1;
    return p1;
}

Optional<ByteSeq> 
InitialI::opByteSeq(const Optional<pair<const Byte*, const Byte*> >& p1, Optional<ByteSeq>& p3, const Current&)
{
    if(p1)
    {
        p3 = ByteSeq(p1->first, p1->second);
    }
    return p3;
}

Optional<ShortSeq> 
InitialI::opShortSeq(const Optional<pair<const Short*, const Short*> >& p1, Optional<ShortSeq>& p3, const Current&)
{
    if(p1)
    {
        p3 = ShortSeq(p1->first, p1->second);
    }
    return p3;
}

Optional<BoolSeq> 
InitialI::opBoolSeq(const Optional<pair<const bool*, const bool*> >& p1, Optional<BoolSeq>& p3, const Current&)
{
    if(p1)
    {
        p3 = BoolSeq(p1->first, p1->second);
    }
    return p3;
}

Optional<StringSeq> 
InitialI::opStringSeq(const Optional<pair<StringSeq::const_iterator, StringSeq::const_iterator> >& p1,
                      Optional<StringSeq>& p3, 
                      const Current&)
{
    if(p1)
    {
        p3 = StringSeq(p1->first, p1->second);
    }
    return p3;
}

Optional<FixedStructSeq> 
InitialI::opFixedStructSeq(const Optional<pair<const FixedStruct*, const FixedStruct*> >& p1,
                           Optional<FixedStructSeq>& p3, 
                           const Current&)
{
    if(p1)
    {
        p3 = FixedStructSeq(p1->first, p1->second);
    }
    return p3;
}
    
Optional<VarStructSeq> 
InitialI::opVarStructSeq(const Optional<pair<VarStructSeq::const_iterator, VarStructSeq::const_iterator> >& p1,
                         Optional<VarStructSeq>& p3, 
                         const Current&)
{
    if(p1)
    {
        p3 = VarStructSeq(p1->first, p1->second);
    }
    return p3;
}

void
InitialI::opClassAndUnknownOptional(const APtr& a, const Ice::Current&)
{
}