blob: 4cc93ea5c36be438bf6089274339d7f435060d4f (
plain)
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
|
// -*- C++ -*-
// $Id$
/**
* @file HMOptions.h
*
* @brief Declared the HMOptions class interface.
*
*/
#ifndef _HMOPTIONS_H
#define _HMOPTIONS_H
#include <string>
#include "ace/Thread_Mutex.h"
#include "ace/Auto_Ptr.h"
#include "host_monitor_export.h"
/**
* @class HMOptions
*
* @brief Declares HMOptions singleton to hold the command line options.
*/
class HostMonitor_Export HMOptions
/// TITLE
/// Singleton class for the program options.
{
public:
/// Singleton access method.
static HMOptions *instance (void);
bool parse_args (int &argc, char **argv);
/// Member accessors.
std::string RM_ior (void) const;
std::string HM_ior_file (void) const;
std::string host_id (void) const;
int port_range_begin (void) const;
int RM_update_freq (void) const;
int load_monitor_freq (void) const;
std::string util_file (void) const;
std::pair <char, std::string> ior_access (void) const;
bool use_naming_service (void) const;
/**
* @return the debug level of the application:
* 0 - all errors and other urgent levels
* 1 - warnings are shown as well
* 2 - LM_DEBUG messages added
* 3 - LM_TRACE messages added
* 4 - LM_NOTICE messages added
* 5 - LM_INFO messages added
*/
long debug_level (void) const;
protected:
/// Constructor is protected to ensure Singleton access.
HMOptions (void);
void set_debug_level (void);
std::string RM_ior_;
std::string host_id_;
std::string HM_ior_file_;
std::string util_file_;
size_t port_range_begin_;
size_t RM_update_freq_;
size_t load_monitor_freq_;
std::pair <char, std::string> ior_access_;
long debug_level_;
/// Singleton-related stuff.
static HMOptions * volatile instance_;
static ACE_Auto_Ptr<HMOptions> deleter_;
static ACE_Thread_Mutex lock_;
};
#endif /* _HMOPTIONS_H */
|