OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Table.cpp
Go to the documentation of this file.
1 // ------------------------------------------------------------------------
2 // $RCSfile: Table.cpp,v $
3 // ------------------------------------------------------------------------
4 // $Revision: 1.2.4.1 $
5 // ------------------------------------------------------------------------
6 // Copyright: see Copyright.readme
7 // ------------------------------------------------------------------------
8 //
9 // Class: Table
10 // This abstract base class defines the interface for the OPAL "TABLE"
11 // command family.
12 //
13 // ------------------------------------------------------------------------
14 //
15 // $Date: 2002/12/09 15:06:07 $
16 // $Author: jsberg $
17 //
18 // ------------------------------------------------------------------------
19 
20 #include "AbstractObjects/Table.h"
23 #include "Utilities/Timer.h"
24 #include <iostream>
25 
26 
27 // Class Table
28 // ------------------------------------------------------------------------
29 
31  // Remove pointer to "this" from table directory.
33 }
34 
35 
36 bool Table::canReplaceBy(Object */*newObject*/) {
37  return false;
38 }
39 
40 
41 Table *Table::find(const std::string &name) {
42  Table *table = dynamic_cast<Table *>(OpalData::getInstance()->find(name));
43  if(table == 0) {
44  throw OpalException("Table::find()", "Table \"" + name + "\" not found.");
45  }
46  return table;
47 }
48 
49 
50 const std::string Table::getCategory() const {
51  return "TABLE";
52 }
53 
54 
55 bool Table::shouldTrace() const {
56  return true;
57 
58 }
59 
60 bool Table::shouldUpdate() const {
61  return true;
62 }
63 
64 
66  if(dynamic) refill = true;
67 }
68 
69 
70 Table::Table(int size, const char *name, const char *help):
71  Object(size, name, help), dynamic(false), refill(false) {
72  // Do not link table exemplar.
73 }
74 
75 
76 Table::Table(const std::string &name, Table *parent):
77  Object(name, parent), dynamic(true), refill(true) {
78  // Link table to table directory.
80 }
const std::string name
The base class for all OPAL objects.
Definition: Object.h:48
bool builtin
Built-in flag.
Definition: Object.h:233
Object * find(const std::string &name)
Find entry.
Definition: OpalData.cpp:565
void unregisterTable(Table *t)
Unregister table.
Definition: OpalData.cpp:614
static OpalData * getInstance()
Definition: OpalData.cpp:195
void registerTable(Table *t)
Register table.
Definition: OpalData.cpp:610
The base class for all OPAL tables.
Definition: Table.h:42
virtual void invalidate()
Mark this table as invalid, if it is dynamic.
Definition: Table.cpp:65
virtual bool shouldUpdate() const
Update flag.
Definition: Table.cpp:60
virtual const std::string getCategory() const
Return the object category as a string.
Definition: Table.cpp:50
virtual bool canReplaceBy(Object *newObject)
Test if object can be replaced.
Definition: Table.cpp:36
virtual ~Table()
Definition: Table.cpp:30
bool refill
Refill flag.
Definition: Table.h:158
static Table * find(const std::string &name)
Find named Table.
Definition: Table.cpp:41
virtual bool shouldTrace() const
Trace flag.
Definition: Table.cpp:55
bool dynamic
Flag dynamic table.
Definition: Table.h:153
The base class for all OPAL exceptions.
Definition: OpalException.h:28