Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / orbsvcs / performance-tests / RTEvent / lib / Client_Options.cpp
blob5c3befa8eed4faf9808f424e2f833aa7f85151ef
1 /**
2 * @file Client_Options.cpp
4 * @author Carlos O'Ryan <coryan@uci.edu>
5 */
7 #include "Client_Options.h"
9 #include "ace/Log_Msg.h"
11 Client_Options::Client_Options (int &argc, ACE_TCHAR *argv[])
12 : ior (ACE_TEXT("file://test.ior"))
13 , iterations (1000)
14 , nthreads (0)
15 , high_priority_period (0)
16 , high_priority_workload (0)
17 , low_priority_period (0)
18 , low_priority_workload (0)
19 , low_priority_consumers (0)
20 , dump_history (0)
21 , use_rt_corba (0)
22 , global_low_priority_rate (0)
23 , unique_low_priority_event (0)
24 , funky_supplier_publication (0)
25 , high_priority_is_last (0)
27 ACE_Arg_Shifter arg_shifter (argc, argv);
29 while (arg_shifter.is_anything_left ())
31 const ACE_TCHAR *arg = arg_shifter.get_current ();
33 if (ACE_OS::strcmp (arg, ACE_TEXT("-k")) == 0)
35 arg_shifter.consume_arg ();
37 if (arg_shifter.is_parameter_next ())
39 this->ior = arg_shifter.get_current ();
40 arg_shifter.consume_arg ();
44 else if (option (arg_shifter, ACE_TEXT("-i"), iterations)) {}
45 else if (option (arg_shifter, ACE_TEXT("-n"), nthreads)) {}
46 else if (option (arg_shifter, ACE_TEXT("-h"), high_priority_period)) {}
47 else if (option (arg_shifter, ACE_TEXT("-l"), low_priority_period)) {}
48 else if (option (arg_shifter, ACE_TEXT("-w"), low_priority_workload)) {}
49 else if (option (arg_shifter, ACE_TEXT("-v"), high_priority_workload)) {}
50 else if (option (arg_shifter, ACE_TEXT("-c"), low_priority_consumers)) {}
52 else if (boolean_option (arg_shifter, ACE_TEXT("-d"), dump_history)) {}
53 else if (boolean_option (arg_shifter, ACE_TEXT("-r"), use_rt_corba)) {}
54 else if (boolean_option (arg_shifter, ACE_TEXT("-g"), global_low_priority_rate)) {}
55 else if (boolean_option (arg_shifter, ACE_TEXT("-u"), unique_low_priority_event)) {}
56 else if (boolean_option (arg_shifter, ACE_TEXT("-f"), funky_supplier_publication)) {}
57 else if (boolean_option (arg_shifter, ACE_TEXT("-x"), high_priority_is_last)) {}
59 else
61 arg_shifter.ignore_arg ();
66 int
67 Client_Options::option (ACE_Arg_Shifter &arg_shifter,
68 const ACE_TCHAR *option_name,
69 int &option_value)
71 if (ACE_OS::strcmp (arg_shifter.get_current (), option_name) != 0)
72 return 0;
73 arg_shifter.consume_arg ();
74 if (arg_shifter.is_parameter_next ())
76 option_value = ACE_OS::atoi (arg_shifter.get_current ());
77 arg_shifter.consume_arg ();
79 else
81 ACE_DEBUG ((LM_DEBUG,
82 "Missing value for option '%s'\n", option_name));
84 return 1;
87 int
88 Client_Options::boolean_option (ACE_Arg_Shifter &arg_shifter,
89 const ACE_TCHAR *option_name,
90 int &option_value)
92 if (ACE_OS::strcmp (arg_shifter.get_current (), option_name) != 0)
93 return 0;
94 arg_shifter.consume_arg ();
95 option_value = 1;
96 return 1;