BeamlineVisitor.h 7.89 KB
Newer Older
gsell's avatar
gsell committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#ifndef CLASSIC_BeamlineVisitor_HH
#define CLASSIC_BeamlineVisitor_HH

// ------------------------------------------------------------------------
// $RCSfile: BeamlineVisitor.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: BeamlineVisitor
//   Defines the abstract interface for a BeamlineVisitor.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------

// Generic element classes interacting with a BeamlineVisitor.
class Component;

// Beam line structure classes.
class Beamline;
class AlignWrapper;
class CorrectorWrapper;
class FlaggedElmPtr;
class MultipoleWrapper;
class RBendWrapper;
class SBendWrapper;
class CyclotronWrapper;

// Specific element classes interacting with a BeamlineVisitor
class BeamBeam;
class Collimator;
class Corrector;
adelmann's avatar
adelmann committed
41
class Degrader;
gsell's avatar
gsell committed
42 43
class Diagnostic;
class Drift;
44
class FlexibleCollimator;
gsell's avatar
gsell committed
45 46 47 48
class Lambertson;
class Marker;
class Monitor;
class Multipole;
ext-rogers_c's avatar
ext-rogers_c committed
49
class MultipoleT;
50
class Offset;
gsell's avatar
gsell committed
51 52 53
class Patch;
class Probe;
class RBend;
54
class RBend3D;
gsell's avatar
gsell committed
55
class RFCavity;
56
class VariableRFCavity;
gsell's avatar
gsell committed
57 58 59
class TravelingWave;
class RFQuadrupole;
class SBend;
60
class SBend3D;
61
class ScalingFFAGMagnet;
gsell's avatar
gsell committed
62 63 64 65
class Cyclotron;
class Separator;
class Septum;
class Solenoid;
66
class Source;
gsell's avatar
gsell committed
67 68 69
class ParallelPlate;
class CyclotronValley;
class Stripper;
kraus's avatar
kraus committed
70
class Ring;
71

gsell's avatar
gsell committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
// Integrators.
class Integrator;
class MapIntegrator;
class TrackIntegrator;


// Class BeamlineVisitor
// ------------------------------------------------------------------------
/// Abstract algorithm.
//  The abstract class BeamlineVisitor is the base class for all visitors
//  (algorithms) that can iterator over a beam line representation.
//  A BeamlineVisitor applies itself to the representation via the
//  ``Visitor'' pattern, see
//  [p]
//  E. Gamma, R. Helm, R. Johnson, and J. Vlissides,
//  [BR]
//  Design Patterns, Elements of Reusable Object-Oriented Software.
//  [p]
//  By using only pure abstract classes as an interface between the
//  BeamlineVisitor and the beam line representation,
//  we decouple the former from the implementation details of the latter.
//  [p]
//  The interface is defined in such a way that a visitor cannot modify the
//  structure of a beam line, but it can assign special data like misalignments
//  or integrators without problems.

class BeamlineVisitor {

public:

    BeamlineVisitor();
    virtual ~BeamlineVisitor();

    /// Execute the algorithm on the attached beam line.
    virtual void execute() = 0;

    /// Apply the algorithm to a beam-beam interaction.
    virtual void visitBeamBeam(const BeamBeam &) = 0;

    /// Apply the algorithm to a collimator.
    virtual void visitCollimator(const Collimator &) = 0;

    /// Apply the algorithm to an arbitrary component (catch all).
    virtual void visitComponent(const Component &) = 0;

    /// Apply the algorithm to a closed orbit corrector.
    virtual void visitCorrector(const Corrector &) = 0;

adelmann's avatar
adelmann committed
120 121 122
    /// Apply the algorithm to a diagnostic.
    virtual void visitDegrader(const Degrader &) = 0;

gsell's avatar
gsell committed
123 124 125 126 127 128
    /// Apply the algorithm to a diagnostic.
    virtual void visitDiagnostic(const Diagnostic &) = 0;

    /// Apply the algorithm to a drift space.
    virtual void visitDrift(const Drift &) = 0;

129 130 131
    /// Apply the algorithm to a flexible collimator
    virtual void visitFlexibleCollimator(const FlexibleCollimator &) = 0;

kraus's avatar
kraus committed
132 133
    /// Apply the algorithm to an Ring
    virtual void visitRing(const Ring &) = 0;
134

gsell's avatar
gsell committed
135 136 137 138 139 140
    /// Apply the algorithm to a cyclotron.
    virtual void visitCyclotron(const Cyclotron &) = 0;

    /// Apply the algorithm to a Lambertson septum magnet.
    virtual void visitLambertson(const Lambertson &) = 0;

141 142 143
    /// Apply the algorithm to an Offset (placement).
    virtual void visitOffset(const Offset &) = 0;

gsell's avatar
gsell committed
144 145 146 147 148 149 150 151 152
    /// Apply the algorithm to a marker.
    virtual void visitMarker(const Marker &) = 0;

    /// Apply the algorithm to a beam position monitor.
    virtual void visitMonitor(const Monitor &) = 0;

    /// Apply the algorithm to a multipole.
    virtual void visitMultipole(const Multipole &) = 0;

ext-rogers_c's avatar
ext-rogers_c committed
153 154 155
    /// Apply the algorithm to an arbitrary straight Multipole.
    virtual void visitMultipoleT(const MultipoleT &) = 0;

gsell's avatar
gsell committed
156 157 158 159 160 161 162 163 164
    /// Apply the algorithm to a patch.
    virtual void visitPatch(const Patch &) = 0;

    /// Apply the algorithm to a probe.
    virtual void visitProbe(const Probe &) = 0;

    /// Apply the algorithm to a rectangular bend.
    virtual void visitRBend(const RBend &) = 0;

165 166 167
    /// Apply the algorithm to a rectangular bend.
    virtual void visitRBend3D(const RBend3D &);

gsell's avatar
gsell committed
168 169 170
    /// Apply the algorithm to a RF cavity.
    virtual void visitRFCavity(const RFCavity &) = 0;

171 172 173
    /// Apply the algorithm to a variable RF cavity.
    virtual void visitVariableRFCavity(const VariableRFCavity &) = 0;

gsell's avatar
gsell committed
174 175 176 177 178 179 180 181 182
    /// Apply the algorithm to a RF cavity.
    virtual void visitTravelingWave(const TravelingWave &) = 0;

    /// Apply the algorithm to a RF quadrupole.
    virtual void visitRFQuadrupole(const RFQuadrupole &) = 0;

    /// Apply the algorithm to a sector bend.
    virtual void visitSBend(const SBend &) = 0;

183 184 185
    /// Apply the algorithm to a Sector Bend with 3D field map.
    virtual void visitSBend3D(const SBend3D &) = 0;

gsell's avatar
gsell committed
186 187 188 189 190 191 192 193 194
    /// Apply the algorithm to an electrostatic separator.
    virtual void visitSeparator(const Separator &) = 0;

    /// Apply the algorithm to a septum magnet.
    virtual void visitSeptum(const Septum &) = 0;

    /// Apply the algorithm to a solenoid.
    virtual void visitSolenoid(const Solenoid &) = 0;

195
    /// Apply the algorithm to a solenoid.
196
    virtual void visitScalingFFAGMagnet(const ScalingFFAGMagnet &) = 0;
197

198 199 200
    /// Apply the algorithm to a source.
    virtual void visitSource(const Source &) = 0;

gsell's avatar
gsell committed
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
    /// Apply the algorithm to a Beamline.
    virtual void visitBeamline(const Beamline &) = 0;

    /// Apply the algorithm to a FlaggedElmPtr.
    virtual void visitFlaggedElmPtr(const FlaggedElmPtr &) = 0;

    /// Apply the algorithm to an align wrapper.
    virtual void visitAlignWrapper(const AlignWrapper &) = 0;

    /// Apply the algorithm to an corrector wrapper.
    virtual void visitCorrectorWrapper(const CorrectorWrapper &) = 0;

    /// Apply the algorithm to an corrector wrapper.
    virtual void visitCyclotronWrapper(const CyclotronWrapper &) = 0;

    /// Apply the algorithm to an multipole wrapper.
    virtual void visitMultipoleWrapper(const MultipoleWrapper &) = 0;

    /// Apply the algorithm to an RBend wrapper.
    virtual void visitRBendWrapper(const RBendWrapper &) = 0;

    /// Apply the algorithm to an SBend wrapper.
    virtual void visitSBendWrapper(const SBendWrapper &) = 0;

    /// Apply the algorithm to an ParallelPlate.
    virtual void visitParallelPlate(const ParallelPlate &) = 0;

    /// Apply the algorithm to a CyclotronValley.
    virtual void visitCyclotronValley(const CyclotronValley &) = 0;

    /// Apply the algorithm to a particle stripper.
    virtual void visitStripper(const Stripper &) = 0;

    /// Apply the algorithm to a generic integrator.
    virtual void visitIntegrator(const Integrator &) = 0;

    /// Apply the algorithm to an integrator capable of tracking.
    virtual void visitTrackIntegrator(const TrackIntegrator &) = 0;

    /// Apply the algorithm to an integrator capable of mapping.
    virtual void visitMapIntegrator(const MapIntegrator &) = 0;

private:

    // Not implemented.
    BeamlineVisitor(const BeamlineVisitor &);
    void operator=(const BeamlineVisitor &);
};

250 251 252 253 254
inline
void BeamlineVisitor::visitRBend3D(const RBend3D &) {

}

255
#endif // CLASSIC_BeamlineVisitor_HH