typecode.cc
来自「编译工具」· CC 代码 · 共 2,713 行 · 第 1/5 页
CC
2,713 行
const CORBA::ULong memberCount = members.length(); for( CORBA::ULong i = 0; i < memberCount; i++ ) if( !PR_is_valid(members[i].type) || CORBA::is_nil(members[i].type) ) OMNIORB_THROW(BAD_TYPECODE, BAD_TYPECODE_TypeCodeIsNil, CORBA::COMPLETED_NO); return new TypeCode_union(id, name, ToTcBase_Checked(discriminator_type), members);}#endifCORBA::TypeCode_ptrCORBA::TypeCode::NP_enum_tc(const char* id, const char* name, const CORBA::EnumMemberSeq& members){ return new TypeCode_enum(id, name, members);}CORBA::TypeCode_ptrCORBA::TypeCode::NP_alias_tc(const char* id, const char* name, CORBA::TypeCode_ptr original_type){ return new TypeCode_alias(id, name, ToTcBase_Checked(original_type));}#if 0CORBA::TypeCode_ptrCORBA::TypeCode::NP_exception_tc(const char* id, const char* name, const CORBA::StructMemberSeq& members){ const CORBA::ULong memberCount = members.length(); for( CORBA::ULong i = 0; i < memberCount; i++ ) if ( !PR_is_valid(members[i].type) || CORBA::is_nil(members[i].type)) OMNIORB_THROW(BAD_TYPECODE, BAD_TYPECODE_TypeCodeIsNil, CORBA::COMPLETED_NO); return new TypeCode_except(id, name, members);}#endifCORBA::TypeCode_ptrCORBA::TypeCode::NP_interface_tc(const char* id, const char* name){ return new TypeCode_objref(id, name);}CORBA::TypeCode_ptrCORBA::TypeCode::NP_string_tc(CORBA::ULong bound){ return new TypeCode_string(bound);}CORBA::TypeCode_ptrCORBA::TypeCode::NP_wstring_tc(CORBA::ULong bound){ return new TypeCode_wstring(bound);}CORBA::TypeCode_ptrCORBA::TypeCode::NP_fixed_tc(CORBA::UShort digits, CORBA::Short scale){ return new TypeCode_fixed(digits, scale);}CORBA::TypeCode_ptrCORBA::TypeCode::NP_sequence_tc(CORBA::ULong bound, CORBA::TypeCode_ptr element_type){ return new TypeCode_sequence(bound, ToTcBase_Checked(element_type));}CORBA::TypeCode_ptrCORBA::TypeCode::NP_array_tc(CORBA::ULong length, CORBA::TypeCode_ptr element_type){ return new TypeCode_array(length, ToTcBase_Checked(element_type));}CORBA::TypeCode_ptrCORBA::TypeCode::NP_recursive_sequence_tc(CORBA::ULong bound, CORBA::ULong offset){ return new TypeCode_sequence(bound, offset);}CORBA::TypeCode_ptrCORBA::TypeCode::NP_recursive_tc(const char* id){ return new TypeCode_indirect(id);}///////////////////////////////////////////////////////////////////////////////////////////// Stub TypeCode Accessors ////////////////////////////////////////////////////////////////////////////////////////////// These are needed by the stubs to generate static typecodes// for user-defined types. Before constructing or using any// of the typecode functionnality it is important to ensure// that any statically initialised data is properly constructed.OMNI_NAMESPACE_BEGIN(omni)static void check_static_data_is_initialised();// The omniTypeCodeList singleton is used to track all "static"// TypeCode objects created in the DynSK files, so they can be deleted// on clean shutdown.class omniTypeCodeList : public omniTrackedObject {public: virtual ~omniTypeCodeList(); void add(CORBA::TypeCode_ptr tc) { pd_list.push_back(tc); }private: omnivector<CORBA::TypeCode_ptr> pd_list;};static omniTypeCodeList* the_tc_list = 0;OMNI_NAMESPACE_END(omni)CORBA::TypeCode_ptrCORBA::TypeCode::PR_struct_tc(const char* id, const char* name, const PR_structMember* members, ULong memberCount){ check_static_data_is_initialised(); TypeCode_struct::Member* new_members = new TypeCode_struct::Member[memberCount]; for( ULong i = 0; i < memberCount; i++ ) { // We duplicate the name and type. new_members[i].name = CORBA::string_dup(members[i].name); new_members[i].type = CORBA::TypeCode::_duplicate(members[i].type); } CORBA::TypeCode_ptr r = new TypeCode_struct(CORBA::string_dup(id), CORBA::string_dup(name), new_members, memberCount); the_tc_list->add(r); return r;}CORBA::TypeCode_ptrCORBA::TypeCode::PR_union_tc(const char* id, const char* name, TypeCode_ptr discriminator_type, const PR_unionMember* members, ULong memberCount, Long deflt){ check_static_data_is_initialised(); CORBA::TypeCode_ptr r = new TypeCode_union(id, name, ToTcBase(discriminator_type), members, memberCount, deflt); the_tc_list->add(r); return r;}CORBA::TypeCode_ptrCORBA::TypeCode::PR_enum_tc(const char* id, const char* name, const char** members, ULong memberCount){ check_static_data_is_initialised(); CORBA::EnumMemberSeq memberSeq; memberSeq.length(memberCount); for( ULong i = 0; i < memberCount; i++ ) memberSeq[i] = members[i]; CORBA::TypeCode_ptr r = NP_enum_tc(id, name, memberSeq); the_tc_list->add(r); return r;}CORBA::TypeCode_ptrCORBA::TypeCode::PR_alias_tc(const char* id, const char* name, CORBA::TypeCode_ptr original_type){ check_static_data_is_initialised(); CORBA::TypeCode_ptr r = new TypeCode_alias(id, name, ToTcBase(original_type)); the_tc_list->add(r); return r;}CORBA::TypeCode_ptrCORBA::TypeCode::PR_exception_tc(const char* id, const char* name, const PR_structMember* members, ULong memberCount){ check_static_data_is_initialised(); TypeCode_struct::Member* new_members = new TypeCode_struct::Member[memberCount]; for( ULong i = 0; i < memberCount; i++ ) { // We duplicate the name and type. new_members[i].name = CORBA::string_dup(members[i].name); new_members[i].type = CORBA::TypeCode::_duplicate(members[i].type); } CORBA::TypeCode_ptr r = new TypeCode_except(CORBA::string_dup(id), CORBA::string_dup(name), new_members, memberCount); the_tc_list->add(r); return r;}CORBA::TypeCode_ptrCORBA::TypeCode::PR_interface_tc(const char* id, const char* name){ check_static_data_is_initialised(); CORBA::TypeCode_ptr r = new TypeCode_objref(id, name); the_tc_list->add(r); return r;}CORBA::TypeCode_ptrCORBA::TypeCode::PR_string_tc(CORBA::ULong bound){ if( bound == 0 ) return PR_string_tc(); check_static_data_is_initialised(); CORBA::TypeCode_ptr r = new TypeCode_string(bound); the_tc_list->add(r); return r;}CORBA::TypeCode_ptrCORBA::TypeCode::PR_wstring_tc(CORBA::ULong bound){ if( bound == 0 ) return PR_wstring_tc(); check_static_data_is_initialised(); CORBA::TypeCode_ptr r = new TypeCode_wstring(bound); the_tc_list->add(r); return r;}CORBA::TypeCode_ptrCORBA::TypeCode::PR_fixed_tc(CORBA::UShort digits, CORBA::UShort scale){ check_static_data_is_initialised(); CORBA::TypeCode_ptr r = new TypeCode_fixed(digits, scale); the_tc_list->add(r); return r;}CORBA::TypeCode_ptrCORBA::TypeCode::PR_sequence_tc(CORBA::ULong bound, CORBA::TypeCode_ptr element_type){ check_static_data_is_initialised(); CORBA::TypeCode_ptr r = new TypeCode_sequence(bound, ToTcBase(element_type)); the_tc_list->add(r); return r;}CORBA::TypeCode_ptrCORBA::TypeCode::PR_array_tc(CORBA::ULong length, CORBA::TypeCode_ptr element_type){ check_static_data_is_initialised(); CORBA::TypeCode_ptr r = new TypeCode_array(length, ToTcBase(element_type)); the_tc_list->add(r); return r;}CORBA::TypeCode_ptrCORBA::TypeCode::PR_recursive_sequence_tc(CORBA::ULong bound, CORBA::ULong offset){ check_static_data_is_initialised(); CORBA::TypeCode_ptr r = new TypeCode_sequence(bound, offset); the_tc_list->add(r); return r;}CORBA::TypeCode_ptrCORBA::TypeCode::PR_forward_sequence_tc(CORBA::ULong bound){ check_static_data_is_initialised(); CORBA::TypeCode_ptr r = new TypeCode_sequence(bound); the_tc_list->add(r); return r;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_null_tc() { check_static_data_is_initialised(); return CORBA::_tc_null;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_void_tc() { check_static_data_is_initialised(); return CORBA::_tc_void;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_short_tc() { check_static_data_is_initialised(); return CORBA::_tc_short;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_long_tc() { check_static_data_is_initialised(); return CORBA::_tc_long;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_ushort_tc() { check_static_data_is_initialised(); return CORBA::_tc_ushort;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_ulong_tc() { check_static_data_is_initialised(); return CORBA::_tc_ulong;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_float_tc() { check_static_data_is_initialised(); return CORBA::_tc_float;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_double_tc() { check_static_data_is_initialised(); return CORBA::_tc_double;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_boolean_tc() { check_static_data_is_initialised(); return CORBA::_tc_boolean;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_char_tc() { check_static_data_is_initialised(); return CORBA::_tc_char;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_wchar_tc() { check_static_data_is_initialised(); return CORBA::_tc_wchar;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_octet_tc() { check_static_data_is_initialised(); return CORBA::_tc_octet;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_any_tc() { check_static_data_is_initialised(); return CORBA::_tc_any;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_TypeCode_tc() { check_static_data_is_initialised(); return CORBA::_tc_TypeCode;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_Principal_tc() { check_static_data_is_initialised(); return CORBA::_tc_Principal;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_Object_tc() { check_static_data_is_initialised(); return CORBA::_tc_Object;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_string_tc() { check_static_data_is_initialised(); return CORBA::_tc_string;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_wstring_tc() { check_static_data_is_initialised(); return CORBA::_tc_wstring;}#ifdef HAS_LongLongCORBA::TypeCode_ptr CORBA::TypeCode::PR_longlong_tc() { check_static_data_is_initialised(); return CORBA::_tc_longlong;}CORBA::TypeCode_ptr CORBA::TypeCode::PR_ulonglong_tc() { check_static_data_is_initialised(); return CORBA::_tc_ulonglong;}#endif#ifdef HAS_LongDoubleCORBA::TypeCode_ptr CORBA::TypeCode::PR_longdouble_tc() { check_static_data_is_initialised(); return CORBA::_tc_longdouble;}#endif// OMG TypeCode release functionvoidCORBA::release(TypeCode_ptr o){ OMNIORB_ASSERT(CORBA::TypeCode::PR_is_valid(o)); if( CORBA::TypeCode::PR_is_valid(o) && !CORBA::is_nil(o) ) TypeCode_collector::releaseRef(ToTcBase(o));}intCORBA::TypeCode::PR_resolve_forward(CORBA::TypeCode_ptr){ OMNIORB_ASSERT(0); return 0;}OMNI_NAMESPACE_BEGIN(omni)////////////////////////////////////////////////////////////////////////////////////////////////// TypeCode_base /////////////////////////////////////////////////////////////////////////////////////////////////TypeCode_base::TypeCode_base(CORBA::TCKind tck) : pd_complete(1), pd_mark(0), pd_ref_count(1), pd_loop_member(0), pd_internal_ref_count(0), pd_cached_paramlist(0), pd_aliasExpandedTc(0), pd_compactTc(0), pd_tck(tck){ switch( tck ) { case CORBA::tk_null: case CORBA::tk_void: pd_alignmentTable.setNumEntries(1); pd_alignmentTable.addSimple(omni::ALIGN_1, 0); pd_aliasExpandedTc = pd_compactTc = this; break; case CORBA::tk_boolean: case CORBA::tk_octet: pd_alignmentTable.setNumEntries(1); pd_alignmentTable.addSimple(omni::ALIGN_1, 1); pd_aliasExpandedTc = pd_compactTc = this; break; case CORBA::tk_short: case CORBA::tk_ushort: pd_alignmentTable.setNumEntries(1); pd_alignmentTable.addSimple(omni::ALIGN_2, 2); pd_aliasExpandedTc = pd_compactTc = this; break; case CORBA::tk_long: case CORBA::tk_ulong: case CORBA::tk_float: pd_alignmentTable.setNumEntries(1); pd_alignmentTable.addSimple(omni::ALIGN_4, 4); pd_aliasExpandedTc = pd_compactTc = this; break; case CORBA::tk_double:#ifdef HAS_LongLong case CORBA::tk_longlong: case CORBA::tk_ulonglong:#endif pd_alignmentTable.setNumEntries(1); pd_alignmentTable.addSimple(omni::ALIGN_8, 8); pd_aliasExpandedTc = pd_compactTc = this; break;#ifdef HAS_LongDouble case CORBA::tk_longdouble: pd_alignmentTable.setNumEntries(1); pd_alignmentTable.addSimple(omni::ALIGN_8, 16); pd_aliasExpandedTc = pd_compactTc = this; break;#endif case CORBA::tk_char: case CORBA::tk_wchar: pd_alignmentTable.setNumEntries(1); pd_alignmentTable.addNasty(this); pd_aliasExpandedTc = pd_compactTc = this; break; case CORBA::tk_any: case CORBA::tk_TypeCode: case CORBA::tk_Principal: pd_alignmentTable.setNumEntries(1); pd_alignmentTable.addNasty(this); pd_aliasExpandedTc = pd_compactTc = this; break; case CORBA::tk_string: pd_compactTc = this; break; case CORBA::tk_wstring: pd_compactTc = this; break; case CORBA::tk_fixed: pd_aliasExpandedTc = pd_compactTc = this; break; default: pd_complete = 0; break; }}TypeCode_base::~TypeCode_base(){ if( pd_cached_paramlist ) delete pd_cached_paramlist; if( pd_aliasExpandedTc && pd_aliasExpandedTc != this ) TypeCode_collector::releaseRef(pd_aliasExpandedTc); if( pd_compactTc && pd_compactTc != this ) TypeCode_collector::releaseRef(pd_compactTc);}voidTypeCode_base::NP_marshalSimpleParams(cdrStream &, TypeCode_offsetTable* ) const{ OMNIORB_THROW(BAD_TYPECODE, BAD_TYPECODE_InvalidOperation, CORBA::COMPLETED_NO);}voidTypeCode_base::NP_marshalComplexParams(cdrStream &, TypeCode_offsetTable* ) const{ OMNIORB_THROW(BAD_TYPECODE, BAD_TYPECODE_InvalidOperation, CORBA::COMPLETED_NO);}const TypeCode_base*TypeCode_base::NP_expand(const TypeCode_base* tc){ while (1) { if (tc->NP_kind() == CORBA::tk_alias) tc = tc->NP_content_type(); else if (tc->NP_kind() == CORBA::_np_tk_indirect) tc = ((TypeCode_indirect*)tc)->NP_resolved(); else break; }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?