(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.52 and 1.57

version 1.52, 2008/08/14 17:44:27 version 1.57, 2008/12/01 17:49:53
Line 1 
Line 1 
 //%2006////////////////////////////////////////////////////////////////////////  //%LICENSE////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development  // Licensed to The Open Group (TOG) under one or more contributor license
 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.  // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;  // this work for additional information regarding copyright ownership.
 // IBM Corp.; EMC Corporation, The Open Group.  // Each contributor licenses this file to you under the OpenPegasus Open
 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;  // Source License; you may not use this file except in compliance with the
 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.  // License.
 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;  
 // EMC Corporation; VERITAS Software Corporation; The Open Group.  
 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;  
 // EMC Corporation; Symantec Corporation; The Open Group.  
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy  // Permission is hereby granted, free of charge, to any person obtaining a
 // of this software and associated documentation files (the "Software"), to  // copy of this software and associated documentation files (the "Software"),
 // deal in the Software without restriction, including without limitation the  // to deal in the Software without restriction, including without limitation
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 // sell copies of the Software, and to permit persons to whom the Software is  // and/or sell copies of the Software, and to permit persons to whom the
 // furnished to do so, subject to the following conditions:  // Software is furnished to do so, subject to the following conditions:
 // //
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  // The above copyright notice and this permission notice shall be included
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  // in all copies or substantial portions of the Software.
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  
 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
 // //
 //==============================================================================  // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
   // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
   // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
   // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   //
   //////////////////////////////////////////////////////////////////////////
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 51 
Line 49 
     RegisteredModuleHandle(     RegisteredModuleHandle(
         const String& name,         const String& name,
         void* module_address,         void* module_address,
         Message* (*receive_message)(Message *, void *),          Message* (*receive_message)(Message *, void *));
         void (*async_callback)(Uint32, Message *, void *));  
  
     virtual ~RegisteredModuleHandle();     virtual ~RegisteredModuleHandle();
  
Line 65 
Line 62 
     RegisteredModuleHandle& operator=(const RegisteredModuleHandle&);     RegisteredModuleHandle& operator=(const RegisteredModuleHandle&);
  
     Message* _receive_message(Message* msg);     Message* _receive_message(Message* msg);
     void _send_async_callback(Uint32 msg_handle, Message* msg, void* parm);  
   
     String _name;     String _name;
     void* _module_address;     void* _module_address;
     Message* (*_module_receive_message)(Message *, void *);     Message* (*_module_receive_message)(Message *, void *);
     void (*_async_callback)(Uint32, Message *, void *);  
  
     friend class ModuleController;     friend class ModuleController;
 }; };
Line 80 
Line 74 
 { {
 public: public:
     typedef MessageQueueService Base;     typedef MessageQueueService Base;
   
     class callback_handle  
     {  
     public:  
         callback_handle(RegisteredModuleHandle* module, void* parm)  
            : _module(module), _parm(parm)  
         {  
         }  
   
         ~callback_handle()  
         {  
             if (_module->get_name() == String(PEGASUS_MODULENAME_TEMP))  
                 _module.reset();  
         }  
   
         AutoPtr<RegisteredModuleHandle> _module;  
         void* _parm;  
     };  
   
 public:  
     ModuleController(const char *name);     ModuleController(const char *name);
  
     ~ModuleController();     ~ModuleController();
  
     // module api      void register_module(
     // @exception AlreadyExistsException  
     // @exception IncompatibleTypesException  
     static ModuleController& register_module(  
         const String & controller_name,  
         const String& module_name,         const String& module_name,
         void* module_address,         void* module_address,
         Message* (*receive_message)(Message *, void *),          Message* (*receive_message)(Message *, void *));
         void (*async_callback)(Uint32, Message *, void *),  
         RegisteredModuleHandle** instance = 0);  
   
     // @exception Permission  
     Boolean deregister_module(const String& module_name);  
   
     // @exception Permission  
     Uint32 find_service(  
         const RegisteredModuleHandle& handle,  
         const String& name);  
   
     // @exception Permission  
     // @exception IPCException  
     Uint32 find_module_in_service(  
         const RegisteredModuleHandle& handle,  
         const String& module_name);  
   
     // send a message to another service  
     // @exception Permission  
     // @exception IPCException  
     AsyncReply* ModuleSendWait(  
         const RegisteredModuleHandle& handle,  
         Uint32 destination_q,  
         AsyncRequest* request);  
   
     // send a message to another module via another service  
     // @exception Permission  
     // @exception Deadlock  
     // @exception IPCException  
     AsyncReply* ModuleSendWait(  
         const RegisteredModuleHandle& handle,  
         Uint32 destination_q,  
         const String& destination_module,  
         AsyncRequest* message);  
   
     // send an async message to another service  
     // @exception Permission  
     // @exception Deadlock  
     // @exception IPCException  
     Boolean ModuleSendAsync(  
         const RegisteredModuleHandle& handle,  
         Uint32 msg_handle,  
         Uint32 destination_q,  
         AsyncRequest* message,  
         void* callback_parm);  
   
     // send an async message to another module via another service  
     // @exception Permission  
     // @exception IPCException  
     Boolean ModuleSendAsync(  
         const RegisteredModuleHandle& handle,  
         Uint32 msg_handle,  
         Uint32 destination_q,  
         const String& destination_module,  
         AsyncRequest* message,  
         void* callback_parm);  
   
     // @exception Permission  
     // @exception IPCException  
     Boolean ModuleSendForget(  
         const RegisteredModuleHandle& handle,  
         Uint32 destination_q,  
         AsyncRequest* message);  
   
     // @exception Permission  
     // @exception IPCException  
     Boolean ModuleSendForget(  
         const RegisteredModuleHandle & handle,  
         Uint32 destination_q,  
         const String & destination_module,  
         AsyncRequest* message);  
   
     Boolean verify_handle(RegisteredModuleHandle *);  
  
     static ModuleController* getModuleController();     static ModuleController* getModuleController();
  
     // send a message to another service     // send a message to another service
     // @exception Permission  
     // @exception IPCException  
     AsyncReply* ClientSendWait(     AsyncReply* ClientSendWait(
         Uint32 destination_q,         Uint32 destination_q,
         AsyncRequest* request);         AsyncRequest* request);
  
     // send a message to another module via another service  
     // @exception Permission  
     // @exception Deadlock  
     // @exception IPCException  
     AsyncReply* ClientSendWait(  
         Uint32 destination_q,  
         String& destination_module,  
         AsyncRequest* message);  
   
     // send an async message to another service  
     // @exception Permission  
     // @exception IPCException  
     Boolean ClientSendAsync(  
         Uint32 msg_handle,  
         Uint32 destination_q,  
         AsyncRequest* message,  
         void (*async_callback)(Uint32, Message *, void *),  
         void* callback_parm);  
   
     // send an async message to another module via another service  
     // @exception Permission  
     // @exception IPCException  
     Boolean ClientSendAsync(  
         Uint32 msg_handle,  
         Uint32 destination_q,  
         const String& destination_module,  
         AsyncRequest* message,  
         void (*async_callback)(Uint32, Message *, void *),  
         void* callback_parm);  
   
     // @exception Permission  
     // @exception IPCException  
     Boolean ClientSendForget(  
         Uint32 destination_q,  
         AsyncRequest* message);  
   
     // @exception Permission  
     // @exception IPCException  
     Boolean ClientSendForget(     Boolean ClientSendForget(
         Uint32 destination_q,         Uint32 destination_q,
         const String& destination_module,  
         AsyncRequest* message);         AsyncRequest* message);
  
 protected: protected:
Line 246 
Line 102 
     virtual void _handle_async_callback(AsyncOpNode *op);     virtual void _handle_async_callback(AsyncOpNode *op);
  
 private: private:
     class _module_lock      typedef List<RegisteredModuleHandle, Mutex> RegisteredModulesList;
     {      RegisteredModulesList _modules;
     public:  
         _module_lock(List<RegisteredModuleHandle, Mutex> * list)  
            :_list(list)  
         {  
            _list->lock();  
         }  
   
         ~_module_lock()  
         {  
            _list->unlock();  
         }  
   
     private:  
         _module_lock();  
         List<RegisteredModuleHandle, Mutex> * _list;  
     };  
   
   
     static void _async_handleEnqueue(  
         AsyncOpNode* h,  
         MessageQueue* q,  
         void* parm);  
   
     List<RegisteredModuleHandle, Mutex> _modules;  
     AsyncReply *_send_wait(Uint32, AsyncRequest *);  
     AsyncReply *_send_wait(Uint32, const String &, AsyncRequest *);  
   
     // @exception IPCException  
     Boolean _send_forget(Uint32, AsyncRequest *);  
   
     // @exception IPCException  
     Boolean _send_forget(Uint32, const String &, AsyncRequest *);  
 }; };
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END


Legend:
Removed from v.1.52  
changed lines
  Added in v.1.57

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2