Defines the interface for specifying a creation strategy for a SVC_HANDLER based on dynamic linking of the SVC_HANDLER. More...
#include <Strategies_T.h>


Public Types | |
| typedef ACE_Creation_Strategy < SVC_HANDLER > | base_type |
Public Member Functions | |
| ACE_DLL_Strategy (void) | |
| "Do-nothing" constructor. | |
| ACE_DLL_Strategy (const ACE_TCHAR dll_name[], const ACE_TCHAR factory_function[], const ACE_TCHAR svc_name[], ACE_Service_Repository *, ACE_Thread_Manager *=0) | |
| int | open (const ACE_TCHAR dll_name[], const ACE_TCHAR factory_function[], const ACE_TCHAR svc_name[], ACE_Service_Repository *, ACE_Thread_Manager *=0) |
| virtual int | make_svc_handler (SVC_HANDLER *&) |
| void | dump (void) const |
| Dump the state of an object. | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
Protected Types | |
| typedef ACE_Creation_Strategy < SVC_HANDLER > | inherited |
Protected Attributes | |
| ACE_TCHAR | dll_name_ [MAXPATHLEN+1] |
| Name of the DLL to dynamically link. | |
| ACE_TCHAR | factory_function_ [MAXPATHLEN+1] |
| ACE_TCHAR | svc_name_ [MAXNAMELEN+1] |
| Name of the service. | |
| ACE_Service_Repository * | svc_rep_ |
| Pointer to the <Service_Repository>. | |
Defines the interface for specifying a creation strategy for a SVC_HANDLER based on dynamic linking of the SVC_HANDLER.
Definition at line 181 of file Strategies_T.h.
| typedef ACE_Creation_Strategy<SVC_HANDLER> ACE_DLL_Strategy< SVC_HANDLER >::base_type |
Definition at line 186 of file Strategies_T.h.
typedef ACE_Creation_Strategy<SVC_HANDLER> ACE_DLL_Strategy< SVC_HANDLER >::inherited [protected] |
Definition at line 221 of file Strategies_T.h.
| ACE_DLL_Strategy< SVC_HANDLER >::ACE_DLL_Strategy | ( | void | ) |
"Do-nothing" constructor.
Definition at line 60 of file Strategies_T.inl.
{
ACE_TRACE ("ACE_DLL_Strategy<SVC_HANDLER>::ACE_DLL_Strategy");
}
| ACE_DLL_Strategy< SVC_HANDLER >::ACE_DLL_Strategy | ( | const ACE_TCHAR | dll_name[], | |
| const ACE_TCHAR | factory_function[], | |||
| const ACE_TCHAR | svc_name[], | |||
| ACE_Service_Repository * | svc_rep, | |||
| ACE_Thread_Manager * | thr_mgr = 0 | |||
| ) |
Initialize the DLL strategy based upon the service's DLL information contained in the <svc_dll_info> string.
Definition at line 42 of file Strategies_T.inl.
| void ACE_DLL_Strategy< SVC_HANDLER >::dump | ( | void | ) | const |
Dump the state of an object.
Reimplemented from ACE_Creation_Strategy< SVC_HANDLER >.
Definition at line 1237 of file Strategies_T.cpp.
{
#if defined (ACE_HAS_DUMP)
ACE_TRACE ("ACE_DLL_Strategy<SVC_HANDLER>::dump");
#endif /* ACE_HAS_DUMP */
}
| int ACE_DLL_Strategy< SVC_HANDLER >::make_svc_handler | ( | SVC_HANDLER *& | sh | ) | [virtual] |
Create a SVC_HANDLER by dynamically linking it from a DLL. Returns -1 on failure, else 0.
Reimplemented from ACE_Creation_Strategy< SVC_HANDLER >.
Definition at line 115 of file Strategies_T.cpp.
{
ACE_TRACE ("ACE_DLL_Strategy<SVC_HANDLER>::make_svc_handler");
// Open the shared library.
ACE_SHLIB_HANDLE handle = ACE_OS::dlopen (this->dll_name_);
// Extract the factory function.
#if defined (ACE_OPENVMS)
SVC_HANDLER *(*factory)(void) =
(SVC_HANDLER *(*)(void)) ACE::ldsymbol (handle,
this->factory_function_);
#else
SVC_HANDLER *(*factory)(void) =
(SVC_HANDLER *(*)(void)) ACE_OS::dlsym (handle,
this->factory_function_);
#endif
// Call the factory function to obtain the new SVC_Handler (should
// use RTTI here when it becomes available...)
SVC_HANDLER *svc_handler = 0;
ACE_ALLOCATOR_RETURN (svc_handler, (*factory)(), -1);
if (svc_handler != 0)
{
// Create an ACE_Service_Type containing the SVC_Handler and
// insert into this->svc_rep_;
ACE_Service_Type_Impl *stp = 0;
ACE_NEW_RETURN (stp,
ACE_Service_Object_Type (svc_handler,
this->svc_name_),
-1);
ACE_Service_Type *srp = 0;
ACE_NEW_RETURN (srp,
ACE_Service_Type (this->svc_name_,
stp,
handle,
1),
-1);
if (srp == 0)
{
delete stp;
errno = ENOMEM;
return -1;
}
if (this->svc_rep_->insert (srp) == -1)
return -1;
// @@ Somehow, we need to deal with this->thr_mgr_...
}
sh = svc_handler;
return 0;
}
| int ACE_DLL_Strategy< SVC_HANDLER >::open | ( | const ACE_TCHAR | dll_name[], | |
| const ACE_TCHAR | factory_function[], | |||
| const ACE_TCHAR | svc_name[], | |||
| ACE_Service_Repository * | svc_rep, | |||
| ACE_Thread_Manager * | thr_mgr = 0 | |||
| ) |
Initialize the DLL strategy based upon the service's DLL information contained in the <svc_dll_info> string.
Definition at line 97 of file Strategies_T.cpp.
{
ACE_TRACE ("ACE_DLL_Strategy<SVC_HANDLER>::open");
this->inherited::open (thr_mgr);
ACE_OS::strcpy (this->dll_name_, dll_name);
ACE_OS::strcpy (this->factory_function_, factory_function);
ACE_OS::strcpy (this->svc_name_, svc_name);
this->svc_rep_ = svc_rep;
return 0;
}
| ACE_DLL_Strategy< SVC_HANDLER >::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
Reimplemented from ACE_Creation_Strategy< SVC_HANDLER >.
Definition at line 218 of file Strategies_T.h.
ACE_TCHAR ACE_DLL_Strategy< SVC_HANDLER >::dll_name_[MAXPATHLEN+1] [protected] |
Name of the DLL to dynamically link.
Definition at line 224 of file Strategies_T.h.
ACE_TCHAR ACE_DLL_Strategy< SVC_HANDLER >::factory_function_[MAXPATHLEN+1] [protected] |
Name of the factory function in the shared library to use to obtain a pointer to the new SVC_HANDLER.
Definition at line 228 of file Strategies_T.h.
ACE_TCHAR ACE_DLL_Strategy< SVC_HANDLER >::svc_name_[MAXNAMELEN+1] [protected] |
Name of the service.
Definition at line 231 of file Strategies_T.h.
ACE_Service_Repository* ACE_DLL_Strategy< SVC_HANDLER >::svc_rep_ [protected] |
Pointer to the <Service_Repository>.
Definition at line 234 of file Strategies_T.h.
1.7.0