summaryrefslogtreecommitdiff
path: root/ACE/examples/Web_Crawler/Web_Crawler.h
blob: 8a2e67509afa02bcf6ffa037b0c7264677dd3295 (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
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    Web_Crawler.h
 *
 *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
 */
//=============================================================================


#ifndef _WEB_CRAWLER_H
#define _WEB_CRAWLER_H

#include "URL_Addr.h"
#include "HTTP_URL.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

// Forward declaration.
class URL_Visitor_Factory;

/**
 * @class Web_Crawler
 *
 * @brief An abstraction for a Web Crawler.
 *
 * This class is a Facade that organizes the other classes in the
 * solution, which include a factory that creates a visitor,
 * which in turn embodies the appropriate visitation strategy.
 */
class Web_Crawler
{
public:
  // = Initialization and termination methods.
  /// Constructor.
  Web_Crawler (void);

  /// Destructor.
  ~Web_Crawler (void);

  /// Parses the command-line options and initializes the
  /// <URL_Visitor_Factory>.
  int open (int argc, ACE_TCHAR *argv[]);

  /// Run the Web Crawler and carries out whatever visitation strategy
  /// is configured.  Returns -1 on failure and 0 on success.
  int run (void);

private:
  /**
   * Pointer to a factory that creates visitors that explore URLs and
   * perform various tasks.  Subclasses of <URL_Visitor_Factory>
   * determine what happens during a visitation.
   */
  URL_Visitor_Factory *url_visitor_factory_;
};

#endif /* _WEB_CRAWLER_H */