summaryrefslogtreecommitdiff
path: root/trunk/TAO/orbsvcs/tests/Notify/lib/Command_Factory_T.cpp
blob: 8b3cd92b48f40cee349f59071847db18fb7c47e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// $Id$

#ifndef TAO_Notify_Tests_COMMAND_FACTORY_T_CPP
#define TAO_Notify_Tests_COMMAND_FACTORY_T_CPP

#include "Command_Factory_T.h"

ACE_RCSID(Notify, TAO_Command_Factory_T, "$Id$")

#include "ace/Dynamic_Service.h"
#include "tao/debug.h"
#include "Command_Builder.h"
#include "Name.h"

template <class COMMAND>
TAO_Notify_Tests_Command_Factory_T<COMMAND>::TAO_Notify_Tests_Command_Factory_T (void)
{
  if (TAO_debug_level > 0)
      ACE_DEBUG ((LM_DEBUG, "Creating command factory for %s\n", COMMAND::name()));
}

template <class COMMAND>
TAO_Notify_Tests_Command_Factory_T<COMMAND>::~TAO_Notify_Tests_Command_Factory_T ()
{
}

template <class COMMAND> int
TAO_Notify_Tests_Command_Factory_T<COMMAND>::init (int /*argc*/, char/*argv*/ *[])
{
  /// register with Command builder
  TAO_Notify_Tests_Command_Builder* cmd_builder =
    ACE_Dynamic_Service<TAO_Notify_Tests_Command_Builder>::instance (TAO_Notify_Tests_Name::command_builder);

  if (cmd_builder)
    cmd_builder->_register (COMMAND::name(), this);
  else
    ACE_DEBUG ((LM_DEBUG, "Could not register command builder %s\n", COMMAND::name()));
  return 0;
}

template <class COMMAND> int
TAO_Notify_Tests_Command_Factory_T<COMMAND>::fini (void)
{
  return 0;
}

template <class COMMAND> TAO_Notify_Tests_Command*
TAO_Notify_Tests_Command_Factory_T<COMMAND>::create (void)
{
  return new COMMAND ();
}

#endif /* TAO_Notify_Tests_COMMAND_FACTORY_T_CPP */