OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
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"
20#include <iostream>
21#include <vector>
24#include "Expressions/SCell.h"
25
26// Class AColumn
27// ------------------------------------------------------------------------
28
29namespace Expressions {
30
32 : OArray<double>(rhs),
33 tab_name(rhs.tab_name),
34 col_name(rhs.col_name),
35 itsRange(rhs.itsRange) {}
36
37 AColumn::AColumn(const std::string& tName, const std::string& cName, const RangeRep& rng)
38 : OArray<double>(), tab_name(tName), col_name(cName), itsRange(rng) {}
39
41
42 OArray<double>* AColumn::clone() const { return new AColumn(*this); }
43
44 std::vector<double> AColumn::evaluate() const {
45 Table* table = Table::find(tab_name);
46 table->fill();
47 return table->getColumn(itsRange, col_name);
48 }
49
50 void AColumn::print(std::ostream& os, int) const {
51 os << "COLUMN(" << tab_name << ',' << col_name << ',' << itsRange << ')';
52 }
53
54} // namespace Expressions
An array expression defined as a table column.
Definition AColumn.h:35
virtual std::vector< double > evaluate() const
Evaluate.
Definition AColumn.cpp:44
virtual OArray< double > * clone() const
Make clone.
Definition AColumn.cpp:42
RangeRep itsRange
Definition AColumn.h:64
virtual void print(std::ostream &os, int precedence=99) const
Print expression.
Definition AColumn.cpp:50
const std::string col_name
Definition AColumn.h:61
const std::string tab_name
Definition AColumn.h:60
Representation of a range within a beam line or sequence.
Definition RangeRep.h:33
The base class for all OPAL tables.
Definition Table.h:41
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:36
Representation objects and parsers for attribute expressions.