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 //=============================================================================
14 #include "Framework_Component_DLL.h"
15 #include "ace/Service_Config.h"
16 #include "ace/Service_Object.h"
17 #include "ace/Framework_Component_T.h"
19 ACE_DLL_UNLOAD_POLICY (Framework_Component_DLL
, ACE_DLL_UNLOAD_POLICY_LAZY
)
21 Simple_Service::Simple_Service ()
23 FRAMEWORK_COMPONENT_DLL_TRACE ("Simple_Service::Simple_Service");
26 Simple_Service::~Simple_Service ()
28 FRAMEWORK_COMPONENT_DLL_TRACE ("Simple_Service::~Simple_Service");
32 Simple_Service::name ()
34 FRAMEWORK_COMPONENT_DLL_TRACE ("Simple_Service::dll_name");
35 return ACE_TEXT ("Simple_Service");
38 /***************************************************************************/
41 class Server_T
: public ACE_Service_Object
44 int init (int, ACE_TCHAR
*[]) override
46 FRAMEWORK_COMPONENT_DLL_TRACE ("Server_T::init");
48 // Initialize the singleton
49 FWCT_DLL_Singleton_Adapter_T
<Simple_Service
> *ss
= SS_SINGLETON::instance ();
52 ACE_TEXT ("Server_T::init() dll_name: %s\n"),
59 FRAMEWORK_COMPONENT_DLL_TRACE ("Server_T::fini");
64 using Server_1
= Server_T
<1>;
65 FRAMEWORK_COMPONENT_DLL_SINGLETON_DECLARATION(Server_T
<1>;)
66 ACE_FACTORY_DEFINE (Framework_Component_DLL
, Server_1
)
68 using Server_2
= Server_T
<2>;
69 FRAMEWORK_COMPONENT_DLL_SINGLETON_DECLARATION(Server_T
<2>;)
70 ACE_FACTORY_DEFINE (Framework_Component_DLL
, Server_2
)