OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
Line.h
Go to the documentation of this file.
1 #ifndef OPAL_Line_HH
2 #define OPAL_Line_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile Line.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: Line
13 //
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:33:42 $
17 // $Author: Andreas Adelmann $
18 //
19 // ------------------------------------------------------------------------
20 
25 
26 class TokenStream;
27 
28 
29 // Class Line
30 // ------------------------------------------------------------------------
32 // A Line contains a CLASSIC TBeamline<FlaggedElmPtr> which represents the
33 // sequence of elements in the line. The line is always flat in the sense
34 // that nested anonymous lines are flattened.
35 
36 class Line: public BeamSequence {
37 
38  friend class LineTemplate;
39 
40 public:
41 
43  Line();
44 
45  virtual ~Line();
46 
48  // The new object is an empty line, it will be filled by the parser.
49  virtual Line *clone(const std::string &name);
50 
52  // Copy also the line list.
53  virtual Line *copy(const std::string &name);
54 
56  virtual double getLength() const;
57 
59  // The template gets the name [b]name[/b], [b]is[/b] is ignored,
60  // and the formals and the line list are read from [b]stat[/b].
61  virtual Object *makeTemplate
62  (const std::string &name, TokenStream &is, Statement &stat);
63 
65  // Read the definition from [b]stat[/b].
66  virtual void parse(Statement &stat);
67 
69  virtual void print(std::ostream &stream) const;
70 
71 private:
72 
73  // Not implemented.
74  Line(const Line &);
75  void operator=(const Line &);
76 
77  // Clone constructor.
78  Line(const std::string &name, Line *parent);
79 
80  // Return the embedded CLASSIC beam line.
81  // The result it the ideal line.
82  virtual FlaggedBeamline *fetchLine() const;
83 
84  // Parse sub-list.
85  void parseList(Statement &);
86 
87  // Replace references to elements.
88  virtual void replace(Object *oldObject, Object *newObject);
89 };
90 
91 #endif // OPAL_Line_HH
Abstract interface for a stream of input tokens.
Definition: TokenStream.h:33
virtual void print(std::ostream &stream) const
Print the line.
Definition: Line.cpp:269
virtual FlaggedBeamline * fetchLine() const
Return the embedded CLASSIC beam line.
Definition: Line.cpp:291
void operator=(const Line &)
virtual Line * clone(const std::string &name)
Make clone.
Definition: Line.cpp:119
virtual Line * copy(const std::string &name)
Make complete copy.
Definition: Line.cpp:124
Template class for beam lines.
Definition: TBeamline.h:40
virtual Object * makeTemplate(const std::string &name, TokenStream &is, Statement &stat)
Make a line template.
Definition: Line.cpp:138
virtual double getLength() const
Return line length.
Definition: Line.cpp:132
Interface for statements.
Definition: Statement.h:38
virtual ~Line()
Definition: Line.cpp:115
The base class for all OPAL beam lines and sequences.
Definition: BeamSequence.h:32
An ``archetype&#39;&#39; for a OPAL beam line with arguments.
Definition: LineTemplate.h:36
The base class for all OPAL objects.
Definition: Object.h:48
const std::string name
virtual void parse(Statement &stat)
Parse the line object.
Definition: Line.cpp:152
Line()
Exemplar constructor.
Definition: Line.cpp:67
void parseList(Statement &)
Definition: Line.cpp:296
virtual void replace(Object *oldObject, Object *newObject)
Replace references.
Definition: Line.cpp:363
The LINE definition.
Definition: Line.h:36