📄 any.cc
字号:
pdAnyP()->setData(CORBA::_tc_wstring, tcd);} void CORBA::Any::operator<<=(from_wstring s){ tcDescriptor tcd; tcd.p_wstring.ptr = &s.val; // tcd.p_wstring.release not needed for insertion if( s.bound ) { CORBA::TypeCode_var newtc = CORBA::TypeCode::NP_wstring_tc(s.bound); pdAnyP()->setData(newtc, tcd); }else pdAnyP()->setData(CORBA::_tc_wstring, tcd); if( s.nc ) CORBA::wstring_free(s.val);}voidCORBA::Any::operator<<=(from_fixed f){ tcDescriptor tcd; tcd.p_fixed = (CORBA::Fixed*)&f.val; // The cast to (CORBA::Fixed*) hides the fact that f.val is // const. setData() doesn't modify the value, so it's OK. CORBA::TypeCode_var newtc = CORBA::TypeCode::NP_fixed_tc(f.digits,f.scale); pdAnyP()->setData(newtc, tcd);}// EXTRACTION OPERATORSCORBA::Boolean CORBA::Any::operator>>=(Short& s) const{ tcDescriptor tcd; tcd.p_short = &s; return pdAnyP()->getData(CORBA::_tc_short, tcd);} CORBA::BooleanCORBA::Any::operator>>=(UShort& u) const{ tcDescriptor tcd; tcd.p_ushort = &u; return pdAnyP()->getData(CORBA::_tc_ushort, tcd);}CORBA::BooleanCORBA::Any::operator>>=(Long& l) const{ tcDescriptor tcd; tcd.p_long = &l; return pdAnyP()->getData(CORBA::_tc_long, tcd);} CORBA::BooleanCORBA::Any::operator>>=(ULong& u) const{ tcDescriptor tcd; tcd.p_ulong = &u; return pdAnyP()->getData(CORBA::_tc_ulong, tcd);}#ifdef HAS_LongLongCORBA::BooleanCORBA::Any::operator>>=(LongLong& l) const{ tcDescriptor tcd; tcd.p_longlong = &l; return pdAnyP()->getData(CORBA::_tc_longlong, tcd);} CORBA::BooleanCORBA::Any::operator>>=(ULongLong& u) const{ tcDescriptor tcd; tcd.p_ulonglong = &u; return pdAnyP()->getData(CORBA::_tc_ulonglong, tcd);}#endif#if !defined(NO_FLOAT)CORBA::BooleanCORBA::Any::operator>>=(Float& f) const{ tcDescriptor tcd; tcd.p_float = &f; return pdAnyP()->getData(CORBA::_tc_float, tcd);}CORBA::BooleanCORBA::Any::operator>>=(Double& d) const{ tcDescriptor tcd; tcd.p_double = &d; return pdAnyP()->getData(CORBA::_tc_double, tcd);}#ifdef HAS_LongDoubleCORBA::BooleanCORBA::Any::operator>>=(LongDouble& d) const{ tcDescriptor tcd; tcd.p_longdouble = &d; return pdAnyP()->getData(CORBA::_tc_longdouble, tcd);}#endif#endifCORBA::Boolean CORBA::Any::operator>>=(CORBA::Any*& a) const{ return this->operator>>=((const CORBA::Any*&) a);}static void delete_any(void* data) { CORBA::Any* ap = (CORBA::Any*) data; delete ap;}CORBA::Boolean CORBA::Any::operator>>=(const CORBA::Any*& a) const{ CORBA::Any* ap = (CORBA::Any*) PR_getCachedData(); if (ap == 0) { tcDescriptor tcd; ap = new CORBA::Any(); tcd.p_any = ap; if (pdAnyP()->getData(CORBA::_tc_any, tcd)) { ((CORBA::Any*) this)->PR_setCachedData(ap,delete_any); a = ap; return 1; } else { delete ap; a = 0; return 0; } } else { CORBA::TypeCode_var tc = type(); if (tc->equivalent(CORBA::_tc_any)) { a = ap; return 1; } else { a = 0; return 0; } }}// pre- CORBA 2.3 operator. Obsoleted.CORBA::Boolean CORBA::Any::operator>>=(Any& a) const{ tcDescriptor tcd; tcd.p_any = &a; return pdAnyP()->getData(CORBA::_tc_any, tcd);}staticvoid delete_typecode(void* data) { CORBA::TypeCode_ptr sp = (CORBA::TypeCode_ptr) data; CORBA::release(sp);}CORBA::BooleanCORBA::Any::operator>>=(CORBA::TypeCode_ptr& tc) const{ CORBA::TypeCode_ptr sp = (CORBA::TypeCode_ptr) PR_getCachedData(); if (sp == 0) { CORBA::TypeCode_member tcm; tcDescriptor tcd; tcd.p_TypeCode = &tcm; CORBA::Boolean ret = pdAnyP()->getData(CORBA::_tc_TypeCode, tcd); if( ret ) { if (!omniORB::omniORB_27_CompatibleAnyExtraction) { ((CORBA::Any*)this)->PR_setCachedData((void*)tcm._ptr,delete_typecode); } tc = tcm._ptr; tcm._ptr = CORBA::TypeCode::_nil(); return 1; } else { tc = CORBA::TypeCode::_nil(); return 0; } } else { CORBA::TypeCode_var t = type(); if (t->equivalent(CORBA::_tc_TypeCode)) { tc = sp; return 1; } else { tc = CORBA::TypeCode::_nil(); return 0; } }}CORBA::BooleanCORBA::Any::operator>>=(to_boolean b) const{ tcDescriptor tcd; tcd.p_boolean = &b.ref; return pdAnyP()->getData(CORBA::_tc_boolean, tcd);}CORBA::BooleanCORBA::Any::operator>>=(to_char c) const{ tcDescriptor tcd; tcd.p_char = &c.ref; return pdAnyP()->getData(CORBA::_tc_char, tcd);} CORBA::BooleanCORBA::Any::operator>>=(to_wchar c) const{ tcDescriptor tcd; tcd.p_wchar = &c.ref; return pdAnyP()->getData(CORBA::_tc_wchar, tcd);} CORBA::BooleanCORBA::Any::operator>>=(to_octet o) const{ tcDescriptor tcd; tcd.p_octet = &o.ref; return pdAnyP()->getData(CORBA::_tc_octet, tcd);}CORBA::BooleanCORBA::Any::operator>>=(char*& s) const{ if (!omniORB::omniORB_27_CompatibleAnyExtraction) { return this->operator>>=((const char*&) s); } else { char* p = 0; tcDescriptor tcd; tcd.p_string.ptr = &p; tcd.p_string.release = 0; if (pdAnyP()->getData(CORBA::_tc_string, tcd)) { s = p; return 1; } } return 0;}staticvoid delete_string(void* data) { char* sp = (char*) data; CORBA::string_free(sp);}CORBA::BooleanCORBA::Any::operator>>=(const char*& s) const{ char* sp = (char*) PR_getCachedData(); if (sp == 0) { tcDescriptor tcd; tcd.p_string.ptr = &sp; tcd.p_string.release = 0; if (pdAnyP()->getData(CORBA::_tc_string, tcd)) { ((CORBA::Any*)this)->PR_setCachedData(sp,delete_string); s = sp; return 1; } else { s = 0; return 0; } } else { CORBA::TypeCode_var tc = type(); if (tc->equivalent(CORBA::_tc_string)) { s = sp; return 1; } else { s = 0; return 0; } }}CORBA::BooleanCORBA::Any::operator>>=(to_string s) const{ CORBA::TypeCode_var newtc = CORBA::TypeCode::NP_string_tc(s.bound); char* sp = (char*) PR_getCachedData(); if (sp == 0) { tcDescriptor tcd; tcd.p_string.ptr = &sp; tcd.p_string.release = 0; if (pdAnyP()->getData(newtc, tcd)) { if (!omniORB::omniORB_27_CompatibleAnyExtraction) { ((CORBA::Any*)this)->PR_setCachedData(sp,delete_string); } s.val = sp; return 1; } else { s.val = 0; return 0; } } else { CORBA::TypeCode_var tc = type(); if (tc->equivalent(newtc)) { s.val = sp; return 1; } else { s.val = 0; return 0; } }}CORBA::BooleanCORBA::Any::operator>>=(const CORBA::SystemException*& e) const{ CORBA::TypeCode_var tc = type(); CORBA::Boolean r;#define EXTRACT_IF_MATCH(name) \ if (tc->equivalent(CORBA::_tc_##name)) { \ const CORBA::name* ex; \ r = *this >>= ex; \ e = ex; \ return r; \ } OMNIORB_FOR_EACH_SYS_EXCEPTION(EXTRACT_IF_MATCH)#undef EXTRACT_IF_MATCH return 0;}staticvoid delete_wstring(void* data) { CORBA::WChar* sp = (CORBA::WChar*) data; CORBA::wstring_free(sp);}CORBA::BooleanCORBA::Any::operator>>=(const CORBA::WChar*& s) const{ CORBA::WChar* sp = (CORBA::WChar*) PR_getCachedData(); if (sp == 0) { tcDescriptor tcd; tcd.p_wstring.ptr = &sp; tcd.p_wstring.release = 0; if (pdAnyP()->getData(CORBA::_tc_wstring, tcd)) { ((CORBA::Any*)this)->PR_setCachedData(sp,delete_wstring); s = sp; return 1; } else { s = 0; return 0; } } else { CORBA::TypeCode_var tc = type(); if (tc->equivalent(CORBA::_tc_wstring)) { s = sp; return 1; } else { s = 0; return 0; } }}CORBA::BooleanCORBA::Any::operator>>=(to_wstring s) const{ CORBA::TypeCode_var newtc = CORBA::TypeCode::NP_wstring_tc(s.bound); CORBA::WChar* sp = (CORBA::WChar*) PR_getCachedData(); if (sp == 0) { tcDescriptor tcd; tcd.p_wstring.ptr = &sp; tcd.p_wstring.release = 0; if (pdAnyP()->getData(newtc, tcd)) { if (!omniORB::omniORB_27_CompatibleAnyExtraction) { ((CORBA::Any*)this)->PR_setCachedData(sp,delete_wstring); } s.val = sp; return 1; } else { s.val = 0; return 0; } } else { CORBA::TypeCode_var tc = type(); if (tc->equivalent(newtc)) { s.val = sp; return 1; } else { s.val = 0; return 0; } }}CORBA::BooleanCORBA::Any::operator>>=(to_fixed f) const{ CORBA::TypeCode_var newtc = CORBA::TypeCode::NP_fixed_tc(f.digits, f.scale); tcDescriptor tcd; tcd.p_fixed = &f.val; return pdAnyP()->getData(newtc, tcd);}CORBA::BooleanCORBA::Any::operator>>=(to_object o) const{ tcDescriptor tcd; tcd.p_objref.opq_objref = (void*) &o.ref; tcd.p_objref.opq_release = 0; tcd.p_objref.setObjectPtr = _0RL_tcParser_objref_setObjectPtr; return pdAnyP()->getObjRef(tcd);}staticvoid delete_object(void* data) { CORBA::release((CORBA::Object_ptr)data);}CORBA::BooleanCORBA::Any::operator>>=(CORBA::Object_ptr& obj) const{ CORBA::Object_ptr sp = (CORBA::Object_ptr) PR_getCachedData(); if (sp == 0) { tcDescriptor tcd; CORBA::Object_var tmp; _0RL_buildDesc_cCORBA_mObject(tcd, tmp); if( PR_unpackTo(CORBA::_tc_Object, &tcd) ) { if (!omniORB::omniORB_27_CompatibleAnyExtraction) { ((CORBA::Any*)this)->PR_setCachedData((void*)(CORBA::Object_ptr)tmp, delete_object); } obj = tmp._retn(); return 1; } else { obj = CORBA::Object::_nil(); return 0; } } else { CORBA::TypeCode_var tc = type(); if (tc->equivalent(CORBA::_tc_Object)) { obj = sp; return 1; } else { obj = CORBA::Object::_nil(); return 0; } }}voidCORBA::Any::replace(TypeCode_ptr TCp, void* value, Boolean release){ // Get rid of the old implementation object delete pdAnyP(); if (value == 0) { // Create a writable, empty implementation object for the desired type pd_ptr = new AnyP(TCp); } else { // Create a read-only implementation for the supplied buffer pd_ptr = new AnyP(TCp, value, release); }}CORBA::TypeCode_ptrCORBA::Any::type() const{ return CORBA::TypeCode::_duplicate(pdAnyP()->getTC());}voidCORBA::Any::type(CORBA::TypeCode_ptr tc){ pdAnyP()->replaceTC(tc);}const void*CORBA::Any::value() const{ if (pdAnyP()->getTC() == CORBA::_tc_null) return 0; else return pdAnyP()->getBuffer();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -