OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
LineTemplate.h
Go to the documentation of this file.
1//
2// Class LineTemplate
3//
4// An ``archetype'' for a OPAL beam line with arguments.
5// The model is stored in form of a MacroStream. A call to the macro line
6// is expanded by first replacing the arguments, and then parsing the
7// resulting stream as a LINE 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_LineTemplate_HH
25#define OPAL_LineTemplate_HH
26
27#include "OpalParser/Macro.h"
29
30class Line;
31class Statement;
32class TokenStream;
33
34class LineTemplate : public Macro {
35 friend class Line;
36
37public:
39 virtual ~LineTemplate();
40
42 // Throw OpalException, since the template cannot be cloned.
43 virtual LineTemplate* clone(const std::string& name);
44
46 // The instance gets the name [b]name[/b], and its actual arguments
47 // are read from [b]stat[/b]. The parser is ignored.
48 virtual Object* makeInstance(const std::string& name, Statement& stat, const Parser*);
49
51 // Return nullptr, since one cannot make a template from a template.
52 virtual Object* makeTemplate(const std::string&, TokenStream&, Statement&);
53
55 // Read the actual arguments from [b]stat[/b]. [b]is[/b] is not used.
56 void parseTemplate(TokenStream& is, Statement& stat);
57
58private:
59 // Not implemented.
61 void operator=(const LineTemplate&);
62
63 // Clone constructor.
64 LineTemplate(const std::string& name, Object* parent);
65
66 // The contained beam line element list.
68};
69
70#endif // OPAL_LineTemplate_HH
MacroStream body
virtual ~LineTemplate()
LineTemplate(const LineTemplate &)
void parseTemplate(TokenStream &is, Statement &stat)
Parse the line template.
virtual Object * makeInstance(const std::string &name, Statement &stat, const Parser *)
Make line instance.
virtual LineTemplate * clone(const std::string &name)
Make clone.
void operator=(const LineTemplate &)
virtual Object * makeTemplate(const std::string &, TokenStream &, Statement &)
Make a line template.
Definition Line.h:30
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
Interface for statements.
Definition Statement.h:37
Abstract interface for a stream of input tokens.
Definition TokenStream.h:30