OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
SequenceParser.h
Go to the documentation of this file.
1#ifndef OPAL_SequenceParser_HH
2#define OPAL_SequenceParser_HH
3
4// ------------------------------------------------------------------------
5// $RCSfile: SequenceParser.h,v $
6// ------------------------------------------------------------------------
7// $Revision: 1.1.1.1 $
8// ------------------------------------------------------------------------
9// Copyright: see Copyright.readme
10// ------------------------------------------------------------------------
11//
12// Class: SequenceParser
13//
14// ------------------------------------------------------------------------
15//
16// $Date: 2000/03/27 09:33:43 $
17// $Author: Andreas Adelmann $
18//
19// ------------------------------------------------------------------------
20
21#include <list>
22#include "Lines/Sequence.h"
24
25class Element;
26class Sequence;
27class SequenceMember;
28class Statement;
29
30// Class SequenceParser
31// ------------------------------------------------------------------------
33// Recognises the format for all possible SEQUENCE members.
34// The SequenceParser is instantiated when a SEQUENCE header is seen.
35// It takes over parsing for the members of the sequence and returns
36// when it sees ENDSEQUENCE. Before returning it makes sure that all
37// sequence members are placed correctly.
38
39class SequenceParser : public OpalParser {
40public:
42 // Assign the current sequence being parsed.
44
45 virtual ~SequenceParser();
46
48 virtual void parse(Statement&) const;
49
50private:
51 // The data structure for relative position definitions.
52 struct Reference {
54
55 Reference(std::string name, SequenceMember* member) : fromName(name) {
56 fromPosition = 0;
57 itsList.push_back(member);
58 }
59
61
62 std::string fromName;
64 std::list<SequenceMember*> itsList;
65 };
66
67 typedef std::list<Reference> RefList;
68
69 // The type of OPALX beamline embedded in a Sequence.
71
72 // Not implemented.
76
77 // Fill in relative positions and convert to absolute.
78 void fillPositions() const;
79
80 // Find positions of elements named in "FROM" clauses.
81 void findFromPositions() const;
82
83 // Find positions of neighbour elements in sequence line.
84 void findNeighbourPositions() const;
85
86 // Parse single member.
87 void parseMember(Statement&) const;
88
89 // Parse element position.
90 void parsePosition(Statement&, Object&, bool defined) const;
91
92 // The sequence being parsed.
94
95 // Flag for success.
96 mutable bool okFlag;
97
98 // The relative positions to be filled in.
100
101 // The sequence being parsed.
102 mutable TLine itsLine;
103};
104
105#endif // OPAL_SequenceParser_HH
The base class for all OPAL objects.
Definition Object.h:45
The default parser for OPAL-9.
Definition OpalParser.h:43
A member of a SEQUENCE.
The parser for SEQUENCE members.
void findFromPositions() const
void fillPositions() const
std::list< Reference > RefList
void operator=(const SequenceParser &)
Sequence * itsSequence
void parseMember(Statement &) const
SequenceParser(const SequenceParser &)
virtual ~SequenceParser()
Sequence::TLine TLine
void findNeighbourPositions() const
virtual void parse(Statement &) const
Parse sequence member.
void parsePosition(Statement &, Object &, bool defined) const
Interface for statements.
Definition Statement.h:37
SequenceMember * fromPosition
Reference(std::string name, SequenceMember *member)
std::list< SequenceMember * > itsList