OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
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
26// Class SCell
27// ------------------------------------------------------------------------
28
29
30namespace Expressions {
31
33 (const std::string &tab, const PlaceRep &place, const std::string &col):
34 tab_name(tab), position(place), col_name(col), itsChannel(0)
35 {}
36
37
39 delete itsChannel;
40 }
41
42
44 return new SCell(tab_name, position, col_name);
45 }
46
47
48 double SCell::evaluate() const {
49 // Define table pointer and refill the table if required.
50 Table *table = Table::find(tab_name);
51 table->fill();
52
53 // Return value of table cell.
54 return table->getCell(position, col_name);
55 }
56
57
58 void SCell::print(std::ostream &os, int) const {
59 os << tab_name << "->" << position;
60 os << "->" << col_name;
61 return;
62 }
63
64}
Representation objects and parsers for attribute expressions.
Definition: Expressions.h:64
Representation of a place within a beam line or sequence.
Definition: PlaceRep.h:41
The base class for all OPAL tables.
Definition: Table.h:42
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:41
virtual void print(std::ostream &stream, int) const
Print expression.
Definition: SCell.cpp:58
ConstChannel * itsChannel
Definition: SCell.h:69
const PlaceRep position
Definition: SCell.h:65
virtual ~SCell()
Definition: SCell.cpp:38
const std::string col_name
Definition: SCell.h:66
const std::string tab_name
Definition: SCell.h:64
virtual Scalar< double > * clone() const
Make clone.
Definition: SCell.cpp:43
virtual double evaluate() const
Evaluate.
Definition: SCell.cpp:48