OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
Sequence Class Reference

#include <Sequence.h>

Inheritance diagram for Sequence:
Inheritance graph
[legend]
Collaboration diagram for Sequence:
Collaboration graph
[legend]

Public Types

typedef TBeamline< SequenceMemberTLine
 The type of a sequence line. More...
 
- Public Types inherited from Element
enum  ReferenceType { IS_ENTRY , IS_CENTRE , IS_EXIT }
 Reference for element positioning. More...
 

Public Member Functions

 Sequence ()
 Exemplar constructor. More...
 
virtual ~Sequence ()
 
virtual Sequenceclone (const std::string &name)
 Make clone. More...
 
virtual Sequencecopy (const std::string &name)
 Make copy of the sequence line. More...
 
virtual double getLength () const
 Return sequence length. More...
 
virtual double getEntrance (ReferenceType) const
 Return the arc length from origin to entrance. More...
 
virtual double getExit (ReferenceType) const
 Return the arc length from origin to exit. More...
 
ReferenceType getReference () const
 Return the reference type flag. More...
 
virtual ObjectmakeTemplate (const std::string &, TokenStream &, Statement &)
 Make a sequence template. More...
 
virtual void parse (Statement &)
 Parse sequence. More...
 
virtual void print (std::ostream &) const
 Print sequence. More...
 
virtual void replace (Object *oldObject, Object *newObject)
 Replace references to elements. More...
 
virtual void update ()
 Update the embedded CLASSIC beam line. More...
 
virtual TLinefetchLine () const
 Return the embedded CLASSIC beam line. More...
 
void storeLine (TLine &line)
 Store sequence line. More...
 
- Public Member Functions inherited from BeamSequence
virtual ~BeamSequence ()
 
virtual const std::string getCategory () const
 Return the object category as a string. More...
 
- Public Member Functions inherited from Element
virtual ~Element ()
 
virtual bool canReplaceBy (Object *object)
 Test if replacement is allowed. More...
 
virtual bool shouldTrace () const
 Trace flag. More...
 
virtual bool shouldUpdate () const
 Update flag. More...
 
virtual void setShared (bool)
 Set shared flag. More...
 
ElementBasegetElement () const
 Return the embedded CLASSIC element. More...
 
void setElement (ElementBase *)
 Assign new CLASSIC element. More...
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
void copyAttributes (const Object &)
 Copy attributes from another object. More...
 
virtual void execute ()
 Execute the command. More...
 
virtual AttributefindAttribute (const std::string &name)
 Find an attribute by name. More...
 
virtual const AttributefindAttribute (const std::string &name) const
 Find an attribute by name. More...
 
virtual ObjectmakeInstance (const std::string &name, Statement &, const Parser *)
 Macro handler function. More...
 
virtual void parseShortcut (Statement &, bool eval=true)
 Parser for single-attribute commands. More...
 
virtual void printValue (std::ostream &) const
 
virtual void printHelp (std::ostream &) const
 Print help. More...
 
bool isBuiltin () const
 True, if [b]this[/b] is a built-in object. More...
 
virtual bool isShared () const
 Shared flag. More...
 
void setDirty (bool)
 Set/reset the [b]modified[/b] flag. More...
 
bool isDirty () const
 True, if the [b]modified[/b] flag is set. More...
 
void setFlag (bool)
 Flag/unflag this object, e. g. to control output of objects for. More...
 
bool isFlagged () const
 True, if [b]this[/b] is flagged by setFlag(true). More...
 
const ObjectgetBaseObject () const
 Return the object's base type object. More...
 
const std::string & getOpalName () const
 Return object name. More...
 
ObjectgetParent () const
 Return parent pointer. More...
 
bool isTreeMember (const Object *subTree) const
 Test for tree membership. More...
 
void setOpalName (const std::string &name)
 Set object name. More...
 
void setParent (Object *)
 Set parent object. More...
 
void clear ()
 Clear the occurrence counter. More...
 
int increment ()
 Increment and return the occurrence counter. More...
 
int occurrenceCount ()
 Return the occurrence counter. More...
 
void registerReference (Invalidator *a)
 Register a reference to this object. More...
 
void unregisterReference (Invalidator *a)
 Unegister a reference to this object. More...
 
void registerOwnership (const AttributeHandler::OwnerType &itsClass) const
 
- Public Member Functions inherited from RCObject
int addReference () const
 Increment reference count. More...
 
int removeReference () const
 Decrement the reference count. More...
 
bool isShared () const
 Test for sharing. More...
 

Private Member Functions

 Sequence (const Sequence &)
 
void operator= (const Sequence &)
 
 Sequence (const std::string &name, Sequence *parent)
 
void addEndMarkers (TLine &line) const
 
double findDriftLength (TLine::iterator drift) const
 
TLine::iterator findNamedPosition (TLine &, const std::string &) const
 
void insertDrifts (TLine &line)
 

Static Private Member Functions

static void updateList (Sequence *, TLine *)
 

Private Attributes

ReferenceType itsCode
 
std::string itsRefPoint
 

Friends

class Edit
 
class SequenceParser
 
class SequenceTemplate
 

Additional Inherited Members

- Static Public Member Functions inherited from BeamSequence
static BeamSequencefind (const std::string &name)
 Find a BeamSequence by name. More...
 
- Static Public Member Functions inherited from Element
static Elementfind (const std::string &name)
 Find named Element. More...
 
- Public Attributes inherited from Object
std::vector< AttributeitsAttr
 The object attributes. More...
 
- Protected Member Functions inherited from BeamSequence
 BeamSequence (int size, const char *name, const char *help)
 Constructor for exemplars. More...
 
 BeamSequence (const std::string &name, BeamSequence *parent)
 Constructor for clones. More...
 
- Protected Member Functions inherited from Element
 Element (int size, const char *name, const char *help)
 Constructor for exemplars. More...
 
 Element (const std::string &name, Element *parent)
 Constructor for clones. More...
 
- Protected Member Functions inherited from Object
 Object (int size, const char *name, const char *help)
 Constructor for exemplars. More...
 
 Object (const std::string &name, Object *parent)
 Constructor for clones. More...
 
- Protected Member Functions inherited from RCObject
 RCObject ()
 Default constructor. More...
 
 RCObject (const RCObject &)
 Copy constructor. More...
 
virtual ~RCObject ()=0
 
RCObjectoperator= (const RCObject &right)
 
- Protected Attributes inherited from Object
bool builtin
 Built-in flag. More...
 
bool modified
 Dirty flag. More...
 
bool flagged
 Object flag. More...
 

Detailed Description

Definition at line 33 of file Sequence.h.

Member Typedef Documentation

◆ TLine

The type of a sequence line.

Definition at line 42 of file Sequence.h.

Constructor & Destructor Documentation

◆ Sequence() [1/3]

Sequence::Sequence ( )

Exemplar constructor.

Definition at line 52 of file Sequence.cpp.

References Object::itsAttr, Attributes::makeReal(), Attributes::makeString(), Object::registerOwnership(), Element::setElement(), AttributeHandler::STATEMENT, and Attrib::Distribution::TYPE.

Referenced by clone().

Here is the call graph for this function:

◆ ~Sequence()

Sequence::~Sequence ( )
virtual

Definition at line 93 of file Sequence.cpp.

◆ Sequence() [2/3]

Sequence::Sequence ( const Sequence )
private

◆ Sequence() [3/3]

Sequence::Sequence ( const std::string &  name,
Sequence parent 
)
private

Definition at line 83 of file Sequence.cpp.

References name, and Element::setElement().

Here is the call graph for this function:

Member Function Documentation

◆ addEndMarkers()

void Sequence::addEndMarkers ( TLine line) const
private

◆ clone()

Sequence * Sequence::clone ( const std::string &  name)
virtual

Make clone.

Implements Object.

Definition at line 97 of file Sequence.cpp.

References name, and Sequence().

Referenced by copy(), and SequenceTemplate::makeInstance().

Here is the call graph for this function:

◆ copy()

Sequence * Sequence::copy ( const std::string &  name)
virtual

Make copy of the sequence line.

Implements BeamSequence.

Definition at line 102 of file Sequence.cpp.

References ElementBase::clone(), clone(), ElementBase::copyStructure(), fetchLine(), SequenceMember::GENERATED, ElmPtr::getElement(), name, ElmPtr::setElement(), and storeLine().

Here is the call graph for this function:

◆ fetchLine()

Sequence::TLine * Sequence::fetchLine ( ) const
virtual

Return the embedded CLASSIC beam line.

Implements BeamSequence.

Definition at line 278 of file Sequence.cpp.

References Element::getElement().

Referenced by copy(), getEntrance(), getExit(), print(), replace(), storeLine(), and update().

Here is the call graph for this function:

◆ findDriftLength()

double Sequence::findDriftLength ( TLine::iterator  drift) const
private

Definition at line 325 of file Sequence.cpp.

References abs(), Element::getEntrance(), Element::getExit(), Object::getOpalName(), and itsCode.

Referenced by updateList().

Here is the call graph for this function:

◆ findNamedPosition()

Sequence::TLine::iterator Sequence::findNamedPosition ( TLine line,
const std::string &  name 
) const
private

Definition at line 124 of file Sequence.cpp.

References SequenceMember::GENERATED, and name.

Referenced by SequenceParser::findFromPositions(), getEntrance(), and getExit().

◆ getEntrance()

double Sequence::getEntrance ( ReferenceType  ref) const
virtual

Return the arc length from origin to entrance.

Reimplemented from Element.

Definition at line 155 of file Sequence.cpp.

References fetchLine(), findNamedPosition(), Element::getEntrance(), itsRefPoint, and Hypervolume::ref.

Here is the call graph for this function:

◆ getExit()

double Sequence::getExit ( ReferenceType  ref) const
virtual

Return the arc length from origin to exit.

Reimplemented from Element.

Definition at line 166 of file Sequence.cpp.

References fetchLine(), findNamedPosition(), Element::getExit(), getLength(), itsRefPoint, and Hypervolume::ref.

Here is the call graph for this function:

◆ getLength()

double Sequence::getLength ( ) const
virtual

Return sequence length.

Implements Element.

Definition at line 150 of file Sequence.cpp.

References Attributes::getReal(), and Object::itsAttr.

Referenced by addEndMarkers(), and getExit().

Here is the call graph for this function:

◆ getReference()

Sequence::ReferenceType Sequence::getReference ( ) const

Return the reference type flag.

Definition at line 177 of file Sequence.cpp.

References Attributes::getString(), Element::IS_CENTRE, Element::IS_ENTRY, Element::IS_EXIT, Object::itsAttr, and Hypervolume::ref.

Referenced by storeLine().

Here is the call graph for this function:

◆ insertDrifts()

void Sequence::insertDrifts ( Sequence::TLine line)
private

Definition at line 368 of file Sequence.cpp.

References SequenceMember::GENERATED, SequenceMember::itsType, ElmPtr::setElement(), and ElementBase::setName().

Referenced by SequenceParser::parse().

Here is the call graph for this function:

◆ makeTemplate()

Object * Sequence::makeTemplate ( const std::string &  name,
TokenStream is,
Statement statement 
)
virtual

Make a sequence template.

Reimplemented from Object.

Definition at line 191 of file Sequence.cpp.

References name, SequenceTemplate::parseTemplate(), and SequenceTemplate.

Here is the call graph for this function:

◆ operator=()

void Sequence::operator= ( const Sequence )
private

◆ parse()

void Sequence::parse ( Statement statement)
virtual

Parse sequence.

Reimplemented from Object.

Definition at line 206 of file Sequence.cpp.

References Attributes::getString(), Object::itsAttr, itsRefPoint, Object::parse(), and OpalParser::run().

Here is the call graph for this function:

◆ print()

void Sequence::print ( std::ostream &  os) const
virtual

◆ replace()

void Sequence::replace ( Object oldObject,
Object newObject 
)
virtual

Replace references to elements.

Reimplemented from Object.

Definition at line 259 of file Sequence.cpp.

References DefaultVisitor::execute(), fetchLine(), Element::getElement(), and Object::getOpalName().

Here is the call graph for this function:

◆ storeLine()

void Sequence::storeLine ( TLine line)

Store sequence line.

Definition at line 283 of file Sequence.cpp.

References OpalData::apply(), fetchLine(), Element::find(), SequenceMember::GENERATED, OpalData::getInstance(), getReference(), Object::increment(), itsCode, and name.

Referenced by copy(), and SequenceParser::parse().

Here is the call graph for this function:

◆ update()

void Sequence::update ( )
virtual

Update the embedded CLASSIC beam line.

Reimplemented from Object.

Definition at line 272 of file Sequence.cpp.

References fetchLine(), and updateList().

Here is the call graph for this function:

◆ updateList()

void Sequence::updateList ( Sequence seq,
TLine line 
)
staticprivate

Definition at line 383 of file Sequence.cpp.

References OpalData::find(), findDriftLength(), OpalData::getInstance(), ElementBase::getName(), and ElementBase::isSharable().

Referenced by update().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ Edit

friend class Edit
friend

Definition at line 35 of file Sequence.h.

◆ SequenceParser

friend class SequenceParser
friend

Definition at line 36 of file Sequence.h.

◆ SequenceTemplate

friend class SequenceTemplate
friend

Definition at line 37 of file Sequence.h.

Referenced by makeTemplate().

Member Data Documentation

◆ itsCode

ReferenceType Sequence::itsCode
private

Definition at line 124 of file Sequence.h.

Referenced by findDriftLength(), and storeLine().

◆ itsRefPoint

std::string Sequence::itsRefPoint
private

Definition at line 127 of file Sequence.h.

Referenced by getEntrance(), getExit(), and parse().


The documentation for this class was generated from the following files: