OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
XCorrectorRep.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: XCorrectorRep.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: XCorrectorRep
10 // Defines a concrete representation for a horizontal orbit corrector.
11 //
12 // ------------------------------------------------------------------------
13 // 02-Nov-98, Chris Iselin, CERN
14 // Original release.
15 // Class category: BeamlineCore
16 // ------------------------------------------------------------------------
17 //
18 // Revision History:
19 // $Date: 2000/03/27 09:32:34 $
20 // $Author: fci $
21 //
22 // ------------------------------------------------------------------------
23 
27 
28 
29 // Attribute access table.
30 // ------------------------------------------------------------------------
31 
32 namespace {
33  struct Entry {
34  const char *name;
35  double(XCorrectorRep::*get)() const;
36  void (XCorrectorRep::*set)(double);
37  };
38 
39  const Entry entries[] = {
40  {
41  "L",
44  },
45  {
46  "BY",
49  },
50  { 0, 0, 0 }
51  };
52 }
53 
54 
55 // Class XCorrectorRep
56 // ------------------------------------------------------------------------
57 
59  CorrectorRep()
60 {}
61 
62 
64  CorrectorRep(rhs)
65 {}
66 
67 
68 XCorrectorRep::XCorrectorRep(const std::string &name):
69  CorrectorRep(name)
70 {}
71 
72 
74 {}
75 
76 
78  return new XCorrectorRep(*this);
79 }
80 
81 
82 Channel *XCorrectorRep::getChannel(const std::string &aKey, bool create) {
83  for(const Entry *entry = entries; entry->name != 0; ++entry) {
84  if(aKey == entry->name) {
85  return new IndirectChannel<XCorrectorRep>(*this, entry->get, entry->set);
86  }
87  }
88 
89  return ElementBase::getChannel(aKey, create);
90 }
91 
92 
95 
96  for(const Entry *entry = entries; entry->name != 0; ++entry) {
97  image->setAttribute(entry->name, (this->*(entry->get))());
98  }
99 
100  return image;
101 }
102 
103 
105  return active ? X : OFF;
106 }
107 
108 
109 double XCorrectorRep::getBx() const {
110  return 0.0;
111 }
112 
113 
114 void XCorrectorRep::setBx(double) {
115  // Do nothing.
116 }
Representation of a closed orbit corrector.
Definition: CorrectorRep.h:33
virtual ElementImage * getImage() const
Construct an image.
Interface for basic beam line object.
Definition: ElementBase.h:128
Corrector is off (inactive).
Definition: Corrector.h:42
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.
virtual double getBy() const
Get vertical field component in Teslas.
virtual double getBx() const
Get field.
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
Plane
Plane selection.
Definition: Corrector.h:40
virtual ~XCorrectorRep()
virtual double getElementLength() const
Get design length.
Definition: ElementBase.h:511
Representation for an orbit corrector.
Definition: XCorrectorRep.h:31
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.
Corrector acts on x-plane.
Definition: Corrector.h:44
virtual ElementBase * clone() const
Return clone.
virtual void setBx(double)
Set field.
virtual void setBy(double)
Set vertical field component in Teslas.
Abstract interface for read/write access to variable.
Definition: Channel.h:32
const std::string name
virtual Plane getPlane() const
Get plane of action.
bool active
The active/inactive flag.
Definition: CorrectorRep.h:109
Access to a [b]double[/b] data member.