summaryrefslogtreecommitdiff
path: root/php/lib/Ice_ns.php
blob: 5f309a535caad0604a7e80959805f012798b2669 (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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<?php
// **********************************************************************
//
// Copyright (c) 2003-2009 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.
//
// **********************************************************************

namespace Ice
{
    //
    // Exceptions.
    //
    abstract class Exception extends \Exception
    {
        public function __construct($message = '')
        {
            parent::__construct($message);
        }

        abstract public function ice_name();
    }

    abstract class UserException extends Exception
    {
        public function __construct($message = '')
        {
            parent::__construct($message);
        }
    }

    abstract class LocalException extends Exception
    {
        public function __construct($message = '')
        {
            parent::__construct($message);
        }
    }

    interface Object
    {
        public function ice_isA($id);
        public function ice_ping();
        public function ice_ids();
        public function ice_id();

        //
        // No need to define these here; the marshaling code will invoke them if defined by a subclass.
        //
        //public function ice_preMarshal();
        //public function ice_postUnmarshal();
    }

    abstract class ObjectImpl implements Object
    {
        public function ice_isA($id)
        {
            return array_search($id, ice_ids());
        }

        public function ice_ping()
        {
        }

        public function ice_ids()
        {
            return array(ice_id());
        }

        public function ice_id()
        {
            return "::Ice::Object";
        }
    }

    $Ice__t_Object = IcePHP_defineClass('::Ice::Object', "\\Ice\\Object", true, null, null, null);
    $Ice__t_ObjectSeq = IcePHP_defineSequence('::Ice::ObjectSeq', $Ice__t_Object);
    $Ice__t_LocalObject = IcePHP_defineClass('::Ice::LocalObject', "\\Ice\\LocalObject", true, null, null, null);
    $Ice__t_ObjectPrx = IcePHP_defineProxy($Ice__t_Object);
    $Ice__t_ObjectProxySeq = IcePHP_defineSequence('::Ice::ObjectProxySeq', $Ice__t_ObjectPrx);

    interface ObjectFactory
    {
        public function create($id);
        public function destroy();
    }

    class InitializationData
    {
        public function __construct($properties=null, $logger=null)
        {
            $this->properties = $properties;
            $this->logger = $logger;
        }

        public $properties;
        public $logger;
    }

    $Ice_sliceChecksums = array();
}

namespace
{
//
// Include certain generated files.
//
require 'Ice/BuiltinSequences.php';
require 'Ice/Endpoint.php';
require 'Ice/EndpointTypes.php';
require 'Ice/LocalException.php';
require 'Ice/Locator.php';
require 'Ice/ObjectFactory.php';
require 'Ice/Process.php';
require 'Ice/Router.php';

IcePHP_defineOperation($Ice__t_Object, 'ice_isA', 0, 0, array($IcePHP__t_string), array(), $IcePHP__t_bool, null);
IcePHP_defineOperation($Ice__t_Object, 'ice_ping', 0, 0, null, null, null, null);
IcePHP_defineOperation($Ice__t_Object, 'ice_id', 0, 0, null, null, $IcePHP__t_string, null);
IcePHP_defineOperation($Ice__t_Object, 'ice_ids', 0, 0, null, null, $Ice__t_StringSeq, null);
}

namespace Ice
{
    //
    // Proxy comparison functions.
    //
    function proxyIdentityCompare($lhs, $rhs)
    {
        if(($lhs != null && !($lhs instanceof ObjectPrx)) || ($rhs != null && !($rhs instanceof ObjectPrx)))
        {
            throw new InvalidArgumentException('argument is not a proxy');
        }
        if($lhs == null && $rhs == null)
        {
            return 0;
        }
        elseif($lhs == null && $rhs != null)
        {
            return -1;
        }
        elseif($lhs != null && $rhs == null)
        {
            return 1;
        }
        else
        {
            $lid = $lhs->ice_getIdentity();
            $rid = $rhs->ice_getIdentity();
            if($lid < $rid)
            {
                return -1;
            }
            elseif($lid > $rid)
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
    }

    function proxyIdentityEqual($lhs, $rhs)
    {
        return proxyIdentityCompare($lhs, $rhs) == 0;
    }

    function proxyIdentityAndFacetCompare($lhs, $rhs)
    {
        $n = proxyIdentityCompare($lhs, $rhs);
        if($n == 0 && $lhs != null && $rhs != null)
        {
            $n = strcmp($lhs->ice_getFacet(), $rhs->ice_getFacet());
        }
        return $n;
    }

    function proxyIdentityAndFacetEqual($lhs, $rhs)
    {
        return proxyIdentityAndFacetCompare($lhs, $rhs) == 0;
    }
}

namespace
{
    function Ice_proxyIdentityCompare($lhs, $rhs)
    {
        return Ice\proxyIdentityCompare($lhs, $rhs);
    }

    function Ice_proxyIdentityEqual($lhs, $rhs)
    {
        return Ice\proxyIdentityEqual($lhs, $rhs);
    }

    function Ice_proxyIdentityAndFacetCompare($lhs, $rhs)
    {
        return Ice\proxyIdentityAndFacetCompare($lhs, $rhs);
    }

    function Ice_proxyIdentityAndFacetEqual($lhs, $rhs)
    {
        return Ice\proxyIdentityAndFacetEqual($lhs, $rhs);
    }
}
?>