Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / examples / Web_Crawler / Command_Processor.h
blob18fb594c0bab93cd154f933386d3edb249409f6a
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file Command_Processor.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 */
9 //=============================================================================
12 #ifndef _COMMAND_PROCESSOR_H
13 #define _COMMAND_PROCESSOR_H
15 #if !defined (ACE_LACKS_PRAGMA_ONCE)
16 #pragma once
17 #endif /* ACE_LACKS_PRAGMA_ONCE */
19 #include "ace/Containers.h"
20 #include "Options.h"
22 // Forward decl.
23 class URL;
25 /**
26 * @class Command
28 * @brief Abstract base class for a command.
30 * Each command is executed by a <Command_Processor>.
32 class Command
34 public:
35 /// Virtual destructor.
36 virtual ~Command ();
38 /// This is the entry point to execute the command.
39 virtual int execute () = 0;
40 virtual int destroy () = 0;
43 /**
44 * @class URL_Command
46 * @brief Defines an API for executing a command on a URL.
48 * Each command is executed by a <Command_Processor>.
50 class URL_Command : public Command
52 public:
53 /// Constructor.
54 URL_Command (URL *);
56 /// Execute the URL command.
57 virtual int execute ();
59 /// Commit suicide.
60 int destroy ();
61 private:
62 /// Pointer to the URL.
63 URL *url_;
66 /**
67 * @class Command_Processor
69 * @brief Execute commands that are passed to it.
71 * This class implements the Command Processor pattern.
73 class Command_Processor
75 public:
76 Command_Processor ();
78 /// Insert a new <Command> into the <Command_Processor>'s queue.
79 int insert (Command *);
81 /// Execute all the <Commands> in the queue.
82 int execute ();
84 /// Destroy the <Command_Processor>.
85 int destroy ();
87 protected:
88 /// Ensure dynamic allocation.
89 ~Command_Processor ();
91 private:
92 // @@ You fill in here...
93 ACE_Unbounded_Queue<Command *> url_queue_;
97 #endif /* _COMMAND_PROCESSOR_H */