Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / tests / Framework_Component_DLL.cpp
blobb3ef6c457a62a7bc2a16bd0da6899da5ec1ecafa
2 //=============================================================================
3 /**
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");
32 const ACE_TCHAR *
33 Simple_Service::name ()
35 FRAMEWORK_COMPONENT_DLL_TRACE ("Simple_Service::dll_name");
36 return ACE_TEXT ("Simple_Service");
39 /***************************************************************************/
41 template <int which>
42 class Server_T : public ACE_Service_Object
44 public:
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 ();
52 ACE_DEBUG ((LM_DEBUG,
53 ACE_TEXT ("Server_T::init() dll_name: %s\n"),
54 ss->dll_name ()));
55 return 0;
58 int fini () override
60 FRAMEWORK_COMPONENT_DLL_TRACE ("Server_T::fini");
61 return 0;
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)