OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
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 
36 class FlaggedElmPtr: public ElmPtr {
37 
38 public:
39 
41  // Assign an element to this beamline position.
42  explicit FlaggedElmPtr
43  (const ElmPtr &, bool reflected = false, bool selected = false);
44 
47 
48  FlaggedElmPtr();
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 
77 protected:
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 
96 inline int FlaggedElmPtr::getCounter() const {
97  return itsCounter;
98 }
99 
100 
101 inline bool FlaggedElmPtr::getReflectionFlag() const {
102  return isReflected;
103 }
104 
105 
106 inline bool FlaggedElmPtr::getSelectionFlag() const {
107  return isSelected;
108 }
109 
110 
111 inline void FlaggedElmPtr::setCounter(int count) const {
112  itsCounter = count;
113 }
114 
115 
116 inline void FlaggedElmPtr::setReflectionFlag(bool flag) const {
117  isReflected = flag;
118 }
119 
120 
121 inline void FlaggedElmPtr::setSelectionFlag(bool flag) const {
122  isSelected = flag;
123 }
124 
125 #endif // CLASSIC_FlaggedElmPtr_HH
int getCounter() const
Get clone counter.
Definition: FlaggedElmPtr.h:96
void setSelectionFlag(bool flag) const
Get selection flag.
virtual ~FlaggedElmPtr()
int itsCounter
Clone counter.
Definition: FlaggedElmPtr.h:82
void setCounter(int) const
Set clone counter.
bool getSelectionFlag() const
Get selection flag.
bool getReflectionFlag() const
Get reflection flag.
bool isSelected
The selection flag.
Definition: FlaggedElmPtr.h:92
virtual void accept(BeamlineVisitor &) const
Apply visitor.
Abstract algorithm.
bool isReflected
The reflection flag.
Definition: FlaggedElmPtr.h:87
A section of a beam line.
Definition: FlaggedElmPtr.h:36
A section of a beam line.
Definition: ElmPtr.h:32
void setReflectionFlag(bool flag) const
Set reflection flag.