54 "The \"ATTLIST\" statement lists the element strengths "
55 "in a beam line or a sequence.") {
57 (
"LINE",
"Name of line to be listed");
59 (
"FILE",
"Name of file to receive output",
"ATTLIST");
61 (
"ALL",
"Are all columns desired?");
63 (
"VALUE",
"Which value is desired: ACTUAL, IDEAL, or ERROR.",
"ACTUAL");
65 (
"COLUMN",
"The columns to be written");
91 if(
BeamSequence *beamLine = dynamic_cast<BeamSequence *>(obj)) {
92 line = beamLine->fetchLine();
93 }
else if(
Table *table = dynamic_cast<Table *>(obj)) {
94 line = table->getLine();
97 "You cannot do an \"ATTLIST\" on \"" + name +
98 "\", it is neither a line nor a table.");
102 "Object \"" + name +
"\" not found.");
107 if(fileName ==
"TERM") {
110 std::ofstream os(fileName.c_str());
116 "Unable to open output stream \"" +
127 if(value ==
"ACTUAL") {
129 }
else if(value ==
"IDEAL") {
131 }
else if(value ==
"ERROR") {
135 "Unknown \"VALUE\" type \"" + value +
"\".");
141 vector<std::string>::size_type
n = header.size();
142 vector<AttCell *> buffer(n);
143 for(vector<std::string>::size_type i = 0; i <
n; ++i) {
149 os <<
"@ TYPE %s ATTRIBUTE\n"
150 <<
"@ LINE %s " << line.
getName() <<
"\n"
151 <<
"@ DATE %s " << timer.
date() <<
"\n"
152 <<
"@ TIME %s " << timer.
time() <<
"\n"
153 <<
"@ ORIGIN %s OPAL_9.5/4\n"
155 <<
"@ VALUE %s " << value <<
"\n";
161 for(vector<std::string>::size_type i = 0; i <
n; ++i) {
162 os <<
' ' << header[i];
168 for(vector<std::string>::size_type i = 0; i <
n; ++i) {
170 buffer[i]->printFormat(os);
171 buffer[i]->clearValue();
176 AttWriter writer(line, os, flag, buffer);
virtual AttList * clone(const std::string &name)
Make clone.
ValueFlag
Switch for value desired on ATTLIST command.
The base class for all OPAL actions.
The base class for all OPAL exceptions.
virtual void execute()
Execute the command.
virtual const std::string & getName() const
Get element name.
void writeTable(const Beamline &line, std::ostream &os)
std::vector< Attribute > itsAttr
The object attributes (see Attribute.hh).
std::string date() const
Return date.
void printTitle(std::ostream &)
Print the page title.
Attribute makeStringArray(const std::string &name, const std::string &help)
Create a string array attribute.
static OpalData * getInstance()
std::vector< std::string > getStringArray(const Attribute &attr)
Get string array value.
void registerOwnership(const AttributeHandler::OwnerType &itsClass) const
AttList()
Exemplar constructor.
The worker class for ATTLIST commands.
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.
std::string time() const
Return time.
The base class for all OPAL objects.
Attribute makeBool(const std::string &name, const std::string &help)
Make logical attribute.
static AttCell * findRegisteredAttribute(const std::string &name)
Find a registered attribute.
The base class for all OPAL tables.
Attribute makeString(const std::string &name, const std::string &help)
Make string attribute.
std::string getString(const Attribute &attr)
Get string value.