OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
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 "OpalParser/Macro.h"
30#include <list>
31
32class Sequence;
33class Statement;
34class TokenStream;
35
36class SequenceTemplate: public Macro {
37
38 friend class Sequence;
39
40public:
41
43 virtual ~SequenceTemplate();
44
46 // Throw OpalException, since the template cannot be cloned.
47 virtual SequenceTemplate *clone(const std::string &name);
48
50 // The instance gets the name [b]name[/b], and its actual arguments
51 // are read from [b]stat[/b]. The parser is ignored.
52 virtual Object *makeInstance
53 (const std::string &name, Statement &, const Parser *);
54
56 // Return nullptr, since one cannot make a template from a template.
57 virtual Object *makeTemplate(const std::string &name, TokenStream &, Statement &);
58
61
62private:
63
64 // Not implemented.
67
68 // Clone constructor.
69 SequenceTemplate(const std::string &name, Object *parent);
70
71 // The contained beam sequence element list.
73};
74
75#endif // OPAL_SequenceTemplate_HH
const std::string name
Object(int size, const char *name, const char *help)
Constructor for exemplars.
Definition Object.cpp:356
Interface for abstract language parser.
Definition Parser.h:31
Interface for statements.
Definition Statement.h:38
Abstract interface for a stream of input tokens.
Definition TokenStream.h:33
friend class Sequence
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.
Macro(int size, const char *name, const char *help)
Exemplar constructor.
Definition Macro.cpp:28
An input buffer for macro commands.
Definition MacroStream.h:31