OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
Line.h
Go to the documentation of this file.
1//
2// Class Line
3// The LINE definition.
4// A Line contains an OPALX 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 friend class LineTemplate;
32
33public:
35 Line();
36
37 virtual ~Line();
38
40 // The new object is an empty line, it will be filled by the parser.
41 virtual Line* clone(const std::string& name);
42
44 // Copy also the line list.
45 virtual Line* copy(const std::string& name);
46
48 virtual double getLength() const;
49
51 // The template gets the name [b]name[/b], [b]is[/b] is ignored,
52 // and the formals and the line list are read from [b]stat[/b].
53 virtual Object* makeTemplate(const std::string& name, TokenStream& is, Statement& stat);
54
56 // Read the definition from [b]stat[/b].
57 virtual void parse(Statement& stat);
58
60 virtual void print(std::ostream& stream) const;
61
62private:
63 // Not implemented.
64 Line(const Line&);
65 void operator=(const Line&);
66
67 // Clone constructor.
68 Line(const std::string& name, Line* parent);
69
70 // Return the embedded OPALX beam line.
71 // The result it the ideal line.
72 virtual FlaggedBeamline* fetchLine() const;
73
74 // Parse sub-list.
75 void parseList(Statement&);
76
77 // Replace references to elements.
78 virtual void replace(Object* oldObject, Object* newObject);
79};
80
81#endif // OPAL_Line_HH
The base class for all OPAL beam lines and sequences.
Definition Line.h:30
virtual void replace(Object *oldObject, Object *newObject)
Replace references.
Definition Line.cpp:341
void operator=(const Line &)
virtual void parse(Statement &stat)
Parse the line object.
Definition Line.cpp:135
virtual FlaggedBeamline * fetchLine() const
Return the embedded OPALX beam line.
Definition Line.cpp:271
virtual void print(std::ostream &stream) const
Print the line.
Definition Line.cpp:251
virtual Line * copy(const std::string &name)
Make complete copy.
Definition Line.cpp:112
virtual double getLength() const
Return line length.
Definition Line.cpp:120
virtual ~Line()
Definition Line.cpp:108
virtual Object * makeTemplate(const std::string &name, TokenStream &is, Statement &stat)
Make a line template.
Definition Line.cpp:122
void parseList(Statement &)
Definition Line.cpp:273
Line()
Exemplar constructor.
Definition Line.cpp:64
Line(const Line &)
virtual Line * clone(const std::string &name)
Make clone.
Definition Line.cpp:110
The base class for all OPAL objects.
Definition Object.h:45
Interface for statements.
Definition Statement.h:37
Abstract interface for a stream of input tokens.
Definition TokenStream.h:30