48 "The \"INSTALL\" sub-command installs new elements in the sequence.") {
51 "Position in metres for installation relative to origin(s)");
53 (
"FROM",
"Position of element defining origin (default is start)");
76 "The \"AT\" attribute must be present.");
95 std::cerr <<
"\nNo \"" << name <<
'"';
96 }
else if(count == 1) {
97 std::cerr <<
"\n1 \"" << name <<
'"';
99 std::cerr <<
'\n' << count <<
" \"" << name <<
"\"'s";
102 std::cerr <<
" installed.\n" <<
std::endl;
109 std::string className;
116 className = objectName;
127 if(objectName.empty()) {
129 "An instantiation of \"" + className +
130 "\" in a sequence shoud have name.");
134 }
else if(! objectName.empty()) {
135 copy =
object->
clone(objectName);
145 "You cannot redefine \"" + objectName +
146 "\" within the sequence editor.");
150 if(
Element *element = dynamic_cast<Element *>(&*copy)) {
154 std::string attrName =
161 attr->
parse(stat,
true);
166 attr->
parse(stat,
true);
168 attr->
parse(stat,
false);
170 throw ParseError(
"EditInstall::parsePosition()",
171 "Delimiter \"=\" or \":=\" expected.");
174 throw ParseError(
"EditInstall::parsePosition()",
176 "\" has no attribute \"" + attrName +
"\".");
179 throw ParseError(
"EditInstall::parsePosition()",
180 "Overriding attributes not permitted here.");
186 throw ParseError(
"EditInstall::parse()",
"Object \"" +
187 objectName +
"\" is not an element.");
191 "Element class name \"" + className +
"\" is unknown.");
int installMultiple(ElementBase *, double)
Install multiple elements.
Interface for basic beam line object.
void define(Object *newObject)
Define a new object.
EditInstall()
Exemplar constructor.
The base class for all OPAL exceptions.
virtual Attribute * findAttribute(const std::string &name)
Find an attribute by name.
virtual const std::string & getName() const
Get element name.
virtual void parse(Statement &statement)
Parse the command.
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
The base class for all OPAL sequence editor commands.
void parseDelimiter(Statement &stat, char delim)
Test for one-character delimiter.
PlaceRep getPlace(const Attribute &attr)
Get place value.
Representation of a place within a beam line or sequence.
virtual EditInstall * clone(const std::string &name)
Make clone.
static OpalData * getInstance()
const std::string & getOpalName() const
Return object name.
The base class for all OPAL elements.
A representation of an Object attribute.
Interface for statements.
Reference-counted pointer.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
int installSingle(const PlaceRep &, ElementBase *, double)
Install element relative to place.
virtual Object * makeInstance(const std::string &name, Statement &, const Parser *)
Macro handler function.
bool isSelected() const
Return select flag.
static Edit * block
Pointer to the edit data.
const T * find(const T table[], const std::string &name)
Look up name.
ElementBase * getElement() const
Return the embedded CLASSIC element.
Attribute makePlace(const std::string &name, const std::string &help)
Create a place attribute.
Object * find(const std::string &name)
Find entry.
The base class for all OPAL objects.
virtual Object * clone(const std::string &name)=0
Return a clone.
virtual void execute()
Execute the command.
double getReal(const Attribute &attr)
Return real value.
std::string parseString(Statement &, const char msg[])
Parse string value.
bool delimiter(char c)
Test for delimiter.
The sequence editor INSTALL command.
Attribute makeReal(const std::string &name, const std::string &help)
Make real attribute.
void parse(Statement &stat, bool eval)
Parse attribute.
Pointer< Element > newElement
Inform & endl(Inform &inf)