OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
SeparatorRep.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: SeparatorRep.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: SeparatorRep
10 // Defines the abstract interface for an electrostatic separator.
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(SeparatorRep::*get)() const;
33  void (SeparatorRep::*set)(double);
34  };
35 
36  const Entry entries[] = {
37  {
38  "L",
41  },
42  {
43  "EX",
46  },
47  {
48  "EY",
51  },
52  { 0, 0, 0 }
53  };
54 }
55 
56 
57 // Class SeparatorRep
58 // ------------------------------------------------------------------------
59 
61  Separator(),
62  geometry(),
63  field()
64 {}
65 
66 
68  Separator(right),
69  geometry(right.geometry),
70  field(right.field)
71 {}
72 
73 
74 SeparatorRep::SeparatorRep(const std::string &name):
75  Separator(name),
76  geometry(),
77  field()
78 {}
79 
80 
82 {}
83 
84 
86  return new SeparatorRep(*this);
87 }
88 
89 
90 Channel *SeparatorRep::getChannel(const std::string &aKey, bool create) {
91  for(const Entry *table = entries; table->name != 0; ++table) {
92  if(aKey == table->name) {
93  return new IndirectChannel<SeparatorRep>(*this, table->get, table->set);
94  }
95  }
96 
97  return ElementBase::getChannel(aKey, create);
98 }
99 
100 
102  return field;
103 }
104 
106  return field;
107 }
108 
109 
111  return geometry;
112 }
113 
115  return geometry;
116 }
117 
118 
121 
122  for(const Entry *table = entries; table->name != 0; ++table) {
123  image->setAttribute(table->name, (this->*(table->get))());
124  }
125 
126  return image;
127 }
128 
129 
130 double SeparatorRep::getEx() const {
131  return field.getEx();
132 }
133 
134 
135 double SeparatorRep::getEy() const {
136  return field.getEy();
137 }
138 
139 
140 void SeparatorRep::setEx(double value) {
141  field.setEx(value);
142 }
143 
144 
145 void SeparatorRep::setEy(double value) {
146  field.setEy(value);
147 }
StraightGeometry geometry
The separator geometry.
Definition: SeparatorRep.h:96
A static homogeneous electrostatic field in the (x,y)-plane.
Definition: EDipoleField.h:30
virtual double getEy() const
Get component.
virtual void setEx(double)
Set component.
Interface for basic beam line object.
Definition: ElementBase.h:128
Interface for electrostatic separator.
Definition: Separator.h:33
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.
Representation for an electrostatic separator.
Definition: SeparatorRep.h:32
virtual EDipoleField & getField()
Get field.
EDipoleField field
The separator field.
Definition: SeparatorRep.h:99
virtual double getElementLength() const
Get design length.
Definition: ElementBase.h:511
virtual ~SeparatorRep()
An image of an element.
Definition: ElementImage.h:35
virtual ElementImage * getImage() const
Construct an image.
virtual double getEy() const
Get component.
void setAttribute(const std::string &aKey, double val)
Set value of an attribute.
virtual double getEx() const
Get component.
A geometry representing a straight line.
Abstract interface for read/write access to variable.
Definition: Channel.h:32
virtual void setEy(double Ey)
Set component.
virtual ElementBase * clone() const
Return clone.
const std::string name
virtual StraightGeometry & getGeometry()
Get geometry.
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
virtual ElementImage * getImage() const
Construct an image.
virtual double getEx() const
Get component.
virtual void setEy(double)
Set component.
Access to a [b]double[/b] data member.
virtual void setEx(double Ex)
Set component.