OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
SequenceTemplate.h
Go to the documentation of this file.
1//
2// Class SequenceTemplate
3//
4// An ``archetype'' for a SEQUENCE with arguments.
5// The model is stored in form of a MacroStream. A call to the macro
6// sequence is expanded by first replacing the arguments, and then parsing
7// the resulting stream as a SEQUENCE definition.
8//
9// Copyright (c) 2008 - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
10//
11// All rights reserved
12//
13// This file is part of OPAL.
14//
15// OPAL is free software: you can redistribute it and/or modify
16// it under the terms of the GNU General Public License as published by
17// the Free Software Foundation, either version 3 of the License, or
18// (at your option) any later version.
19//
20// You should have received a copy of the GNU General Public License
21// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
22//
23
24#ifndef OPAL_SequenceTemplate_HH
25#define OPAL_SequenceTemplate_HH
26
27#include <list>
28#include "OpalParser/Macro.h"
31
32class Sequence;
33class Statement;
34class TokenStream;
35
36class SequenceTemplate : public Macro {
37 friend class Sequence;
38
39public:
41 virtual ~SequenceTemplate();
42
44 // Throw OpalException, since the template cannot be cloned.
45 virtual SequenceTemplate* clone(const std::string& name);
46
48 // The instance gets the name [b]name[/b], and its actual arguments
49 // are read from [b]stat[/b]. The parser is ignored.
50 virtual Object* makeInstance(const std::string& name, Statement&, const Parser*);
51
53 // Return nullptr, since one cannot make a template from a template.
54 virtual Object* makeTemplate(const std::string& name, TokenStream&, Statement&);
55
58
59private:
60 // Not implemented.
63
64 // Clone constructor.
65 SequenceTemplate(const std::string& name, Object* parent);
66
67 // The contained beam sequence element list.
69};
70
71#endif // OPAL_SequenceTemplate_HH
An input buffer for macro commands.
Definition MacroStream.h:30
Abstract base class for macros.
Definition Macro.h:33
The base class for all OPAL objects.
Definition Object.h:45
Interface for abstract language parser.
Definition Parser.h:30
virtual SequenceTemplate * clone(const std::string &name)
Make clone.
void parseTemplate(TokenStream &, Statement &)
Parse the sequence template.
virtual Object * makeInstance(const std::string &name, Statement &, const Parser *)
Make line instance.
SequenceTemplate(const SequenceTemplate &)
void operator=(const SequenceTemplate &)
virtual Object * makeTemplate(const std::string &name, TokenStream &, Statement &)
Make a sequence template.
Interface for statements.
Definition Statement.h:37
Abstract interface for a stream of input tokens.
Definition TokenStream.h:30