OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
AColumn.cpp
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2// $RCSfile: AColumn.cpp,v $
3// ------------------------------------------------------------------------
4// $Revision: 1.1.1.1 $
5// ------------------------------------------------------------------------
6// Copyright: see Copyright.readme
7// ------------------------------------------------------------------------
8//
9// Class: AColumn
10// Expression class. Generates a list of values from a TABLE() function.
11//
12// ------------------------------------------------------------------------
13//
14// $Date: 2000/03/27 09:33:41 $
15// $Author: Andreas Adelmann $
16//
17// ------------------------------------------------------------------------
18
19#include "Expressions/AColumn.h"
22#include "Expressions/SCell.h"
23#include <iostream>
24#include <vector>
25
26
27// Class AColumn
28// ------------------------------------------------------------------------
29
30namespace Expressions {
31
33 OArray<double>(rhs), tab_name(rhs.tab_name),
34 col_name(rhs.col_name), itsRange(rhs.itsRange)
35 {}
36
37
39 (const std::string &tName, const std::string &cName, const RangeRep &rng):
40 OArray<double>(), tab_name(tName), col_name(cName), itsRange(rng)
41 {}
42
43
45 {}
46
47
49 return new AColumn(*this);
50 }
51
52
53 std::vector<double> AColumn::evaluate() const {
54 Table *table = Table::find(tab_name);
55 table->fill();
56 return table->getColumn(itsRange, col_name);
57 }
58
59
60 void AColumn::print(std::ostream &os, int) const {
61 os << "COLUMN(" << tab_name << ',' << col_name << ','
62 << itsRange << ')';
63 }
64
65}
Representation objects and parsers for attribute expressions.
Definition: Expressions.h:64
An array expression.
Definition: Expressions.h:142
Representation of a range within a beam line or sequence.
Definition: RangeRep.h:34
The base class for all OPAL tables.
Definition: Table.h:42
virtual std::vector< double > getColumn(const RangeRep &range, const std::string &col)=0
Return column [b]col[/b] of this table, limited by [b]range[/b].
virtual void fill()=0
Refill the buffer.
static Table * find(const std::string &name)
Find named Table.
Definition: Table.cpp:41
An array expression defined as a table column.
Definition: AColumn.h:36
virtual std::vector< double > evaluate() const
Evaluate.
Definition: AColumn.cpp:53
virtual OArray< double > * clone() const
Make clone.
Definition: AColumn.cpp:48
RangeRep itsRange
Definition: AColumn.h:69
virtual void print(std::ostream &os, int precedence=99) const
Print expression.
Definition: AColumn.cpp:60
const std::string col_name
Definition: AColumn.h:66
const std::string tab_name
Definition: AColumn.h:65