46 "The \"REPLACE\" sub-command replaces element(s) in the sequence "
49 (
"SELECTED",
"If true, all selected elements are replaced");
51 (
"CLASS",
"Name of element class to be replaced");
77 if(!
bool(
itsAttr[CLASS]) || newName.empty()) {
79 "\"ELEMENT=SELECTED\" or \"ELEMENT=<name>\" and "
80 "\"BY=<name>\" are required for \"REPLACE\".");
95 std::cerr <<
"\nNo elements";
96 }
else if(count == 1) {
97 std::cerr <<
"\n1 element";
99 std::cerr <<
'\n' << count <<
" elements";
102 std::cerr <<
" replaced.\n" <<
std::endl;
The sequence editor REPLACE command.
virtual EditReplace * clone(const std::string &name)
Make clone.
Interface for basic beam line object.
The base class for all OPAL exceptions.
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
The base class for all OPAL sequence editor commands.
bool getBool(const Attribute &attr)
Return logical value.
PlaceRep getPlace(const Attribute &attr)
Get place value.
Representation of a place within a beam line or sequence.
int replaceSingle(const PlaceRep &, ElementBase *elem)
Replace single element.
EditReplace()
Exemplar constructor.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
static Edit * block
Pointer to the edit data.
ElementBase * getElement() const
Return the embedded CLASSIC element.
static Element * find(const std::string &name)
Find named Element.
Attribute makePlace(const std::string &name, const std::string &help)
Create a place attribute.
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
int replaceMultiple(ElementBase *elem)
Replace multiple elements.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
Inform & endl(Inform &inf)
std::string getString(const Attribute &attr)
Get string value.
virtual void execute()
Execute the command.