EchoSample.cpp
Go to the documentation of this file.
1 // **********************************************************************
2 //
3 // Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
4 //
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
7 //
8 // **********************************************************************
9 
10 // Ice version 3.2.1
11 // Generated from file `EchoSample.ice'
12 
13 #include <EchoSample.h>
14 #include <Ice/LocalException.h>
15 #include <Ice/ObjectFactory.h>
16 #include <Ice/BasicStream.h>
17 #include <Ice/Object.h>
18 #include <IceUtil/Iterator.h>
19 #include <IceUtil/ScopedArray.h>
20 
21 #ifndef ICE_IGNORE_VERSION
22 # if ICE_INT_VERSION / 100 != 302
23 # error Ice version mismatch!
24 # endif
25 # if ICE_INT_VERSION % 100 > 50
26 # error Beta header file detected
27 # endif
28 # if ICE_INT_VERSION % 100 < 1
29 # error Ice patch level mismatch!
30 # endif
31 #endif
32 
33 static const ::std::string __Demo__EchoSample__echo_name = "echo";
34 
35 void
37 {
38  p->__incRef();
39 }
40 
41 void
43 {
44  p->__decRef();
45 }
46 
47 void
49 {
50  p->__incRef();
51 }
52 
53 void
55 {
56  p->__decRef();
57 }
58 
59 void
60 Demo::__write(::IceInternal::BasicStream* __os, const ::Demo::EchoSamplePrx& v)
61 {
62  __os->write(::Ice::ObjectPrx(v));
63 }
64 
65 void
66 Demo::__read(::IceInternal::BasicStream* __is, ::Demo::EchoSamplePrx& v)
67 {
68  ::Ice::ObjectPrx proxy;
69  __is->read(proxy);
70  if(!proxy)
71  {
72  v = 0;
73  }
74  else
75  {
76  v = new ::IceProxy::Demo::EchoSample;
77  v->__copyFrom(proxy);
78  }
79 }
80 
81 void
82 Demo::__write(::IceInternal::BasicStream* __os, const ::Demo::EchoSamplePtr& v)
83 {
84  __os->write(::Ice::ObjectPtr(v));
85 }
86 
87 void
88 Demo::__addObject(const EchoSamplePtr& p, ::IceInternal::GCCountMap& c)
89 {
90  p->__addObject(c);
91 }
92 
93 bool
95 {
96  return p->__usesClasses();
97 }
98 
99 void
101 {
102  p->__decRefUnsafe();
103 }
104 
105 void
107 {
108  p.__clearHandleUnsafe();
109 }
110 
111 void
112 IceProxy::Demo::EchoSample::echo(const ::std::string& msg, const ::Ice::Context* __ctx)
113 {
114  int __cnt = 0;
115  while(true)
116  {
117  ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase;
118  try
119  {
120  __delBase = __getDelegate();
121  ::IceDelegate::Demo::EchoSample* __del = dynamic_cast< ::IceDelegate::Demo::EchoSample*>(__delBase.get());
122  __del->echo(msg, __ctx);
123  return;
124  }
125  catch(const ::IceInternal::LocalExceptionWrapper& __ex)
126  {
127  __handleExceptionWrapper(__delBase, __ex);
128  }
129  catch(const ::Ice::LocalException& __ex)
130  {
131  __handleException(__delBase, __ex, __cnt);
132  }
133  }
134 }
135 
136 const ::std::string&
138 {
139  return ::Demo::EchoSample::ice_staticId();
140 }
141 
142 ::IceInternal::Handle< ::IceDelegateM::Ice::Object>
144 {
145  return ::IceInternal::Handle< ::IceDelegateM::Ice::Object>(new ::IceDelegateM::Demo::EchoSample);
146 }
147 
148 ::IceInternal::Handle< ::IceDelegateD::Ice::Object>
150 {
151  return ::IceInternal::Handle< ::IceDelegateD::Ice::Object>(new ::IceDelegateD::Demo::EchoSample);
152 }
153 
154 bool
155 IceProxy::Demo::operator==(const ::IceProxy::Demo::EchoSample& l, const ::IceProxy::Demo::EchoSample& r)
156 {
157  return static_cast<const ::IceProxy::Ice::Object&>(l) == static_cast<const ::IceProxy::Ice::Object&>(r);
158 }
159 
160 bool
161 IceProxy::Demo::operator!=(const ::IceProxy::Demo::EchoSample& l, const ::IceProxy::Demo::EchoSample& r)
162 {
163  return static_cast<const ::IceProxy::Ice::Object&>(l) != static_cast<const ::IceProxy::Ice::Object&>(r);
164 }
165 
166 bool
167 IceProxy::Demo::operator<(const ::IceProxy::Demo::EchoSample& l, const ::IceProxy::Demo::EchoSample& r)
168 {
169  return static_cast<const ::IceProxy::Ice::Object&>(l) < static_cast<const ::IceProxy::Ice::Object&>(r);
170 }
171 
172 bool
173 IceProxy::Demo::operator<=(const ::IceProxy::Demo::EchoSample& l, const ::IceProxy::Demo::EchoSample& r)
174 {
175  return l < r || l == r;
176 }
177 
178 bool
179 IceProxy::Demo::operator>(const ::IceProxy::Demo::EchoSample& l, const ::IceProxy::Demo::EchoSample& r)
180 {
181  return !(l < r) && !(l == r);
182 }
183 
184 bool
185 IceProxy::Demo::operator>=(const ::IceProxy::Demo::EchoSample& l, const ::IceProxy::Demo::EchoSample& r)
186 {
187  return !(l < r);
188 }
189 
190 void
191 IceDelegateM::Demo::EchoSample::echo(const ::std::string& msg, const ::Ice::Context* __context)
192 {
193  ::IceInternal::Outgoing __og(__connection.get(), __reference.get(), __Demo__EchoSample__echo_name, ::Ice::Normal, __context, __compress);
194  try
195  {
196  ::IceInternal::BasicStream* __os = __og.os();
197  __os->write(msg);
198  }
199  catch(const ::Ice::LocalException& __ex)
200  {
201  __og.abort(__ex);
202  }
203  bool __ok = __og.invoke();
204  try
205  {
206  ::IceInternal::BasicStream* __is = __og.is();
207  if(!__ok)
208  {
209  try
210  {
211  __is->throwException();
212  }
213  catch(const ::Ice::UserException& __ex)
214  {
215  throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
216  }
217  }
218  }
219  catch(const ::Ice::LocalException& __ex)
220  {
221  throw ::IceInternal::LocalExceptionWrapper(__ex, false);
222  }
223 }
224 
225 void
226 IceDelegateD::Demo::EchoSample::echo(const ::std::string& msg, const ::Ice::Context* __context)
227 {
228  ::Ice::Current __current;
229  __initCurrent(__current, __Demo__EchoSample__echo_name, ::Ice::Normal, __context);
230  while(true)
231  {
232  ::IceInternal::Direct __direct(__current);
233  try
234  {
235  ::Demo::EchoSample* __servant = dynamic_cast< ::Demo::EchoSample*>(__direct.servant().get());
236  if(!__servant)
237  {
238  ::Ice::OperationNotExistException __opEx(__FILE__, __LINE__);
239  __opEx.id = __current.id;
240  __opEx.facet = __current.facet;
241  __opEx.operation = __current.operation;
242  throw __opEx;
243  }
244  try
245  {
246  __servant->echo(msg, __current);
247  }
248  catch(const ::Ice::LocalException& __ex)
249  {
250  throw ::IceInternal::LocalExceptionWrapper(__ex, false);
251  }
252  }
253  catch(...)
254  {
255  __direct.destroy();
256  throw;
257  }
258  __direct.destroy();
259  return;
260  }
261 }
262 
263 ::Ice::ObjectPtr
265 {
266  throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);
267  return 0; // to avoid a warning with some compilers
268 }
269 
270 static const ::std::string __Demo__EchoSample_ids[2] =
271 {
272  "::Demo::EchoSample",
273  "::Ice::Object"
274 };
275 
276 bool
277 Demo::EchoSample::ice_isA(const ::std::string& _s, const ::Ice::Current&) const
278 {
279  return ::std::binary_search(__Demo__EchoSample_ids, __Demo__EchoSample_ids + 2, _s);
280 }
281 
282 ::std::vector< ::std::string>
283 Demo::EchoSample::ice_ids(const ::Ice::Current&) const
284 {
285  return ::std::vector< ::std::string>(&__Demo__EchoSample_ids[0], &__Demo__EchoSample_ids[2]);
286 }
287 
288 const ::std::string&
289 Demo::EchoSample::ice_id(const ::Ice::Current&) const
290 {
291  return __Demo__EchoSample_ids[0];
292 }
293 
294 const ::std::string&
296 {
297  return __Demo__EchoSample_ids[0];
298 }
299 
300 ::IceInternal::DispatchStatus
301 Demo::EchoSample::___echo(::IceInternal::Incoming&__inS, const ::Ice::Current& __current)
302 {
303  __checkMode(::Ice::Normal, __current.mode);
304  ::IceInternal::BasicStream* __is = __inS.is();
305  ::std::string msg;
306  __is->read(msg);
307  echo(msg, __current);
308  return ::IceInternal::DispatchOK;
309 }
310 
311 static ::std::string __Demo__EchoSample_all[] =
312 {
313  "echo",
314  "ice_id",
315  "ice_ids",
316  "ice_isA",
317  "ice_ping"
318 };
319 
320 ::IceInternal::DispatchStatus
321 Demo::EchoSample::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current)
322 {
323  ::std::pair< ::std::string*, ::std::string*> r = ::std::equal_range(__Demo__EchoSample_all, __Demo__EchoSample_all + 5, current.operation);
324  if(r.first == r.second)
325  {
326  return ::IceInternal::DispatchOperationNotExist;
327  }
328 
329  switch(r.first - __Demo__EchoSample_all)
330  {
331  case 0:
332  {
333  return ___echo(in, current);
334  }
335  case 1:
336  {
337  return ___ice_id(in, current);
338  }
339  case 2:
340  {
341  return ___ice_ids(in, current);
342  }
343  case 3:
344  {
345  return ___ice_isA(in, current);
346  }
347  case 4:
348  {
349  return ___ice_ping(in, current);
350  }
351  }
352 
353  assert(false);
354  return ::IceInternal::DispatchOperationNotExist;
355 }
356 
357 void
358 Demo::EchoSample::__write(::IceInternal::BasicStream* __os) const
359 {
360  __os->writeTypeId(ice_staticId());
361  __os->startWriteSlice();
362  __os->endWriteSlice();
363 #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
364  Object::__write(__os);
365 #else
367 #endif
368 }
369 
370 void
371 Demo::EchoSample::__read(::IceInternal::BasicStream* __is, bool __rid)
372 {
373  if(__rid)
374  {
375  ::std::string myId;
376  __is->readTypeId(myId);
377  }
378  __is->startReadSlice();
379  __is->endReadSlice();
380 #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
381  Object::__read(__is, true);
382 #else
383  ::Ice::Object::__read(__is, true);
384 #endif
385 }
386 
387 void
388 Demo::EchoSample::__write(const ::Ice::OutputStreamPtr&) const
389 {
390  Ice::MarshalException ex(__FILE__, __LINE__);
391  ex.reason = "type Demo::EchoSample was not generated with stream support";
392  throw ex;
393 }
394 
395 void
396 Demo::EchoSample::__read(const ::Ice::InputStreamPtr&, bool)
397 {
398  Ice::MarshalException ex(__FILE__, __LINE__);
399  ex.reason = "type Demo::EchoSample was not generated with stream support";
400  throw ex;
401 }
402 
403 void
404 Demo::__patch__EchoSamplePtr(void* __addr, ::Ice::ObjectPtr& v)
405 {
406  ::Demo::EchoSamplePtr* p = static_cast< ::Demo::EchoSamplePtr*>(__addr);
407  assert(p);
408  *p = ::Demo::EchoSamplePtr::dynamicCast(v);
409  if(v && !*p)
410  {
411  ::Ice::UnexpectedObjectException e(__FILE__, __LINE__);
412  e.type = v->ice_id();
413  e.expectedType = ::Demo::EchoSample::ice_staticId();
414  throw e;
415  }
416 }
417 
418 bool
419 Demo::operator==(const ::Demo::EchoSample& l, const ::Demo::EchoSample& r)
420 {
421  return static_cast<const ::Ice::Object&>(l) == static_cast<const ::Ice::Object&>(r);
422 }
423 
424 bool
425 Demo::operator!=(const ::Demo::EchoSample& l, const ::Demo::EchoSample& r)
426 {
427  return static_cast<const ::Ice::Object&>(l) != static_cast<const ::Ice::Object&>(r);
428 }
429 
430 bool
431 Demo::operator<(const ::Demo::EchoSample& l, const ::Demo::EchoSample& r)
432 {
433  return static_cast<const ::Ice::Object&>(l) < static_cast<const ::Ice::Object&>(r);
434 }
435 
436 bool
437 Demo::operator<=(const ::Demo::EchoSample& l, const ::Demo::EchoSample& r)
438 {
439  return l < r || l == r;
440 }
441 
442 bool
443 Demo::operator>(const ::Demo::EchoSample& l, const ::Demo::EchoSample& r)
444 {
445  return !(l < r) && !(l == r);
446 }
447 
448 bool
449 Demo::operator>=(const ::Demo::EchoSample& l, const ::Demo::EchoSample& r)
450 {
451  return !(l < r);
452 }
virtual void echo(const ::std::string &, const ::Ice::Context *)=0
bool __usesClasses(const EchoSamplePtr &)
Definition: EchoSample.cpp:94
bool operator>=(const EchoSample &, const EchoSample &)
virtual bool ice_isA(const ::std::string &, const ::Ice::Current &=::Ice::Current()) const
Definition: EchoSample.cpp:277
virtual ::IceInternal::Handle< ::IceDelegateD::Ice::Object > __createDelegateD()
Definition: EchoSample.cpp:149
::IceInternal::ProxyHandle< ::IceProxy::Demo::EchoSample > EchoSamplePrx
Definition: EchoSample.h:87
static const ::std::string __Demo__EchoSample__echo_name
Definition: EchoSample.cpp:33
bool operator!=(const EchoSample &, const EchoSample &)
virtual ::std::vector< ::std::string > ice_ids(const ::Ice::Current &=::Ice::Current()) const
Definition: EchoSample.cpp:283
bool operator<(const EchoSample &, const EchoSample &)
void __patch__EchoSamplePtr(void *,::Ice::ObjectPtr &)
Definition: EchoSample.cpp:404
static const ::std::string __Demo__EchoSample_ids[2]
Definition: EchoSample.cpp:270
bool operator==(const EchoSample &, const EchoSample &)
void __addObject(const EchoSamplePtr &,::IceInternal::GCCountMap &)
Definition: EchoSample.cpp:88
void echo(const ::std::string &msg)
Definition: EchoSample.h:116
void __clearHandleUnsafe(EchoSamplePtr &)
Definition: EchoSample.cpp:106
void __decRefUnsafe(const EchoSamplePtr &)
Definition: EchoSample.cpp:100
void __read(::IceInternal::BasicStream *, EchoSamplePrx &)
::IceInternal::DispatchStatus ___echo(::IceInternal::Incoming &, const ::Ice::Current &)
Definition: EchoSample.cpp:301
virtual void echo(const ::std::string &, const ::Ice::Context *)
Definition: EchoSample.cpp:191
bool operator<=(const EchoSample &, const EchoSample &)
virtual ::IceInternal::Handle< ::IceDelegateM::Ice::Object > __createDelegateM()
Definition: EchoSample.cpp:143
virtual void __read(::IceInternal::BasicStream *, bool)
Definition: EchoSample.cpp:371
virtual ::Ice::ObjectPtr ice_clone() const
Definition: EchoSample.cpp:264
virtual void echo(const ::std::string &, const ::Ice::Context *)
Definition: EchoSample.cpp:226
void incRef(::Demo::EchoSample *)
Definition: EchoSample.cpp:36
void __write(::IceInternal::BasicStream *, const EchoSamplePrx &)
void decRef(::Demo::EchoSample *)
Definition: EchoSample.cpp:42
virtual void __write(::IceInternal::BasicStream *) const
Definition: EchoSample.cpp:358
bool operator>(const EchoSample &, const EchoSample &)
static const ::std::string & ice_staticId()
Definition: EchoSample.cpp:137
::std::string __Demo__EchoSample_all[]
Definition: EchoSample.cpp:311
virtual ::IceInternal::DispatchStatus __dispatch(::IceInternal::Incoming &, const ::Ice::Current &)
Definition: EchoSample.cpp:321
::IceInternal::Handle< ::Demo::EchoSample > EchoSamplePtr
Definition: EchoSample.h:86
virtual const ::std::string & ice_id(const ::Ice::Current &=::Ice::Current()) const
Definition: EchoSample.cpp:289


openrtm_aist
Author(s): Noriaki Ando
autogenerated on Mon Jun 10 2019 14:07:52