source: PSPA/Interface_Web/trunk/pspaWT/sources/userInterface/src/GWt_abstractElementFactory.cc @ 487

Last change on this file since 487 was 487, checked in by touze, 10 years ago

ajout de quadrupole et sextupole

File size: 3.6 KB
Line 
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
11GWt_abstractElementFactory::GWt_abstractElementFactory()
12 :isDriftElementEnable(false),
13  isRFGunElementEnable(false),
14  isCellElementEnable(false),
15  isBendElementEnable(false),
16  isSolenoElementEnable(false),
17  isBeamElementEnable(false),
18  isFitElementEnable(false),
19  isSnapshotElementEnable(false),
20  isMPoleElementEnable(false),
21  isQPoleElementEnable(false),
22  isSPoleElementEnable(false)
23{}
24
25GWt_abstractElementFactory::~GWt_abstractElementFactory() 
26{
27  isDriftElementEnable = false;
28  isRFGunElementEnable = false;
29  isCellElementEnable = false;
30  isBendElementEnable = false;
31  isSolenoElementEnable = false;
32  isBeamElementEnable = false;
33  isFitElementEnable = false;
34  isSnapshotElementEnable = false;
35  isMPoleElementEnable = false;
36  isQPoleElementEnable = false;
37  isSPoleElementEnable = false;
38}
39
40GWt_elementDrift* GWt_abstractElementFactory::createDriftElement()
41{
42  if (isDriftElementEnable) {
43    return new GWt_elementDrift();
44  }
45  return NULL;
46}
47
48GWt_elementRfgun* GWt_abstractElementFactory::createRFGunElement() 
49{
50  if (isRFGunElementEnable) {
51    return new GWt_elementRfgun();
52  }
53  return NULL;
54}
55
56GWt_elementCell* GWt_abstractElementFactory::createCellElement()
57{
58  if (isCellElementEnable) {
59    return new GWt_elementCell();
60  }
61  return NULL;
62}
63
64GWt_elementBend* GWt_abstractElementFactory::createBendElement()
65{
66  if (isBendElementEnable) {
67    return new GWt_elementBend();
68  }
69  return NULL;
70}
71
72GWt_elementSoleno* GWt_abstractElementFactory::createSolenoElement()
73{
74  if (isSolenoElementEnable) {
75    return new GWt_elementSoleno();
76  }
77  return NULL;
78}
79
80GWt_elementBeam* GWt_abstractElementFactory::createBeamElement()
81{
82  if (isBeamElementEnable) {
83    return new GWt_elementBeam();
84  }
85  return NULL;
86}
87
88GWt_elementFit* GWt_abstractElementFactory::createFitElement()
89{
90  if (isFitElementEnable) {
91    return new GWt_elementFit();
92  }
93  return NULL;
94}
95
96GWt_elementSnapshot* GWt_abstractElementFactory::createSnapshotElement()
97{
98  if (isSnapshotElementEnable) {
99    return new GWt_elementSnapshot();
100  }
101  return NULL;
102}
103
104GWt_elementMpole* GWt_abstractElementFactory::createMPoleElement()
105{
106  if (isMPoleElementEnable) {
107    return new GWt_elementMpole();
108  }
109  return NULL;
110}
111
112GWt_elementQpole* GWt_abstractElementFactory::createQPoleElement()
113{
114  if (isQPoleElementEnable) {
115    return new GWt_elementQpole();
116  }
117  return NULL;
118}
119
120GWt_elementSpole* GWt_abstractElementFactory::createSPoleElement()
121{
122  if (isSPoleElementEnable) {
123    return new GWt_elementSpole();
124  }
125  return NULL;
126}
127
128vector <GWt_abstractElement*> GWt_abstractElementFactory::getAllElements()
129{
130  vector <GWt_abstractElement*> elems;
131  if (isRFGunElementEnable) {
132    elems.push_back(new GWt_elementRfgun());
133  }
134  if (isBeamElementEnable) {
135    elems.push_back(new GWt_elementBeam());
136  }
137  if (isDriftElementEnable) {
138    elems.push_back(new GWt_elementDrift());
139  }
140  if (isBendElementEnable) {
141    elems.push_back(new GWt_elementBend());
142  }
143  if (isCellElementEnable) {
144    elems.push_back(new GWt_elementCell());
145  }
146  if (isSolenoElementEnable) {
147    elems.push_back(new GWt_elementSoleno());
148  }
149  if (isFitElementEnable) {
150    elems.push_back(new GWt_elementFit());
151  }
152  if (isSnapshotElementEnable) {
153    elems.push_back(new GWt_elementSnapshot());
154  }
155  if (isMPoleElementEnable) {
156    elems.push_back(new GWt_elementMpole());
157  }
158  if (isQPoleElementEnable) {
159    elems.push_back(new GWt_elementQpole());
160  }
161  if (isSPoleElementEnable) {
162    elems.push_back(new GWt_elementSpole());
163  }
164
165  return elems;
166}
Note: See TracBrowser for help on using the repository browser.