OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
ProbeRep.cpp
Go to the documentation of this file.
1//
2// Class ProbeRep
3// Representation for Probe.
4//
5// Copyright (c) 200x - 2020, Paul Scherrer Institut, Villigen PSI, Switzerland
6// All rights reserved
7//
8// This file is part of OPAL.
9//
10// OPAL is free software: you can redistribute it and/or modify
11// it under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// You should have received a copy of the GNU General Public License
16// along with OPAL. If not, see <https://www.gnu.org/licenses/>.
17//
20
21namespace {
22 struct Entry {
23 const char* name;
24 double (ProbeRep::*get)() const;
25 void (ProbeRep::*set)(double);
26 };
27
28 static const Entry entries[] = {
30} // namespace
31
32ProbeRep::ProbeRep() : Probe(), field(), geometry(), active(true) {}
33
35 : Probe(right), field(), geometry(right.geometry), active(true) {}
36
37ProbeRep::ProbeRep(const std::string& name) : Probe(name), field(), geometry(), active(true) {}
38
40
41ElementBase* ProbeRep::clone() const { return new ProbeRep(*this); }
42
43Channel* ProbeRep::getChannel(const std::string& aKey, bool create) {
44 for (const Entry* entry = entries; entry->name != 0; ++entry) {
45 if (aKey == entry->name) {
46 return new IndirectChannel<ProbeRep>(*this, entry->get, entry->set);
47 }
48 }
49
50 return ElementBase::getChannel(aKey, create);
51}
52
54
55const NullField& ProbeRep::getField() const { return field; }
56
58
60
61void ProbeRep::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.
A zero electromagnetic field.
Definition NullField.h:29
NullField field
The zero magnetic field.
Definition ProbeRep.h:70
bool active
The active/inactive flag.
Definition ProbeRep.h:76
virtual StraightGeometry & getGeometry()
Get geometry.
Definition ProbeRep.cpp:57
virtual ElementBase * clone() const
Return clone.
Definition ProbeRep.cpp:41
virtual ~ProbeRep()
Definition ProbeRep.cpp:39
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
Definition ProbeRep.cpp:43
StraightGeometry geometry
The probe's geometry.
Definition ProbeRep.h:73
virtual void setActive(bool=true)
Set active flag.
Definition ProbeRep.cpp:61
virtual NullField & getField()
Get field.
Definition ProbeRep.cpp:53
Definition Probe.h:28
A geometry representing a straight line.