(file) Return to ModuleController.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/ModuleController.h between version 1.6 and 1.7

version 1.6, 2002/03/21 22:53:10 version 1.7, 2002/03/22 19:51:37
Line 42 
Line 42 
  
 class ModuleController; class ModuleController;
  
   
   
 class PEGASUS_COMMON_LINKAGE pegasus_module  
 {  
       class PEGASUS_COMMON_LINKAGE module_rep       class PEGASUS_COMMON_LINKAGE module_rep
       {       {
          public:          public:
             module_rep(ModuleController *controller,             module_rep(ModuleController *controller,
                        const String & name,                        const String & name,
                        void *module_address,                        void *module_address,
                        Boolean (*receive_message)(Message *),                         Message * (*receive_message)(Message *),
                        void (*async_callback)(Uint32, Message *),                        void (*async_callback)(Uint32, Message *),
                        void (*shutdown_notify)(Uint32 code))                        void (*shutdown_notify)(Uint32 code))
                : _thread_safety(),                : _thread_safety(),
Line 77 
Line 73 
                   _shutdown_notify = default_shutdown_notify;                   _shutdown_notify = default_shutdown_notify;
             }             }
  
             virtual ~module_rep(void)              ~module_rep(void)
             {             {
  
             }             }
Line 108 
Line 104 
             Uint32 reference_count(void)  { return _reference_count.value(); }             Uint32 reference_count(void)  { return _reference_count.value(); }
             const String & get_name(void) const { return _name; }             const String & get_name(void) const { return _name; }
             void *get_module_address(void) const { return _module_address; }             void *get_module_address(void) const { return _module_address; }
             Boolean module_receive_message(Message *msg)              Message * module_receive_message(Message *msg)
             {             {
                Boolean ret;                 Message * ret;
                _thread_safety.lock(pegasus_thread_self());                _thread_safety.lock(pegasus_thread_self());
                try {  ret = _receive_message(msg); }                try {  ret = _receive_message(msg); }
                catch(...) { _thread_safety.unlock(); throw; }                catch(...) { _thread_safety.unlock(); throw; }
Line 157 
Line 153 
             Uint32 _shutting_down;             Uint32 _shutting_down;
  
             void *_module_address;             void *_module_address;
             Boolean (*_receive_message)(Message *);              Message * (*_receive_message)(Message *);
             void (*_async_callback)(Uint32, Message *);             void (*_async_callback)(Uint32, Message *);
             void (*_shutdown_notify)(Uint32 code);             void (*_shutdown_notify)(Uint32 code);
  
             static Boolean default_receive_message(Message *msg)              static Message * default_receive_message(Message *msg)
             {             {
                throw NotImplemented("Module Receive");                throw NotImplemented("Module Receive");
             }             }
Line 179 
Line 175 
             friend class ModuleController;             friend class ModuleController;
       };       };
  
   
   class PEGASUS_COMMON_LINKAGE pegasus_module
   {
   
    public:    public:
  
       pegasus_module(ModuleController *controller,       pegasus_module(ModuleController *controller,
                      const String &id,                      const String &id,
                      void *module_address,                      void *module_address,
                      Boolean (*receive_message)(Message *),                       Message * (*receive_message)(Message *),
                      void (*async_callback)(Uint32, Message *),                      void (*async_callback)(Uint32, Message *),
                      void (*shutdown_notify)(Uint32 code)) ;                      void (*shutdown_notify)(Uint32 code)) ;
  
Line 209 
Line 209 
    private:    private:
  
       module_rep *_rep;       module_rep *_rep;
   
       pegasus_module(void);       pegasus_module(void);
       pegasus_module(const pegasus_module & mod);       pegasus_module(const pegasus_module & mod);
       Boolean _rcv_msg(Message *) ;       Boolean _rcv_msg(Message *) ;
       Boolean _receive_message(Message *msg)        Message * _receive_message(Message *msg)
       {       {
          return _rep->module_receive_message(msg);          return _rep->module_receive_message(msg);
       }       }
Line 236 
Line 235 
 }; };
  
  
   
   
 class PEGASUS_COMMON_LINKAGE ModuleController : public MessageQueueService class PEGASUS_COMMON_LINKAGE ModuleController : public MessageQueueService
 { {
  
Line 253 
Line 250 
                        struct timeval & deadlock);                        struct timeval & deadlock);
  
  
       virtual ~ModuleController(void);        ~ModuleController(void);
  
       // module api       // module api
       ModuleController & register_module(const String & module_name,       ModuleController & register_module(const String & module_name,
                                          void *module_address,                                          void *module_address,
                                          Boolean (*receive_message)(Message *),                                           Message * (*receive_message)(Message *),
                                          void (*async_callback)(Uint32, Message *),                                          void (*async_callback)(Uint32, Message *),
                                          void (*shutdown_notify)(Uint32)) throw(AlreadyExists);                                          void (*shutdown_notify)(Uint32)) throw(AlreadyExists);
  
       Boolean deregister_module(const String & module_name);       Boolean deregister_module(const String & module_name);
  
       Uint32 find_service(pegasus_module & handle, String & name);        Uint32 find_service(pegasus_module & handle, const String & name) throw(Permission);
       String & find_service(pegasus_module & handle, Uint32 queue_id);  
         Uint32 find_module_in_service(pegasus_module & handle,
                                       const String & module_name)
            throw(Permission, IPCException);
  
       pegasus_module & get_module_reference(pegasus_module & handle, String & name);  
         pegasus_module * get_module_reference(pegasus_module & my_handle,
                                               const String & module_name)
            throw(Permission);
  
       // send a message to another service       // send a message to another service
       Message *ModuleSendWait(pegasus_module & handle,        AsyncReply *ModuleSendWait(pegasus_module & handle,
                               Uint32 destination_q,                               Uint32 destination_q,
                               Message *message);                                AsyncRequest *request) throw(Permission, IPCException);
  
       // send a message to another module via another service       // send a message to another module via another service
       Message *ModuleSendWait(pegasus_module & handle,        AsyncReply *ModuleSendWait(pegasus_module & handle,
                               Uint32 destination_q,                               Uint32 destination_q,
                               String & destination_module,                               String & destination_module,
                               Message *message);                                AsyncRequest *message) throw(Permission, Deadlock, IPCException);
  
       // send a message to another service       // send a message to another service
       Boolean ModuleSendAsync(pegasus_module & handle,       Boolean ModuleSendAsync(pegasus_module & handle,
                               Uint32 msg_handle,                               Uint32 msg_handle,
                               Uint32 destination_q,                               Uint32 destination_q,
                               Message *message);                                AsyncMessage *message) throw(Permission, IPCException);
  
       // send a message to another module via another service       // send a message to another module via another service
       Boolean ModuleSendAsync(pegasus_module & handle,       Boolean ModuleSendAsync(pegasus_module & handle,
                               Uint32 msg_handle,                               Uint32 msg_handle,
                               Uint32 destination_q,                               Uint32 destination_q,
                               String & destination_module,                               String & destination_module,
                               Message *message);                                AsyncMessage *message) throw(Permission, IPCException);
  
       Uint32 blocking_thread_exec(pegasus_module & handle,        void blocking_thread_exec(pegasus_module & handle,
                                   PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *thread_func)(void *),                                   PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *thread_func)(void *),
                                   void *parm);                                  void *parm) throw(Permission, Deadlock, IPCException);
       Uint32 async_thread_exec(pegasus_module & handle,        void async_thread_exec(pegasus_module & handle,
                                PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *thread_func)(void *),                                PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *thread_func)(void *),
                                void *parm);                               void *parm) throw(Permission, Deadlock, IPCException);
         Boolean verify_handle(pegasus_module *);
    protected:    protected:
  
    private:    private:
  
   
         static void _async_handleEnqueue(AsyncOpNode *h, MessageQueue *q, void *parm);
   
       DQueue<pegasus_module> _modules;       DQueue<pegasus_module> _modules;
       ThreadPool _thread_pool;       ThreadPool _thread_pool;
 }; };


Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2