OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
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 }
Interface for basic beam line object.
Definition: ElementBase.h:128
ElementBase * newBase
Definition: Replacer.h:56
virtual void visitFlaggedElmPtr(const FlaggedElmPtr &)
Apply the algorithm to a FlaggedElmPtr.
virtual const std::string & getName() const
Get element name.
Definition: ElementBase.cpp:95
Default algorithms.
The base class for all OPAL elements.
Definition: Element.h:46
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition: Element.h:133
virtual ElementBase * copyStructure()
Make a structural copy.
virtual ~Replacer()
Definition: Replacer.cpp:41
An abstract sequence of beam line components.
Definition: Beamline.h:37
virtual void visitFlaggedElmPtr(const FlaggedElmPtr &)
Apply the visitor to an FlaggedElmPtr.
Definition: Replacer.cpp:45
const std::string name
const std::string itsName
Definition: Replacer.h:53
ElementBase * getElement() const
Get the element pointer.
Definition: ElmPtr.h:58
std::string itsName
Definition: Object.h:253
A section of a beam line.
Definition: FlaggedElmPtr.h:36