diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-05-06 18:24:48 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-05-06 18:24:48 +0000 |
commit | 92e0baede6f3769f1cf946e17b3c67c377a00f37 (patch) | |
tree | fdc6756cd69e04ed291adfed799ffa0e5cd99fc9 /TAO/tao/ValueBase.h | |
parent | 47d718ea65450fc100d726cbfd0bcf3211e837b8 (diff) | |
download | ATCD-92e0baede6f3769f1cf946e17b3c67c377a00f37.tar.gz |
ChangeLogTag:Thu May 6 12:11:22 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/ValueBase.h')
-rw-r--r-- | TAO/tao/ValueBase.h | 176 |
1 files changed, 176 insertions, 0 deletions
diff --git a/TAO/tao/ValueBase.h b/TAO/tao/ValueBase.h new file mode 100644 index 00000000000..ceb24153731 --- /dev/null +++ b/TAO/tao/ValueBase.h @@ -0,0 +1,176 @@ +// This may look like C, but it's really -*- C++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO +// +// = FILENAME +// ValueBase.h +// +// = AUTHOR +// Torsten Kuepper <kuepper2@lfa.uni-wuppertal.de> +// +// ============================================================================ + +#ifndef TAO_VALUEBASE_H +#define TAO_VALUEBASE_H + +#include "ace/OS.h" /* for ptr_arith_t */ +#include "tao/corbafwd.h" + +#ifdef TAO_HAS_VALUETYPE + + +class TAO_Export CORBA_ValueBase +{ + // = TITLE + // Abstract baseclass for Valuetypes + // (see CORBA 2.3 20.17.5) + +public: + // reference counting + virtual void _add_ref (void) = 0; + virtual void _remove_ref (void) = 0; + // %! virtual CORBA::ValueBase* _copy_value (void) = 0; + virtual CORBA::ULong _refcount_value (void) = 0; + + // dynamic casting + static CORBA::ValueBase* _downcast (CORBA::ValueBase*); + + virtual const char* _tao_obv_repository_id () const = 0; + // TAO extension + + // TAO internal -------------------------- + + static CORBA::Boolean _tao_marshal (TAO_OutputCDR &strm, + CORBA_ValueBase *_this, + ptr_arith_t formal_type_id = 0); + // Marshal a valuetype (see operator<< in tao_idl generated file + // how it is called) + + static CORBA::Boolean _tao_unmarshal (TAO_InputCDR &strm, + CORBA_ValueBase *&_this); + // Unmarshal a valuetype, if formal type is a pointer to ValueBase + + // static CORBA::Boolean + // T::_tao_unmarshal (TAO_InputCDR &, CORBA_ValueBase *&_this) + // is typespecific for valuetype T and generated from tao_idl + // Use this for unmarshaling. + + static CORBA::Boolean _tao_unmarshal_pre (TAO_InputCDR &strm, + CORBA_ValueFactory_ptr &, + CORBA_ValueBase *&, + const char * const repo_id); + CORBA::Boolean _tao_unmarshal_post (TAO_InputCDR &strm); + // Both used internally and are called from T::_tao_unmarshal () + + +public: // otherwise these cannot be called from a static function + virtual void *_tao_obv_narrow (ptr_arith_t) = 0; + + virtual CORBA::Boolean _tao_marshal_v (TAO_OutputCDR &) = 0; + // during marshal jump to the most derived part + + virtual CORBA::Boolean _tao_unmarshal_v (TAO_InputCDR &) = 0; + // called after obtaining the fresh object from create_for_unmarshal () + +protected: + CORBA_ValueBase (void); + CORBA_ValueBase (const CORBA_ValueBase&); + virtual ~CORBA_ValueBase (); + +private: + void operator= (const CORBA_ValueBase &); +}; // CORBA_ValueBase + + + + +class TAO_Export CORBA_DefaultValueRefCountBase : public virtual CORBA_ValueBase +{ + // = TITLE + // Default mix-in for reference count of a valuetype. + +public: + virtual void _add_ref (void); + virtual void _remove_ref (void); + virtual CORBA::ULong _refcount_value (void); + + void _tao_add_ref (void); + void _tao_remove_ref (void); + CORBA::ULong _tao_refcount_value (void); + // The _tao variants are inline for fast access from T_var + // (if valuetype T is compiled with optimization for that.) %! (todo) + +protected: + CORBA_DefaultValueRefCountBase (void); + CORBA_DefaultValueRefCountBase (const CORBA_DefaultValueRefCountBase&); + virtual ~CORBA_DefaultValueRefCountBase (); + +private: + void operator= (const CORBA_DefaultValueRefCountBase &); + +private: // data + CORBA::ULong _tao_reference_count_; + ACE_SYNCH_MUTEX _tao_reference_count_lock_; +}; // CORBA_DefaultValueRefCountBase + +// %! which lock has the lowest memory overhead ? +// %! todo refcountbase w/o locking (now memory overhead) +// $! todo: debug aids for refcounts + + +class TAO_OBV_GIOP_Flags +{ + // CORBA 2.3: 15.3.4 +public: + enum Tag // test: + { + Null_ref = 0x00000000L, // equal + Value_tag_base = 0x7fffff00L, + Value_tag_sigbits = 0xffffff00L, + Codebase_url = 0x00000001L, // and + Type_info_no = 0x00000000L, + Type_info_single = 0x00000002L, + Type_info_list = 0x00000006L, + Type_info_sigbits = 0x00000006L, + Chunked_encoding = 0x00000008L, // and + Indirection_tag = 0xffffffffL, // equal + Block_size_tag_min = 1, // range + Block_size_tag_max = 0x7fffff00L -1, + // @@ %! but how encode a stateless block ? + End_tag_min = -0x80000000L +1, // range + End_tag_max = -1, + Indirection_min = -0x80000000L +1, // range + Indirection_max = -5, + }; + // all flags without a comment are complete tested against + // the analog _sigbits mask. + + + +public: + static CORBA::Boolean is_null_ref (const CORBA::ULong); + static CORBA::Boolean is_value_tag (const CORBA::ULong); + static CORBA::Boolean has_codebase_url (const CORBA::ULong); + static CORBA::Boolean has_no_type_info (const CORBA::ULong); + static CORBA::Boolean has_single_type_info (const CORBA::ULong); + static CORBA::Boolean has_list_type_info (const CORBA::ULong); + static CORBA::Boolean is_chunked (const CORBA::ULong); + static CORBA::Boolean is_indirection_tag (const CORBA::ULong); + static CORBA::Boolean block_size (const CORBA::ULong, CORBA::ULong &size); + static CORBA::Boolean end_tag_depth (const CORBA::ULong, CORBA::ULong &d); + static CORBA::Boolean indirection (const CORBA::ULong, CORBA::Long &jump); + // static CORBA::Boolean (const CORBA::ULong); + // static CORBA::Boolean (const CORBA::ULong); + +}; + +#if defined (__ACE_INLINE__) +# include "tao/ValueBase.i" +#endif /* __ACE_INLINE__) */ + +#endif /* TAO_HAS_VALUETYPE */ +#endif /* TAO_VALUEBASE_H */ |