00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TAO_EC_DISPATCHING_TASK_H
00017 #define TAO_EC_DISPATCHING_TASK_H
00018
00019 #include "ace/pre.h"
00020
00021 #include "orbsvcs/Event/EC_ProxySupplier.h"
00022
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif
00026
00027 #include "orbsvcs/RtecEventCommC.h"
00028 #include "orbsvcs/Event/event_serv_export.h"
00029 #include "ace/Task.h"
00030 #include "ace/Message_Block.h"
00031 #include "ace/Lock_Adapter_T.h"
00032 #include "ace/Service_Config.h"
00033 #include "ace/Global_Macros.h"
00034
00035 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00036
00037
00038 class TAO_EC_Dispatching_Task;
00039
00040 class TAO_RTEvent_Serv_Export TAO_EC_Queue_Full_Service_Object : public ACE_Service_Object
00041 {
00042 public:
00043 enum QueueFullActionReturnValue
00044 {
00045 WAIT_TO_EMPTY = 0,
00046 SILENTLY_DISCARD = -1
00047 };
00048
00049
00050 virtual int queue_full_action (TAO_EC_Dispatching_Task *task,
00051 TAO_EC_ProxyPushSupplier *proxy,
00052 RtecEventComm::PushConsumer_ptr consumer,
00053 RtecEventComm::EventSet& event
00054 ACE_ENV_ARG_DECL) = 0;
00055 };
00056
00057 class TAO_RTEvent_Serv_Export TAO_EC_Simple_Queue_Full_Action :
00058 public TAO_EC_Queue_Full_Service_Object
00059 {
00060 public:
00061 TAO_EC_Simple_Queue_Full_Action ();
00062
00063
00064
00065 static int init_svcs (void);
00066
00067
00068 virtual int init (int argc, char* argv[]);
00069 virtual int fini (void);
00070
00071 virtual int queue_full_action (TAO_EC_Dispatching_Task *task,
00072 TAO_EC_ProxyPushSupplier *proxy,
00073 RtecEventComm::PushConsumer_ptr consumer,
00074 RtecEventComm::EventSet& event
00075 ACE_ENV_ARG_DECL);
00076
00077 protected:
00078 int queue_full_action_return_value_;
00079 };
00080
00081 class TAO_RTEvent_Serv_Export TAO_EC_Queue : public ACE_Message_Queue<ACE_SYNCH>
00082 {
00083 public:
00084 TAO_EC_Queue (size_t high_water_mark = ACE_Message_Queue_Base::DEFAULT_HWM,
00085 size_t low_water_mark = ACE_Message_Queue_Base::DEFAULT_LWM,
00086 ACE_Notification_Strategy * = 0);
00087
00088 protected:
00089
00090
00091 virtual int is_full_i (void);
00092 };
00093
00094
00095
00096
00097
00098
00099
00100
00101 class TAO_RTEvent_Serv_Export TAO_EC_Dispatching_Task : public ACE_Task<ACE_SYNCH>
00102 {
00103 public:
00104
00105 TAO_EC_Dispatching_Task (ACE_Thread_Manager* thr_manager = 0, TAO_EC_Queue_Full_Service_Object* queue_full_service_object = 0);
00106
00107
00108 virtual int svc (void);
00109
00110 virtual void push (TAO_EC_ProxyPushSupplier *proxy,
00111 RtecEventComm::PushConsumer_ptr consumer,
00112 RtecEventComm::EventSet& event
00113 ACE_ENV_ARG_DECL);
00114
00115 private:
00116
00117 ACE_Allocator *allocator_;
00118
00119
00120 ACE_Locked_Data_Block<ACE_Lock_Adapter<TAO_SYNCH_MUTEX> > data_block_;
00121
00122
00123 TAO_EC_Queue the_queue_;
00124
00125 TAO_EC_Queue_Full_Service_Object* queue_full_service_object_;
00126 };
00127
00128
00129
00130 class TAO_RTEvent_Serv_Export TAO_EC_Dispatch_Command : public ACE_Message_Block
00131 {
00132 public:
00133
00134 TAO_EC_Dispatch_Command (ACE_Allocator *mb_allocator = 0);
00135
00136
00137 TAO_EC_Dispatch_Command (ACE_Data_Block*,
00138 ACE_Allocator *mb_allocator = 0);
00139
00140
00141 virtual ~TAO_EC_Dispatch_Command (void);
00142
00143
00144 virtual int execute (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) = 0;
00145 };
00146
00147
00148
00149 class TAO_RTEvent_Serv_Export TAO_EC_Shutdown_Task_Command : public TAO_EC_Dispatch_Command
00150 {
00151 public:
00152
00153 TAO_EC_Shutdown_Task_Command (ACE_Allocator *mb_allocator = 0);
00154
00155
00156 virtual int execute (ACE_ENV_SINGLE_ARG_DECL_NOT_USED);
00157 };
00158
00159
00160
00161 class TAO_RTEvent_Serv_Export TAO_EC_Push_Command : public TAO_EC_Dispatch_Command
00162 {
00163 public:
00164
00165 TAO_EC_Push_Command (TAO_EC_ProxyPushSupplier* proxy,
00166 RtecEventComm::PushConsumer_ptr consumer,
00167 RtecEventComm::EventSet& event,
00168 ACE_Data_Block* data_block,
00169 ACE_Allocator *mb_allocator);
00170
00171
00172 virtual ~TAO_EC_Push_Command (void);
00173
00174
00175 virtual int execute (ACE_ENV_SINGLE_ARG_DECL_NOT_USED);
00176
00177 private:
00178
00179 TAO_EC_ProxyPushSupplier* proxy_;
00180
00181
00182 RtecEventComm::PushConsumer_var consumer_;
00183
00184
00185 RtecEventComm::EventSet event_;
00186 };
00187
00188 TAO_END_VERSIONED_NAMESPACE_DECL
00189
00190 #if defined (__ACE_INLINE__)
00191 #include "orbsvcs/Event/EC_Dispatching_Task.i"
00192 #endif
00193
00194 ACE_STATIC_SVC_DECLARE (TAO_EC_Simple_Queue_Full_Action)
00195 ACE_FACTORY_DECLARE (TAO_RTEvent_Serv, TAO_EC_Simple_Queue_Full_Action)
00196
00197 #include "ace/post.h"
00198
00199 #endif