1 #include "Command_Builder.h"
2 #include "ace/Arg_Shifter.h"
3 #include "ace/Get_Opt.h"
5 #include "Command_Factory.h"
9 TAO_Notify_Tests_Command_Builder::TAO_Notify_Tests_Command_Builder ()
15 TAO_Notify_Tests_Command_Builder::~TAO_Notify_Tests_Command_Builder ()
20 TAO_Notify_Tests_Command_Builder::init (int argc
, ACE_TCHAR
*argv
[])
22 ACE_Arg_Shifter
arg_shifter (argc
, argv
);
24 ACE_CString current_arg
;
25 TAO_Notify_Tests_Command_Factory
* factory
= 0;
27 if (arg_shifter
.is_anything_left ())
29 current_arg
= ACE_TEXT_ALWAYS_CHAR(arg_shifter
.get_current ());
31 arg_shifter
.consume_arg ();
34 if (this->factory_map_
.find (current_arg
, factory
) == -1)
35 ACE_DEBUG ((LM_DEBUG
, "NS Command: %s not recognized!\n", current_arg
.c_str ()));
38 TAO_Notify_Tests_Command
* new_command
= factory
->create ();
40 new_command
->init (arg_shifter
);
42 if (this->start_command_
== 0)
44 this->start_command_
= new_command
;
45 this->last_command_
= new_command
;
50 this->last_command_
->next (new_command
);
51 this->last_command_
= new_command
;
60 TAO_Notify_Tests_Command_Builder::fini ()
66 TAO_Notify_Tests_Command_Builder::_register (ACE_CString command_factory_name
, TAO_Notify_Tests_Command_Factory
* command_factory
)
68 if (this->factory_map_
.bind (command_factory_name
, command_factory
) == -1)
69 ACE_DEBUG ((LM_DEBUG
, "Failed to register command factory for %s\n", command_factory_name
.c_str ()));
71 ACE_DEBUG ((LM_DEBUG
, "Registered command factory for %s\n", command_factory_name
.c_str ()));
75 TAO_Notify_Tests_Command_Builder::execute ()
77 if (this->start_command_
)
78 this->start_command_
->execute ();
81 ACE_STATIC_SVC_DEFINE(TAO_Notify_Tests_Command_Builder
,
82 TAO_Notify_Tests_Name::command_builder
,
84 &ACE_SVC_NAME (TAO_Notify_Tests_Command_Builder
),
85 ACE_Service_Type::DELETE_THIS
| ACE_Service_Type::DELETE_OBJ
,
88 ACE_FACTORY_DEFINE (TAO_NOTIFY_TEST
, TAO_Notify_Tests_Command_Builder
)
90 ACE_STATIC_SVC_REQUIRE (TAO_Notify_Tests_Command_Builder
)