2 //=============================================================================
4 * @file Framework_Component_DLL.cpp
6 * This is a simple server that can be loaded via the ACE
7 * Service Configuration framework and uses the singleton that
8 * also lives in this library.
10 * @author Don Hinton <dhinton@ieee.org>
12 //=============================================================================
15 #include "Framework_Component_DLL.h"
16 #include "ace/Service_Config.h"
17 #include "ace/Service_Object.h"
18 #include "ace/Framework_Component_T.h"
20 ACE_DLL_UNLOAD_POLICY (Framework_Component_DLL
, ACE_DLL_UNLOAD_POLICY_LAZY
)
22 Simple_Service::Simple_Service ()
24 FRAMEWORK_COMPONENT_DLL_TRACE ("Simple_Service::Simple_Service");
27 Simple_Service::~Simple_Service ()
29 FRAMEWORK_COMPONENT_DLL_TRACE ("Simple_Service::~Simple_Service");
33 Simple_Service::name ()
35 FRAMEWORK_COMPONENT_DLL_TRACE ("Simple_Service::dll_name");
36 return ACE_TEXT ("Simple_Service");
39 /***************************************************************************/
42 class Server_T
: public ACE_Service_Object
45 int init (int, ACE_TCHAR
*[]) override
47 FRAMEWORK_COMPONENT_DLL_TRACE ("Server_T::init");
49 // Initialize the singleton
50 FWCT_DLL_Singleton_Adapter_T
<Simple_Service
> *ss
= SS_SINGLETON::instance ();
53 ACE_TEXT ("Server_T::init() dll_name: %s\n"),
60 FRAMEWORK_COMPONENT_DLL_TRACE ("Server_T::fini");
65 using Server_1
= Server_T
<1>;
66 FRAMEWORK_COMPONENT_DLL_SINGLETON_DECLARATION(Server_T
<1>;)
67 ACE_FACTORY_DEFINE (Framework_Component_DLL
, Server_1
)
69 using Server_2
= Server_T
<2>;
70 FRAMEWORK_COMPONENT_DLL_SINGLETON_DECLARATION(Server_T
<2>;)
71 ACE_FACTORY_DEFINE (Framework_Component_DLL
, Server_2
)