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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
/**
* @file Client_Options.cpp
*
* @author Carlos O'Ryan <coryan@uci.edu>
*/
#include "Client_Options.h"
#include "ace/Log_Msg.h"
Client_Options::Client_Options (int &argc, ACE_TCHAR *argv[])
: ior (ACE_TEXT("file://test.ior"))
, iterations (1000)
, nthreads (0)
, high_priority_period (0)
, high_priority_workload (0)
, low_priority_period (0)
, low_priority_workload (0)
, low_priority_consumers (0)
, dump_history (0)
, use_rt_corba (0)
, global_low_priority_rate (0)
, unique_low_priority_event (0)
, funky_supplier_publication (0)
, high_priority_is_last (0)
{
ACE_Arg_Shifter arg_shifter (argc, argv);
while (arg_shifter.is_anything_left ())
{
const ACE_TCHAR *arg = arg_shifter.get_current ();
if (ACE_OS::strcmp (arg, ACE_TEXT("-k")) == 0)
{
arg_shifter.consume_arg ();
if (arg_shifter.is_parameter_next ())
{
this->ior = arg_shifter.get_current ();
arg_shifter.consume_arg ();
}
}
else if (option (arg_shifter, ACE_TEXT("-i"), iterations)) {}
else if (option (arg_shifter, ACE_TEXT("-n"), nthreads)) {}
else if (option (arg_shifter, ACE_TEXT("-h"), high_priority_period)) {}
else if (option (arg_shifter, ACE_TEXT("-l"), low_priority_period)) {}
else if (option (arg_shifter, ACE_TEXT("-w"), low_priority_workload)) {}
else if (option (arg_shifter, ACE_TEXT("-v"), high_priority_workload)) {}
else if (option (arg_shifter, ACE_TEXT("-c"), low_priority_consumers)) {}
else if (boolean_option (arg_shifter, ACE_TEXT("-d"), dump_history)) {}
else if (boolean_option (arg_shifter, ACE_TEXT("-r"), use_rt_corba)) {}
else if (boolean_option (arg_shifter, ACE_TEXT("-g"), global_low_priority_rate)) {}
else if (boolean_option (arg_shifter, ACE_TEXT("-u"), unique_low_priority_event)) {}
else if (boolean_option (arg_shifter, ACE_TEXT("-f"), funky_supplier_publication)) {}
else if (boolean_option (arg_shifter, ACE_TEXT("-x"), high_priority_is_last)) {}
else
{
arg_shifter.ignore_arg ();
}
}
}
int
Client_Options::option (ACE_Arg_Shifter &arg_shifter,
const ACE_TCHAR *option_name,
int &option_value)
{
if (ACE_OS::strcmp (arg_shifter.get_current (), option_name) != 0)
return 0;
arg_shifter.consume_arg ();
if (arg_shifter.is_parameter_next ())
{
option_value = ACE_OS::atoi (arg_shifter.get_current ());
arg_shifter.consume_arg ();
}
else
{
ACE_DEBUG ((LM_DEBUG,
"Missing value for option '%s'\n", option_name));
}
return 1;
}
int
Client_Options::boolean_option (ACE_Arg_Shifter &arg_shifter,
const ACE_TCHAR *option_name,
int &option_value)
{
if (ACE_OS::strcmp (arg_shifter.get_current (), option_name) != 0)
return 0;
arg_shifter.consume_arg ();
option_value = 1;
return 1;
}
|