forked from OpenDDS/OpenDDS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOptions.cpp
More file actions
84 lines (72 loc) · 1.66 KB
/
Copy pathOptions.cpp
File metadata and controls
84 lines (72 loc) · 1.66 KB
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
// -*- C++ -*-
//
/*
*
*
* Distributed under the OpenDDS License.
* See: http://www.opendds.org/license.html
*/
#include "dds/DCPS/debug.h"
#include "dds/monitor/monitorC.h"
#include "Options.h"
#include "ace/Arg_Shifter.h"
#include "ace/Log_Priority.h"
#include "ace/Log_Msg.h"
#include "ace/OS_NS_stdlib.h"
#include <string>
#include <iostream>
namespace { // anonymous namespace for file scope.
//
// Default values.
//
enum { DEFAULT_DOMAINID = OpenDDS::DCPS::MONITOR_DOMAIN_ID};
// Command line argument definitions.
const ACE_TCHAR* VERBOSE_ARGUMENT = ACE_TEXT("-v");
} // end of anonymous namespace.
Monitor::Options::~Options()
{
}
bool
Monitor::Options::verbose() const
{
return this->verbose_;
}
bool
Monitor::Options::configured() const
{
return this->configured_;
}
long
Monitor::Options::domain() const
{
return this->domain_;
}
Monitor::Options::Options( int argc, ACE_TCHAR** argv, char** /* envp */)
: verbose_( false),
configured_( false),
domain_( DEFAULT_DOMAINID)
{
ACE_Arg_Shifter parser( argc, argv);
while( parser.is_anything_left()) {
if( this->verbose()) {
ACE_DEBUG((LM_DEBUG,
ACE_TEXT("(%P|%t) Options::Options() - ")
ACE_TEXT("processing argument: %s.\n"),
parser.get_current()
));
}
// const ACE_TCHAR* currentArg = 0;
if( 0 <= (parser.cur_arg_strncasecmp( VERBOSE_ARGUMENT))) {
this->verbose_ = true;
if( this->verbose()) {
ACE_DEBUG((LM_DEBUG,
ACE_TEXT("(%P|%t) Options::Options() - ")
ACE_TEXT("Setting VERBOSE mode.\n")
));
}
parser.consume_arg();
} else {
parser.ignore_arg();
}
}
}