OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Replacer.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: Replacer.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.1.1.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: Replacer
10 //
11 // ------------------------------------------------------------------------
12 //
13 // $Date: 2000/03/27 09:33:42 $
14 // $Author: Andreas Adelmann $
15 //
16 // ------------------------------------------------------------------------
17 
18 #include "Lines/Replacer.h"
22 #include "AbstractObjects/Object.h"
23 #include "Beamlines/Beamline.h"
25 
26 class Element;
27 
28 
29 // Class Replacer
30 // ------------------------------------------------------------------------
31 
32 Replacer::Replacer(const Beamline &beamline,
33  const std::string &name,
34  ElementBase *elm):
35  DefaultVisitor(beamline, false, false),
36  itsName(name),
37  newBase(elm)
38 {}
39 
40 
42 {}
43 
44 
46  // Find proper OPAL element.
47  const std::string &name = fep.getElement()->getName();
48 
49  // Do the required operations on the beamline or element.
50  if(name == itsName) {
52  const_cast<FlaggedElmPtr &>(fep).setElement(base);
53  } else {
55  }
56 }
const std::string name
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition: Element.h:125
std::string itsName
Definition: Object.h:255
virtual const std::string & getName() const
Get element name.
virtual ElementBase * copyStructure()
Make a structural copy.
virtual void visitFlaggedElmPtr(const FlaggedElmPtr &)
Apply the algorithm to a FlaggedElmPtr.
An abstract sequence of beam line components.
Definition: Beamline.h:34
ElementBase * getElement() const
Get the element pointer.
Definition: ElmPtr.h:58
A section of a beam line.
Definition: FlaggedElmPtr.h:36
const std::string itsName
Definition: Replacer.h:53
virtual ~Replacer()
Definition: Replacer.cpp:41
ElementBase * newBase
Definition: Replacer.h:56
virtual void visitFlaggedElmPtr(const FlaggedElmPtr &)
Apply the visitor to an FlaggedElmPtr.
Definition: Replacer.cpp:45