CEC_Dispatching_Task.h

Go to the documentation of this file.
00001 // $Id: CEC_Dispatching_Task.h 76589 2007-01-25 18:04:11Z elliott_c $
00002 // -*- C++ -*-
00003 
00004 //=============================================================================
00005 /**
00006  *  @file   CEC_Dispatching_Task.h
00007  *
00008  *  $Id: CEC_Dispatching_Task.h 76589 2007-01-25 18:04:11Z elliott_c $
00009  *
00010  *  @author Carlos O'Ryan (coryan@cs.wustl.edu)
00011  */
00012 //=============================================================================
00013 
00014 
00015 #ifndef TAO_CEC_DISPATCHING_TASK_H
00016 #define TAO_CEC_DISPATCHING_TASK_H
00017 
00018 #include /**/ "ace/pre.h"
00019 
00020 #include "orbsvcs/CosEvent/event_serv_export.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 #include "orbsvcs/CosEvent/CEC_ProxyPushSupplier.h"
00027 
00028 #include "tao/Basic_Types.h"
00029 
00030 #include "ace/Message_Block.h"
00031 #include "ace/Lock_Adapter_T.h"
00032 #include "ace/Task.h"
00033 
00034 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00035 #include "orbsvcs/CosEvent/CEC_TypedEvent.h"
00036 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00037 
00038 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00039 
00040 /**
00041  * @class TAO_CEC_Dispatching_Task
00042  *
00043  * @brief Implement the dispatching queues for FIFO and Priority
00044  * dispatching.
00045  *
00046  */
00047 class TAO_Event_Serv_Export TAO_CEC_Dispatching_Task : public ACE_Task<ACE_SYNCH>
00048 {
00049 public:
00050   /// Constructor
00051   TAO_CEC_Dispatching_Task (ACE_Thread_Manager* thr_manager = 0);
00052 
00053   /// Process the events in the queue.
00054   virtual int svc (void);
00055 
00056   virtual void push (TAO_CEC_ProxyPushSupplier *proxy,
00057                      CORBA::Any& event);
00058 
00059 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00060   virtual void invoke (TAO_CEC_ProxyPushSupplier *proxy,
00061                        TAO_CEC_TypedEvent& typed_event);
00062 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00063 
00064 private:
00065   /// An per-task allocator
00066   ACE_Allocator *allocator_;
00067 
00068   /// Helper data structure to minimize memory allocations...
00069   ACE_Locked_Data_Block<ACE_Lock_Adapter<TAO_SYNCH_MUTEX> > data_block_;
00070 };
00071 
00072 // ****************************************************************
00073 
00074 class TAO_Event_Serv_Export TAO_CEC_Dispatch_Command : public ACE_Message_Block
00075 {
00076 public:
00077   /// Constructor, it will allocate its own data block
00078   TAO_CEC_Dispatch_Command (ACE_Allocator *mb_allocator = 0);
00079 
00080   /// Constructor, it assumes ownership of the data block
00081   TAO_CEC_Dispatch_Command (ACE_Data_Block*,
00082                            ACE_Allocator *mb_allocator = 0);
00083 
00084   /// Destructor
00085   virtual ~TAO_CEC_Dispatch_Command (void);
00086 
00087   /// Command callback
00088   virtual int execute (void) = 0;
00089 };
00090 
00091 // ****************************************************************
00092 
00093 class TAO_Event_Serv_Export TAO_CEC_Shutdown_Task_Command : public TAO_CEC_Dispatch_Command
00094 {
00095 public:
00096   /// Constructor
00097   TAO_CEC_Shutdown_Task_Command (ACE_Allocator *mb_allocator = 0);
00098 
00099   /// Command callback
00100   virtual int execute (void);
00101 };
00102 
00103 // ****************************************************************
00104 
00105 class TAO_Event_Serv_Export TAO_CEC_Push_Command : public TAO_CEC_Dispatch_Command
00106 {
00107 public:
00108   /// Constructor
00109   TAO_CEC_Push_Command (TAO_CEC_ProxyPushSupplier* proxy,
00110                         CORBA::Any& event,
00111                         ACE_Data_Block* data_block,
00112                         ACE_Allocator *mb_allocator);
00113 
00114   /// Destructor
00115   virtual ~TAO_CEC_Push_Command (void);
00116 
00117   /// Command callback
00118   virtual int execute (void);
00119 
00120 private:
00121   /// The proxy
00122   TAO_CEC_ProxyPushSupplier* proxy_;
00123 
00124   /// The event
00125   CORBA::Any event_;
00126 };
00127 
00128 // ****************************************************************
00129 
00130 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00131 class TAO_Event_Serv_Export TAO_CEC_Invoke_Command : public TAO_CEC_Dispatch_Command
00132 {
00133 public:
00134   /// Constructor
00135   TAO_CEC_Invoke_Command (TAO_CEC_ProxyPushSupplier* proxy,
00136                           TAO_CEC_TypedEvent& typed_event,
00137                           ACE_Data_Block* data_block,
00138                           ACE_Allocator *mb_allocator);
00139 
00140   /// Destructor
00141   virtual ~TAO_CEC_Invoke_Command (void);
00142 
00143   /// Command callback
00144   virtual int execute (void);
00145 
00146 private:
00147   /// The proxy
00148   TAO_CEC_ProxyPushSupplier* proxy_;
00149 
00150   /// The event
00151   TAO_CEC_TypedEvent typed_event_;
00152 };
00153 #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */
00154 
00155 TAO_END_VERSIONED_NAMESPACE_DECL
00156 
00157 #if defined (__ACE_INLINE__)
00158 #include "orbsvcs/CosEvent/CEC_Dispatching_Task.inl"
00159 #endif /* __ACE_INLINE__ */
00160 
00161 #include /**/ "ace/post.h"
00162 
00163 #endif  /* TAO_CEC_DISPATCHING_TASK_H */

Generated on Tue Feb 2 17:44:50 2010 for TAO_CosEvent by  doxygen 1.4.7