OPALX (Object Oriented Parallel Accelerator Library for Exascal) MINIorX
OPALX
Line.h
Go to the documentation of this file.
1//
2// Class Line
3// The LINE definition.
4// A Line contains a CLASSIC TBeamline<FlaggedElmPtr> which represents the
5// sequence of elements in the line. The line is always flat in the sense
6// that nested anonymous lines are flattened.
7//
8// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
9// All rights reserved
10//
11// This file is part of OPAL.
12//
13// OPAL is free software: you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation, either version 3 of the License, or
16// (at your option) any later version.
17//
18// You should have received a copy of the GNU General Public License
19// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
20//
21#ifndef OPAL_Line_HH
22#define OPAL_Line_HH
23
27
28class TokenStream;
29
30class Line: public BeamSequence {
31
32 friend class LineTemplate;
33
34public:
35
37 Line();
38
39 virtual ~Line();
40
42 // The new object is an empty line, it will be filled by the parser.
43 virtual Line *clone(const std::string &name);
44
46 // Copy also the line list.
47 virtual Line *copy(const std::string &name);
48
50 virtual double getLength() const;
51
53 // The template gets the name [b]name[/b], [b]is[/b] is ignored,
54 // and the formals and the line list are read from [b]stat[/b].
55 virtual Object *makeTemplate
56 (const std::string &name, TokenStream &is, Statement &stat);
57
59 // Read the definition from [b]stat[/b].
60 virtual void parse(Statement &stat);
61
63 virtual void print(std::ostream &stream) const;
64
65private:
66
67 // Not implemented.
68 Line(const Line &);
69 void operator=(const Line &);
70
71 // Clone constructor.
72 Line(const std::string &name, Line *parent);
73
74 // Return the embedded CLASSIC beam line.
75 // The result it the ideal line.
76 virtual FlaggedBeamline *fetchLine() const;
77
78 // Parse sub-list.
79 void parseList(Statement &);
80
81 // Replace references to elements.
82 virtual void replace(Object *oldObject, Object *newObject);
83};
84
85#endif // OPAL_Line_HH
TBeamline< FlaggedElmPtr > FlaggedBeamline
A beam line with flagged elements.
BeamSequence(int size, const char *name, const char *help)
Constructor for exemplars.
Object(int size, const char *name, const char *help)
Constructor for exemplars.
Definition Object.cpp:354
virtual void replace(Object *oldObject, Object *newObject)
Replace references.
Definition Line.cpp:367
void operator=(const Line &)
friend class LineTemplate
Definition Line.h:32
virtual void parse(Statement &stat)
Parse the line object.
Definition Line.cpp:151
virtual FlaggedBeamline * fetchLine() const
Return the embedded CLASSIC beam line.
Definition Line.cpp:292
virtual void print(std::ostream &stream) const
Print the line.
Definition Line.cpp:270
virtual Line * copy(const std::string &name)
Make complete copy.
Definition Line.cpp:123
virtual double getLength() const
Return line length.
Definition Line.cpp:131
virtual ~Line()
Definition Line.cpp:114
virtual Object * makeTemplate(const std::string &name, TokenStream &is, Statement &stat)
Make a line template.
Definition Line.cpp:137
void parseList(Statement &)
Definition Line.cpp:297
Line()
Exemplar constructor.
Definition Line.cpp:66
Line(const Line &)
virtual Line * clone(const std::string &name)
Make clone.
Definition Line.cpp:118
Interface for statements.
Definition Statement.h:38
Abstract interface for a stream of input tokens.
Definition TokenStream.h:33