OPAL (Object Oriented Parallel Accelerator Library) 2022.1
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"
23#include "Beamlines/Beamline.h"
25
26class Element;
27
28
29// Class Replacer
30// ------------------------------------------------------------------------
31
33 const std::string &name,
34 ElementBase *elm):
35 DefaultVisitor(beamline, false, false),
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