OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
FlaggedElmPtr.h
Go to the documentation of this file.
1#ifndef CLASSIC_FlaggedElmPtr_HH
2#define CLASSIC_FlaggedElmPtr_HH
3
4// ------------------------------------------------------------------------
5// $RCSfile: FlaggedElmPtr.h,v $
6// ------------------------------------------------------------------------
7// $Revision: 1.1.1.1 $
8// ------------------------------------------------------------------------
9// Copyright: see Copyright.readme
10// ------------------------------------------------------------------------
11//
12// Class: FlaggedElmPtr
13//
14// ------------------------------------------------------------------------
15// Class category: Beamlines
16// ------------------------------------------------------------------------
17//
18// $Date: 2000/03/27 09:32:35 $
19// $Author: fci $
20//
21// ------------------------------------------------------------------------
22
23#include "Beamlines/ElmPtr.h"
24
25
26// Class FlaggedElmPtr
27// ------------------------------------------------------------------------
29// A FlaggedBeamline is built as a list of FlaggedElmPtr objects.
30// A FlaggedElmPtr contains two flags:
31// [dl]
32// [dt]reflected [dd]If true, this section of the line is reversed.
33// [dt]selected [dd]Can be set to indicate a selected status for algorithms.
34// [/dl]
35
36class FlaggedElmPtr: public ElmPtr {
37
38public:
39
41 // Assign an element to this beamline position.
42 explicit FlaggedElmPtr
43 (const ElmPtr &, bool reflected = false, bool selected = false);
44
47
49 virtual ~FlaggedElmPtr();
50
52 // If any error occurs, this method throws an exception.
53 virtual void accept(BeamlineVisitor &) const;
54
56 // Return the value set by the last call to [tt]setCounter()[/tt].
57 // See [b]FlaggedElmPtr::itsCounter[/b] for details.
58 inline int getCounter() const;
59
61 inline bool getReflectionFlag() const;
62
64 inline bool getSelectionFlag() const;
65
67 // The value set is the entire responsibility of any algorithm using it.
68 // See [b]FlaggedElmPtr::itsCounter[/b] for details.
69 inline void setCounter(int) const;
70
72 inline void setReflectionFlag(bool flag) const;
73
75 inline void setSelectionFlag(bool flag) const;
76
77protected:
78
80 // This value can be set and interrogated by an algorithm.
81 // It is not used by the CLASSIC library.
82 mutable int itsCounter;
83
85 // If true, the portion of the line pointed at by [b]itsElement[/b]
86 // is reflected, i.e. its elements occur in reverse order.
87 mutable bool isReflected;
88
90 // This flag can be set to indicate a ``selected'' status for certain
91 // algorithms.
92 mutable bool isSelected;
93};
94
95
96inline int FlaggedElmPtr::getCounter() const {
97 return itsCounter;
98}
99
100
102 return isReflected;
103}
104
105
107 return isSelected;
108}
109
110
111inline void FlaggedElmPtr::setCounter(int count) const {
112 itsCounter = count;
113}
114
115
116inline void FlaggedElmPtr::setReflectionFlag(bool flag) const {
117 isReflected = flag;
118}
119
120
121inline void FlaggedElmPtr::setSelectionFlag(bool flag) const {
122 isSelected = flag;
123}
124
125#endif // CLASSIC_FlaggedElmPtr_HH
A section of a beam line.
Definition ElmPtr.h:32
A section of a beam line.
int getCounter() const
Get clone counter.
void setCounter(int) const
Set clone counter.
void setReflectionFlag(bool flag) const
Set reflection flag.
bool isReflected
The reflection flag.
bool getReflectionFlag() const
Get reflection flag.
int itsCounter
Clone counter.
bool getSelectionFlag() const
Get selection flag.
bool isSelected
The selection flag.
void setSelectionFlag(bool flag) const
Get selection flag.
virtual ~FlaggedElmPtr()
virtual void accept(BeamlineVisitor &) const
Apply visitor.