OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
MonitorRep.cpp
Go to the documentation of this file.
1//
2// Class MonitorRep
3// Representation for an orbit position monitor.
4// The base class observes both planes.
5//
6// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
7// All rights reserved
8//
9// This file is part of OPAL.
10//
11// OPAL is free software: you can redistribute it and/or modify
12// it under the terms of the GNU General Public License as published by
13// the Free Software Foundation, either version 3 of the License, or
14// (at your option) any later version.
15//
16// You should have received a copy of the GNU General Public License
17// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
18//
21
22namespace {
23 struct Entry {
24 const char* name;
25 double (MonitorRep::*get)() const;
26 void (MonitorRep::*set)(double);
27 };
28
29 const Entry entries[] = {
31} // namespace
32
33MonitorRep::MonitorRep() : Monitor(), field(), geometry(), active(true) {}
34
36 : Monitor(right), field(), geometry(right.geometry), active(true) {}
37
38MonitorRep::MonitorRep(const std::string& name)
39 : Monitor(name), field(), geometry(), active(true) {}
40
42
43ElementBase* MonitorRep::clone() const { return new MonitorRep(*this); }
44
45Channel* MonitorRep::getChannel(const std::string& aKey, bool create) {
46 for (const Entry* entry = entries; entry->name != 0; ++entry) {
47 if (aKey == entry->name) {
48 return new IndirectChannel<MonitorRep>(*this, entry->get, entry->set);
49 }
50 }
51
52 return ElementBase::getChannel(aKey, create);
53}
54
56
57const NullField& MonitorRep::getField() const { return field; }
58
60
62
64
65void MonitorRep::setActive(bool flag) { active = flag; }
Abstract interface for read/write access to variable.
Definition Channel.h:30
virtual Channel * getChannel(const std::string &aKey, bool create=false)
Construct a read/write channel.
virtual double getElementLength() const
Get design length.
virtual void setElementLength(double length)
Set design length.
Access to a [b]double[/b] data member.
NullField field
The zero magnetic field.
Definition MonitorRep.h:74
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
virtual ElementBase * clone() const
Return clone.
virtual NullField & getField()
Get field.
StraightGeometry geometry
The monitor geometry.
Definition MonitorRep.h:77
virtual StraightGeometry & getGeometry()
Get geometry.
virtual Plane getPlane() const
Get planes.
virtual void setActive(bool=true)
Set active flag.
bool active
The active/inactive flag.
Definition MonitorRep.h:80
virtual ~MonitorRep()
Plane
Plane selection.
Definition Monitor.h:36
@ XY
Monitor acts on both planes.
Definition Monitor.h:44
@ OFF
Monitor is off (inactive).
Definition Monitor.h:38
A zero electromagnetic field.
Definition NullField.h:29
A geometry representing a straight line.