00001 // ********************************************************************** 00002 // 00003 // Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved. 00004 // 00005 // This copy of Ice is licensed to you under the terms described in the 00006 // ICE_LICENSE file included in this distribution. 00007 // 00008 // ********************************************************************** 00009 00010 // Ice version 3.3.1 00011 // Generated from file `TestSIFT.ice' 00012 00013 #include <TestSIFT.ice.H> 00014 #include <Ice/LocalException.h> 00015 #include <Ice/ObjectFactory.h> 00016 #include <Ice/BasicStream.h> 00017 #include <IceUtil/Iterator.h> 00018 #include <IceUtil/ScopedArray.h> 00019 00020 #ifndef ICE_IGNORE_VERSION 00021 # if ICE_INT_VERSION / 100 != 303 00022 # error Ice version mismatch! 00023 # endif 00024 # if ICE_INT_VERSION % 100 > 50 00025 # error Beta header file detected 00026 # endif 00027 # if ICE_INT_VERSION % 100 < 1 00028 # error Ice patch level mismatch! 00029 # endif 00030 #endif 00031 00032 static const ::std::string __TestSIFT__SIFTMatcher__matchKeypoints_name = "matchKeypoints"; 00033 00034 ::Ice::Object* IceInternal::upCast(::TestSIFT::SIFTMatcher* p) { return p; } 00035 ::IceProxy::Ice::Object* IceInternal::upCast(::IceProxy::TestSIFT::SIFTMatcher* p) { return p; } 00036 00037 void 00038 TestSIFT::__read(::IceInternal::BasicStream* __is, ::TestSIFT::SIFTMatcherPrx& v) 00039 { 00040 ::Ice::ObjectPrx proxy; 00041 __is->read(proxy); 00042 if(!proxy) 00043 { 00044 v = 0; 00045 } 00046 else 00047 { 00048 v = new ::IceProxy::TestSIFT::SIFTMatcher; 00049 v->__copyFrom(proxy); 00050 } 00051 } 00052 00053 bool 00054 TestSIFT::keypoint::operator==(const keypoint& __rhs) const 00055 { 00056 if(this == &__rhs) 00057 { 00058 return true; 00059 } 00060 if(x != __rhs.x) 00061 { 00062 return false; 00063 } 00064 if(y != __rhs.y) 00065 { 00066 return false; 00067 } 00068 if(s != __rhs.s) 00069 { 00070 return false; 00071 } 00072 if(o != __rhs.o) 00073 { 00074 return false; 00075 } 00076 if(m != __rhs.m) 00077 { 00078 return false; 00079 } 00080 if(oriFV != __rhs.oriFV) 00081 { 00082 return false; 00083 } 00084 return true; 00085 } 00086 00087 bool 00088 TestSIFT::keypoint::operator<(const keypoint& __rhs) const 00089 { 00090 if(this == &__rhs) 00091 { 00092 return false; 00093 } 00094 if(x < __rhs.x) 00095 { 00096 return true; 00097 } 00098 else if(__rhs.x < x) 00099 { 00100 return false; 00101 } 00102 if(y < __rhs.y) 00103 { 00104 return true; 00105 } 00106 else if(__rhs.y < y) 00107 { 00108 return false; 00109 } 00110 if(s < __rhs.s) 00111 { 00112 return true; 00113 } 00114 else if(__rhs.s < s) 00115 { 00116 return false; 00117 } 00118 if(o < __rhs.o) 00119 { 00120 return true; 00121 } 00122 else if(__rhs.o < o) 00123 { 00124 return false; 00125 } 00126 if(m < __rhs.m) 00127 { 00128 return true; 00129 } 00130 else if(__rhs.m < m) 00131 { 00132 return false; 00133 } 00134 if(oriFV < __rhs.oriFV) 00135 { 00136 return true; 00137 } 00138 else if(__rhs.oriFV < oriFV) 00139 { 00140 return false; 00141 } 00142 return false; 00143 } 00144 00145 void 00146 TestSIFT::keypoint::__write(::IceInternal::BasicStream* __os) const 00147 { 00148 __os->write(x); 00149 __os->write(y); 00150 __os->write(s); 00151 __os->write(o); 00152 __os->write(m); 00153 if(oriFV.size() == 0) 00154 { 00155 __os->writeSize(0); 00156 } 00157 else 00158 { 00159 __os->write(&oriFV[0], &oriFV[0] + oriFV.size()); 00160 } 00161 } 00162 00163 void 00164 TestSIFT::keypoint::__read(::IceInternal::BasicStream* __is) 00165 { 00166 __is->read(x); 00167 __is->read(y); 00168 __is->read(s); 00169 __is->read(o); 00170 __is->read(m); 00171 ::std::pair<const ::Ice::Byte*, const ::Ice::Byte*> ___oriFV; 00172 __is->read(___oriFV); 00173 ::std::vector< ::Ice::Byte>(___oriFV.first, ___oriFV.second).swap(oriFV); 00174 } 00175 00176 void 00177 TestSIFT::__writekeypointSequence(::IceInternal::BasicStream* __os, const ::TestSIFT::keypoint* begin, const ::TestSIFT::keypoint* end) 00178 { 00179 ::Ice::Int size = static_cast< ::Ice::Int>(end - begin); 00180 __os->writeSize(size); 00181 for(int i = 0; i < size; ++i) 00182 { 00183 begin[i].__write(__os); 00184 } 00185 } 00186 00187 void 00188 TestSIFT::__readkeypointSequence(::IceInternal::BasicStream* __is, ::TestSIFT::keypointSequence& v) 00189 { 00190 ::Ice::Int sz; 00191 __is->readSize(sz); 00192 __is->startSeq(sz, 21); 00193 v.resize(sz); 00194 for(int i = 0; i < sz; ++i) 00195 { 00196 v[i].__read(__is); 00197 __is->checkSeq(); 00198 __is->endElement(); 00199 } 00200 __is->endSeq(sz); 00201 } 00202 00203 ::TestSIFT::idSequence 00204 IceProxy::TestSIFT::SIFTMatcher::matchKeypoints(const ::TestSIFT::keypointSequence& keypoints, const ::Ice::Context* __ctx) 00205 { 00206 int __cnt = 0; 00207 while(true) 00208 { 00209 ::IceInternal::Handle< ::IceDelegate::Ice::Object> __delBase; 00210 try 00211 { 00212 #if defined(__BCPLUSPLUS__) && (__BCPLUSPLUS__ >= 0x0600) // C++Builder 2009 compiler bug 00213 IceUtil::DummyBCC dummy; 00214 #endif 00215 __checkTwowayOnly(__TestSIFT__SIFTMatcher__matchKeypoints_name); 00216 __delBase = __getDelegate(false); 00217 ::IceDelegate::TestSIFT::SIFTMatcher* __del = dynamic_cast< ::IceDelegate::TestSIFT::SIFTMatcher*>(__delBase.get()); 00218 return __del->matchKeypoints(keypoints, __ctx); 00219 } 00220 catch(const ::IceInternal::LocalExceptionWrapper& __ex) 00221 { 00222 __handleExceptionWrapper(__delBase, __ex, 0); 00223 } 00224 catch(const ::Ice::LocalException& __ex) 00225 { 00226 __handleException(__delBase, __ex, 0, __cnt); 00227 } 00228 } 00229 } 00230 00231 const ::std::string& 00232 IceProxy::TestSIFT::SIFTMatcher::ice_staticId() 00233 { 00234 return ::TestSIFT::SIFTMatcher::ice_staticId(); 00235 } 00236 00237 ::IceInternal::Handle< ::IceDelegateM::Ice::Object> 00238 IceProxy::TestSIFT::SIFTMatcher::__createDelegateM() 00239 { 00240 return ::IceInternal::Handle< ::IceDelegateM::Ice::Object>(new ::IceDelegateM::TestSIFT::SIFTMatcher); 00241 } 00242 00243 ::IceInternal::Handle< ::IceDelegateD::Ice::Object> 00244 IceProxy::TestSIFT::SIFTMatcher::__createDelegateD() 00245 { 00246 return ::IceInternal::Handle< ::IceDelegateD::Ice::Object>(new ::IceDelegateD::TestSIFT::SIFTMatcher); 00247 } 00248 00249 ::IceProxy::Ice::Object* 00250 IceProxy::TestSIFT::SIFTMatcher::__newInstance() const 00251 { 00252 return new SIFTMatcher; 00253 } 00254 00255 ::TestSIFT::idSequence 00256 IceDelegateM::TestSIFT::SIFTMatcher::matchKeypoints(const ::TestSIFT::keypointSequence& keypoints, const ::Ice::Context* __context) 00257 { 00258 ::IceInternal::Outgoing __og(__handler.get(), __TestSIFT__SIFTMatcher__matchKeypoints_name, ::Ice::Normal, __context); 00259 try 00260 { 00261 ::IceInternal::BasicStream* __os = __og.os(); 00262 if(keypoints.size() == 0) 00263 { 00264 __os->writeSize(0); 00265 } 00266 else 00267 { 00268 ::TestSIFT::__writekeypointSequence(__os, &keypoints[0], &keypoints[0] + keypoints.size()); 00269 } 00270 } 00271 catch(const ::Ice::LocalException& __ex) 00272 { 00273 __og.abort(__ex); 00274 } 00275 bool __ok = __og.invoke(); 00276 ::TestSIFT::idSequence __ret; 00277 try 00278 { 00279 if(!__ok) 00280 { 00281 try 00282 { 00283 __og.throwUserException(); 00284 } 00285 catch(const ::Ice::UserException& __ex) 00286 { 00287 ::Ice::UnknownUserException __uue(__FILE__, __LINE__, __ex.ice_name()); 00288 throw __uue; 00289 } 00290 } 00291 ::IceInternal::BasicStream* __is = __og.is(); 00292 __is->startReadEncaps(); 00293 __is->read(__ret); 00294 __is->endReadEncaps(); 00295 return __ret; 00296 } 00297 catch(const ::Ice::LocalException& __ex) 00298 { 00299 throw ::IceInternal::LocalExceptionWrapper(__ex, false); 00300 } 00301 } 00302 00303 ::TestSIFT::idSequence 00304 IceDelegateD::TestSIFT::SIFTMatcher::matchKeypoints(const ::TestSIFT::keypointSequence& keypoints, const ::Ice::Context* __context) 00305 { 00306 class _DirectI : public ::IceInternal::Direct 00307 { 00308 public: 00309 00310 _DirectI(::TestSIFT::idSequence& __result, const ::TestSIFT::keypointSequence& keypoints, const ::Ice::Current& __current) : 00311 ::IceInternal::Direct(__current), 00312 _result(__result), 00313 _m_keypoints(keypoints) 00314 { 00315 } 00316 00317 virtual ::Ice::DispatchStatus 00318 run(::Ice::Object* object) 00319 { 00320 ::TestSIFT::SIFTMatcher* servant = dynamic_cast< ::TestSIFT::SIFTMatcher*>(object); 00321 if(!servant) 00322 { 00323 throw ::Ice::OperationNotExistException(__FILE__, __LINE__, _current.id, _current.facet, _current.operation); 00324 } 00325 _result = servant->matchKeypoints(_m_keypoints, _current); 00326 return ::Ice::DispatchOK; 00327 } 00328 00329 private: 00330 00331 ::TestSIFT::idSequence& _result; 00332 const ::TestSIFT::keypointSequence& _m_keypoints; 00333 }; 00334 00335 ::Ice::Current __current; 00336 __initCurrent(__current, __TestSIFT__SIFTMatcher__matchKeypoints_name, ::Ice::Normal, __context); 00337 ::TestSIFT::idSequence __result; 00338 try 00339 { 00340 _DirectI __direct(__result, keypoints, __current); 00341 try 00342 { 00343 __direct.servant()->__collocDispatch(__direct); 00344 } 00345 catch(...) 00346 { 00347 __direct.destroy(); 00348 throw; 00349 } 00350 __direct.destroy(); 00351 } 00352 catch(const ::Ice::SystemException&) 00353 { 00354 throw; 00355 } 00356 catch(const ::IceInternal::LocalExceptionWrapper&) 00357 { 00358 throw; 00359 } 00360 catch(const ::std::exception& __ex) 00361 { 00362 ::IceInternal::LocalExceptionWrapper::throwWrapper(__ex); 00363 } 00364 catch(...) 00365 { 00366 throw ::IceInternal::LocalExceptionWrapper(::Ice::UnknownException(__FILE__, __LINE__, "unknown c++ exception"), false); 00367 } 00368 return __result; 00369 } 00370 00371 ::Ice::ObjectPtr 00372 TestSIFT::SIFTMatcher::ice_clone() const 00373 { 00374 throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__); 00375 return 0; // to avoid a warning with some compilers 00376 } 00377 00378 static const ::std::string __TestSIFT__SIFTMatcher_ids[2] = 00379 { 00380 "::Ice::Object", 00381 "::TestSIFT::SIFTMatcher" 00382 }; 00383 00384 bool 00385 TestSIFT::SIFTMatcher::ice_isA(const ::std::string& _s, const ::Ice::Current&) const 00386 { 00387 return ::std::binary_search(__TestSIFT__SIFTMatcher_ids, __TestSIFT__SIFTMatcher_ids + 2, _s); 00388 } 00389 00390 ::std::vector< ::std::string> 00391 TestSIFT::SIFTMatcher::ice_ids(const ::Ice::Current&) const 00392 { 00393 return ::std::vector< ::std::string>(&__TestSIFT__SIFTMatcher_ids[0], &__TestSIFT__SIFTMatcher_ids[2]); 00394 } 00395 00396 const ::std::string& 00397 TestSIFT::SIFTMatcher::ice_id(const ::Ice::Current&) const 00398 { 00399 return __TestSIFT__SIFTMatcher_ids[1]; 00400 } 00401 00402 const ::std::string& 00403 TestSIFT::SIFTMatcher::ice_staticId() 00404 { 00405 return __TestSIFT__SIFTMatcher_ids[1]; 00406 } 00407 00408 ::Ice::DispatchStatus 00409 TestSIFT::SIFTMatcher::___matchKeypoints(::IceInternal::Incoming& __inS, const ::Ice::Current& __current) 00410 { 00411 __checkMode(::Ice::Normal, __current.mode); 00412 ::IceInternal::BasicStream* __is = __inS.is(); 00413 __is->startReadEncaps(); 00414 ::TestSIFT::keypointSequence keypoints; 00415 ::TestSIFT::__readkeypointSequence(__is, keypoints); 00416 __is->endReadEncaps(); 00417 ::IceInternal::BasicStream* __os = __inS.os(); 00418 ::TestSIFT::idSequence __ret = matchKeypoints(keypoints, __current); 00419 if(__ret.size() == 0) 00420 { 00421 __os->writeSize(0); 00422 } 00423 else 00424 { 00425 __os->write(&__ret[0], &__ret[0] + __ret.size()); 00426 } 00427 return ::Ice::DispatchOK; 00428 } 00429 00430 static ::std::string __TestSIFT__SIFTMatcher_all[] = 00431 { 00432 "ice_id", 00433 "ice_ids", 00434 "ice_isA", 00435 "ice_ping", 00436 "matchKeypoints" 00437 }; 00438 00439 ::Ice::DispatchStatus 00440 TestSIFT::SIFTMatcher::__dispatch(::IceInternal::Incoming& in, const ::Ice::Current& current) 00441 { 00442 ::std::pair< ::std::string*, ::std::string*> r = ::std::equal_range(__TestSIFT__SIFTMatcher_all, __TestSIFT__SIFTMatcher_all + 5, current.operation); 00443 if(r.first == r.second) 00444 { 00445 throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); 00446 } 00447 00448 switch(r.first - __TestSIFT__SIFTMatcher_all) 00449 { 00450 case 0: 00451 { 00452 return ___ice_id(in, current); 00453 } 00454 case 1: 00455 { 00456 return ___ice_ids(in, current); 00457 } 00458 case 2: 00459 { 00460 return ___ice_isA(in, current); 00461 } 00462 case 3: 00463 { 00464 return ___ice_ping(in, current); 00465 } 00466 case 4: 00467 { 00468 return ___matchKeypoints(in, current); 00469 } 00470 } 00471 00472 assert(false); 00473 throw ::Ice::OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation); 00474 } 00475 00476 void 00477 TestSIFT::SIFTMatcher::__write(::IceInternal::BasicStream* __os) const 00478 { 00479 __os->writeTypeId(ice_staticId()); 00480 __os->startWriteSlice(); 00481 __os->endWriteSlice(); 00482 #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug 00483 Object::__write(__os); 00484 #else 00485 ::Ice::Object::__write(__os); 00486 #endif 00487 } 00488 00489 void 00490 TestSIFT::SIFTMatcher::__read(::IceInternal::BasicStream* __is, bool __rid) 00491 { 00492 if(__rid) 00493 { 00494 ::std::string myId; 00495 __is->readTypeId(myId); 00496 } 00497 __is->startReadSlice(); 00498 __is->endReadSlice(); 00499 #if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug 00500 Object::__read(__is, true); 00501 #else 00502 ::Ice::Object::__read(__is, true); 00503 #endif 00504 } 00505 00506 void 00507 TestSIFT::SIFTMatcher::__write(const ::Ice::OutputStreamPtr&) const 00508 { 00509 Ice::MarshalException ex(__FILE__, __LINE__); 00510 ex.reason = "type TestSIFT::SIFTMatcher was not generated with stream support"; 00511 throw ex; 00512 } 00513 00514 void 00515 TestSIFT::SIFTMatcher::__read(const ::Ice::InputStreamPtr&, bool) 00516 { 00517 Ice::MarshalException ex(__FILE__, __LINE__); 00518 ex.reason = "type TestSIFT::SIFTMatcher was not generated with stream support"; 00519 throw ex; 00520 } 00521 00522 void 00523 TestSIFT::__patch__SIFTMatcherPtr(void* __addr, ::Ice::ObjectPtr& v) 00524 { 00525 ::TestSIFT::SIFTMatcherPtr* p = static_cast< ::TestSIFT::SIFTMatcherPtr*>(__addr); 00526 assert(p); 00527 *p = ::TestSIFT::SIFTMatcherPtr::dynamicCast(v); 00528 if(v && !*p) 00529 { 00530 IceInternal::Ex::throwUOE(::TestSIFT::SIFTMatcher::ice_staticId(), v->ice_id()); 00531 } 00532 } 00533 00534 bool 00535 TestSIFT::operator==(const ::TestSIFT::SIFTMatcher& l, const ::TestSIFT::SIFTMatcher& r) 00536 { 00537 return static_cast<const ::Ice::Object&>(l) == static_cast<const ::Ice::Object&>(r); 00538 } 00539 00540 bool 00541 TestSIFT::operator<(const ::TestSIFT::SIFTMatcher& l, const ::TestSIFT::SIFTMatcher& r) 00542 { 00543 return static_cast<const ::Ice::Object&>(l) < static_cast<const ::Ice::Object&>(r); 00544 }