OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
SCell.cpp
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2// $RCSfile: SCell.cpp,v $
3// ------------------------------------------------------------------------
4// $Revision: 1.3 $
5// ------------------------------------------------------------------------
6// Copyright: see Copyright.readme
7// ------------------------------------------------------------------------
8//
9// Template class SCell:
10// Reference to a table cell.
11//
12// ------------------------------------------------------------------------
13//
14// $Date: 2002/01/22 15:16:02 $
15// $Author: jsberg $
16//
17// ------------------------------------------------------------------------
18
19#include "Expressions/SCell.h"
22
23#include <iostream>
24
25// Class SCell
26// ------------------------------------------------------------------------
27
28namespace Expressions {
29
30 SCell::SCell(const std::string& tab, const PlaceRep& place, const std::string& col)
31 : tab_name(tab), position(place), col_name(col), itsChannel(0) {}
32
34
36
37 double SCell::evaluate() const {
38 // Define table pointer and refill the table if required.
39 Table* table = Table::find(tab_name);
40 table->fill();
41
42 // Return value of table cell.
43 return table->getCell(position, col_name);
44 }
45
46 void SCell::print(std::ostream& os, int) const {
47 os << tab_name << "->" << position;
48 os << "->" << col_name;
49 return;
50 }
51
52} // namespace Expressions
virtual void print(std::ostream &stream, int) const
Print expression.
Definition SCell.cpp:46
ConstChannel * itsChannel
Definition SCell.h:65
const PlaceRep position
Definition SCell.h:61
virtual ~SCell()
Definition SCell.cpp:33
const std::string col_name
Definition SCell.h:62
const std::string tab_name
Definition SCell.h:60
virtual Scalar< double > * clone() const
Make clone.
Definition SCell.cpp:35
virtual double evaluate() const
Evaluate.
Definition SCell.cpp:37
Representation of a place within a beam line or sequence.
Definition PlaceRep.h:40
The base class for all OPAL tables.
Definition Table.h:41
virtual double getCell(const PlaceRep &row, const std::string &col)=0
Return value in selected table cell.
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.