version 1.1, 2002/03/14 13:27:31
|
version 1.2, 2002/03/14 23:28:56
|
|
|
class ModuleController; | class ModuleController; |
| |
| |
class PEGASUS_COMMON_LINKAGE service_module |
class PEGASUS_COMMON_LINKAGE pegasus_module |
{ | { |
public: | public: |
| |
service_module() |
pegasus_module() |
{ | { |
} | } |
| |
virtual ~service_module() |
virtual ~pegasus_module() |
{ | { |
} | } |
| |
|
|
| |
String & get_name(void); | String & get_name(void); |
| |
|
// introspection interface |
|
virtual Boolean query_interface(String & class_id, |
|
void **object_ptr) = 0; |
|
virtual Uint32 reference(void) { _reference_count++; } |
|
virtual Uint32 dereference(void) { _reference_count--; } |
| |
private: | private: |
|
|
virtual Boolean _rcv_msg(Message *) = 0; | virtual Boolean _rcv_msg(Message *) = 0; |
virtual void _send_async_callback(Uint32 msg_handle, Message *msg) = 0; | virtual void _send_async_callback(Uint32 msg_handle, Message *msg) = 0; |
| |
virtual Boolean _shutdown(Uint32) = 0; | virtual Boolean _shutdown(Uint32) = 0; |
ModuleController *_controller; | ModuleController *_controller; |
|
|
String _name; | String _name; |
|
AtomicInt _reference_count; |
| |
friend class ModuleController; | friend class ModuleController; |
} |
}; |
| |
| |
class PEGASUS_COMMON_LINKAGE ModuleController : public MessageQueueService | class PEGASUS_COMMON_LINKAGE ModuleController : public MessageQueueService |
|
|
| |
| |
// module api | // module api |
ModuleController & register_module(service_module *); |
ModuleController & register_module(pegasus_module *); |
deregister_module(service_module *); |
deregister_module(pegasus_module *); |
|
|
|
Uint32 find_service(pegasus_module & handle, String & name); |
|
String & find_service(pegasus_module & handle, Uint32 queue_id); |
| |
Uint32 find_service(service_module & handle, String & name); |
pegasus_module & get_module_reference(pegasus_module & handle, String & name); |
String & find_service(service_module & handle, Uint32 queue_id); |
|
| |
Message *ModuleSendWait(service_module & handle, |
|
Uint32 destination, |
// send a message to another service |
|
Message *ModuleSendWait(pegasus_module & handle, |
|
Uint32 destination_q, |
Message *message); | Message *message); |
| |
Message *ModuleSendWait(service_module & handle, |
// send a message to another module via another service |
String & destination, |
Message *ModuleSendWait(pegasus_module & handle, |
|
Uint32 destination_q, |
|
String & destination_module, |
Message *message); | Message *message); |
| |
Boolean ModuleSendAsync(service_module & handle, |
// send a message to another service |
|
Boolean ModuleSendAsync(pegasus_module & handle, |
Uint32 msg_handle, | Uint32 msg_handle, |
Uint32 destination, |
Uint32 destination_q, |
Message *message); | Message *message); |
| |
Boolean ModuleSendAsync(service_module & handle, |
// send a message to another module via another service |
|
Boolean ModuleSendAsync(pegasus_module & handle, |
Uint32 msg_handle, | Uint32 msg_handle, |
String & destination, |
Uint32 destination_q, |
|
String & destination_module, |
Message *message); | Message *message); |
| |
Uint32 blocking_thread_exec(service_module & handle, |
Uint32 blocking_thread_exec(pegasus_module & handle, |
PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *thread_func)(void *)); |
PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *thread_func)(void *), |
Uint32 async_thread_exec(service_module & handle, |
void *parm); |
PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *thread_func)(void *)); |
Uint32 async_thread_exec(pegasus_module & handle, |
|
PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *thread_func)(void *), |
|
void *parm); |
|
|
|
// << Thu Mar 14 09:52:56 2002 mdd >> |
|
// need to add a blocking semaphore to ThreadPool for "joinable" threads |
|
// need to define a special message type for sending messages to modules |
|
// |
| |
protected: | protected: |
| |
|
|
|
|
|
|
private: | private: |
| |
|
DQueue<pegasus_module> _modules; |
|
|
|
|
|
|
DQueue<service_module> _modules; |
|
ThreadPool _thread_pool; | ThreadPool _thread_pool; |
|
}; |
| |
| |
} |
|
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |
| |