OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
FlaggedElmPtr.h
Go to the documentation of this file.
1#ifndef OPALX_FlaggedElmPtr_HH
2#define OPALX_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// Class FlaggedElmPtr
26// ------------------------------------------------------------------------
28// A FlaggedBeamline is built as a list of FlaggedElmPtr objects.
29// A FlaggedElmPtr contains two flags:
30// [dl]
31// [dt]reflected [dd]If true, this section of the line is reversed.
32// [dt]selected [dd]Can be set to indicate a selected status for algorithms.
33// [/dl]
34
35class FlaggedElmPtr : public ElmPtr {
36public:
38 // Assign an element to this beamline position.
39 explicit FlaggedElmPtr(const ElmPtr&, bool reflected = false, bool selected = false);
40
43
45 virtual ~FlaggedElmPtr();
46
48 // If any error occurs, this method throws an exception.
49 virtual void accept(BeamlineVisitor&) const;
50
52 // Return the value set by the last call to [tt]setCounter()[/tt].
53 // See [b]FlaggedElmPtr::itsCounter[/b] for details.
54 inline int getCounter() const;
55
57 inline bool getReflectionFlag() const;
58
60 inline bool getSelectionFlag() const;
61
63 // The value set is the entire responsibility of any algorithm using it.
64 // See [b]FlaggedElmPtr::itsCounter[/b] for details.
65 inline void setCounter(int) const;
66
68 inline void setReflectionFlag(bool flag) const;
69
71 inline void setSelectionFlag(bool flag) const;
72
73protected:
75 // This value can be set and interrogated by an algorithm.
76 // It is not used by the OPALX library.
77 mutable int itsCounter;
78
80 // If true, the portion of the line pointed at by [b]itsElement[/b]
81 // is reflected, i.e. its elements occur in reverse order.
82 mutable bool isReflected;
83
85 // This flag can be set to indicate a ``selected'' status for certain
86 // algorithms.
87 mutable bool isSelected;
88};
89
90inline int FlaggedElmPtr::getCounter() const { return itsCounter; }
91
92inline bool FlaggedElmPtr::getReflectionFlag() const { return isReflected; }
93
94inline bool FlaggedElmPtr::getSelectionFlag() const { return isSelected; }
95
96inline void FlaggedElmPtr::setCounter(int count) const { itsCounter = count; }
97
98inline void FlaggedElmPtr::setReflectionFlag(bool flag) const { isReflected = flag; }
99
100inline void FlaggedElmPtr::setSelectionFlag(bool flag) const { isSelected = flag; }
101
102#endif // OPALX_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.