summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/examples/FaultTolerance/FLARe/HMOptions.h
blob: 3298cf401796e4c768f086042486ea44efeda522 (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
/**
 *  @file   HMOptions.h
 *
 *  @brief Declared the HMOptions class interface.
 *
 */

#ifndef _HMOPTIONS_H
#define _HMOPTIONS_H

#include <iostream>
#include <string>
#include "ace/Thread_Mutex.h"


/**
 *  @class   HMOptions
 *
 *  @brief Declares HMOptions singleton to hold the command line options.
 */

#include "ArgPair.h"

class HMOptions
/// TITLE
///   Singleton class for the program options.
{
public:

  /// Singleton access method.
  static HMOptions *instance (void);

  /// Parse command-line arguments and set the appropriate values as
  /// follows:
  bool parse_args (int argc, char **argv);
  std::string RM_ior () const;
  std::string HM_ior_file () const;
  std::string host_id () const;
  int RM_update_freq () const;
  int load_monitor_freq () const;
  std::string util_file () const;
  ArgPair arg_pair (); 
  std::pair <char, std::string> ior_access () const;


protected:

  /// Constructor is protected to ensure Singleton access.
  HMOptions (void);

  std::string RM_ior_;
  std::string host_id_;
  std::string HM_ior_file_;
  std::string util_file_;
  ArgPair arg_pair_; 
  size_t RM_update_freq_;
  size_t load_monitor_freq_;
  std::pair <char, std::string> ior_access_;

  /// Singleton instance.
  static HMOptions * volatile instance_;
  static std::auto_ptr<HMOptions> deleter_;
  static ACE_Thread_Mutex lock_;
};


#endif /* _APPOPTIONS_H */