Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / examples / Web_Crawler / Options.h
blobc4b1537f0e498d10e6fd5191efaa5920dd2c5a4b
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file Options.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 */
9 //=============================================================================
12 #ifndef _OPTIONS_H
13 #define _OPTIONS_H
15 #include "ace/Null_Mutex.h"
16 #include "ace/Singleton.h"
17 #include "ace/Time_Value.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 // Forward decls.
24 class Command_Processor;
25 class URL_Visitor;
27 /**
28 * @class Options
30 * @brief Maintains the global options.
32 * This class is converted into a Singleton by the
33 * <ACE_Singleton> template.
35 class Options
37 public:
38 /// Parse the command-line arguments and initialize the options.
39 int parse_args (int argc, ACE_TCHAR *argv[]);
41 /// If non-0 and the link is an HTML file then recursively check all
42 /// links that are embedded in the body of file.
43 int recurse () const;
45 /// Return the hostname of the initial Web server.
46 const ACE_TCHAR *hostname () const;
48 /// Return the initial URI.
49 const ACE_TCHAR *path_name () const;
51 /// String used to filter out which URLs to validate.
52 const ACE_TCHAR *url_filter () const;
54 /// Are we debugging?
55 int debug () const;
57 /// Are we being verbose?
58 int verbose () const;
60 /// Which order? LIFO|FIFO??
61 const ACE_TCHAR *order () const;
63 /// Port #
64 int port_no () const;
66 /// Return the timeout used to prevent hanging on <recv> and
67 /// <connect> calls to broken servers.
68 const ACE_Time_Value *timeout () const;
70 // = Get/set the <Command_Processor>.
71 Command_Processor *command_processor () const;
72 void command_processor (Command_Processor *);
74 // = Get/set the <URL_Visitor>.
75 URL_Visitor *visitor () const;
76 void visitor (URL_Visitor *);
78 // Get the handle_limit.
79 int handle_limit ();
80 private:
81 /// Are we recursving.
82 int recurse_;
84 /// Initial Web server name.
85 const ACE_TCHAR *hostname_;
87 /// Initial URI name.
88 const ACE_TCHAR *uri_;
90 /// Are we debugging?
91 int debug_;
93 /// Are we being verbose?
94 int verbose_;
96 /// Whether the URLs are traversed in FIFO or LIFO order.
97 const ACE_TCHAR *order_;
99 /// Timeout on <recv> and <connect> to broken Web servers.
100 ACE_Time_Value timeout_;
102 /// String used to filter out which URLs to validate.
103 const ACE_TCHAR *url_filter_;
105 /// Pointer to the Command_Processor.
106 Command_Processor *command_processor_;
108 /// Pointer to the <URL_Visitor>.
109 URL_Visitor *visitor_;
111 /// Port no.
112 int port_no_;
114 /// The limit of the number of descriptors to be given for this process.
115 int handle_limit_;
118 // Typedef an Options Singleton.
119 typedef ACE_Singleton <Options, ACE_Null_Mutex> OPTIONS;
121 #endif /* _OPTIONS_H */