39 namespace MakeSequenceNS {
61 ! dynamic_cast<BeamSequence *>(
object)) {
63 (*this)(
object->getParent());
118 itsName(name), itsStream(os), sum_length(0.0)
122 std::string comment =
"// ";
123 std::string line(72,
'-');
125 << comment <<
"Sequence definition.\n"
126 << comment << line <<
'\n'
127 <<
itsName <<
":SEQUENCE,REFER=CENTRE";
144 std::string objectName = element.
getName();
145 if(objectName[0] !=
'#') {
163 using namespace MakeSequenceNS;
167 "The \"MAKESEQ\" statement constructs a flat sequence from a "
168 "\"LINE\" object.") {
170 (
"LINE",
"Name of the lattice to be flattened");
173 "Name to be given to the generated seqence (default = original name).");
176 "Name to be given to the generated file (default = new sequence name).");
201 if(name.empty()) name = useName;
202 if(file.empty()) file = name;
208 std::ofstream os(file.c_str());
211 "Unable to open output stream \"" + file +
"\".");
214 std::string line(72,
'-');
215 std::string comment =
"// ";
221 os << comment << line <<
'\n'
222 << comment <<
"Variable definitions." <<
'\n'
223 << comment << line <<
'\n';
228 os << comment << line <<
'\n'
229 << comment <<
"Element definitions." <<
'\n'
230 << comment << line <<
'\n';
virtual double getExit(ReferenceType) const
Return arc length from origin to exit (positive !).
bool isFlagged() const
True, if [b]this[/b] is flagged by setFlag(true).
VariableWriter(std::ostream &ostr)
ElementWriter(std::ostream &ostr)
MakeSequence()
Exemplar constructor.
virtual MakeSequence * clone(const std::string &name)
Make clone.
Interface for basic beam line object.
virtual void execute()
Apply the algorithm to the top-level beamline.
The base class for all OPAL actions.
bool isBuiltin() const
True, if [b]this[/b] is a built-in object.
The base class for all OPAL exceptions.
virtual void operator()(Object *) const
The function to be executed.
virtual void operator()(Object *) const
The function to be executed.
virtual void visitDrift(const Drift &)
Apply the algorithm to a drift.
Object * getParent() const
Return parent pointer.
virtual const std::string & getName() const
Get element name.
Interface for drift space.
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
void apply(const ObjectFunction &)
Apply a function to all objects.
static OpalData * getInstance()
const std::string & getOpalName() const
Return object name.
static BeamSequence * find(const std::string &name)
Find a BeamSequence by name.
The base class for all OPAL elements.
virtual void execute()
Execute the command.
virtual double getElementLength() const
Get design length.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
virtual Beamline * fetchLine() const =0
Return the embedded CLASSIC beam line.
virtual void applyDefault(const ElementBase &element)
virtual void operator()(Object *) const
The function to be executed.
An abstract sequence of beam line components.
virtual void execute()
Apply the algorithm to the top-level beamline.
The base class for all OPAL beam lines and sequences.
static Element * find(const std::string &name)
Find named Element.
The base class for all OPAL objects.
SequenceWriter(const Beamline &beamline, const std::string &name, std::ostream &os)
The base class for all OPAL value definitions.
Abstract base class for functor objects whose argument is an Object.
virtual ~SequenceWriter()
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
void setFlag(bool)
Flag/unflag this object, e. g. to control output of objects for.
virtual double getEntrance(ReferenceType) const
Return arc length from origin to entrance (negative !).
Inform & endl(Inform &inf)
std::string getString(const Attribute &attr)
Get string value.