[289] | 1 | // |
---|
| 2 | // GWt_abstractElementFactory.cc |
---|
| 3 | // PSPA |
---|
| 4 | // |
---|
| 5 | // Created by Garnier Laurent on 28/01/13. |
---|
| 6 | // Copyright (c) 2013 Garnier Laurent. All rights reserved. |
---|
| 7 | // |
---|
| 8 | |
---|
| 9 | #include "GWt_abstractElementFactory.h" |
---|
| 10 | |
---|
[343] | 11 | GWt_abstractElementFactory::GWt_abstractElementFactory() |
---|
| 12 | :isDriftElementEnable(false), |
---|
| 13 | isRFGunElementEnable(false), |
---|
| 14 | isCellElementEnable(false), |
---|
| 15 | isBendElementEnable(false), |
---|
| 16 | isSolenoElementEnable(false), |
---|
| 17 | isBeamElementEnable(false), |
---|
| 18 | isFitElementEnable(false), |
---|
[431] | 19 | isSnapshotElementEnable(false), |
---|
| 20 | isMPoleElementEnable(false) |
---|
[343] | 21 | {} |
---|
[289] | 22 | |
---|
[343] | 23 | GWt_abstractElementFactory::~GWt_abstractElementFactory() |
---|
[289] | 24 | { |
---|
[343] | 25 | isDriftElementEnable = false; |
---|
| 26 | isRFGunElementEnable = false; |
---|
| 27 | isCellElementEnable = false; |
---|
| 28 | isBendElementEnable = false; |
---|
| 29 | isSolenoElementEnable = false; |
---|
| 30 | isBeamElementEnable = false; |
---|
| 31 | isFitElementEnable = false; |
---|
| 32 | isSnapshotElementEnable = false; |
---|
[431] | 33 | isMPoleElementEnable = false; |
---|
[289] | 34 | } |
---|
| 35 | |
---|
[437] | 36 | GWt_elementDrift* GWt_abstractElementFactory::createDriftElement() |
---|
[343] | 37 | { |
---|
| 38 | if (isDriftElementEnable) { |
---|
[437] | 39 | return new GWt_elementDrift(); |
---|
[343] | 40 | } |
---|
| 41 | return NULL; |
---|
| 42 | } |
---|
[289] | 43 | |
---|
[437] | 44 | GWt_elementRfgun* GWt_abstractElementFactory::createRFGunElement() |
---|
[343] | 45 | { |
---|
| 46 | if (isRFGunElementEnable) { |
---|
[437] | 47 | return new GWt_elementRfgun(); |
---|
[343] | 48 | } |
---|
| 49 | return NULL; |
---|
[289] | 50 | } |
---|
| 51 | |
---|
[437] | 52 | GWt_elementCell* GWt_abstractElementFactory::createCellElement() |
---|
[343] | 53 | { |
---|
| 54 | if (isCellElementEnable) { |
---|
[437] | 55 | return new GWt_elementCell(); |
---|
[343] | 56 | } |
---|
| 57 | return NULL; |
---|
[289] | 58 | } |
---|
| 59 | |
---|
[437] | 60 | GWt_elementBend* GWt_abstractElementFactory::createBendElement() |
---|
[343] | 61 | { |
---|
| 62 | if (isBendElementEnable) { |
---|
[437] | 63 | return new GWt_elementBend(); |
---|
[343] | 64 | } |
---|
| 65 | return NULL; |
---|
[289] | 66 | } |
---|
| 67 | |
---|
[437] | 68 | GWt_elementSoleno* GWt_abstractElementFactory::createSolenoElement() |
---|
[343] | 69 | { |
---|
| 70 | if (isSolenoElementEnable) { |
---|
[437] | 71 | return new GWt_elementSoleno(); |
---|
[343] | 72 | } |
---|
| 73 | return NULL; |
---|
[289] | 74 | } |
---|
| 75 | |
---|
[437] | 76 | GWt_elementBeam* GWt_abstractElementFactory::createBeamElement() |
---|
[343] | 77 | { |
---|
| 78 | if (isBeamElementEnable) { |
---|
[437] | 79 | return new GWt_elementBeam(); |
---|
[343] | 80 | } |
---|
| 81 | return NULL; |
---|
[289] | 82 | } |
---|
| 83 | |
---|
[437] | 84 | GWt_elementFit* GWt_abstractElementFactory::createFitElement() |
---|
[289] | 85 | { |
---|
[343] | 86 | if (isFitElementEnable) { |
---|
[437] | 87 | return new GWt_elementFit(); |
---|
[343] | 88 | } |
---|
| 89 | return NULL; |
---|
[289] | 90 | } |
---|
| 91 | |
---|
[437] | 92 | GWt_elementSnapshot* GWt_abstractElementFactory::createSnapshotElement() |
---|
[343] | 93 | { |
---|
| 94 | if (isSnapshotElementEnable) { |
---|
[437] | 95 | return new GWt_elementSnapshot(); |
---|
[343] | 96 | } |
---|
| 97 | return NULL; |
---|
[289] | 98 | } |
---|
| 99 | |
---|
[437] | 100 | GWt_elementMpole* GWt_abstractElementFactory::createMPoleElement() |
---|
[431] | 101 | { |
---|
| 102 | if (isMPoleElementEnable) { |
---|
[437] | 103 | return new GWt_elementMpole(); |
---|
[431] | 104 | } |
---|
| 105 | return NULL; |
---|
| 106 | } |
---|
| 107 | |
---|
[343] | 108 | vector <GWt_abstractElement*> GWt_abstractElementFactory::getAllElements() |
---|
| 109 | { |
---|
| 110 | vector <GWt_abstractElement*> elems; |
---|
[401] | 111 | if (isRFGunElementEnable) { |
---|
[437] | 112 | elems.push_back(new GWt_elementRfgun()); |
---|
[343] | 113 | } |
---|
| 114 | if (isBeamElementEnable) { |
---|
[437] | 115 | elems.push_back(new GWt_elementBeam()); |
---|
[343] | 116 | } |
---|
[401] | 117 | if (isDriftElementEnable) { |
---|
[437] | 118 | elems.push_back(new GWt_elementDrift()); |
---|
[401] | 119 | } |
---|
[343] | 120 | if (isBendElementEnable) { |
---|
[437] | 121 | elems.push_back(new GWt_elementBend()); |
---|
[343] | 122 | } |
---|
| 123 | if (isCellElementEnable) { |
---|
[437] | 124 | elems.push_back(new GWt_elementCell()); |
---|
[343] | 125 | } |
---|
[401] | 126 | if (isSolenoElementEnable) { |
---|
[437] | 127 | elems.push_back(new GWt_elementSoleno()); |
---|
[401] | 128 | } |
---|
[343] | 129 | if (isFitElementEnable) { |
---|
[437] | 130 | elems.push_back(new GWt_elementFit()); |
---|
[343] | 131 | } |
---|
| 132 | if (isSnapshotElementEnable) { |
---|
[437] | 133 | elems.push_back(new GWt_elementSnapshot()); |
---|
[343] | 134 | } |
---|
[431] | 135 | if (isMPoleElementEnable) { |
---|
[437] | 136 | elems.push_back(new GWt_elementMpole()); |
---|
[431] | 137 | } |
---|
[289] | 138 | |
---|
[343] | 139 | return elems; |
---|
[289] | 140 | } |
---|