OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
RangeRep.h
Go to the documentation of this file.
1#ifndef OPAL_RangeRep_HH
2#define OPAL_RangeRep_HH
3
4// ------------------------------------------------------------------------
5// $RCSfile: RangeRep.h,v $
6// ------------------------------------------------------------------------
7// $Revision: 1.1.1.1 $
8// ------------------------------------------------------------------------
9// Copyright: see Copyright.readme
10// ------------------------------------------------------------------------
11//
12// Class: RangeRep
13//
14// ------------------------------------------------------------------------
15//
16// $Date: 2000/03/27 09:33:35 $
17// $Author: Andreas Adelmann $
18//
19// ------------------------------------------------------------------------
20
22
23class FlaggedElmPtr;
24
25
26// Class RangeRep
27// ------------------------------------------------------------------------
29// This representation holds two places, defining the beginning and ending
30// of the range. It keeps track wether we are before, within, or after
31// the range.
32// The value may also be "FULL", denoting the complete beam line.
33
34class RangeRep {
35
36public:
37
39 // Construct range for full line (value "FULL").
40 RangeRep();
41
44
45 RangeRep(const RangeRep &);
46 ~RangeRep();
47 const RangeRep &operator=(const RangeRep &);
48
50 // Sets the internal state to the beginning of the beam line.
51 void initialize();
52
54 // Return true, if we are within the specified range.
55 bool isActive() const;
56
58 // Sets the internal state to active, when we enter the specified range.
59 void enter(const FlaggedElmPtr &) const;
60
62 // Sets the internal state to inactive, when we leave the specified range.
63 void leave(const FlaggedElmPtr &) const;
64
66 void print(std::ostream &os) const;
67
68private:
69
70 // The begin/end Place structures.
73
74 // Flag for full range. If true the places are not looked at.
76
77 // If true we are within this range.
78 mutable bool status;
79};
80
81
82inline std::ostream &operator<<(std::ostream &os, const RangeRep &val) {
83 val.print(os);
84 return os;
85}
86
87#endif // OPAL_RangeRep_HH
std::ostream & operator<<(std::ostream &os, const RangeRep &val)
Definition: RangeRep.h:82
Representation of a place within a beam line or sequence.
Definition: PlaceRep.h:41
Representation of a range within a beam line or sequence.
Definition: RangeRep.h:34
PlaceRep first
Definition: RangeRep.h:71
bool isActive() const
Test for active range.
Definition: RangeRep.cpp:65
const RangeRep & operator=(const RangeRep &)
Definition: RangeRep.cpp:46
void initialize()
Initialise data for search.
Definition: RangeRep.cpp:54
PlaceRep last
Definition: RangeRep.h:72
bool fullRange
Definition: RangeRep.h:75
~RangeRep()
Definition: RangeRep.cpp:42
void print(std::ostream &os) const
Print in input format.
Definition: RangeRep.cpp:90
void leave(const FlaggedElmPtr &) const
Leave an element or line.
Definition: RangeRep.cpp:80
bool status
Definition: RangeRep.h:78
RangeRep()
Default constructor.
Definition: RangeRep.cpp:27
void enter(const FlaggedElmPtr &) const
Enter an element or line.
Definition: RangeRep.cpp:70
A section of a beam line.
Definition: FlaggedElmPtr.h:36