48 "The \"SELECT\" sub-command selects the positions to be affected "
49 "by subsequent error sub-commands.") {
52 "Name of the lattice to be affected by selections",
56 "If true, all elements are selected");
59 "If true, all selections are cleared");
62 "Range to be considered for selection (default: full range)");
65 "Name of class to be selected (default: all classes)");
68 "The type name of elements to be selected (default: all types)");
71 "Regular expression for matching names (default: all names)");
87 return new Select(name,
this);
96 if (
BeamSequence* line = dynamic_cast<BeamSequence*>(obj)) {
97 select(*line->fetchLine());
98 }
else if (
Table* table = dynamic_cast<Table*>(obj)) {
102 "You cannot do a \"SELECT\" on \"" + name +
103 "\", it is neither a line nor a table.");
107 "Object \"" + name +
"\" not found.");
118 *gmsg <<
level2 <<
"\nAll elements selected.\n" <<
endl;
125 *gmsg <<
level2 <<
"\nAll elements de-selected.\n" <<
endl;
138 *gmsg <<
level2 <<
"No elements";
139 }
else if (count == 1) {
140 *gmsg <<
level2 <<
"\n1 element";
142 *gmsg <<
level2 <<
'\n' << count <<
" elements";
virtual void execute()
Execute the command.
static OpalData * getInstance()
The base class for all OPAL objects.
virtual void execute()
Apply the algorithm to the top-level beamline.
std::string getString(const Attribute &attr)
Get string value.
Select()
Exemplar constructor.
The base class for all OPAL tables.
An abstract sequence of beam line components.
Inform & endl(Inform &inf)
void select(const Beamline &)
Attribute makeRange(const std::string &name, const std::string &help)
Create a range attribute.
const T * find(const T table[], const std::string &name)
Look up name.
bool getBool(const Attribute &attr)
Return logical value.
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
The base class for all OPAL exceptions.
The base class for all OPAL beam lines and sequences.
virtual Select * clone(const std::string &name)
Make clone.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Set/reset all selection flags in a beam line built from FlaggedElmPtr.
virtual void execute()
Execute the selection.
std::vector< Attribute > itsAttr
The object attributes.
int getCount() const
Return the count of selected elements.
Inform & level2(Inform &inf)
The base class for all OPAL actions.
RangeRep getRange(const Attribute &attr)
Get range value.