OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
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// Class Replacer
29// ------------------------------------------------------------------------
30
31Replacer::Replacer(const Beamline& beamline, const std::string& name, ElementBase* elm)
32 : DefaultVisitor(beamline, false, false), itsName(name), newBase(elm) {}
33
35
37 // Find proper OPAL element.
38 const std::string& name = fep.getElement()->getName();
39
40 // Do the required operations on the beamline or element.
41 if (name == itsName) {
43 const_cast<FlaggedElmPtr&>(fep).setElement(base);
44 } else {
46 }
47}
An abstract sequence of beam line components.
Definition Beamline.h:34
void visitFlaggedElmPtr(const FlaggedElmPtr &) override
Apply the algorithm to a FlaggedElmPtr.
virtual const std::string & getName() const
Get element name.
virtual ElementBase * copyStructure()
Make a structural copy.
ElementBase * getElement() const
Get the element pointer.
Definition ElmPtr.h:56
A section of a beam line.
std::string itsName
Definition Object.h:247
const std::string itsName
Definition Replacer.h:49
virtual ~Replacer()
Definition Replacer.cpp:34
ElementBase * newBase
Definition Replacer.h:52
virtual void visitFlaggedElmPtr(const FlaggedElmPtr &)
Apply the visitor to an FlaggedElmPtr.
Definition Replacer.cpp:36