OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
YCorrectorRep.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: YCorrectorRep.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: YCorrectorRep
10 // Defines a concrete representation for a vertical orbit corrector.
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(YCorrectorRep::*get)() const;
33  void (YCorrectorRep::*set)(double);
34  };
35 
36  const Entry entries[] = {
37  {
38  "L",
41  },
42  {
43  "BX",
46  },
47  { 0, 0, 0 }
48  };
49 }
50 
51 
52 // Class YCorrectorRep
53 // ------------------------------------------------------------------------
54 
56  CorrectorRep()
57 {}
58 
59 
61  CorrectorRep(right)
62 {}
63 
64 
65 YCorrectorRep::YCorrectorRep(const std::string &name):
66  CorrectorRep(name)
67 {}
68 
69 
71 {}
72 
73 
75  return new YCorrectorRep(*this);
76 }
77 
78 
79 Channel *YCorrectorRep::getChannel(const std::string &aKey, bool create) {
80  for(const Entry *entry = entries; entry->name != 0; ++entry) {
81  if(aKey == entry->name) {
82  return new IndirectChannel<YCorrectorRep>(*this, entry->get, entry->set);
83  }
84  }
85 
86  return ElementBase::getChannel(aKey, create);
87 }
88 
89 
92 
93  for(const Entry *entry = entries; entry->name != 0; ++entry) {
94  image->setAttribute(entry->name, (this->*(entry->get))());
95  }
96 
97  return image;
98 }
99 
100 
102  return Y;
103 }
104 
105 
106 double YCorrectorRep::getBy() const {
107  return 0.0;
108 }
109 
110 
111 void YCorrectorRep::setBy(double) {
112  // Do nothing.
113 }
Representation of a closed orbit corrector.
Definition: CorrectorRep.h:33
Interface for basic beam line object.
Definition: ElementBase.h:128
virtual double getBy() const
Get field.
virtual ~YCorrectorRep()
virtual ElementBase * clone() const
Return clone.
virtual void setElementLength(double length)
Set design length.
Definition: ElementBase.h:515
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
virtual Channel * getChannel(const std::string &aKey, bool create=false)
Construct a read/write channel.
virtual ElementImage * getImage() const
Construct an image.
virtual double getBx() const
Get horizontal field component in Teslas.
virtual Plane getPlane() const
Get plane.
Plane
Plane selection.
Definition: Corrector.h:40
virtual double getElementLength() const
Get design length.
Definition: ElementBase.h:511
virtual void setBy(double)
Set field.
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 y-plane.
Definition: Corrector.h:46
Abstract interface for read/write access to variable.
Definition: Channel.h:32
const std::string name
virtual void setBx(double)
Set horizontal field component in Teslas.
Representation for an orbit corrector.
Definition: YCorrectorRep.h:31
Access to a [b]double[/b] data member.