OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
OpalHMonitor.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: OpalHMonitor.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: OpalHMonitor
10 // The class of OPAL monitors for the horizontal plane.
11 //
12 // ------------------------------------------------------------------------
13 //
14 // $Date: 2000/03/27 09:33:39 $
15 // $Author: Andreas Adelmann $
16 //
17 // ------------------------------------------------------------------------
18 
19 #include "Elements/OpalHMonitor.h"
21 #include "Attributes/Attributes.h"
23 
24 
25 // Class OpalHMonitor
26 // ------------------------------------------------------------------------
27 
28 
30  OpalElement(COMMON, "HMONITOR",
31  "The \"HMONITOR\" element defines a monitor "
32  "for the horizontal plane.") {
33  setElement((new XMonitorRep("HMONITOR"))->makeAlignWrapper());
34 }
35 
36 
37 OpalHMonitor::OpalHMonitor(const std::string &name, OpalHMonitor *parent):
38  OpalElement(name, parent) {
39  setElement((new XMonitorRep(name))->makeAlignWrapper());
40 }
41 
42 
44 {}
45 
46 
47 OpalHMonitor *OpalHMonitor::clone(const std::string &name) {
48  return new OpalHMonitor(name, this);
49 }
50 
51 
54 
55  XMonitorRep *mon =
56  dynamic_cast<XMonitorRep *>(getElement()->removeWrappers());
57  double length = Attributes::getReal(itsAttr[LENGTH]);
58  mon->setElementLength(length);
59 
60  // Transmit "unknown" attributes.
62 }
The HMONITOR element.
Definition: OpalHMonitor.h:28
virtual ElementBase * removeWrappers()
Return the design element.
virtual void setElementLength(double length)
Set design length.
Definition: ElementBase.h:515
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
Definition: Object.h:214
Representation for a orbit position monitor.
Definition: XMonitorRep.h:31
virtual void update()
Update the embedded CLASSIC monitor.
virtual OpalHMonitor * clone(const std::string &name)
Make clone.
Base class for all beam line elements.
Definition: OpalElement.h:41
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition: Element.h:133
virtual void update()
Update the embedded CLASSIC element.
virtual void updateUnknown(ElementBase *)
Transmit the ``unknown&#39;&#39; (not known to OPAL) attributes to CLASSIC.
OpalHMonitor()
Exemplar constructor.
ElementBase * getElement() const
Return the embedded CLASSIC element.
Definition: Element.h:128
const std::string name
double getReal(const Attribute &attr)
Return real value.
Definition: Attributes.cpp:217
virtual ~OpalHMonitor()