casacore
Loading...
Searching...
No Matches
TableSyncData.h
Go to the documentation of this file.
1//# TableSyncData.h: Class to hold table synchronization data
2//# Copyright (C) 1997,1999
3//# Associated Universities, Inc. Washington DC, USA.
4//#
5//# This library is free software; you can redistribute it and/or modify it
6//# under the terms of the GNU Library General Public License as published by
7//# the Free Software Foundation; either version 2 of the License, or (at your
8//# option) any later version.
9//#
10//# This library is distributed in the hope that it will be useful, but WITHOUT
11//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13//# License for more details.
14//#
15//# You should have received a copy of the GNU Library General Public License
16//# along with this library; if not, write to the Free Software Foundation,
17//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18//#
19//# Correspondence concerning AIPS++ should be addressed as follows:
20//# Internet email: casa-feedback@nrao.edu.
21//# Postal address: AIPS++ Project Office
22//# National Radio Astronomy Observatory
23//# 520 Edgemont Road
24//# Charlottesville, VA 22903-2475 USA
25
26#ifndef TABLES_TABLESYNCDATA_H
27#define TABLES_TABLESYNCDATA_H
28
29//# Includes
30#include <casacore/casa/aips.h>
31#include <casacore/casa/Containers/Block.h>
32#include <casacore/casa/IO/MemoryIO.h>
33#include <casacore/casa/IO/AipsIO.h>
34
35
36namespace casacore { //# NAMESPACE CASACORE - BEGIN
37
38// <summary>
39// Class to hold table synchronization data.
40// </summary>
41
42// <use visibility=local>
43
44// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="tTable" demos="">
45// </reviewed>
46
47// <prerequisite>
48// <li> class <linkto class=Table>TableLockData</linkto>
49// </prerequisite>
50
51// <synopsis>
52// This class keeps counters to synchronize the table data when a table
53// is locked or unlocked.
54// <br>
55// A few counters are kept by this class:
56// <ul>
57// <li> The numbers of rows in the table.
58// <li> The number of columns in the table.
59// <li> The table change counter.
60// <li> A change counter per data manager.
61// </ul>
62// When a lock on the table is acquired, it reads the sync data from the
63// lock file and determines if anything has changed. If so, the necessary
64// steps are taken to reread the table data when needed.
65// <br>
66// When a lock on the table is released, it updates and writes the sync data
67// which tells if table data have changed.
68// <p>
69// This class can also be used for the synchronization of tables and
70// external fillers (see class
71// <linkto class=ExternalLockSync>ExternalLockSync</linkto>). For this
72// purpose it is sufficient to store the number of rows.
73// </synopsis>
74
75
77{
78public:
80
82
83 // Copy constructor is forbidden.
84 TableSyncData (const TableSyncData& that) = delete;
85
86 // Assignment is forbidden.
87 TableSyncData& operator= (const TableSyncData& that) = delete;
88
89 // Update the synchronization data and write it into the MemoryIO object.
90 // This function is called when a table flush is done to reflect
91 // if anything has changed compared to the previous flush.
92 void write (rownr_t nrrow, uInt nrcolumn, Bool tableChanged,
93 const Block<Bool>& dataManChanged);
94
95 // Update the synchronization data and write it into the MemoryIO object.
96 // This function should be used by an external filler when it flushes
97 // its data.
98 void write (rownr_t nrrow);
99
100 // Read the synchronization data from the MemoryIO object.
101 // This function is called when a lock is acquired to see if
102 // table data has to be reread.
103 // <br>It returns False when the MemoryIO object is empty.
104 Bool read (rownr_t& nrrow, uInt& nrcolumn, Bool& tableChanged,
105 Block<Bool>& dataManChanged);
106
107 // Get the MemoryIO object.
108 // This is used to let <src>LockFile</src> read or write the
109 // synchronization data into it.
111
112 // Get the modify counter.
113 uInt getModifyCounter() const;
114
115
116private:
117 //# Member variables.
123 std::shared_ptr<MemoryIO> itsMemIO;
125};
126
127
128
130{
131 return *itsMemIO;
132}
134{
135 return itsModifyCounter;
136}
137
138
139
140
141} //# NAMESPACE CASACORE - END
142
143#endif
simple 1-D array
Definition Block.h:198
Block< uInt > itsDataManChangeCounter
void write(rownr_t nrrow, uInt nrcolumn, Bool tableChanged, const Block< Bool > &dataManChanged)
Update the synchronization data and write it into the MemoryIO object.
TableSyncData & operator=(const TableSyncData &that)=delete
Assignment is forbidden.
MemoryIO & memoryIO()
Get the MemoryIO object.
std::shared_ptr< MemoryIO > itsMemIO
Bool read(rownr_t &nrrow, uInt &nrcolumn, Bool &tableChanged, Block< Bool > &dataManChanged)
Read the synchronization data from the MemoryIO object.
TableSyncData(const TableSyncData &that)=delete
Copy constructor is forbidden.
void write(rownr_t nrrow)
Update the synchronization data and write it into the MemoryIO object.
uInt getModifyCounter() const
Get the modify counter.
this file contains all the compiler specific defines
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
int Int
Definition aipstype.h:48
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
uInt64 rownr_t
Define the type of a row number in a table.
Definition aipsxtype.h:44