OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
MacroCmd.h
Go to the documentation of this file.
1 #ifndef CLASSIC_MacroCmd_HH
2 #define CLASSIC_MacroCmd_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: MacroCmd.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: MacroCmd
13 //
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:33:43 $
17 // $Author: Andreas Adelmann $
18 //
19 // ------------------------------------------------------------------------
20 
21 #include "OpalParser/Macro.h"
22 #include "OpalParser/MacroStream.h"
24 #include <iosfwd>
25 
26 
27 // Class MacroCmd
28 // ------------------------------------------------------------------------
30 // The macro is stored as a MacroStream. For execution, first the
31 // parameters are replaced, then the resulting stream is sent to the parser.
32 
33 class MacroCmd: public Macro {
34 
35 public:
36 
37  MacroCmd();
38  MacroCmd(const std::string &name, MacroCmd *parent);
39  virtual ~MacroCmd();
40 
42  virtual void execute();
43 
45  // Expects parse pointer in the statement to be set on the first argument.
46  // The parser is used to determine the parse mode
47  // (normal, error, match, edit, track).
48  virtual Object *makeInstance
49  (const std::string &name, Statement &, const Parser *);
50 
52  // Expects parse pointer in the statement to be set on the first argument.
53  virtual Object *makeTemplate(const std::string &, TokenStream &, Statement &);
54 
55 private:
56 
57  // Not implemented.
58  MacroCmd(const MacroCmd &);
59  void operator=(const MacroCmd &);
60 
61  // The stream of tokens representing the macro command.
63 
64  // Pointer to the parser to be used in execution.
65  const Parser *itsParser;
66 };
67 
68 #endif // CLASSIC_MacroCmd_HH
MacroCmd()
Definition: MacroCmd.cpp:29
Abstract interface for a stream of input tokens.
Definition: TokenStream.h:33
virtual void execute()
Execute the macro command.
Definition: MacroCmd.cpp:47
Interface for abstract language parser.
Definition: Parser.h:31
const Parser * itsParser
Definition: MacroCmd.h:65
Encapsulate the buffer for the ``archetypes&#39;&#39; of all macros.
Definition: MacroCmd.h:33
Interface for statements.
Definition: Statement.h:38
virtual ~MacroCmd()
Definition: MacroCmd.cpp:43
virtual Object * makeTemplate(const std::string &, TokenStream &, Statement &)
Make a macro template.
Definition: MacroCmd.cpp:97
void operator=(const MacroCmd &)
Abstract base class for macros.
Definition: Macro.h:34
Pointer< MacroStream > body
Definition: MacroCmd.h:62
The base class for all OPAL objects.
Definition: Object.h:48
virtual Object * makeInstance(const std::string &name, Statement &, const Parser *)
Make a macro instance.
Definition: MacroCmd.cpp:54
const std::string name