⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dynanyimpl.h

📁 编译工具
💻 H
📖 第 1 页 / 共 3 页
字号:
  /***********  * internal *  ***********/  virtual void set_to_initial_value();  TypeCode_enum* actualTc() const {    return (TypeCode_enum*) DynAnyImplBase::actualTc();  }  virtual void _NP_incrRefCount();  virtual void _NP_decrRefCount();  // Must not hold DynAnyImplBase::refCountLock.  virtual void* _ptrToObjRef(const char* repoId);};//////////////////////////////////////////////////////////////////////////////////////////////// DynAnyConstrBase //////////////////////////////////////////////////////////////////////////////////////////////////: Base class for constructed type DynAny's.class DynAnyConstrBase : public DynAnyImplBase{public:  DynAnyConstrBase(TypeCode_base* tc, int nodetype, CORBA::Boolean is_root);  ~DynAnyConstrBase();  /*******************  * public interface *  *******************/  virtual void assign(DynamicAny::DynAny_ptr dyn_any);  virtual CORBA::Boolean equal(DynamicAny::DynAny_ptr dyn_any);  virtual void insert_boolean   (CORBA::Boolean      	value);  virtual void insert_octet     (CORBA::Octet        	value);  virtual void insert_char      (CORBA::Char         	value);  virtual void insert_short     (CORBA::Short        	value);  virtual void insert_ushort    (CORBA::UShort       	value);  virtual void insert_long      (CORBA::Long         	value);  virtual void insert_ulong     (CORBA::ULong        	value);#ifndef NO_FLOAT				 	        virtual void insert_float     (CORBA::Float        	value);  virtual void insert_double    (CORBA::Double       	value);#endif						 	        virtual void insert_string    (const char*         	value);  virtual void insert_reference (CORBA::Object_ptr   	value);  virtual void insert_typecode  (CORBA::TypeCode_ptr 	value);#ifdef HAS_LongLong				 	        virtual void insert_longlong  (CORBA::LongLong     	value);  virtual void insert_ulonglong (CORBA::ULongLong    	value);#endif						 	      #ifdef HAS_LongDouble				 	        virtual void insert_longdouble(CORBA::LongDouble   	value);#endif						 	        virtual void insert_wchar     (CORBA::WChar        	value);  virtual void insert_wstring   (const CORBA::WChar* 	value);  virtual void insert_any       (const CORBA::Any&   	value);  virtual void insert_dyn_any   (DynamicAny::DynAny_ptr value);  virtual CORBA::Boolean      	 get_boolean();  virtual CORBA::Octet        	 get_octet();  virtual CORBA::Char         	 get_char();  virtual CORBA::Short        	 get_short();  virtual CORBA::UShort       	 get_ushort();  virtual CORBA::Long         	 get_long();  virtual CORBA::ULong        	 get_ulong();#ifndef NO_FLOAT  virtual CORBA::Float        	 get_float();  virtual CORBA::Double       	 get_double();#endif			 	     virtual char*               	 get_string();  virtual CORBA::Object_ptr   	 get_reference();  virtual CORBA::TypeCode_ptr 	 get_typecode();#ifdef HAS_LongLong  virtual CORBA::LongLong     	 get_longlong();  virtual CORBA::ULongLong    	 get_ulonglong();#endif			 	   #ifdef HAS_LongDouble  virtual CORBA::LongDouble   	 get_longdouble();#endif  virtual CORBA::WChar        	 get_wchar();  virtual CORBA::WChar*       	 get_wstring();  virtual CORBA::Any*         	 get_any();  virtual DynamicAny::DynAny_ptr get_dyn_any();  virtual void insert_boolean_seq   (CORBA::BooleanSeq&    value);  virtual void insert_octet_seq     (CORBA::OctetSeq&      value);  virtual void insert_char_seq      (CORBA::CharSeq&       value);  virtual void insert_short_seq     (CORBA::ShortSeq&      value);  virtual void insert_ushort_seq    (CORBA::UShortSeq&     value);  virtual void insert_long_seq      (CORBA::LongSeq&       value);  virtual void insert_ulong_seq     (CORBA::ULongSeq&      value);#ifndef NO_FLOAT  virtual void insert_float_seq     (CORBA::FloatSeq&      value);  virtual void insert_double_seq    (CORBA::DoubleSeq&     value);#endif#ifdef HAS_LongLong  virtual void insert_longlong_seq  (CORBA::LongLongSeq&   value);  virtual void insert_ulonglong_seq (CORBA::ULongLongSeq&  value);#endif#ifdef HAS_LongDouble						   virtual void insert_longdouble_seq(CORBA::LongDoubleSeq& value);#endif								   virtual void insert_wchar_seq     (CORBA::WCharSeq&      value);  virtual CORBA::BooleanSeq*    get_boolean_seq();  virtual CORBA::OctetSeq*      get_octet_seq();  virtual CORBA::CharSeq*       get_char_seq();  virtual CORBA::ShortSeq*      get_short_seq();  virtual CORBA::UShortSeq*     get_ushort_seq();  virtual CORBA::LongSeq*       get_long_seq();  virtual CORBA::ULongSeq* 	get_ulong_seq();#ifndef NO_FLOAT  virtual CORBA::FloatSeq* 	get_float_seq();  virtual CORBA::DoubleSeq*     get_double_seq();#endif#ifdef HAS_LongLong  virtual CORBA::LongLongSeq*   get_longlong_seq();  virtual CORBA::ULongLongSeq*  get_ulonglong_seq();#endif#ifdef HAS_LongDouble  virtual CORBA::LongDoubleSeq* get_longdouble_seq();#endif  virtual CORBA::WCharSeq*      get_wchar_seq();  virtual CORBA::Boolean seek(CORBA::Long index);  virtual void rewind();  virtual CORBA::Boolean next();  virtual CORBA::ULong component_count();  virtual DynamicAny::DynAny_ptr current_component();  /***********  * internal *  ***********/  virtual void set_to_initial_value();  virtual int copy_to(cdrMemoryStream& mbs);  virtual int copy_from(cdrMemoryStream& mbs);  virtual void onDispose();  static const char* _PD_repoId;  // Fake repoId for use by _ptrToObjRefprotected:  void setNumComponents(unsigned n);  // May be called by derived classes to set/change the number of  // components.  //  Concurrency: hold DynAnyImplBase::lock (unless called from  //                                          a constructor)  virtual TypeCode_base* nthComponentTC(unsigned n) = 0;  // Returns the TypeCode of the n'th component. Overriden by descendants.  // This does not return a new reference - so it should not be  // released. <n> MUST be in the range [0..pd_n_components).  //  Must hold DynAnyImplBase::lock.  CORBA::TCKind currentKind() {    return TypeCode_base::NP_expand(nthComponentTC(pd_curr_index))->NP_kind();  }  // Return the alias expanded CORBA::TCKind of the current component.  // There MUST be a valid current component.  //  Must hold DynAnyImplBase::lock.  CORBA::Boolean canAppendComponent(unsigned i) const {    return i == pd_n_really_in_buf && i == pd_n_in_buf && i < pd_first_in_comp;  }  // True if the given component can be appended to <pd_buf>.  // The result is only valid if <i> is in range.  //  Must hold DynAnyImplBase::lock.  cdrMemoryStream& writeCurrent(CORBA::TCKind kind) {    if( pd_curr_index < 0 )      throw DynamicAny::DynAny::InvalidValue();    if( currentKind() != kind )      throw DynamicAny::DynAny::TypeMismatch();    if( canAppendComponent(pd_curr_index) ) {      pd_n_in_buf++;      pd_n_really_in_buf++;      return pd_buf;    } else {      DynAnyImpl* cc = ToDynAnyImpl(getCurrent());      cc->pd_buf.rewindPtrs();      cc->setValid();      return cc->pd_buf;    }  }  // Helper function for writing primitive values into the current  // component. It returns a reference to the buffer which the value  // should be inserted into. If the value can be appended to <pd_buf>,  // then <pd_buf> is returned, otherwise it is the buffer of the  // child DynAny.  //  Checks also the there is a current component, and that its type  // is the same as the value being inserted.  //  Must hold DynAnyImplBase::lock.  cdrMemoryStream& readCurrent(CORBA::TCKind kind) {    if( pd_curr_index < 0 )      throw DynamicAny::DynAny::InvalidValue();    if( currentKind() != kind )      throw DynamicAny::DynAny::TypeMismatch();    if( pd_curr_index < (int)pd_n_in_buf ) {      if( pd_read_index != pd_curr_index )  seekTo(pd_curr_index);      pd_read_index++;      return pd_buf;    }    else if( pd_curr_index >= (int)pd_first_in_comp ) {      DynAnyImpl* cc = ToDynAnyImpl(getCurrent());      if( !cc->isValid() )  throw DynamicAny::DynAny::InvalidValue();      cc->pd_buf.rewindInputPtr();      return cc->pd_buf;    }    else throw DynamicAny::DynAny::InvalidValue();#ifdef NEED_DUMMY_RETURN    return pd_buf;#endif  }  // Helper function for reading a primitive value from the current  // component. Returns a reference to the buffer from which the  // value may be extracted. It checks that <pd_curr_index> is valid,  // and the component is of the type expected.  //  Must hold DynAnyImplBase::lock.public:  enum SeqLocation { SEQ_HERE, SEQ_COMPONENT };protected:  virtual SeqLocation prepareSequenceWrite(CORBA::TCKind kind,					   CORBA::ULong len) = 0;  // Used by insert_..._seq functions. Check if a sequence with the  // specified kind and length can be inserted, and prepare for the  // write. Returns SEQ_HERE if it can be inserted in this DynAny's  // <pd_buf>, SEQ_COMPONENT if it can be inserted in the current  // component. Throws InvalidValue if no current component or wrong  // length, TypeMismatch if the kind is wrong.  virtual SeqLocation prepareSequenceRead(CORBA::TCKind kind) = 0;  // Used by get_..._seq functions. Check if a sequence with the  // specified kind can be read. Returns SEQ_HERE if this DynAny is a  // sequence or array of the specified kind, SEQ_COMPONENT if the  // current component is a sequence or array of the specified kind.  // If there is a current component but it's not a sequence of the  // right kind, throws TypeMismatch; if there is no current  // component, throws InvalidValue.  DynAnyImplBase* getCurrent() {    if( pd_curr_index < (int)pd_first_in_comp )      createComponent(pd_curr_index);    return pd_components[pd_curr_index];  }  // If not already there, puts the current component (and those  // following it) into <pd_components>, and returns it. There  // must be a current component.  //  Must hold DynAnyImplBase::lock.  void createComponent(unsigned n);  // If it does not already exist, create a DynAny for the n'th  // component. Ensures also that DynAny's are created for all  // components following that one.  //  Requires n < pd_n_components.  //  Must hold DynAnyImplBase::lock.  void seekTo(unsigned n);  // Seek the internal buffer so as to read the i'th component.  //  Does not throw any exceptions.  //  Requires n < pd_n_in_buf.  //  Must hold DynAnyImplBase::lock.  int component_to_any(unsigned i, CORBA::Any& a);  // Copy the i'th component into <a>. Returns 0 if that  // component is not properly initialised.  //  Does not throw any exceptions.  //  Requires i < pd_n_components.  //  Must hold DynAnyImplBase::lock.  int component_from_any(unsigned i, const CORBA::Any& a);  // Sets the value of the i'th component to that in <a>.  // Returns 0 if the value in the Any is of the wrong  // type, or the Any has not been initialised.  //  Does not throw any exceptions.  //  Requires i < pd_n_components.  //  Must hold DynAnyImplBase::lock.  omnivector<DynAnyImplBase*> pd_components;  // Sequence of pointers to components that are not stored in <pd_buf>.  // The length of this sequence is always equal to pd_n_components.  unsigned pd_n_components;  // The total number of components this value has.  unsigned pd_n_in_buf;  // Components in the range [0..pd_n_in_buf) are in <pd_buf>.  // pd_n_in_buf <= pd_first_in_comp.  unsigned pd_n_really_in_buf;  // The number of components which have actually been written into  // <pd_buf>. This value may be greater than <pd_n_components> or  // <pd_first_in_comp>.  unsigned pd_first_in_comp;  // Components in the range [pd_first_in_comp..pd_n_components)  // are in pd_components. Thus those in the range  // [pd_n_in_buf..pd_first_in_comp) are not yet defined.  int pd_curr_index;  // The index of the 'current component'. If this is -1 then  // there is no current component. If there are zero components  // then this is always -1.  int pd_read_index;  // The index of the component that the buffer's read marker is  // pointing at. So if pd_curr_index == pd_read_index, and the  // component is in the buffer, then it can be read out.};////////////////////////////////////////////////////////////////////////////////////////////////// DynStructImpl ///////////////////////////////////////////////////////////////////////////////////////////////////: DynAny for structure and exception types.class DynStructImpl : public DynAnyConstrBase,		      public DynamicAny::DynStruct{public:  DynStructImpl(TypeCode_base* tc, CORBA::Boolean is_root=1);  virtual ~DynStructImpl();  /*******************  * public interface *  *******************/  virtual DynamicAny::DynAny_ptr copy();  virtual char* current_member_name();  virtual CORBA::TCKind current_member_kind();  virtual DynamicAny::NameValuePairSeq* get_members();  virtual void set_members(const DynamicAny::NameValuePairSeq& value);  virtual DynamicAny::NameDynAnyPairSeq* get_members_as_dyn_any();  virtual void set_members_as_dyn_any(const DynamicAny::NameDynAnyPairSeq& value);  /****************************  * exposed private interface *  ****************************/  virtual int NP_nodetype() const;  /***********  * internal *  ***********/  virtual TypeCode_base* nthComponentTC(unsigned n);  // Overrides DynAnyConstrBase  virtual SeqLocation prepareSequenceWrite(CORBA::TCKind kind,					   CORBA::ULong len);  virtual SeqLocation prepareSequenceRead(CORBA::TCKind kind);  virtual void _NP_incrRefCount();  virtual void _NP_decrRefCount();  // Must not hold DynAnyImplBase::refCountLock.  virtual void* _ptrToObjRef(const char* repoId);};///////////////////////////////////////////////////////////////////////////////////////////////// DynUnionDisc /////////////////////////////////////////////////////////////////////////////////////////////////////: DynAny for the discriminator of a union.// Behaves like a DynAnyImpl, but catches any updates, and informs// the union (which this is the discriminator of) so that it may// update its member appropriately.class DynUnionDisc : public DynAnyImpl {public:  DynUnionDisc(TypeCode_base* tc, int nodetype, DynUnionImpl* un)    : DynAnyImpl(tc, nodetype, DYNANY_CHILD),      pd_union(un) {}  virtual ~DynUnionDisc();  /*******************  * public interface *  *******************/  virtual void assign(DynamicAny::DynAny_ptr dyn_any);  virtual void insert_boolean   (CORBA::Boolean      	value);  virtual void insert_octet     (CORBA::Octet        	value);  virtual void insert_char      (CORBA::Char         	value);  virtual void insert_short     (CORBA::Short        	value);  virtual void insert_ushort    (CORBA::UShort       	value);  virtual void insert_long      (CORBA::Long         	value);  virtual void insert_ulong     (CORBA::ULong        	value);#ifndef NO_FLOAT				 	        virtual void insert_float     (CORBA::Float        	value);  virtual void insert_double    (CORBA::Double       	value);#endif						 	        virtual void insert_string    (const char*         	value);  virtual void insert_reference (CORBA::Object_ptr   	value);  virtual void insert_typecode  (CORBA::TypeCode_ptr 	value);#ifdef HAS_LongLong				 	        virtual void insert_longlong  (CORBA::LongLong     	value);  virtual void insert_ulonglong (CORBA::ULongLong    	value);#endif						 	      #ifdef HAS_LongDouble				 	        virtual void insert_longdouble(CORBA::LongDouble   	value);#endif						 	        virtual void insert_wchar     (CORBA::WChar        	value);  virtual void insert_wstring   (const CORBA::WChar* 	value);  virtual void insert_any       (const CORBA::Any&   	value);  virtual void insert_dyn_any   (DynamicAny::DynAny_ptr value);  /****************************  * exposed private interface *  ****************************/  virtual int NP_nodetype() const;  /***********  * internal *  ***********/  void set_to_initial_value();  void detach() {    pd_union = 0;    DynAnyImpl::detach();  }  virtual void set_value(TypeCode_union::Discriminator v);  // Must NOT hold DynAnyImplBase::lock.protected:  DynUnionImpl* pd_union;  // Pointer to the parent union, or 0 if detached.};/////////////////////////////////////////////////////////////////////////////////////////////// DynUnionEnumDisc ///////////////////////////////////////////////////////////////////////////////////////////////////: DynAny for the (enum) discriminator of a union.class DynUnionEnumDisc : public DynUnionDisc,			 public DynamicAny::DynEnum{public:  DynUnionEnumDisc(TypeCode_base* tc, DynUnionImpl* un);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -