OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
OPAL
OpalMarker.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: OpalMarker.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.4 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: OpalMarker
10 // The class of OPAL markers.
11 //
12 // ------------------------------------------------------------------------
13 //
14 // $Date: 2002/01/22 15:16:02 $
15 // $Author: jsberg $
16 //
17 // ------------------------------------------------------------------------
18 
19 #include "Elements/OpalMarker.h"
21 #include "Utilities/Options.h"
22 #include "BeamlineCore/MarkerRep.h"
23 
24 #include <iostream>
25 
26 using namespace std;
27 
28 // Class OpalMarker
29 // ------------------------------------------------------------------------
30 
32  OpalElement(COMMON, "MARKER",
33  "The \"MARKER\" element defines a marker.") {
34  setElement(new MarkerRep("MARKER"));
35 
36  // Construct the begin marker for beam lines.
37  OpalMarker *S = new OpalMarker("#S", this);
38  S->getElement()->makeSharable();
39  S->builtin = true;
41 
42  // Construct the end marker for beam lines.
43  OpalMarker *E = new OpalMarker("#E", this);
44  E->getElement()->makeSharable();
45  E->builtin = true;
47 }
48 
49 
50 OpalMarker::OpalMarker(const std::string &name, OpalMarker *parent):
51  OpalElement(name, parent) {
52  setElement(new MarkerRep(name));
53 }
54 
55 
57 {}
58 
59 
60 OpalMarker *OpalMarker::clone(const std::string &name) {
61  return new OpalMarker(name, this);
62 }
63 
64 
65 void OpalMarker::print(std::ostream &os) const {
67 }
68 
69 
71  // Transmit "unknown" attributes.
72  MarkerRep *mark = dynamic_cast<MarkerRep *>(getElement());
74 }
Representation for a marker element.
Definition: MarkerRep.h:32
void create(Object *newObject)
Create new object.
Definition: OpalData.cpp:524
virtual OpalMarker * clone(const std::string &name)
Make clone.
Definition: OpalMarker.cpp:60
OpalMarker()
Exemplar constructor.
Definition: OpalMarker.cpp:31
The MARKER element.
Definition: OpalMarker.h:28
virtual ~OpalMarker()
Definition: OpalMarker.cpp:56
virtual void makeSharable()
Set sharable flag.
virtual void print(std::ostream &) const
Print the element.
Definition: OpalMarker.cpp:65
static OpalData * getInstance()
Definition: OpalData.cpp:209
Base class for all beam line elements.
Definition: OpalElement.h:41
void setElement(ElementBase *)
Assign new CLASSIC element.
Definition: Element.h:133
virtual void updateUnknown(ElementBase *)
Transmit the ``unknown&#39;&#39; (not known to OPAL) attributes to CLASSIC.
ElementBase * getElement() const
Return the embedded CLASSIC element.
Definition: Element.h:128
virtual void update()
Update the embedded CLASSIC marker.
Definition: OpalMarker.cpp:70
const std::string name
bool builtin
Built-in flag.
Definition: Object.h:231
virtual void print(std::ostream &) const
Print the object.