OPAL (Object Oriented Parallel Accelerator Library)  2024.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"
20 #include "AbstractObjects/Table.h"
21 #include "Channels/ConstChannel.h"
22 
23 #include <iostream>
24 
25 
26 // Class SCell
27 // ------------------------------------------------------------------------
28 
29 
30 namespace 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 }
virtual Scalar< double > * clone() const
Make clone.
Definition: SCell.cpp:43
virtual double getCell(const PlaceRep &row, const std::string &col)=0
Return value in selected table cell.
const std::string col_name
Definition: SCell.h:66
The base class for all OPAL tables.
Definition: Table.h:42
const PlaceRep position
Definition: SCell.h:65
virtual double evaluate() const
Evaluate.
Definition: SCell.cpp:48
static Table * find(const std::string &name)
Find named Table.
Definition: Table.cpp:41
c Accompany it with the information you received as to the offer to distribute corresponding source complete source code means all the source code for all modules it plus any associated interface definition plus the scripts used to control compilation and installation of the executable as a special the source code distributed need not include anything that is normally and so on of the operating system on which the executable unless that component itself accompanies the executable If distribution of executable or object code is made by offering access to copy from a designated place
Definition: LICENSE:162
Representation of a place within a beam line or sequence.
Definition: PlaceRep.h:41
virtual void fill()=0
Refill the buffer.
ConstChannel * itsChannel
Definition: SCell.h:69
const std::string tab_name
Definition: SCell.h:64
virtual ~SCell()
Definition: SCell.cpp:38
virtual void print(std::ostream &stream, int) const
Print expression.
Definition: SCell.cpp:58