Any_Unknown_IDL_Type.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Any_Unknown_IDL_Type.h
00006  *
00007  *  $Id: Any_Unknown_IDL_Type.h 76551 2007-01-24 13:42:44Z johnnyw $
00008  *
00009  *  @author Carlos O'Ryan
00010  *  @author Jeff Parsons
00011  */
00012 //=============================================================================
00013 
00014 #ifndef TAO_ANY_UNKNOWN_IDL_TYPE_H
00015 #define TAO_ANY_UNKNOWN_IDL_TYPE_H
00016 
00017 #include /**/ "ace/pre.h"
00018 
00019 #include "tao/AnyTypeCode/Any_Impl.h"
00020 #include "tao/CDR.h"
00021 
00022 #include "ace/Auto_Ptr.h"
00023 
00024 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 # pragma once
00026 #endif /* ACE_LACKS_PRAGMA_ONCE */
00027 
00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00029 
00030 namespace TAO
00031 {
00032   /**
00033    * @class Unknown_IDL_Type
00034    *
00035    * @brief CDR-based Any impl class.
00036    *
00037    * Used when demarshaling an Any, and with DII/DSI, and Dynamic Anys.
00038    */
00039   class TAO_AnyTypeCode_Export Unknown_IDL_Type : public Any_Impl
00040   {
00041   public:
00042     Unknown_IDL_Type (CORBA::TypeCode_ptr,
00043                       TAO_InputCDR &cdr);
00044 
00045     Unknown_IDL_Type (CORBA::TypeCode_ptr);
00046 
00047     virtual ~Unknown_IDL_Type (void);
00048 
00049     virtual CORBA::Boolean marshal_value (TAO_OutputCDR &);
00050     virtual const void *value (void) const;
00051     virtual void free_value (void);
00052 
00053     virtual TAO_InputCDR &_tao_get_cdr (void);
00054     virtual int _tao_byte_order (void) const;
00055 
00056     virtual void _tao_decode (TAO_InputCDR &
00057                              );
00058 
00059     virtual CORBA::Boolean to_object (CORBA::Object_ptr &) const;
00060     virtual CORBA::Boolean to_value (CORBA::ValueBase *&) const;
00061     virtual CORBA::Boolean to_abstract_base (CORBA::AbstractBase_ptr &) const;
00062 
00063   private:
00064     // We make the lock global, so that it won't  be deleted when shared.
00065     // For instance, see Any_Basic_Impl::extract() which copies the insides
00066     // from an Unknown_IDL_Type to an Any_Basic_Impl.
00067 
00068     // [Iliyan] However, having a global static makes this a subject
00069     // to the whim of the specific compiler implentation. It is the
00070     // one deciding the order in which our instance is initialized and
00071     // destroyed and that is boundto be a problem
00072     // somewhere. Typically, it becomes a problem when a code that
00073     // depends on that instance finds that the runtime has already
00074     // destroyed it. The scenario plays allmost always in the process
00075     // shutdown code, after main() exits, having to debug which is a
00076     // lot of fun :) ...  Bottom line, use a static function, which
00077     // encapsulates a local static initializer, guaranteed to be
00078     // initialized at the first invocation.
00079     static ACE_Lock *lock_i (void);
00080 
00081     mutable TAO_InputCDR cdr_;
00082   };
00083 }
00084 
00085 TAO_END_VERSIONED_NAMESPACE_DECL
00086 
00087 #include /**/ "ace/post.h"
00088 
00089 #endif /* TAO_ANY_UNKNOWN_IDL_TYPE_H */

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