OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
CCollimatorRep.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: CCollimatorRep.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: CCollimatorRep
10 // Defines a concrete collimator representation.
11 //
12 // ------------------------------------------------------------------------
13 // Class category: BeamlineCore
14 // ------------------------------------------------------------------------
15 //
16 // $Date: 2000/03/27 09:32:33 $
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(CCollimatorRep::*get)() const;
33  void (CCollimatorRep::*set)(double);
34  };
35 
36  const Entry entries[] = {
37  {
38  "L",
41  },
42  { 0, 0, 0 }
43  };
44 }
45 
46 
47 // Class CCollimatorRep
48 // ------------------------------------------------------------------------
49 
51  CCollimator(),
52  geometry(0.0)
53 {}
54 
55 
57  CCollimator(right),
58  geometry(right.geometry)
59 {}
60 
61 
63  CCollimator(name),
64  geometry()
65 {}
66 
67 
69 {}
70 
71 
73  return new CCollimatorRep(*this);
74 }
75 
76 
77 Channel *CCollimatorRep::getChannel(const std::string &aKey, bool create) {
78  for(const Entry *entry = entries; entry->name != 0; ++entry) {
79  if(aKey == entry->name) {
80  return new IndirectChannel<CCollimatorRep>(*this, entry->get, entry->set);
81  }
82  }
83 
84  return ElementBase::getChannel(aKey, create);
85 }
86 
87 
89  return field;
90 }
91 
93  return field;
94 }
95 
96 
98  return geometry;
99 }
100 
102  return geometry;
103 }
104 
105 
108 
109  for(const Entry *entry = entries; entry->name != 0; ++entry) {
110  image->setAttribute(entry->name, (this->*(entry->get))());
111  }
112 
113  return image;
114 }
115 
116 
117 /*
118 double CCollimatorRep::getXsize() const
119 {
120  return xSize;
121 }
122 
123 double CCollimatorRep::getYsize() const
124 {
125  return ySize;
126 }
127 
128 void CCollimatorRep::setXsize(double size)
129 {
130  INFOMSG("void CCollimatorRep::setXsize(double size) " << xSize << endl;);
131  xSize = size;
132 }
133 
134 void CCollimatorRep::setYsize(double size)
135 {
136  ySize = size;
137 }
138 */
Interface for basic beam line object.
Definition: ElementBase.h:128
virtual ElementBase * clone() const
Return clone.
Representation for a collimator.
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.
A zero electromagnetic field.
Definition: NullField.h:30
virtual double getElementLength() const
Get design length.
Definition: ElementBase.h:511
virtual ElementImage * getImage() const
Construct an image.
An image of an element.
Definition: ElementImage.h:35
virtual ElementImage * getImage() const
Construct an image.
Interface for cyclotron collimator.
Definition: CCollimator.h:13
void setAttribute(const std::string &aKey, double val)
Set value of an attribute.
virtual NullField & getField()
Get field.
A geometry representing a straight line.
virtual StraightGeometry & getGeometry()
Get geometry.
Abstract interface for read/write access to variable.
Definition: Channel.h:32
const std::string name
NullField field
virtual ~CCollimatorRep()
StraightGeometry geometry
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
Access to a [b]double[/b] data member.