OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
YMonitorRep.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: YMonitorRep.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: YMonitorRep
10 // Defines a concrete representation for a vertical orbit monitor.
11 //
12 // ------------------------------------------------------------------------
13 // Class category: BeamlineCore
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:32:34 $
17 // $Author: fci $
18 //
19 // ------------------------------------------------------------------------
20 
24 
25 
26 // Attribute access table.
27 // ------------------------------------------------------------------------
28 
29 namespace {
30  struct Entry {
31  const char *name;
32  double(YMonitorRep::*get)() const;
33  void (YMonitorRep::*set)(double);
34  };
35 
36  const Entry entries[] = {
37  {
38  "L",
41  },
42  { 0, 0, 0 }
43  };
44 }
45 
46 
47 // Class YMonitorRep
48 // ------------------------------------------------------------------------
49 
51  MonitorRep()
52 {}
53 
54 
56  MonitorRep(right)
57 {}
58 
59 
60 YMonitorRep::YMonitorRep(const std::string &name):
61  MonitorRep(name)
62 {}
63 
64 
66 {}
67 
68 
70  return new YMonitorRep(*this);
71 }
72 
73 
74 Channel *YMonitorRep::getChannel(const std::string &aKey, bool create) {
75  for(const Entry *entry = entries; entry->name != 0; ++entry) {
76  if(aKey == entry->name) {
77  return new IndirectChannel<YMonitorRep>(*this, entry->get, entry->set);
78  }
79  }
80 
81  return ElementBase::getChannel(aKey, create);
82 }
83 
84 
87 
88  for(const Entry *entry = entries; entry->name != 0; ++entry) {
89  image->setAttribute(entry->name, (this->*(entry->get))());
90  }
91 
92  return image;
93 }
94 
95 
97  return active ? Y : OFF;
98 }
virtual Plane getPlane() const
Get plane.
Definition: YMonitorRep.cpp:96
Interface for basic beam line object.
Definition: ElementBase.h:128
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
Definition: YMonitorRep.cpp:74
virtual void setElementLength(double length)
Set design length.
Definition: ElementBase.h:515
virtual Channel * getChannel(const std::string &aKey, bool create=false)
Construct a read/write channel.
Monitor is off (inactive).
Definition: Monitor.h:48
virtual double getElementLength() const
Get design length.
Definition: ElementBase.h:511
An image of an element.
Definition: ElementImage.h:35
virtual ElementImage * getImage() const
Construct an image.
void setAttribute(const std::string &aKey, double val)
Set value of an attribute.
virtual ElementBase * clone() const
Return clone.
Definition: YMonitorRep.cpp:69
Monitor acts on y-plane.
Definition: Monitor.h:52
Abstract interface for read/write access to variable.
Definition: Channel.h:32
virtual ElementImage * getImage() const
Construct an image.
Definition: YMonitorRep.cpp:85
Representation for a orbit position monitor.
Definition: YMonitorRep.h:31
const std::string name
Representation for an orbit position monitor.
Definition: MonitorRep.h:32
virtual ~YMonitorRep()
Definition: YMonitorRep.cpp:65
bool active
The active/inactive flag.
Definition: MonitorRep.h:94
Plane
Plane selection.
Definition: Monitor.h:46
Access to a [b]double[/b] data member.