Changes to attempt to silence bcc64x
[ACE_TAO.git] / TAO / orbsvcs / tests / Notify / lib / Command_Builder.cpp
blob1f5f36299837cb3d22181944386b5a9eda9d91d2
1 #include "Command_Builder.h"
2 #include "ace/Arg_Shifter.h"
3 #include "ace/Get_Opt.h"
4 #include "Command.h"
5 #include "Command_Factory.h"
6 #include "Name.h"
9 TAO_Notify_Tests_Command_Builder::TAO_Notify_Tests_Command_Builder ()
10 : start_command_ (0),
11 last_command_ (0)
15 TAO_Notify_Tests_Command_Builder::~TAO_Notify_Tests_Command_Builder ()
19 int
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 ();
33 // obtain the factory
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 ()));
36 else
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;
47 else
49 // linked list
50 this->last_command_->next (new_command);
51 this->last_command_ = new_command;
56 return 0;
59 int
60 TAO_Notify_Tests_Command_Builder::fini ()
62 return 0;
65 void
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 ()));
70 else
71 ACE_DEBUG ((LM_DEBUG, "Registered command factory for %s\n", command_factory_name.c_str ()));
74 void
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,
83 ACE_SVC_OBJ_T,
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)