OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
ParallelPlateRep.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: ParallelPlateRep.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: ParallelPlateRep
10 // Defines a representation for a RF cavity.
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 
30 namespace {
31  struct Entry {
32  const char *name;
33  double(ParallelPlateRep::*get)() const;
34  void (ParallelPlateRep::*set)(double);
35  };
36 
37  static const Entry entries[] = {
38  {
39  "L",
42  },
43  {
44  "AMPLITUDE",
47  },
48  {
49  "FREQUENCY",
52  },
53  {
54  "PHASE",
57  },
58  { 0, 0, 0 }
59  };
60 }
61 
62 
63 // Class ParallelPlateRep
64 // ------------------------------------------------------------------------
65 
68 {}
69 
70 
72  ParallelPlate(right)
73 {}
74 
75 
77  ParallelPlate(name)
78 {}
79 
80 
82 {}
83 
84 
86  return new ParallelPlateRep(*this);
87 }
88 
89 
90 Channel *ParallelPlateRep::getChannel(const std::string &aKey, bool create) {
91  for(const Entry *entry = entries; entry->name != 0; ++entry) {
92  if(aKey == entry->name) {
93  return new IndirectChannel<ParallelPlateRep>(*this, entry->get, entry->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 *entry = entries; entry->name != 0; ++entry) {
123  image->setAttribute(entry->name, (this->*(entry->get))());
124  }
125 
126  return image;
127 }
StraightGeometry geometry
The cavity&#39;s geometry.
Interface for basic beam line object.
Definition: ElementBase.h:128
void setPhase(double phase)
virtual ElementBase * clone() const
Return clone.
void setFrequency(double freq)
Interface for RF cavity.
Definition: ParallelPlate.h:36
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 Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
void setAmplitude(double vPeak)
virtual double getElementLength() const
Get design length.
Definition: ElementBase.h:511
double getPhase() const
An image of an element.
Definition: ElementImage.h:35
virtual ElementImage * getImage() const
Construct an image.
AcceleratingField field
The cavity&#39;s field.
void setAttribute(const std::string &aKey, double val)
Set value of an attribute.
virtual ElementImage * getImage() const
Construct an image.
A geometry representing a straight line.
Abstract interface for read/write access to variable.
Definition: Channel.h:32
double getAmplitude() const
const std::string name
Representation for a RF cavity.
double getFrequency() const
virtual AcceleratingField & getField()
Get field.
virtual ~ParallelPlateRep()
Access to a [b]double[/b] data member.
virtual StraightGeometry & getGeometry()
Get geometry.