LocalObject.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  * @file LocalObject.h
00006  *
00007  * $Id: LocalObject.h 81490 2008-04-28 14:32:24Z johnnyw $
00008  *
00009  * Header file for CORBA's base "LocalObject" type.
00010  *
00011  * A "LocalObject" is an entity that can be the target of a local
00012  * invocation.  See the CORBA Component Model specification for
00013  * details.
00014  *
00015  * @author Nanbor Wang <nanbor@cs.wustl.edu>
00016  */
00017 //=============================================================================
00018 
00019 
00020 #ifndef TAO_CORBA_LOCALOBJECT_H
00021 #define TAO_CORBA_LOCALOBJECT_H
00022 
00023 #include /**/ "ace/pre.h"
00024 
00025 #include "ace/Thread_Mutex.h"
00026 #include "ace/Atomic_Op.h"
00027 
00028 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00029 # pragma once
00030 #endif /* ACE_LACKS_PRAGMA_ONCE */
00031 
00032 #include "tao/Object.h"
00033 
00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00035 
00036 namespace CORBA
00037 {
00038   class LocalObject;
00039   typedef LocalObject *LocalObject_ptr;
00040   typedef TAO_Pseudo_Var_T<LocalObject> LocalObject_var;
00041   typedef TAO_Pseudo_Out_T<LocalObject> LocalObject_out;
00042 
00043   /**
00044    * @class LocalObject
00045    */
00046   class TAO_Export LocalObject : public virtual CORBA::Object
00047   {
00048   public:
00049 
00050     /// Destructor
00051     virtual ~LocalObject (void);
00052 
00053     /// Increment the ref count
00054     static LocalObject_ptr _duplicate (LocalObject_ptr obj);
00055 
00056     /// Return a NIL object
00057     static LocalObject_ptr _nil (void);
00058 
00059     /**
00060      * @todo Narrowing a LocalObject to a CORBA::Object is broken
00061      * right now.  The solution seems to be making CORBA::Object an
00062      * abstract base class and create a CORBA::RemoteObject for
00063      * regular object.  Or, even easier, add a @c is_local member into
00064      * CORBA::Object.  I'll take the easier route for now.
00065      */
00066     static LocalObject_ptr _narrow (CORBA::Object_ptr obj);
00067 
00068 #if (TAO_HAS_MINIMUM_CORBA == 0)
00069 
00070     /// Always returns false.
00071     virtual CORBA::Boolean _non_existent (void);
00072 
00073     /// Get the repository id.
00074     virtual char * _repository_id (void);
00075 
00076 #if ! defined (CORBA_E_COMPACT) && ! defined (CORBA_E_MICRO)
00077     /// Gets info about object from the Interface Repository.
00078     virtual CORBA::InterfaceDef_ptr _get_interface (void);
00079 
00080     /// Throws NO_IMPLEMENT.
00081     virtual CORBA::Object_ptr _get_component (void);
00082 
00083     virtual void _create_request (CORBA::Context_ptr ctx,
00084                                   const char * operation,
00085                                   CORBA::NVList_ptr arg_list,
00086                                   CORBA::NamedValue_ptr result,
00087                                   CORBA::Request_ptr & request,
00088                                   CORBA::Flags req_flags);
00089 
00090     virtual void _create_request (CORBA::Context_ptr ctx,
00091                                   const char * operation,
00092                                   CORBA::NVList_ptr arg_list,
00093                                   CORBA::NamedValue_ptr result,
00094                                   CORBA::ExceptionList_ptr exclist,
00095                                   CORBA::ContextList_ptr ctxtlist,
00096                                   CORBA::Request_ptr & request,
00097                                   CORBA::Flags req_flags);
00098 
00099     /// Throws NO_IMPLEMENT.
00100     virtual CORBA::Request_ptr _request (const char * operation);
00101 
00102 #endif
00103 #endif /* TAO_HAS_MINIMUM_CORBA */
00104 
00105 #if (TAO_HAS_CORBA_MESSAGING == 1)
00106 
00107     /// Throws CORBA::NO_IMPLEMENT.
00108     CORBA::Policy_ptr _get_policy (CORBA::PolicyType type);
00109 
00110     /// Throws CORBA::NO_IMPLEMENT.
00111     CORBA::Policy_ptr _get_cached_policy (TAO_Cached_Policy_Type type);
00112 
00113     /// Throws CORBA::NO_IMPLEMENT.
00114     CORBA::Object_ptr _set_policy_overrides (
00115         const CORBA::PolicyList & policies,
00116         CORBA::SetOverrideType set_add);
00117 
00118     /// Throws CORBA::NO_IMPLEMENT.
00119     CORBA::PolicyList * _get_policy_overrides (
00120         const CORBA::PolicyTypeSeq & types);
00121 
00122     /// Throws CORBA::NO_IMPLEMENT.
00123     CORBA::Boolean _validate_connection (
00124         CORBA::PolicyList_out inconsistent_policies);
00125 
00126 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
00127 
00128     /**
00129      * Return a hash value for this object.  The hash is based on the
00130      * address of the object.  On non-32 bit platforms, the hash may
00131      * be non-unique.
00132      */
00133     virtual CORBA::ULong _hash (CORBA::ULong maximum);
00134 
00135     /**
00136      * Try to determine if this object is the same as @c other_obj.
00137      * This method relies on the representation of the object
00138      * reference's private state.  Since that changes easily (when
00139      * different ORB protocols are in use) there is no default
00140      * implementation.
00141      */
00142     virtual CORBA::Boolean _is_equivalent (CORBA::Object_ptr other_obj);
00143 
00144     virtual CORBA::ORB_ptr _get_orb (void);
00145 
00146     // = TAO extensions
00147 
00148     /// Throws CORBA::NO_IMPLEMENT.
00149     virtual TAO::ObjectKey * _key (void);
00150 
00151     /// Useful for template programming.
00152     typedef LocalObject_ptr _ptr_type;
00153     typedef LocalObject_var _var_type;
00154     typedef LocalObject_out _out_type;
00155 
00156   protected:
00157 
00158     /// Default constructor.
00159     /**
00160      * Make it protected to prevent instantiation of this class.
00161      */
00162     LocalObject (void);
00163 
00164   private:
00165 
00166     /**
00167      * @name Unimplemented methods
00168      */
00169     //@{
00170     LocalObject (const LocalObject &);
00171     LocalObject & operator = (const LocalObject &);
00172     //@}
00173 
00174   };
00175 }   // End CORBA namespace
00176 
00177 #if !defined (ACE_LACKS_DEPRECATED_MACROS)
00178 /**
00179  * @brief This class is there to keep backwards compatibility to the
00180  *        v1.1 C++ mapping
00181  */
00182 class TAO_Export TAO_Local_RefCounted_Object
00183   : public virtual CORBA::LocalObject
00184 {
00185   protected:
00186      // Default constructor.
00187      /**
00188       * Make it protected to prevent instantiation of this class.
00189       */
00190      TAO_Local_RefCounted_Object (void);
00191 
00192    private:
00193 
00194      /**
00195       * @name Unimplemented methods
00196       */
00197      //@{
00198      TAO_Local_RefCounted_Object (const TAO_Local_RefCounted_Object &);
00199      TAO_Local_RefCounted_Object & operator = (
00200          const TAO_Local_RefCounted_Object &);
00201      //@}
00202 };
00203 #endif
00204 
00205 TAO_END_VERSIONED_NAMESPACE_DECL
00206 
00207 #if defined (__ACE_INLINE__)
00208 # include "tao/LocalObject.inl"
00209 #endif /* __ACE_INLINE__ */
00210 
00211 #include /**/ "ace/post.h"
00212 
00213 #endif /* TAO_CORBA_LOCALOBJECT_H */

Generated on Tue Feb 2 17:37:52 2010 for TAO by  doxygen 1.4.7