OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
BeamStrippingRep.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: BeamStrippingRep.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: BeamStrippingRep
10 // Defines a concrete collimator representation.
11 //
12 // ------------------------------------------------------------------------
13 // Class category: BeamlineCore
14 // ------------------------------------------------------------------------
15 // $Date: 2018/11 $
16 // $Author: PedroCalvo$
17 // ------------------------------------------------------------------------
18 
22 
23 // Attribute access table.
24 // ------------------------------------------------------------------------
25 
26 namespace {
27  struct Entry {
28  const char *name;
29  double(BeamStrippingRep::*get)() const;
30  void (BeamStrippingRep::*set)(double);
31  };
32  const Entry entries[] = {
33  {
34  "p",
37  },
38  { 0, 0, 0 }
39  };
40 }
41 
42 
43 // Class BeamStrippingRep
44 // ------------------------------------------------------------------------
45 
47  BeamStripping(),
48  geometry(0.0, 0.0)
49 {}
50 
52  BeamStripping(right),
53  geometry(0.0, 0.0)
54 {}
55 
57  BeamStripping(name),
58  geometry(0.0, 0.0)
59 {}
60 
62 {}
63 
64 
66  return new BeamStrippingRep(*this);
67 }
68 
69 
70 Channel *BeamStrippingRep::getChannel(const std::string &aKey, bool create) {
71  for(const Entry *entry = entries; entry->name != 0; ++entry) {
72  if(aKey == entry->name) {
73  return new IndirectChannel<BeamStrippingRep>(*this, entry->get, entry->set);
74  }
75  }
76  return ElementBase::getChannel(aKey, create);
77 }
78 
79 
81  return field;
82 }
83 
85  return field;
86 }
87 
88 
90  return geometry;
91 }
92 
94  return geometry;
95 }
96 
97 
100 
101  for(const Entry *entry = entries; entry->name != 0; ++entry) {
102  image->setAttribute(entry->name, (this->*(entry->get))());
103  }
104 
105  return image;
106 }
Interface for basic beam line object.
Definition: ElementBase.h:128
A simple arc in the XZ plane.
double getPressure() const
virtual Channel * getChannel(const std::string &aKey, bool create=false)
Construct a read/write channel.
virtual ElementImage * getImage() const
Construct an image.
Representation for a beam stripping.
A zero electromagnetic field.
Definition: NullField.h:30
An image of an element.
Definition: ElementImage.h:35
virtual ElementImage * getImage() const
Construct an image.
PlanarArcGeometry geometry
virtual ElementBase * clone() const
Return clone.
void setAttribute(const std::string &aKey, double val)
Set value of an attribute.
void setPressure(double pressure)
Abstract interface for read/write access to variable.
Definition: Channel.h:32
virtual PlanarArcGeometry & getGeometry()
Get geometry.
const std::string name
virtual NullField & getField()
Get field.
virtual ~BeamStrippingRep()
virtual Channel * getChannel(const std::string &aKey, bool=false)
Construct a read/write channel.
Access to a [b]double[/b] data member.