casacore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DataManager.h
Go to the documentation of this file.
1 //# DataManager.h: Abstract base class for a data manager
2 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2001,2002,2016
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: aips2-request@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 //# $Id$
27 
28 #ifndef TABLES_DATAMANAGER_H
29 #define TABLES_DATAMANAGER_H
30 
31 
32 //# Includes
33 #include <casacore/casa/aips.h>
39 
40 #include <iosfwd>
41 #include <map>
42 #include <mutex>
43 
44 namespace casacore { //# NAMESPACE CASACORE - BEGIN
45 
46 //# Forward Declarations
47 class DataManager;
48 class SetupNewTable;
49 class Table;
50 class MultiFileBase;
51 class Record;
52 class AipsIO;
53 
54 
55 // <summary>
56 // Define the type of the static construction function.
57 // </summary>
58 
59 // <use visibility=local>
60 
61 // <reviewed reviewer="Gareth Hunt" date="94Nov17" tests="">
62 // </reviewed>
63 
64 // <synopsis>
65 // Class names of data managers and pointers to their associated constructor
66 // function are registered in a static map to be able to create the correct
67 // data manager object from a string giving the type name of the data manager.
68 // DataManagerCtor is the type of the constructor functions.
69 // </synopsis>
70 // <group name=DataManagerCtor>
71 typedef DataManager* (*DataManagerCtor) (const String& dataManagerType,
72  const Record& spec);
73 // </group>
74 
75 
76 // <summary>
77 // Abstract base class for a data manager
78 // </summary>
79 
80 // <use visibility=local>
81 
82 // <reviewed reviewer="Gareth Hunt" date="94Nov17" tests="">
83 // </reviewed>
84 
85 // <prerequisite>
86 //# Classes you should understand before using this one.
87 // </prerequisite>
88 
89 // <synopsis>
90 // DataManager is the abstract base class for all kind of table data managers.
91 // <br> The DataManager class structure is shown in this
92 // <a href="DataManager.drawio.svg.html">UML diagram</a>.
93 // There are currently 2 classes of data managers:
94 // <ul>
95 // <li> Storage managers handling the storage of data. These classes
96 // have to be derived from DataManager.
97 // StManAipsIO is an example of a storage manager.
98 // <li> Virtual column engines handling the on-the-fly calculation
99 // of data, which are not stored as such. The base class for
100 // these is VirtualColumnEngine (which is derived from DataManager),
101 // from which all virtual columns engine must be derived from.
102 // </ul>
103 // DataManager contains some common data and defines several virtual
104 // functions, which usually have to be implemented in the derived classes.
105 // It also contains some helper functions for the derived classes
106 // (like fileName().
107 //
108 // The actual handling of a column by the data manager is defined in
109 // the abstract base class
110 // <linkto class="DataManagerColumn:description">DataManagerColumn</linkto>.
111 // Each data manager must
112 // have an associated class (derived from DataManagerColumn) to
113 // handle the columns.
114 //
115 // There is a protocol defined how a data manager is created and
116 // initialized. For a new table it is:
117 // <ul>
118 // <li>
119 // The user creates data managers and binds them to columns. For example:
120 // <srcblock>
121 // SetupNewTable newtab("name.data", Table::New); // set up new table
122 // StManAipsIO stman; // define storage manager
123 // newtab.bindColumn ("column1", stman); // bind column to st.man.
124 // newtab.bindColumn ("column2", stman); // bind column to st.man.
125 // Table tab(newtab); // actually create table
126 // </srcblock>
127 // When the given data manager object is used for the first time in a bind
128 // function, a copy of the object is made using the clone function.
129 // Thus in the above example column1 and column2 share the same data
130 // manager; only at the first bind the stman object is cloned.
131 // Columns not explicitly bound to a data manager get implicitly bound
132 // to the default data manager (as defined in the column description)
133 // by the Table constructor (as used in line 5).
134 // <li>
135 // After binding the unbound columns, the PlainTable constructor sets up
136 // the data managers. For each column it asks the data manager to
137 // construct a DataManagerColumn object (in fact, an object of a class
138 // derived from DataManagerColumn). This is done by the functions
139 // createScalarColumn, createIndArrColumn and createDirArrColumn.
140 // For each data manager the create function is called. This allows
141 // them to initialize themselves and/or to call an initialization
142 // function in their column objects.
143 // This is, for instance, used by the storage managers to create files.
144 // Thereafter the prepare function is called to allow the data managers
145 // to do further initialization possibly requiring information from
146 // other columns.
147 // <li>
148 // When the table gets written (by the PlainTable destructor),
149 // the flush function is called for each data manager. This allows
150 // the data manager or their column objects to write or flush their data.
151 // The table system takes care of storing the information required
152 // to reconstruct the data managers. It uses the function dataManagerType
153 // to store the (unique) type name of the data manager class.
154 // <li>
155 // Finally each data manager object gets deleted. Their destructors
156 // must delete their column objects (if any and if needed).
157 // </ul>
158 // For an existing table the procedure is slightly different:
159 // <ul>
160 // <li>
161 // The statement
162 // <br><src> Table tab("name.data"); </src>
163 // will create a table object for an existing table. This has the effect
164 // that the given table file will be read to reconstruct the Table object
165 // and the data managers.
166 // <li>
167 // The stored data manager class names are used to reconstruct
168 // the data managers. This uses the static registration map, which
169 // maps the class name to a static class constructor function (usually
170 // called makeObject). This requires that the type name and constructor
171 // for each possible data manager are registered before the table
172 // is opened. The DataManager function registerMainCtor (implemented
173 // in DataManager.cc) is called before a table is opened, so registration
174 // of data managers should, in principle, be done there.
175 // <br>However, for unknown data managers it is tried to load a shared
176 // library whose name is the lowercase version of the data manager without a
177 // possible template argument (e.g. <src>bitflagsengine</src> for
178 // data manager <src>BitFlagsEngine<Int></src>).
179 // It can be preceeded by lib or libcasa_ and followed by .so or .dylib.
180 // The shared library has to have a function with a name like
181 // <src>register_bitflagsengine</src> that must register the data manager(s).
182 // The function must be declared as <src>extern "C"</src>, otherwise its
183 // name gets mangled.
184 // <li>
185 // Each table column is bound to the correct data manager. The sequence
186 // number stored in the table file is used for that purpose.
187 // <li>
188 // The DataManager createXXXColumn functions are called for each table
189 // column to let the data manager construct a data manager column object.
190 // <li>
191 // For each data manager the open function is called to allow it and
192 // its column objects to read back the information stored in the
193 // flush function.
194 // Thereafter the prepare function is called for each data manager
195 // to allow it to initialize some variables.
196 // The reason that open and prepare are separated is that in order to
197 // initialize variables it may be required to use other columns.
198 // So it may be needed that all columns are read back before they
199 // get initialized.
200 // <li>
201 // Similar to a new table the flush functions gets called when the
202 // table gets written. Destruction is also the same as sketched
203 // for new tables.
204 // </ul>
205 // </synopsis>
206 
207 // <motivation>
208 // An abstract base class is needed to support data managers and
209 // virtual column engines in the table system in a transparant way.
210 // </motivation>
211 
212 // <todo asof="$DATE:$">
213 //# A List of bugs, limitations, extensions or planned refinements.
214 // <li> Handle unregistered data managers in a better way.
215 // Instead of throwing an exception a subprocess could be
216 // started which represents the data manager.
217 // </todo>
218 
219 
221 {
222 friend class SetupNewTable;
223 friend class ColumnSet;
224 
225 public:
226 
227  // Default constructor.
228  DataManager();
229 
230  virtual ~DataManager();
231 
232  // Make a clone of the derived object.
233  virtual DataManager* clone() const = 0;
234 
235  // Return the name of the data manager. This is the name of this
236  // instantiation of the data manager, thus not its type name.
237  // By default it returns an empty string.
238  virtual String dataManagerName() const;
239 
240  // Return the type name of the data manager (in fact its class name).
241  // It has to be a unique name, thus if the class is templated
242  // the template parameter has to be part of the name.
243  // This is used by the open/flush mechanism to be able to reconstruct
244  // the correct data manager.
245  virtual String dataManagerType() const = 0;
246 
247  // Add SEQNR and SPEC (the DataManagerSpec subrecord) to the info.
248  void dataManagerInfo (Record& info) const;
249 
250  // Return a record containing data manager specifications.
251  // The default implementation returns an empty record.
252  virtual Record dataManagerSpec() const;
253 
254  // Get data manager properties that can be modified.
255  // It is a subset of the data manager specification.
256  // The default implementation returns an empty record.
257  virtual Record getProperties() const;
258 
259  // Modify data manager properties given in record fields. Only the
260  // properties as returned by getProperties are used, others are ignored.
261  // The default implementation does nothing.
262  virtual void setProperties (const Record& spec);
263 
264  // Is the data manager a storage manager?
265  // The default is yes.
266  virtual Bool isStorageManager() const;
267 
268  // Tell if the data manager wants to reallocate the data manager
269  // column objects.
270  // This is used by the tiling storage manager.
271  // By default it returns False.
272  virtual Bool canReallocateColumns() const;
273 
274  // Reallocate the column object if it is part of this data manager.
275  // It returns a pointer to the new column object.
276  // This function is used by the tiling storage manager.
277  // By default it does nothing and returns the input pointer.
279 
280  // Get the (unique) sequence nr of this data manager.
281  uInt sequenceNr() const
282  { return seqnr_p; }
283 
284  // Get the nr of columns in this data manager (can be zero).
285  uInt ncolumn() const
286  { return nrcol_p; }
287 
288  // Have the data to be stored in big or little endian canonical format?
290  { return asBigEndian_p; }
291 
292  // Get the TSM option.
293  const TSMOption& tsmOption() const
294  { return tsmOption_p; }
295 
296  // Get the MultiFile pointer (can be 0).
298  { return multiFile_p; }
299 
300  // Compose a keyword name from the given keyword appended with the
301  // sequence number (e.g. key_0).
302  // This makes the keyword name unique if multiple data managers
303  // are used with the same type.
304  String keywordName (const String& keyword) const;
305 
306  // Compose a unique filename from the table name and sequence number.
307  String fileName() const;
308 
309  // Get the AipsIO option of the underlying file.
311 
312  // Is this a regular storage manager?
313  // It is regular if it allows addition of rows and writing data in them.
314  // <br>The default implementation returns True.
315  virtual Bool isRegular() const;
316 
317  // Get the table this object is associated with.
318  Table& table() const
319  { return *table_p; }
320 
321  // Reopen the data manager for read/write access.
322  // By default it is assumed that a reopen for read/write does
323  // not have to do anything.
324  virtual void reopenRW();
325 
326  // Does the data manager allow to add rows? (default no)
327  virtual Bool canAddRow() const;
328 
329  // Does the data manager allow to delete rows? (default no)
330  virtual Bool canRemoveRow() const;
331 
332  // Does the data manager allow to add columns? (default no)
333  virtual Bool canAddColumn() const;
334 
335  // Does the data manager allow to delete columns? (default no)
336  virtual Bool canRemoveColumn() const;
337 
338  // Does the data manager allow to rename columns? (default yes)
339  virtual Bool canRenameColumn() const;
340 
341  // Set the maximum cache size (in bytes) to be used by a storage manager.
342  // The default implementation does nothing.
343  virtual void setMaximumCacheSize (uInt nMiB);
344 
345  // Show the data manager's IO statistics. By default it does nothing.
346  virtual void showCacheStatistics (std::ostream&) const;
347 
348  // Create a column in the data manager on behalf of a table column.
349  // It calls makeXColumn and checks the data type.
350  // <group>
351  // Create a scalar column.
352  // The <src>dataTypeId</src> argument is gives the id (i.e. name)
353  // of the data type of the column. It is only used for virtual
354  // columns of a non-standard data type to be able to check if
355  // the correctness of the column data type.
356  // <br>Storage managers only handle standard data types and
357  // can readily ignore this argument.
358  DataManagerColumn* createScalarColumn (const String& columnName,
359  int dataType,
360  const String& dataTypeId);
361  // Create a direct array column.
362  DataManagerColumn* createDirArrColumn (const String& columnName,
363  int dataType,
364  const String& dataTypeId);
365  // Create an indirect array column.
366  DataManagerColumn* createIndArrColumn (const String& columnName,
367  int dataType,
368  const String& dataTypeId);
369  // </group>
370 
371  // The data manager will be deleted (because all its columns are
372  // requested to be deleted).
373  // So clean up the things needed (e.g. delete files).
374  virtual void deleteManager() = 0;
375 
376 
377 protected:
378  // Decrement number of columns (in case a column is deleted).
380  { nrcol_p--; }
381 
382  // Tell the data manager if big or little endian format is needed.
383  void setEndian (Bool bigEndian)
384  { asBigEndian_p = bigEndian; }
385 
386  // Tell the data manager which TSM option to use.
387  void setTsmOption (const TSMOption& tsmOption);
388 
389  // Tell the data manager that MultiFile can be used.
390  // Because MultiFile cannot be used with mmapped files, it sets
391  // the TSMOption accordingly.
392  void setMultiFile (MultiFileBase* mfile);
393 
394  // Does the data manager support use of MultiFile?
395  // A derived class has to return True if it can use the MultiFile.
396  // The default implementation returns False.
397  virtual Bool hasMultiFileSupport() const;
398 
399  // Throw an exception in case data type is TpOther, because the
400  // storage managers (and maybe other data managers) do not support
401  // such columns.
402  void throwDataTypeOther (const String& columnName, int dataType) const;
403 
404 
405 private:
406  uInt nrcol_p; //# #columns in this st.man.
407  uInt seqnr_p; //# Unique nr of this st.man. in a Table
408  Bool asBigEndian_p; //# store data in big or little endian
410  MultiFileBase* multiFile_p; //# MultiFile to use; 0=no MultiFile
411  Table* table_p; //# Table this data manager belongs to
412  mutable DataManager* clone_p; //# Pointer to clone (used by SetupNewTab)
413 
414 
415  // The copy constructor cannot be used for this base class.
416  // The clone function should be used instead.
417  // The private declaration of this constructor makes it unusable.
418  DataManager (const DataManager&);
419 
420  // Assignment cannot be used for this base class.
421  // The private declaration of this operator makes it unusable.
423 
424  // Create a column in the data manager on behalf of a table column.
425  //# Should be private, but has to be public because friend
426  //# declaration gave internal CFront error.
427  // <group>
428  // Create a scalar column.
429  virtual DataManagerColumn* makeScalarColumn (const String& columnName,
430  int dataType,
431  const String& dataTypeId) = 0;
432  // Create a direct array column.
433  virtual DataManagerColumn* makeDirArrColumn (const String& columnName,
434  int dataType,
435  const String& dataTypeId) = 0;
436  // Create an indirect array column.
437  virtual DataManagerColumn* makeIndArrColumn (const String& columnName,
438  int dataType,
439  const String& dataTypeId) = 0;
440  // </group>
441 
442  // Check if the data type of the created data manager column is correct.
443  void checkDataType (const DataManagerColumn* colPtr,
444  const String& columnName,
445  int dataType, const String& dataTypeId) const;
446 
447  // Add rows to all columns.
448  // <br>The default implementation calls the uInt version.
449  virtual void addRow64 (rownr_t nrrow);
450 
451  // Delete a row from all columns.
452  // <br>The default implementation calls the uInt version.
453  virtual void removeRow64 (rownr_t rownr);
454 
455  // Add a column.
456  // The default implementation throws a "not possible" exception.
457  virtual void addColumn (DataManagerColumn*);
458 
459  // Delete a column.
460  // The default implementation throws a "not possible" exception.
461  virtual void removeColumn (DataManagerColumn*);
462 
463  // Set the sequence number of this data manager.
464  void setSeqnr (uInt nr)
465  { seqnr_p = nr; }
466 
467  // Link the data manager to the Table object.
468  void linkToTable (Table& tab);
469 
470  // Flush and optionally fsync the data.
471  // The AipsIO stream represents the main table file and can be
472  // used by virtual column engines to store SMALL amounts of data.
473  // It returns a True status if it had to flush (i.e. if data have changed).
474  virtual Bool flush (AipsIO& ios, Bool fsync) = 0;
475 
476  // Let the data manager initialize itself for a new table.
477  // <br>The default implementation calls the uInt version.
478  virtual void create64 (rownr_t nrrow);
479 
480  // Let the data manager initialize itself for an existing table.
481  // The AipsIO stream represents the main table file and must be
482  // used by virtual column engines to retrieve the data stored
483  // in the flush function.
484  // <br>The data manager returns 0 or the nr of rows it thinks there are.
485  // This is particularly useful for data managers like LofarStMan whose
486  // data are written outside the table system, thus for which no rows
487  // have been added.
488  // <br>The default implementation calls the uInt version of open and open1.
489  virtual rownr_t open64 (rownr_t nrrow, AipsIO& ios);
490 
491  // Resync the data by rereading cached data from the file.
492  // This is called when a lock is acquired on the file and it appears
493  // that data in this data manager has been changed by another process.
494  // <br>The data manager returns 0 or the number of rows it thinks there are.
495  // This is particularly useful for data managers like LofarStMan whose
496  // data are written outside the table system, thus for which no rows
497  // have been added.
498  // <br>The default implementation calls the uInt version of resync and
499  // resync1.
500  virtual rownr_t resync64 (rownr_t nrrow);
501 
502  // Let the data manager initialize itself further.
503  // Prepare is called after create/open has been called for all
504  // columns. In this way one can be sure that referenced columns
505  // are read back and partly initialized.
506  // The default implementation does nothing.
507  virtual void prepare();
508 
509  // Backward compatibility function using uInt instead of rownr_t.
510  // The default implementations throw an exception.
511  // <group>
512  virtual void addRow (uInt nrrow);
513  virtual void removeRow (uInt rownr);
514  virtual void create (uInt nrrow);
515  virtual void open (uInt nrrow, AipsIO& ios);
516  virtual uInt open1 (uInt nrrow, AipsIO& ios);
517  virtual void resync (uInt nrrow);
518  virtual uInt resync1 (uInt nrrow);
519  // </group>
520 
521  // Declare the mapping of the data manager type name to a static
522  // "makeObject" function.
523  static std::map<String,DataManagerCtor> theirRegisterMap;
524  static std::recursive_mutex theirMutex;
525 
526 public:
527  // Has the object already been cloned?
529  { return clone_p; }
530 
531  // Set the pointer to the clone.
532  void setClone (DataManager* clone) const
533  { clone_p = clone; }
534 
535  // Register a mapping of a data manager type to its static construction
536  // function. It is fully thread-safe.
537  static void registerCtor (const String& type, DataManagerCtor func);
538 
539  // Get the "constructor" of a data manager (thread-safe).
540  static DataManagerCtor getCtor (const String& dataManagerType);
541 
542  // Test if a data manager is registered (thread-safe).
543  static Bool isRegistered (const String& dataManagerType);
544 
545  // Serve as default function for theirRegisterMap, which catches all
546  // unknown data manager types.
547  // <thrown>
548  // <li> TableUnknownDataManager
549  // </thrown>
551  const Record& spec);
552 
553  // Define the highest row number that can be represented as signed 32-bit.
554  // In principle it is the maximum uInt number, but for test purposes it
555  // can be reset (to a lower number).
556  static rownr_t MAXROWNR32; //# set to 2147483647
557 
558 private:
559  // Register the main data managers.
560  static std::map<String,DataManagerCtor> initRegisterMap();
561 };
562 
563 
564 } //# NAMESPACE CASACORE - END
565 
566 #endif
void setMultiFile(MultiFileBase *mfile)
Tell the data manager that MultiFile can be used.
void throwDataTypeOther(const String &columnName, int dataType) const
Throw an exception in case data type is TpOther, because the storage managers (and maybe other data m...
static std::recursive_mutex theirMutex
Definition: DataManager.h:524
static void registerCtor(const String &type, DataManagerCtor func)
Register a mapping of a data manager type to its static construction function.
Create a new table - define shapes, data managers, etc.
Definition: SetupNewTab.h:340
uInt ncolumn() const
Get the nr of columns in this data manager (can be zero).
Definition: DataManager.h:285
static std::map< String, DataManagerCtor > initRegisterMap()
Register the main data managers.
static rownr_t MAXROWNR32
Define the highest row number that can be represented as signed 32-bit.
Definition: DataManager.h:556
ByteIO::OpenOption fileOption() const
Get the AipsIO option of the underlying file.
Main interface class to a read/write table.
Definition: Table.h:157
void decrementNcolumn()
Decrement number of columns (in case a column is deleted).
Definition: DataManager.h:379
virtual Bool canAddRow() const
Does the data manager allow to add rows? (default no)
virtual uInt open1(uInt nrrow, AipsIO &ios)
virtual Bool flush(AipsIO &ios, Bool fsync)=0
Flush and optionally fsync the data.
Abstract base class to combine multiple files in a single one.
void dataManagerInfo(Record &info) const
Add SEQNR and SPEC (the DataManagerSpec subrecord) to the info.
AipsIO is the object persistency mechanism of Casacore.
Definition: AipsIO.h:168
virtual void removeRow(uInt rownr)
virtual Record dataManagerSpec() const
Return a record containing data manager specifications.
virtual Bool canRenameColumn() const
Does the data manager allow to rename columns? (default yes)
Abstract base class for a column in a data manager.
virtual void reopenRW()
Reopen the data manager for read/write access.
virtual void resync(uInt nrrow)
const TSMOption & tsmOption() const
Get the TSM option.
Definition: DataManager.h:293
String fileName() const
Compose a unique filename from the table name and sequence number.
static DataManagerCtor getCtor(const String &dataManagerType)
Get the &quot;constructor&quot; of a data manager (thread-safe).
virtual Bool hasMultiFileSupport() const
Does the data manager support use of MultiFile? A derived class has to return True if it can use the ...
virtual void deleteManager()=0
The data manager will be deleted (because all its columns are requested to be deleted).
virtual void addRow(uInt nrrow)
Backward compatibility function using uInt instead of rownr_t.
MultiFileBase * multiFile()
Get the MultiFile pointer (can be 0).
Definition: DataManager.h:297
String keywordName(const String &keyword) const
Compose a keyword name from the given keyword appended with the sequence number (e.g.
virtual String dataManagerName() const
Return the name of the data manager.
virtual void create64(rownr_t nrrow)
Let the data manager initialize itself for a new table.
Class to manage a set of table columns.
Definition: ColumnSet.h:93
DataManagerColumn * createIndArrColumn(const String &columnName, int dataType, const String &dataTypeId)
Create an indirect array column.
virtual void setMaximumCacheSize(uInt nMiB)
Set the maximum cache size (in bytes) to be used by a storage manager.
virtual void open(uInt nrrow, AipsIO &ios)
virtual void showCacheStatistics(std::ostream &) const
Show the data manager&#39;s IO statistics.
void setClone(DataManager *clone) const
Set the pointer to the clone.
Definition: DataManager.h:532
static Bool isRegistered(const String &dataManagerType)
Test if a data manager is registered (thread-safe).
virtual void addRow64(rownr_t nrrow)
Add rows to all columns.
virtual Bool canRemoveColumn() const
Does the data manager allow to delete columns? (default no)
virtual Bool canRemoveRow() const
Does the data manager allow to delete rows? (default no)
DataManager * clone_p
Definition: DataManager.h:412
virtual DataManagerColumn * makeScalarColumn(const String &columnName, int dataType, const String &dataTypeId)=0
Create a column in the data manager on behalf of a table column.
virtual void removeRow64(rownr_t rownr)
Delete a row from all columns.
virtual DataManagerColumn * makeIndArrColumn(const String &columnName, int dataType, const String &dataTypeId)=0
Create an indirect array column.
virtual Record getProperties() const
Get data manager properties that can be modified.
virtual void create(uInt nrrow)
virtual void setProperties(const Record &spec)
Modify data manager properties given in record fields.
void setTsmOption(const TSMOption &tsmOption)
Tell the data manager which TSM option to use.
virtual void prepare()
Let the data manager initialize itself further.
DataManager & operator=(const DataManager &)
Assignment cannot be used for this base class.
Options for the Tiled Storage Manager Access.
Definition: TSMOption.h:116
A hierarchical collection of named fields of various types.
Definition: Record.h:180
virtual Bool canReallocateColumns() const
Tell if the data manager wants to reallocate the data manager column objects.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void linkToTable(Table &tab)
Link the data manager to the Table object.
virtual void removeColumn(DataManagerColumn *)
Delete a column.
virtual DataManagerColumn * reallocateColumn(DataManagerColumn *column)
Reallocate the column object if it is part of this data manager.
virtual DataManagerColumn * makeDirArrColumn(const String &columnName, int dataType, const String &dataTypeId)=0
Create a direct array column.
virtual Bool isRegular() const
Is this a regular storage manager? It is regular if it allows addition of rows and writing data in th...
DataManager * getClone() const
Has the object already been cloned?
Definition: DataManager.h:528
DataManager()
Default constructor.
uInt sequenceNr() const
Get the (unique) sequence nr of this data manager.
Definition: DataManager.h:281
virtual rownr_t open64(rownr_t nrrow, AipsIO &ios)
Let the data manager initialize itself for an existing table.
uInt64 rownr_t
Define the type of a row number in a table.
Definition: aipsxtype.h:46
virtual String dataManagerType() const =0
Return the type name of the data manager (in fact its class name).
virtual DataManager * clone() const =0
Make a clone of the derived object.
virtual void addColumn(DataManagerColumn *)
Add a column.
OpenOption
Define the possible ByteIO open options.
Definition: ByteIO.h:65
Abstract base class for a data manager.
Definition: DataManager.h:220
virtual uInt resync1(uInt nrrow)
void setEndian(Bool bigEndian)
Tell the data manager if big or little endian format is needed.
Definition: DataManager.h:383
virtual Bool isStorageManager() const
Is the data manager a storage manager? The default is yes.
String: the storage and methods of handling collections of characters.
Definition: String.h:225
virtual Bool canAddColumn() const
Does the data manager allow to add columns? (default no)
MultiFileBase * multiFile_p
Definition: DataManager.h:410
Table & table() const
Get the table this object is associated with.
Definition: DataManager.h:318
DataManagerColumn * createDirArrColumn(const String &columnName, int dataType, const String &dataTypeId)
Create a direct array column.
void checkDataType(const DataManagerColumn *colPtr, const String &columnName, int dataType, const String &dataTypeId) const
Check if the data type of the created data manager column is correct.
DataManagerColumn * createScalarColumn(const String &columnName, int dataType, const String &dataTypeId)
Create a column in the data manager on behalf of a table column.
virtual rownr_t resync64(rownr_t nrrow)
Resync the data by rereading cached data from the file.
void setSeqnr(uInt nr)
Set the sequence number of this data manager.
Definition: DataManager.h:464
Bool asBigEndian() const
Have the data to be stored in big or little endian canonical format?
Definition: DataManager.h:289
static DataManager * unknownDataManager(const String &dataManagerType, const Record &spec)
Serve as default function for theirRegisterMap, which catches all unknown data manager types...
unsigned int uInt
Definition: aipstype.h:51
static std::map< String, DataManagerCtor > theirRegisterMap
Declare the mapping of the data manager type name to a static &quot;makeObject&quot; function.
Definition: DataManager.h:523