00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CSD_TP_Custom_Request_Operation.h 00006 * 00007 * $Id: CSD_TP_Custom_Request_Operation.h 80158 2007-12-02 16:12:30Z sowayaa $ 00008 * 00009 * @author Tim Bradley <bradley_t@ociweb.com> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_CSD_TP_CUSTOM_REQUEST_OPERATION_H 00014 #define TAO_CSD_TP_CUSTOM_REQUEST_OPERATION_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/CSD_ThreadPool/CSD_TP_Export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/Intrusive_Ref_Count_Base_T.h" 00025 #include "tao/Intrusive_Ref_Count_Handle_T.h" 00026 #include "tao/PortableServer/Servant_Base.h" 00027 #include "ace/Synch.h" 00028 00029 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00030 00031 namespace TAO 00032 { 00033 namespace CSD 00034 { 00035 00036 class TP_Custom_Request_Operation; 00037 typedef TAO_Intrusive_Ref_Count_Handle<TP_Custom_Request_Operation> 00038 TP_Custom_Request_Operation_Handle; 00039 00040 00041 /** 00042 * @class TP_Custom_Request_Operation 00043 * 00044 * @brief Base class for all custom request operations. 00045 * 00046 * @note The caller that creates a new TP_Custom_Request_Operation 00047 * object needs call _add_ref () on the servant before 00048 * constructing it and the TP_Custom_Request_Operation object 00049 * is responsible to decrement the reference count. 00050 * 00051 * TBD - Add description 00052 */ 00053 class TAO_CSD_TP_Export TP_Custom_Request_Operation 00054 : public TAO_Intrusive_Ref_Count_Base<TAO_SYNCH_MUTEX> 00055 { 00056 public: 00057 00058 /// Virtual Destructor. 00059 virtual ~TP_Custom_Request_Operation(); 00060 00061 /// Invoked by a worker thread to perform the operation. 00062 void execute(); 00063 00064 /// Invoked when the request has been cancelled. 00065 void cancel(); 00066 00067 /// Used by the TP_Strategy to obtain the target servant in order 00068 /// to construct the custom request object. Returns the servant as 00069 /// an "in" argument (the caller does not get a new 'copy'). This 00070 /// is useful for chaining. 00071 PortableServer::Servant servant(); 00072 00073 00074 protected: 00075 00076 /// Constructor. 00077 TP_Custom_Request_Operation(PortableServer::Servant servant); 00078 00079 virtual void execute_i() = 0; 00080 virtual void cancel_i() = 0; 00081 00082 00083 private: 00084 00085 PortableServer::ServantBase_var servant_; 00086 }; 00087 00088 } 00089 } 00090 00091 TAO_END_VERSIONED_NAMESPACE_DECL 00092 00093 #if defined (__ACE_INLINE__) 00094 # include "tao/CSD_ThreadPool/CSD_TP_Custom_Request_Operation.inl" 00095 #endif /* __ACE_INLINE__ */ 00096 00097 #include /**/ "ace/post.h" 00098 00099 #endif /* TAO_CSD_TP_CUSTOM_REQUEST_OPERATION_H */