53 "The \"SELECT\" sub-command selects the positions to be affected "
54 "by subsequent error sub-commands.") {
57 "Name of the lattice to be affected by selections",
61 "If true, all elements are selected");
64 "If true, all selections are cleared");
67 "Range to be considered for selection (default: full range)");
70 "Name of class to be selected (default: all classes)");
73 "The type name of elements to be selected (default: all types)");
76 "Regular expression for matching names (default: all names)");
92 return new Select(name,
this);
101 if(
BeamSequence *line = dynamic_cast<BeamSequence *>(obj)) {
102 select(*line->fetchLine());
103 }
else if(
Table *table = dynamic_cast<Table *>(obj)) {
104 select(*table->getLine());
107 "You cannot do a \"SELECT\" on \"" + name +
108 "\", it is neither a line nor a table.");
112 "Object \"" + name +
"\" not found.");
123 *gmsg <<
level3 <<
"\nAll elements selected.\n" <<
endl;
130 *gmsg <<
level3 <<
"\nAll elements de-selected.\n" <<
endl;
143 *gmsg <<
level3 <<
"No elements";
144 }
else if(count == 1) {
145 *gmsg <<
level3 <<
"\n1 element";
147 *gmsg <<
level3 <<
'\n' << count <<
" elements";
Select()
Exemplar constructor.
RangeRep getRange(const Attribute &attr)
Get range value.
The base class for all OPAL actions.
virtual void execute()
Execute the command.
The base class for all OPAL exceptions.
Attribute makeRange(const std::string &name, const std::string &help)
Create a range attribute.
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
Set selection flags for a given range in a beam line.
bool getBool(const Attribute &attr)
Return logical value.
static OpalData * getInstance()
void select(const Beamline &)
virtual Select * clone(const std::string &name)
Make clone.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
Set/reset all selection flags in a beam line built from FlaggedElmPtr.
An abstract sequence of beam line components.
const T * find(const T table[], const std::string &name)
Look up name.
virtual void execute()
Apply the algorithm to the top-level beamline.
The base class for all OPAL beam lines and sequences.
The base class for all OPAL objects.
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
Inform & level3(Inform &inf)
The base class for all OPAL tables.
virtual void execute()
Execute the selection.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
int getCount() const
Return the count of selected elements.
Inform & endl(Inform &inf)
std::string getString(const Attribute &attr)
Get string value.