diff options
author | venkita <venkita@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-15 03:40:57 +0000 |
---|---|---|
committer | venkita <venkita@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-04-15 03:40:57 +0000 |
commit | d50b4b30d4ce9e094d03d50ffd66981ecc0ada91 (patch) | |
tree | 6c347018d7934fdb6b03e64bbaad8bd758a5ae2b | |
parent | 9059df93e1e7c1da8c8a0bd3d8d00d876678bc96 (diff) | |
download | ATCD-d50b4b30d4ce9e094d03d50ffd66981ecc0ada91.tar.gz |
ChangeLogTag: Mon Apr 14 22:37:34 2003 Venkita Subramonian <venkita@cs.wustl.edu>
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | Kokyu/DSRT_Dispatcher_Impl.cpp | 86 | ||||
-rw-r--r-- | Kokyu/DSRT_Dispatcher_Impl.h | 17 | ||||
-rw-r--r-- | Kokyu/Kokyu.cpp | 11 |
4 files changed, 118 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog index 08417c87312..3053a9fe0f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Mon Apr 14 22:37:34 2003 Venkita Subramonian <venkita@cs.wustl.edu> + + * Kokyu/Kokyu.cpp: + * Kokyu/DSRT_Dispatcher_Impl.cpp: + * Kokyu/DSRT_Dispatcher_Impl.h: + + Made the dispatcher a service object so that the scheduler type + can be passed as a parameter in svc.conf. + Mon Apr 14 15:19:38 2003 Venkita Subramonian <venkita@cs.wustl.edu> * Kokyu/tests/DSRT_MIF: diff --git a/Kokyu/DSRT_Dispatcher_Impl.cpp b/Kokyu/DSRT_Dispatcher_Impl.cpp index eed2ed8d633..352be03c6c0 100644 --- a/Kokyu/DSRT_Dispatcher_Impl.cpp +++ b/Kokyu/DSRT_Dispatcher_Impl.cpp @@ -1,7 +1,9 @@ // $Id$ -#include "DSRT_Dispatcher_Impl.h" #include "ace/Sched_Params.h" +#include "ace/Arg_Shifter.h" + +#include "DSRT_Dispatcher_Impl.h" #if ! defined (__ACE_INLINE__) #include "DSRT_Dispatcher_Impl.i" @@ -9,6 +11,8 @@ ACE_RCSID(Kokyu, Dispatcher_Impl, "$Id$") + //using namespace Kokyu; + namespace Kokyu { @@ -56,6 +60,59 @@ static Priority_t schedule_MIF (Importance_t imp) } int +DSRT_Dispatcher_Impl::init_svcs (void) +{ + return ACE_Service_Config::static_svcs ()-> + insert (&ace_svc_desc_DSRT_Dispatcher_Impl); +} + +int +DSRT_Dispatcher_Impl::init (int argc, ACE_TCHAR* argv[]) +{ + ACE_Arg_Shifter arg_shifter (argc, argv); + + while (arg_shifter.is_anything_left ()) + { + const ACE_TCHAR* arg = arg_shifter.get_current (); + + if (ACE_OS::strcasecmp (arg, ACE_LIB_TEXT("-schedtype")) == 0) + { + arg_shifter.consume_arg (); + + if (arg_shifter.is_parameter_next ()) + { + const ACE_TCHAR* opt = arg_shifter.get_current (); + if (ACE_OS::strcasecmp (opt, ACE_LIB_TEXT("MIF")) == 0) + { + this->sched_type_ = SCHED_MIF; + } + else + { + ACE_ERROR ((LM_ERROR, + ACE_LIB_TEXT("DSRT_Dispatcher_Impl - ") + ACE_LIB_TEXT("unsupported sched type <%s>\n"), + opt)); + } + arg_shifter.consume_arg (); + } + } + + else + { + arg_shifter.ignore_arg (); + } + } + return 0; + +} + +int +DSRT_Dispatcher_Impl::fini (void) +{ + return 0; +} + +int DSRT_Dispatcher_Impl::init_i (const DSRT_ConfigInfo& config_info) { //create and init the dispatcher tasks here @@ -97,7 +154,7 @@ DSRT_Dispatcher_Impl::schedule_i (guid_t guid, const QoSDescriptor& qos_info) { ACE_UNUSED_ARG (guid); - switch (curr_config_info_.scheduler_type_) + switch (this->sched_type_) { case SCHED_MIF: ACE_DEBUG ((LM_DEBUG, "(%t) request for MIF schedule\n")); @@ -125,3 +182,28 @@ DSRT_Dispatcher_Impl::cancel_schedule_i (guid_t guid, } } + +// **************************************************************** + +ACE_STATIC_SVC_DEFINE (DSRT_Dispatcher_Impl, + ACE_TEXT ("DSRT_Dispatcher_Impl"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (DSRT_Dispatcher_Impl), + ACE_Service_Type::DELETE_THIS | + ACE_Service_Type::DELETE_OBJ, + 0) +//ACE_FACTORY_DEFINE (Kokyu, DSRT_Dispatcher_Impl) + +void _gobble_DSRT_Dispatcher_Impl (void *p) { \ + ACE_Service_Object *_p = ACE_static_cast (ACE_Service_Object *, p); + ACE_ASSERT (_p != 0); + delete _p; } +extern "C" Kokyu_Export ACE_Service_Object * +_make_DSRT_Dispatcher_Impl (ACE_Service_Object_Exterminator *gobbler) +{ + if (gobbler != 0) + *gobbler = (ACE_Service_Object_Exterminator) _gobble_DSRT_Dispatcher_Impl; + return new Kokyu::DSRT_Dispatcher_Impl; +} + +// **************************************************************** diff --git a/Kokyu/DSRT_Dispatcher_Impl.h b/Kokyu/DSRT_Dispatcher_Impl.h index 21853c3a661..4000ca83230 100644 --- a/Kokyu/DSRT_Dispatcher_Impl.h +++ b/Kokyu/DSRT_Dispatcher_Impl.h @@ -18,17 +18,26 @@ #include "ace/Task.h" #include "ace/Message_Block.h" #include "ace/Auto_Ptr.h" +#include "ace/Service_Config.h" #include "kokyu_export.h" #include "Kokyu.h" namespace Kokyu { - class DSRT_Dispatcher_Impl + class DSRT_Dispatcher_Impl : public ACE_Service_Object { public: + + static int init_svcs (void); + virtual ~DSRT_Dispatcher_Impl (); // int activate (); + + // = The Service_Object entry points + virtual int init (int argc, ACE_TCHAR* argv[]); + virtual int fini (void); + int init (const DSRT_ConfigInfo&); int schedule (guid_t guid, const QoSDescriptor&); @@ -50,10 +59,16 @@ namespace Kokyu // typedef auto_ptr<DSRT_Dispatcher_Task> DSRT_Dispatcher_Task_Auto_Ptr; // DSRT_Dispatcher_Task_Auto_Ptr task_; DSRT_ConfigInfo curr_config_info_; + DSRT_Sched_t sched_type_; }; } //end of namespace +extern ACE_Static_Svc_Descriptor ace_svc_desc_DSRT_Dispatcher_Impl; + +//ACE_STATIC_SVC_DECLARE (DSRT_Dispatcher_Impl) +ACE_FACTORY_DECLARE (Kokyu, DSRT_Dispatcher_Impl) + #if defined (__ACE_INLINE__) #include "DSRT_Dispatcher_Impl.i" #endif /* __ACE_INLINE__ */ diff --git a/Kokyu/Kokyu.cpp b/Kokyu/Kokyu.cpp index 9398e3d92cc..90f691671e4 100644 --- a/Kokyu/Kokyu.cpp +++ b/Kokyu/Kokyu.cpp @@ -1,5 +1,6 @@ // $Id$ +#include "ace/Dynamic_Service.h" #include "Kokyu.h" #include "Default_Dispatcher_Impl.h" @@ -71,11 +72,17 @@ Dispatcher_Factory:: create_DSRT_dispatcher (const DSRT_ConfigInfo& config_info) { DSRT_Dispatcher_Impl* tmp; - ACE_NEW_RETURN (tmp, DSRT_Dispatcher_Impl, (DSRT_Dispatcher*)0); + //ACE_NEW_RETURN (tmp, DSRT_Dispatcher_Impl, (DSRT_Dispatcher*)0); + + DSRT_Dispatcher_Impl::init_svcs (); + + tmp = + ACE_Dynamic_Service<DSRT_Dispatcher_Impl>::instance ("DSRT_Dispatcher_Impl"); + DSRT_Dispatcher* disp; ACE_NEW_RETURN (disp, DSRT_Dispatcher, (DSRT_Dispatcher*)0); disp->implementation (tmp); - tmp->init (config_info); + // tmp->init (config_info); return disp; } |