Any_Impl.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Any_Impl.h
00006  *
00007  *  $Id: Any_Impl.h 76995 2007-02-11 12:51:42Z johnnyw $
00008  *
00009  *  @author Carlos O'Ryan
00010  *  @author Jeff Parsons
00011  */
00012 //=============================================================================
00013 
00014 #ifndef TAO_ANY_IMPL_H
00015 #define TAO_ANY_IMPL_H
00016 
00017 #include /**/ "ace/pre.h"
00018 
00019 #include "tao/orbconf.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
00026 #include "tao/Basic_Types.h"
00027 
00028 #include "ace/Synch_Traits.h"
00029 #include "ace/Null_Mutex.h"
00030 #include "ace/Thread_Mutex.h"
00031 #include "ace/Atomic_Op.h"
00032 
00033 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00034 class ACE_Message_Block;
00035 ACE_END_VERSIONED_NAMESPACE_DECL
00036 
00037 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00038 
00039 class TAO_OutputCDR;
00040 class TAO_InputCDR;
00041 
00042 namespace CORBA
00043 {
00044   class TypeCode;
00045   typedef TypeCode *TypeCode_ptr;
00046 
00047   class Object;
00048   typedef Object *Object_ptr;
00049 
00050   class ValueBase;
00051   class AbstractBase;
00052   typedef AbstractBase *AbstractBase_ptr;
00053 }
00054 
00055 namespace TAO
00056 {
00057   /**
00058    * @class Any_Impl
00059    *
00060    * @brief Base class for the Any template subclasses.
00061    *
00062    * Contains common functionality and some pure virtual methods.
00063    */
00064   class TAO_AnyTypeCode_Export Any_Impl
00065   {
00066   public:
00067     /// Generated data types define a 'destructor' function that
00068     /// correctly destroys an object stored in an Any.
00069     typedef void (*_tao_destructor)(void *);
00070 
00071     CORBA::Boolean marshal (TAO_OutputCDR &);
00072     virtual CORBA::Boolean marshal_value (TAO_OutputCDR &) = 0;
00073 
00074     virtual void free_value (void);
00075 
00076     CORBA::TypeCode_ptr type (void) const;
00077     CORBA::TypeCode_ptr _tao_get_typecode (void) const;
00078     void type (CORBA::TypeCode_ptr);
00079 
00080     virtual int _tao_byte_order (void) const;
00081 
00082     virtual void _add_ref (void);
00083     virtual void _remove_ref (void);
00084 
00085     /// Used to release these CORBA basic types.
00086     static void _tao_any_string_destructor (void *);
00087     static void _tao_any_wstring_destructor (void *);
00088 
00089     virtual void _tao_decode (TAO_InputCDR &);
00090 
00091     virtual CORBA::Boolean to_object (CORBA::Object_ptr &) const;
00092     virtual CORBA::Boolean to_value (CORBA::ValueBase *&) const;
00093     virtual CORBA::Boolean to_abstract_base (CORBA::AbstractBase_ptr &) const;
00094 
00095     bool encoded (void) const;
00096 
00097   protected:
00098     Any_Impl (_tao_destructor,
00099               CORBA::TypeCode_ptr,
00100               bool encoded = false);
00101     virtual ~Any_Impl (void);
00102 
00103     TAO::Any_Impl::_tao_destructor value_destructor_;
00104     CORBA::TypeCode_ptr type_;
00105     bool encoded_;
00106 
00107   private:
00108     /// Reference counter.
00109     ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
00110   };
00111 }
00112 
00113 TAO_END_VERSIONED_NAMESPACE_DECL
00114 
00115 #include /**/ "ace/post.h"
00116 
00117 #endif /* TAO_ANY_IMPL_H */

Generated on Sun Jan 27 13:21:06 2008 for TAO_AnyTypeCode by doxygen 1.3.6