?? typecode.h
字號:
virtual const char* NP_member_name(CORBA::ULong index) const; virtual TypeCode_base* NP_member_type(CORBA::ULong index) const; virtual CORBA::Long NP_param_count() const; virtual CORBA::Any* NP_parameter(CORBA::Long) const; virtual CORBA::Boolean NP_containsAnAlias(); virtual TypeCode_base* NP_aliasExpand(TypeCode_pairlist*); virtual void removeOptionalNames();private: inline TypeCode_except() : TypeCode_base(CORBA::tk_except), pd_members(0), pd_nmembers(0) {} void generateAlignmentTable(); CORBA::String_member pd_repoId; CORBA::String_member pd_name; TypeCode_struct::Member* pd_members; CORBA::ULong pd_nmembers;};////////////////////////////////////////////////////////////////////////////////////////////////// TypeCode_enum /////////////////////////////////////////////////////////////////////////////////////////////////class TypeCode_enum : public TypeCode_base {public: TypeCode_enum(const char* repositoryId, const char* name, const CORBA::EnumMemberSeq& members); virtual ~TypeCode_enum(); // omniORB marshalling routines specific to complex types virtual void NP_marshalComplexParams(cdrStream&, TypeCode_offsetTable*) const; static TypeCode_base* NP_unmarshalComplexParams(cdrStream& s, TypeCode_offsetTable*); // OMG Interface: virtual CORBA::Boolean NP_extendedEqual(const TypeCode_base* TCp, CORBA::Boolean equivalent, const TypeCode_pairlist* tcpl) const; virtual const char* NP_id() const; virtual const char* NP_name() const; virtual CORBA::ULong NP_member_count() const; virtual const char* NP_member_name(CORBA::ULong index) const; virtual CORBA::Long NP_param_count() const; virtual CORBA::Any* NP_parameter(CORBA::Long) const; CORBA::Long NP_member_index(const char* name) const; // Return the index of the member with the given name, // or -1 if no such member exists. virtual void removeOptionalNames();private: TypeCode_enum(); CORBA::String_member pd_repoId; CORBA::String_member pd_name; CORBA::EnumMemberSeq pd_members; //?? Consider also storing a lookup array sorted on the name to // enable faster lookups.};///////////////////////////////////////////////////////////////////////////////////////////////// TypeCode_union /////////////////////////////////////////////////////////////////////////////////////////////////class TypeCode_union : public TypeCode_base {public: // This type is used to store discriminator values for all types // of discriminator - so must be able to store values as large // as the largest discriminator type. typedef CORBA::PR_unionDiscriminator Discriminator; typedef CORBA::PR_unionDiscriminatorSigned DiscriminatorSigned; TypeCode_union(const char* repoId, const char* name, TypeCode_base* discTC, const CORBA::UnionMemberSeq& members); TypeCode_union(const char* repoId, const char* name, TypeCode_base* discTC, const CORBA::PR_unionMember* members, CORBA::ULong memberCount, CORBA::Long deflt); virtual ~TypeCode_union(); // omniORB marshalling routines specific to complex types virtual void NP_marshalComplexParams(cdrStream&, TypeCode_offsetTable*) const; static TypeCode_base* NP_unmarshalComplexParams(cdrStream& s, TypeCode_offsetTable*); // omniORB recursive typecode handling virtual CORBA::Boolean NP_complete_recursive_sequences(TypeCode_base* tc, CORBA::ULong offset); virtual CORBA::Boolean NP_complete_recursive(TypeCode_base* tc, const char* repoId); // OMG Interface: virtual CORBA::Boolean NP_extendedEqual(const TypeCode_base* TCp, CORBA::Boolean equivalent, const TypeCode_pairlist* tcpl) const; virtual const char* NP_id() const; virtual const char* NP_name() const; virtual CORBA::ULong NP_member_count() const; virtual const char* NP_member_name(CORBA::ULong index) const; virtual TypeCode_base* NP_member_type(CORBA::ULong index) const; virtual CORBA::Any* NP_member_label(CORBA::ULong index) const; virtual TypeCode_base* NP_discriminator_type() const; virtual CORBA::Long NP_default_index() const; virtual CORBA::Long NP_param_count() const; virtual CORBA::Any* NP_parameter(CORBA::Long) const; inline Discriminator NP_member_label_val(CORBA::ULong index) const { return pd_members[index].alabel; } CORBA::Long NP_index_from_discriminator(Discriminator) const; // Returns the index of the member corresponding to the given // discriminator value. Returns -1 if the value is invalid. // (This can only happen if there is no default). Discriminator NP_default_value(); // Returns a value which may be used as either explicit or // implicit default for this union. // Must not be called if the union has no default. virtual CORBA::Boolean NP_containsAnAlias(); virtual TypeCode_base* NP_aliasExpand(TypeCode_pairlist*); virtual void removeOptionalNames();private: TypeCode_union(); struct TcUnionMember { CORBA::String_member aname; Discriminator alabel; // undefined if default member CORBA::TypeCode_member atype; }; typedef _CORBA_PseudoValue_Sequence<TcUnionMember> TcUnionMemberSeq; CORBA::String_member pd_repoId; CORBA::String_member pd_name; CORBA::TypeCode_member pd_discrim_tc;# define TYPECODE_UNION_IMPLICIT_DEFAULT -1# define TYPECODE_UNION_NO_DEFAULT -2 CORBA::Long pd_default; // Index of the default member in in <pd_members>. // TYPECODE_UNION_IMPLICIT_DEFAULT if there is no explicit // default but there is an implicit default value. // TYPECODE_UNION_NO_DEFAULT if all cases are given explicitly. TcUnionMemberSeq pd_members; // This is a value which may be used as an explicit or implicit // default value for the union. CORBA::Boolean pd_have_calculated_default_value; Discriminator pd_default_value;};///////////////////////////////////////////////////////////////////////////////////////////////// TypeCode_indirect //////////////////////////////////////////////////////////////////////////////////////////////class TypeCode_indirect : public TypeCode_base {public: TypeCode_indirect(const char* repoId); virtual ~TypeCode_indirect(); virtual void NP_marshalSimpleParams(cdrStream& nbuf, TypeCode_offsetTable*) const; virtual void NP_marshalComplexParams(cdrStream&, TypeCode_offsetTable*) const; // omniORB recursive typecode & reference count handling virtual CORBA::Boolean NP_complete_recursive_sequences(TypeCode_base* tc, CORBA::ULong offset); virtual CORBA::Boolean NP_complete_recursive(TypeCode_base* tc, const char* repoId); virtual CORBA::Boolean NP_extendedEqual(const TypeCode_base* TCp, CORBA::Boolean equivalent, const TypeCode_pairlist* pl) const; virtual const char* NP_id() const; virtual const char* NP_name() const; virtual CORBA::ULong NP_member_count() const; virtual const char* NP_member_name(CORBA::ULong index) const; virtual TypeCode_base* NP_member_type(CORBA::ULong index) const; virtual CORBA::Any* NP_member_label(CORBA::ULong index) const; virtual TypeCode_base* NP_discriminator_type() const; virtual CORBA::Long NP_default_index() const; virtual CORBA::ULong NP_length() const; virtual TypeCode_base* NP_content_type() const; virtual CORBA::UShort NP_fixed_digits() const; virtual CORBA::Short NP_fixed_scale() const; virtual CORBA::Long NP_param_count() const; virtual CORBA::Any* NP_parameter(CORBA::Long) const; virtual CORBA::Boolean NP_containsAnAlias(); virtual TypeCode_base* NP_aliasExpand(TypeCode_pairlist*); virtual void removeOptionalNames(); inline TypeCode_base* NP_resolved() { if (!pd_resolved) OMNIORB_THROW(BAD_TYPECODE, BAD_TYPECODE_UnresolvedRecursiveTC, CORBA::COMPLETED_NO); return pd_resolved; } static inline const TypeCode_base* strip(const TypeCode_base* tc) { while (tc->NP_kind() == CORBA::_np_tk_indirect) tc = ((TypeCode_indirect*)tc)->NP_resolved(); return tc; } static inline TypeCode_base* strip(TypeCode_base* tc) { while (tc->NP_kind() == CORBA::_np_tk_indirect) tc = ((TypeCode_indirect*)tc)->NP_resolved(); return tc; }private: CORBA::String_var pd_repoId; TypeCode_base* pd_resolved;};////////////////////////////////////////////////////////////////////////////////////////////// TypeCode_offsetEntry //////////////////////////////////////////////////////////////////////////////////////////////// Internal buffer-offset to typecode mapping classclass TypeCode_offsetEntry{private: friend class TypeCode_offsetTable; TypeCode_offsetEntry* pd_next; CORBA::ULong pd_offset; TypeCode_base* pd_typecode;};////////////////////////////////////////////////////////////////////////////////////////////// TypeCode_offsetTable //////////////////////////////////////////////////////////////////////////////////////////////class TypeCode_offsetTable{public: TypeCode_offsetTable(); ~TypeCode_offsetTable(); // Constructor to create a new offset table based on an existing one // When the new table is created, it assumes the currentOffset field // of the parent table to be the base location. // EXAMPLE: // .1) The user creates an offsetTable // .2) The user does some work, leaving the currentOffset at _n_. // .3) The user now wants to deal with the offsetTable as if the current // offset wasn't _n_ but was, instead _base_. // .4) A new offsetTable, B, is created, with initial offset of _base_. // Now, a call such as B->addEntry(_m_, _tc_) will be mapped to // A->addEntry(_m_ + (_n_ - _base_), _tc) // i.e. The offset passed to B->addEntry is relative to offset zero // in table B. The is automatically mapped to the corresponding // offset in table A. TypeCode_offsetTable(TypeCode_offsetTable* parent, CORBA::Long base_offset); // Routine to add an offset->typecode mapping void addEntry(CORBA::Long offset, TypeCode_base* typecode); // Routines to retrieve typecode by offset or vica versa TypeCode_base* lookupOffset(CORBA::Long offset); CORBA::Boolean lookupTypeCode(const TypeCode_base* tc, CORBA::Long& offset); // Routine to retrieve the current buffer offset inline CORBA::Long currentOffset() { return pd_curr_offset; } inline void setOffset(CORBA::Long i) { pd_curr_offset = i; }private: TypeCode_offsetEntry* pd_table; CORBA::Long pd_curr_offset; // Fields for use when this offsetTable is actually just a wrapper round // an existing offsetTable TypeCode_offsetTable* pd_parent_table; CORBA::Long pd_parent_base_offset;};//////////////////////////////////////////////////////////////////////////////////////////////// TypeCode_pairlist ///////////////////////////////////////////////////////////////////////////////////////////////// Instances of this class are chained together on the stack and are used// by NP_equal to avoid loops in typecode comparisonsclass TypeCode_pairlist{public: inline TypeCode_pairlist(const TypeCode_pairlist* next, const TypeCode_base* tc1, const TypeCode_base* tc2) : d_next(next), d_tc1(tc1), d_tc2(tc2) {} const TypeCode_pairlist* d_next; const TypeCode_base* d_tc1; const TypeCode_base* d_tc2; static int contains(const TypeCode_pairlist*, const TypeCode_base*, const TypeCode_base*); // Returns true if the given list contains the given pair. static const TypeCode_base* search(const TypeCode_pairlist*, const TypeCode_base*); // Search for given typecode in the pair list, and if // found as the second of a pair, return the first in // the same pair. Otherwise return 0.};/////////////////////////////////////////////////////////////////////////////////////////////// TypeCode_marshaller //////////////////////////////////////////////////////////////////////////////////////////////class TypeCode_marshaller{public: // Marshal/unmarshal to cdrStream static void marshal(TypeCode_base* obj, cdrStream& s, TypeCode_offsetTable* otbl); static TypeCode_base* unmarshal(cdrStream& s, TypeCode_offsetTable* otbl); // Find out what kind of parameter list the given TypeCode Kind requires static TypeCode_paramListType paramListType(CORBA::ULong kind);};/////////////////////////////////////////////////////////////////////////////////////////////// TypeCode_collector ///////////////////////////////////////////////////////////////////////////////////////////////class TypeCode_collector{public: // Duplicate a typecode pointer static TypeCode_base* duplicateRef(TypeCode_base* tc); // Release a typecode pointer static void releaseRef(TypeCode_base* tc); // Traverse a typecode tree, marking all nodes that are part of a loop static void markLoopMembers(TypeCode_base* tc);private: // Internal routines used by releaseRef static CORBA::ULong markLoops(TypeCode_base* tc, CORBA::ULong depth); static void countInternalRefs(TypeCode_base* tc); static CORBA::Boolean checkInternalRefs(TypeCode_base* tc, CORBA::ULong depth);};////////////////////////////////////////////////////////////////////////////////////////////// TypeCode_union_helper /////////////////////////////////////////////////////////////////////////////////////////////class TypeCode_union_helper{public: static TypeCode_union::Discriminator extractLabel(const CORBA::Any& discval, CORBA::TypeCode_ptr tc); // Extract a discriminator value from the given Any, and cast it to // the TypeCode_union::Discriminator type. Checks that the value in // <discval> is of type <tc>, and throws BAD_PARAM if not. // Also checks that <tc> is a legal union disciminator type, // and throws BAD_TYPECODE if not. static void insertLabel(CORBA::Any& label, TypeCode_union::Discriminator, CORBA::TypeCode_ptr tc); // Insert the discriminator value into the given Any, with the // required type. static void marshalLabel(TypeCode_union::Discriminator, CORBA::TypeCode_ptr tc, cdrStream& s); // Marshal a discriminator value (as the given type). static TypeCode_union::Discriminator unmarshalLabel(CORBA::TypeCode_ptr tc, cdrStream& s); // Unmarshal a discriminator value of the given type from the stream. // Throws CORBA::MARSHAL on error. static CORBA::Boolean has_implicit_default(TypeCode_base* tc); // True if the union has an implicit default - ie. no explicit // default given, and not all values of the discriminator type // have been used. // This need only be called by the TypeCode_union constructor, // as it caches the result.};OMNI_NAMESPACE_END(omni)#endif // __TYPECODE_H__
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -