casacore
DataManager.h
Go to the documentation of this file.
1 //# DataManager.h: Abstract base classes for a data manager
2 //# Copyright (C) 1994,1995,1996,1997,1998,1999,2001,2002
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>
34 #include <casacore/tables/Tables/ColumnCache.h>
35 #include <casacore/tables/DataMan/TSMOption.h>
36 #include <casacore/casa/BasicSL/String.h>
37 #include <casacore/casa/BasicSL/Complex.h>
38 #include <casacore/casa/Containers/SimOrdMap.h>
39 #include <casacore/casa/IO/ByteIO.h>
40 #include <casacore/casa/OS/Mutex.h>
41 #include<iosfwd>
42 
43 namespace casacore { //# NAMESPACE CASACORE - BEGIN
44 
45 //# Forward Declarations
46 class DataManager;
47 class DataManagerColumn;
48 class SetupNewTable;
49 class Table;
50 class MultiFileBase;
51 class Record;
52 class IPosition;
53 class Slicer;
54 class RefRows;
55 template<class T> class Array;
56 class AipsIO;
57 
58 
59 // <summary>
60 // Define the type of the static construction function.
61 // </summary>
62 
63 // <use visibility=local>
64 
65 // <reviewed reviewer="Gareth Hunt" date="94Nov17" tests="">
66 // </reviewed>
67 
68 // <synopsis>
69 // Class names of data managers and pointers to their associated constructor
70 // function are registered in a static map to be able to create the correct
71 // data manager object from a string giving the type name of the data manager.
72 // DataManagerCtor is the type of the constructor functions.
73 // </synopsis>
74 // <group name=DataManagerCtor>
75 typedef DataManager* (*DataManagerCtor) (const String& dataManagerType,
76  const Record& spec);
77 // </group>
78 
79 
80 // <summary>
81 // Abstract base class for a data manager
82 // </summary>
83 
84 // <use visibility=local>
85 
86 // <reviewed reviewer="Gareth Hunt" date="94Nov17" tests="">
87 // </reviewed>
88 
89 // <prerequisite>
90 //# Classes you should understand before using this one.
91 // </prerequisite>
92 
93 // <synopsis>
94 // DataManager is the abstract base class for all kind of table data managers.
95 // There are currently 2 classes of data managers:
96 // <ul>
97 // <li> Storage managers handling the storage of data. These classes
98 // have to be derived from DataManager.
99 // StManAipsIO is an example of a storage manager.
100 // <li> Virtual column engines handling the on-the-fly calculation
101 // of data, which are not stored as such. The base class for
102 // these is VirtualColumnEngine (which is derived from DataManager),
103 // from which all virtual columns engine must be derived from.
104 // </ul>
105 // DataManager contains some common data and defines several virtual
106 // functions, which usually have to be implemented in the derived classes.
107 // It also contains some helper functions for the derived classes
108 // (like fileName().
109 //
110 // The actual handling of a column by the data manager is defined in
111 // the abstract base class
112 // <linkto class="DataManagerColumn:description">DataManagerColumn</linkto>.
113 // Each data manager must
114 // have an associated class (derived from DataManagerColumn) to
115 // handle the columns.
116 //
117 // There is a protocol defined how a data manager is created and
118 // initialized. For a new table it is:
119 // <ul>
120 // <li>
121 // The user creates data managers and binds them to columns. For example:
122 // <srcblock>
123 // SetupNewTable newtab("name.data", Table::New); // set up new table
124 // StManAipsIO stman; // define storage manager
125 // newtab.bindColumn ("column1", stman); // bind column to st.man.
126 // newtab.bindColumn ("column2", stman); // bind column to st.man.
127 // Table tab(newtab); // actually create table
128 // </srcblock>
129 // When the given data manager object is used for the first time in a bind
130 // function, a copy of the object is made using the clone function.
131 // Thus in the above example column1 and column2 share the same data
132 // manager; only at the first bind the stman object is cloned.
133 // Columns not explicitly bound to a data manager get implicitly bound
134 // to the default data manager (as defined in the column description)
135 // by the Table constructor (as used in line 5).
136 // <li>
137 // After binding the unbound columns, the PlainTable constructor sets up
138 // the data managers. For each column it asks the data manager to
139 // construct a DataManagerColumn object (in fact, an object of a class
140 // derived from DataManagerColumn). This is done by the functions
141 // createScalarColumn, createIndArrColumn and createDirArrColumn.
142 // For each data manager the create function is called. This allows
143 // them to initialize themselves and/or to call an initialization
144 // function in their column objects.
145 // This is, for instance, used by the storage managers to create files.
146 // Thereafter the prepare function is called to allow the data managers
147 // to do further initialization possibly requiring information from
148 // other columns.
149 // <li>
150 // When the table gets written (by the PlainTable destructor),
151 // the flush function is called for each data manager. This allows
152 // the data manager or their column objects to write or flush their data.
153 // The table system takes care of storing the information required
154 // to reconstruct the data managers. It uses the function dataManagerType
155 // to store the (unique) type name of the data manager class.
156 // <li>
157 // Finally each data manager object gets deleted. Their destructors
158 // must delete their column objects (if any and if needed).
159 // </ul>
160 // For an existing table the procedure is slightly different:
161 // <ul>
162 // <li>
163 // The statement
164 // <br><src> Table tab("name.data"); </src>
165 // will create a table object for an existing table. This has the effect
166 // that the given table file will be read to reconstruct the Table object
167 // and the data managers.
168 // <li>
169 // The stored data manager class names are used to reconstruct
170 // the data managers. This uses the static registration map, which
171 // maps the class name to a static class constructor function (usually
172 // called makeObject). This requires that the type name and constructor
173 // for each possible data manager are registered before the table
174 // is opened. The DataManager function registerMainCtor (implemented
175 // in DataManager.cc) is called before a table is opened, so registration
176 // of data managers should, in principle, be done there.
177 // <br>However, for unknown data managers it is tried to load a shared
178 // library whose name is the lowercase version of the data manager without a
179 // possible template argument (e.g. <src>bitflagsengine</src> for
180 // data manager <src>BitFlagsEngine<Int></src>).
181 // It can be preceeded by lib or libcasa_ and followed by .so or .dylib.
182 // The shared library has to have a function with a name like
183 // <src>register_bitflagsengine</src> that must register the data manager(s).
184 // The function must be declared as <src>extern "C"</src>, otherwise its
185 // name gets mangled.
186 // <li>
187 // Each table column is bound to the correct data manager. The sequence
188 // number stored in the table file is used for that purpose.
189 // <li>
190 // The DataManager createXXXColumn functions are called for each table
191 // column to let the data manager construct a data manager column object.
192 // <li>
193 // For each data manager the open function is called to allow it and
194 // its column objects to read back the information stored in the
195 // flush function.
196 // Thereafter the prepare function is called for each data manager
197 // to allow it to initialize some variables.
198 // The reason that open and prepare are separated is that in order to
199 // initialize variables it may be required to use other columns.
200 // So it may be needed that all columns are read back before they
201 // get initialized.
202 // <li>
203 // Similar to a new table the flush functions gets called when the
204 // table gets written. Destruction is also the same as sketched
205 // for new tables.
206 // </ul>
207 // </synopsis>
208 
209 // <motivation>
210 // An abstract base class is needed to support data managers and
211 // virtual column engines in the table system in a transparant way.
212 // </motivation>
213 
214 // <todo asof="$DATE:$">
215 //# A List of bugs, limitations, extensions or planned refinements.
216 // <li> Handle unregistered data managers in a better way.
217 // Instead of throwing an exception a subprocess could be
218 // started which represents the data manager.
219 // </todo>
220 
221 
223 {
224 friend class SetupNewTable;
225 friend class ColumnSet;
226 
227 public:
228 
229  // Default constructor.
230  DataManager();
231 
232  virtual ~DataManager();
233 
234  // Make a clone of the derived object.
235  virtual DataManager* clone() const = 0;
236 
237  // Return the name of the data manager. This is the name of this
238  // instantiation of the data manager, thus not its type name.
239  // By default it returns an empty string.
240  virtual String dataManagerName() const;
241 
242  // Return the type name of the data manager (in fact its class name).
243  // It has to be a unique name, thus if the class is templated
244  // the template parameter has to be part of the name.
245  // This is used by the open/flush mechanism to be able to reconstruct
246  // the correct data manager.
247  virtual String dataManagerType() const = 0;
248 
249  // Add SEQNR and SPEC (the DataManagerSpec subrecord) to the info.
250  void dataManagerInfo (Record& info) const;
251 
252  // Return a record containing data manager specifications.
253  // The default implementation returns an empty record.
254  virtual Record dataManagerSpec() const;
255 
256  // Get data manager properties that can be modified.
257  // It is a subset of the data manager specification.
258  // The default implementation returns an empty record.
259  virtual Record getProperties() const;
260 
261  // Modify data manager properties given in record fields. Only the
262  // properties as returned by getProperties are used, others are ignored.
263  // The default implementation does nothing.
264  virtual void setProperties (const Record& spec);
265 
266  // Is the data manager a storage manager?
267  // The default is yes.
268  virtual Bool isStorageManager() const;
269 
270  // Tell if the data manager wants to reallocate the data manager
271  // column objects.
272  // This is used by the tiling storage manager.
273  // By default it returns False.
274  virtual Bool canReallocateColumns() const;
275 
276  // Reallocate the column object if it is part of this data manager.
277  // It returns a pointer to the new column object.
278  // This function is used by the tiling storage manager.
279  // By default it does nothing and returns the input pointer.
281 
282  // Get the (unique) sequence nr of this data manager.
283  uInt sequenceNr() const
284  { return seqnr_p; }
285 
286  // Get the nr of columns in this data manager (can be zero).
287  uInt ncolumn() const
288  { return nrcol_p; }
289 
290  // Have the data to be stored in big or little endian canonical format?
292  { return asBigEndian_p; }
293 
294  // Get the TSM option.
295  const TSMOption& tsmOption() const
296  { return tsmOption_p; }
297 
298  // Get the MultiFile pointer (can be 0).
300  { return multiFile_p; }
301 
302  // Compose a keyword name from the given keyword appended with the
303  // sequence number (e.g. key_0).
304  // This makes the keyword name unique if multiple data managers
305  // are used with the same type.
306  String keywordName (const String& keyword) const;
307 
308  // Compose a unique filename from the table name and sequence number.
309  String fileName() const;
310 
311  // Get the AipsIO option of the underlying file.
313 
314  // Is this a regular storage manager?
315  // It is regular if it allows addition of rows and writing data in them.
316  // <br>The default implementation returns True.
317  virtual Bool isRegular() const;
318 
319  // Get the table this object is associated with.
320  Table& table() const
321  { return *table_p; }
322 
323  // Reopen the data manager for read/write access.
324  // By default it is assumed that a reopen for read/write does
325  // not have to do anything.
326  virtual void reopenRW();
327 
328  // Does the data manager allow to add rows? (default no)
329  virtual Bool canAddRow() const;
330 
331  // Does the data manager allow to delete rows? (default no)
332  virtual Bool canRemoveRow() const;
333 
334  // Does the data manager allow to add columns? (default no)
335  virtual Bool canAddColumn() const;
336 
337  // Does the data manager allow to delete columns? (default no)
338  virtual Bool canRemoveColumn() const;
339 
340  // Does the data manager allow to rename columns? (default yes)
341  virtual Bool canRenameColumn() const;
342 
343  // Set the maximum cache size (in bytes) to be used by a storage manager.
344  // The default implementation does nothing.
345  virtual void setMaximumCacheSize (uInt nbytes);
346 
347  // Show the data manager's IO statistics. By default it does nothing.
348  virtual void showCacheStatistics (std::ostream&) const;
349 
350  // Create a column in the data manager on behalf of a table column.
351  // It calls makeXColumn and checks the data type.
352  // <group>
353  // Create a scalar column.
354  // The <src>dataTypeId</src> argument is gives the id (i.e. name)
355  // of the data type of the column. It is only used for virtual
356  // columns of a non-standard data type to be able to check if
357  // the correctness of the column data type.
358  // <br>Storage managers only handle standard data types and
359  // can readily ignore this argument.
360  DataManagerColumn* createScalarColumn (const String& columnName,
361  int dataType,
362  const String& dataTypeId);
363  // Create a direct array column.
364  DataManagerColumn* createDirArrColumn (const String& columnName,
365  int dataType,
366  const String& dataTypeId);
367  // Create an indirect array column.
368  DataManagerColumn* createIndArrColumn (const String& columnName,
369  int dataType,
370  const String& dataTypeId);
371  // </group>
372 
373  // The data manager will be deleted (because all its columns are
374  // requested to be deleted).
375  // So clean up the things needed (e.g. delete files).
376  virtual void deleteManager() = 0;
377 
378 
379 protected:
380  // Decrement number of columns (in case a column is deleted).
382  { nrcol_p--; }
383 
384  // Tell the data manager if big or little endian format is needed.
385  void setEndian (Bool bigEndian)
386  { asBigEndian_p = bigEndian; }
387 
388  // Tell the data manager which TSM option to use.
389  void setTsmOption (const TSMOption& tsmOption);
390 
391  // Tell the data manager that MultiFile can be used.
392  // Because MultiFile cannot be used with mmapped files, it sets
393  // the TSMOption accordingly.
394  void setMultiFile (MultiFileBase* mfile);
395 
396  // Does the data manager support use of MultiFile?
397  // A derived class has to return True if it can use the MultiFile.
398  // The default implementation returns False.
399  virtual Bool hasMultiFileSupport() const;
400 
401  // Throw an exception in case data type is TpOther, because the
402  // storage managers (and maybe other data managers) do not support
403  // such columns.
404  void throwDataTypeOther (const String& columnName, int dataType) const;
405 
406 
407 private:
408  uInt nrcol_p; //# #columns in this st.man.
409  uInt seqnr_p; //# Unique nr of this st.man. in a Table
410  Bool asBigEndian_p; //# store data in big or little endian
412  MultiFileBase* multiFile_p; //# MultiFile to use; 0=no MultiFile
413  Table* table_p; //# Table this data manager belongs to
414  mutable DataManager* clone_p; //# Pointer to clone (used by SetupNewTab)
415 
416 
417  // The copy constructor cannot be used for this base class.
418  // The clone function should be used instead.
419  // The private declaration of this constructor makes it unusable.
420  DataManager (const DataManager&);
421 
422  // Assignment cannot be used for this base class.
423  // The private declaration of this operator makes it unusable.
425 
426  // Create a column in the data manager on behalf of a table column.
427  //# Should be private, but has to be public because friend
428  //# declaration gave internal CFront error.
429  // <group>
430  // Create a scalar column.
431  virtual DataManagerColumn* makeScalarColumn (const String& columnName,
432  int dataType,
433  const String& dataTypeId) = 0;
434  // Create a direct array column.
435  virtual DataManagerColumn* makeDirArrColumn (const String& columnName,
436  int dataType,
437  const String& dataTypeId) = 0;
438  // Create an indirect array column.
439  virtual DataManagerColumn* makeIndArrColumn (const String& columnName,
440  int dataType,
441  const String& dataTypeId) = 0;
442  // </group>
443 
444  // Check if the data type of the created data manager column is correct.
445  void checkDataType (const DataManagerColumn* colPtr,
446  const String& columnName,
447  int dataType, const String& dataTypeId) const;
448 
449  // Add rows to all columns.
450  // The default implementation throws a "not possible" exception.
451  virtual void addRow (uInt nrrow);
452 
453  // Delete a row from all columns.
454  // The default implementation throws a "not possible" exception.
455  virtual void removeRow (uInt rownr);
456 
457  // Add a column.
458  // The default implementation throws a "not possible" exception.
459  virtual void addColumn (DataManagerColumn*);
460 
461  // Delete a column.
462  // The default implementation throws a "not possible" exception.
463  virtual void removeColumn (DataManagerColumn*);
464 
465  // Set the sequence number of this data manager.
466  void setSeqnr (uInt nr)
467  { seqnr_p = nr; }
468 
469  // Link the data manager to the Table object.
470  void linkToTable (Table& tab);
471 
472  // Flush and optionally fsync the data.
473  // The AipsIO stream represents the main table file and can be
474  // used by virtual column engines to store SMALL amounts of data.
475  // It returns a True status if it had to flush (i.e. if data have changed).
476  virtual Bool flush (AipsIO& ios, Bool fsync) = 0;
477 
478  // Let the data manager initialize itself for a new table.
479  virtual void create (uInt nrrow) = 0;
480 
481  // Let the data manager initialize itself for an existing table.
482  // The AipsIO stream represents the main table file and must be
483  // used by virtual column engines to retrieve the data stored
484  // in the flush function.
485  virtual void open (uInt nrrow, AipsIO& ios) = 0;
486 
487  // Open as above.
488  // The data manager can return the number of rows it thinks there are.
489  // This is particularly useful for data managers like LofarStMan whose
490  // data are written outside the table system, thus for which no rows
491  // have been added.
492  // <br>By default it calls open and returns <src>nrrow</src>.
493  virtual uInt open1 (uInt nrrow, AipsIO& ios);
494 
495  // Resync the data by rereading cached data from the file.
496  // This is called when a lock is acquired on the file and it appears
497  // that data in this data manager has been changed by another process.
498  virtual void resync (uInt nrrow) = 0;
499 
500  // Resync as above.
501  // The data manager can return the number of rows it thinks there are.
502  // This is particularly useful for data managers like LofarStMan whose
503  // data are written outside the table system, thus for which no rows
504  // have been added.
505  // <br>By default it calls resync and returns <src>nrrow</src>.
506  virtual uInt resync1 (uInt nrrow);
507 
508  // Let the data manager initialize itself further.
509  // Prepare is called after create/open has been called for all
510  // columns. In this way one can be sure that referenced columns
511  // are read back and partly initialized.
512  // The default implementation does nothing.
513  virtual void prepare();
514 
515  // Declare the mapping of the data manager type name to a static
516  // "makeObject" function.
519 
520 public:
521  // Has the object already been cloned?
523  { return clone_p; }
524 
525  // Set the pointer to the clone.
526  void setClone (DataManager* clone) const
527  { clone_p = clone; }
528 
529  // Register a mapping of a data manager type to its static construction
530  // function. It is fully thread-safe.
531  static void registerCtor (const String& type, DataManagerCtor func);
532 
533  // Get the "constructor" of a data manager (thread-safe).
534  static DataManagerCtor getCtor (const String& dataManagerType);
535 
536  // Test if a data manager is registered (thread-safe).
537  static Bool isRegistered (const String& dataManagerType);
538 
539  // Register the main data managers (if not done yet).
540  // It is fully thread-safe.
541  static void registerMainCtor()
542  { theirMutexedInit.exec(); }
543 
544  // Serve as default function for theirRegisterMap, which catches all
545  // unknown data manager types.
546  // <thrown>
547  // <li> TableUnknownDataManager
548  // </thrown>
549  static DataManager* unknownDataManager (const String& dataManagerType,
550  const Record& spec);
551 
552 private:
553  // Register a data manager constructor.
554  static void unlockedRegisterCtor (const String& type,
555  DataManagerCtor func)
556  { theirRegisterMap.define (type, func); }
557 
558  // Do the actual (thread-safe) registration of the main data managers.
559  static void doRegisterMainCtor (void*);
560 };
561 
562 
563 
564 
565 // <summary>
566 // Abstract base class for a column in a data manager
567 // </summary>
568 
569 // <use visibility=local>
570 
571 // <reviewed reviewer="Gareth Hunt" date="94Nov17" tests="">
572 // </reviewed>
573 
574 // <prerequisite>
575 //# Classes you should understand before using this one.
576 // <li> DataManager
577 // </prerequisite>
578 
579 // <etymology>
580 // DataManagerColumn handles a column for a data manager.
581 // </etymology>
582 
583 // <synopsis>
584 // DataManagerColumn is the abstract base class to handle a column in
585 // a data manager. Each data manager class must have one or more associated
586 // classes derived from DataManagerColumn to handle the columns.
587 // For example, storage manager StManAipsIO has columns classes
588 // StManColumnAipsIO, StManColumnArrayAipsIO and StManColumnIndArrayAipsIO
589 // to handle scalars, direct arrays and indirect arrays, resp..
590 // However, using multiple inheritance it is possible that the derived
591 // DataManager and DataManagerColumn classes are the same. This is used
592 // in class ScaledArrayEngine<S,T> which represents both the data manager
593 // and its column class. It can do that, because the virtual column engine
594 // <linkto class="ScaledArrayEngine:description">ScaledArrayEngine</linkto>
595 // can handle only one column.
596 //
597 // In the synopsis of class DataManager it is described how the (derived)
598 // DataManagerColumn objects gets created and deleted.
599 //
600 // DataManagerColumn defines various virtual functions to get or put (slices)
601 // of data in a column. These functions are called by the table column
602 // classes ScalarColumnData and ArrayColumnData.
603 // It does not define functions create, open, flush and prepare like
604 // those defined in DataManager. It is left to the derived classes to
605 // define those as needed and to interact properly with their
606 // data manager object.
607 // </synopsis>
608 
609 // <motivation>
610 // An abstract base class is needed to support multiple data
611 // managers in the table system
612 // </motivation>
613 
614 // <todo asof="$DATE:$">
615 //# A List of bugs, limitations, extensions or planned refinements.
616 // </todo>
617 
618 
620 {
621 public:
622 
623  // Create a column.
625  : isFixedShape_p(False) {;}
626 
627  // Frees up the storage.
628  virtual ~DataManagerColumn();
629 
630  // Set the isFixedShape flag.
631  void setIsFixedShape (Bool isFixedShape)
632  { isFixedShape_p = isFixedShape; }
633 
634  // Is this a fixed shape column?
636  { return isFixedShape_p; }
637 
638  // Get the data type of the column as defined in DataType.h.
639  virtual int dataType() const = 0;
640 
641  // Get the data type id of the column for dataType==TpOther.
642  // The default implementation returns an emptry string.
643  // This function is required for virtual column engines handling
644  // non-standard data types. It is used to check the data type.
645  virtual String dataTypeId() const;
646 
647  // Test if data can be put into this column.
648  // This does not test if the data file is writable, only if
649  // it is in principle allowed to store data into the column.
650  // (It may not be allowed for virtual columns).
651  // The default is True.
652  virtual Bool isWritable() const;
653 
654  // Set the maximum length of the value (can be used for strings).
655  // By default the maximum length is ignored.
656  virtual void setMaxLength (uInt maxLength);
657 
658  // Set the shape of all (fixed-shaped) arrays in the column.
659  // Effectively it is the same as setShapeColumn, but it also sets
660  // the isFixedShape_p flag.
662  { setShapeColumn (shape); isFixedShape_p = True; }
663 
664  // Set the shape of an (variable-shaped) array in the given row.
665  // By default it throws a "not possible" exception.
666  virtual void setShape (uInt rownr, const IPosition& shape);
667 
668  // Set the shape and tile shape of an (variable-shaped) array
669  // in the given row.
670  // By default it ignores the tile shape (thus only sets the shape).
671  virtual void setShapeTiled (uInt rownr, const IPosition& shape,
672  const IPosition& tileShape);
673 
674  // Is the value shape defined in the given row?
675  // By default it returns True.
676  virtual Bool isShapeDefined (uInt rownr);
677 
678  // Get the dimensionality of the item in the given row.
679  // By default it returns shape(rownr).nelements().
680  virtual uInt ndim (uInt rownr);
681 
682  // Get the shape of the item in the given row.
683  // By default it returns a zero-length IPosition (for a scalar value).
684  virtual IPosition shape (uInt rownr);
685 
686  // Get the tile shape of the item in the given row.
687  // By default it returns a zero-length IPosition.
688  virtual IPosition tileShape (uInt rownr);
689 
690  // Can the data manager handle chaging the shape of an existing array?
691  // Default is no.
692  virtual Bool canChangeShape() const;
693 
694  // Can the column data manager handle access to a scalar column?
695  // If not, the caller should access the column by looping through
696  // all cells in the column.
697  // Default is no.
698  // <br>
699  // The returned reask switch determines if the information is
700  // permanent. False indicates it is permanent; True indicates it
701  // will be reasked for the next get/putColumn.
702  // By default reask is set to False.
703  virtual Bool canAccessScalarColumn (Bool& reask) const;
704 
705  // Can the column data manager handle access to a clooection of cells
706  // in a scalar column?
707  // If not, the caller should access the column cells by looping through
708  // the cells in the column.
709  // Default is no.
710  // <br>
711  // The returned reask switch determines if the information is
712  // permanent. False indicates it is permanent; True indicates it
713  // will be reasked for the next get/putColumn.
714  // By default reask is set to False.
715  virtual Bool canAccessScalarColumnCells (Bool& reask) const;
716 
717  // Can the column data manager handle access to a scalar column?
718  // If not, the caller should access the column by looping through
719  // all cells in the column.
720  // Default is no.
721  // <br>
722  // The returned reask switch determines if the information is
723  // permanent. False indicates it is permanent; True indicates it
724  // will be reasked for the next get/putColumn.
725  // By default reask is set to False.
726  virtual Bool canAccessArrayColumn (Bool& reask) const;
727 
728  // Can the column data manager handle access to a collection of cells
729  // in an array column?
730  // If not, the caller should access the column cells by looping through
731  // the cells in the column.
732  // Default is no.
733  // <br>
734  // The returned reask switch determines if the information is
735  // permanent. False indicates it is permanent; True indicates it
736  // will be reasked for the next get/putColumn.
737  // By default reask is set to False.
738  virtual Bool canAccessArrayColumnCells (Bool& reask) const;
739 
740  // Can the column data manager handle access to a cell slice?
741  // If not, the caller should do slicing itself (by accessing the
742  // entire array and slicing it).
743  // Default is no.
744  // <br>
745  // The returned reask switch determines if the information is
746  // permanent. False indicates it is permanent; True indicates it
747  // will be reasked for the next get/putColumn.
748  // By default reask is set to False.
749  virtual Bool canAccessSlice (Bool& reask) const;
750 
751  // Can the column data manager handle access to a column slice?
752  // If not, the caller should access the column slice by looping through
753  // all cell slices in the column.
754  // Default is no.
755  // <br>
756  // The returned reask switch determines if the information is
757  // permanent. False indicates it is permanent; True indicates it
758  // will be reasked for the next get/putColumn.
759  // By default reask is set to False.
760  virtual Bool canAccessColumnSlice (Bool& reask) const;
761 
762  // Get access to the ColumnCache object.
763  // <group>
765  { return colCache_p; }
767  { return &colCache_p; }
768  // </group>
769 
770  // Get the scalar value in the given row.
771  // These functions are non-virtual and are converted to their
772  // virtual getV equivalent to achieve that a derived templated class
773  //(like VirtualScalarColumn) does not have to declare and implement
774  // all these functions.
775  // The compiler complains about hiding virtual functions if you do not
776  // declare all virtual functions with the same name in a derived class.
777  // <group>
778  void get (uInt rownr, Bool* dataPtr)
779  { getBoolV (rownr, dataPtr); }
780  void get (uInt rownr, uChar* dataPtr)
781  { getuCharV (rownr, dataPtr); }
782  void get (uInt rownr, Short* dataPtr)
783  { getShortV (rownr, dataPtr); }
784  void get (uInt rownr, uShort* dataPtr)
785  { getuShortV (rownr, dataPtr); }
786  void get (uInt rownr, Int* dataPtr)
787  { getIntV (rownr, dataPtr); }
788  void get (uInt rownr, uInt* dataPtr)
789  { getuIntV (rownr, dataPtr); }
790  void get (uInt rownr, float* dataPtr)
791  { getfloatV (rownr, dataPtr); }
792  void get (uInt rownr, double* dataPtr)
793  { getdoubleV (rownr, dataPtr); }
794  void get (uInt rownr, Complex* dataPtr)
795  { getComplexV (rownr, dataPtr); }
796  void get (uInt rownr, DComplex* dataPtr)
797  { getDComplexV (rownr, dataPtr); }
798  void get (uInt rownr, String* dataPtr)
799  { getStringV (rownr, dataPtr); }
800  // This function is the get for all non-standard data types.
801  void get (uInt rownr, void* dataPtr)
802  { getOtherV (rownr, dataPtr); }
803  // </group>
804 
805  // Put the scalar value into the given row.
806  // These functions are non-virtual and are converted to their
807  // virtual putV equivalent to achieve that a derived templated class
808  //(like VirtualScalarColumn) does not have to declare and implement
809  // all these functions.
810  // The compiler complains about hiding virtual functions if you do not
811  // declare all virtual functions with the same name in a derived class.
812  // <group>
813  void put (uInt rownr, const Bool* dataPtr)
814  { putBoolV (rownr, dataPtr); }
815  void put (uInt rownr, const uChar* dataPtr)
816  { putuCharV (rownr, dataPtr); }
817  void put (uInt rownr, const Short* dataPtr)
818  { putShortV (rownr, dataPtr); }
819  void put (uInt rownr, const uShort* dataPtr)
820  { putuShortV (rownr, dataPtr); }
821  void put (uInt rownr, const Int* dataPtr)
822  { putIntV (rownr, dataPtr); }
823  void put (uInt rownr, const uInt* dataPtr)
824  { putuIntV (rownr, dataPtr); }
825  void put (uInt rownr, const float* dataPtr)
826  { putfloatV (rownr, dataPtr); }
827  void put (uInt rownr, const double* dataPtr)
828  { putdoubleV (rownr, dataPtr); }
829  void put (uInt rownr, const Complex* dataPtr)
830  { putComplexV (rownr, dataPtr); }
831  void put (uInt rownr, const DComplex* dataPtr)
832  { putDComplexV (rownr, dataPtr); }
833  void put (uInt rownr, const String* dataPtr)
834  { putStringV (rownr, dataPtr); }
835  // This function is the put for all non-standard data types.
836  void put (uInt rownr, const void* dataPtr)
837  { putOtherV (rownr, dataPtr); }
838  // </group>
839 
840  // Get all scalar values in the column.
841  // The argument dataPtr is in fact a Vector<T>*, but a void*
842  // is needed to be generic.
843  // The vector pointed to by dataPtr has to have the correct length
844  // (which is guaranteed by the ScalarColumn getColumn function).
845  // The default implementation throws an "invalid operation" exception.
846  virtual void getScalarColumnV (void* dataPtr);
847 
848  // Put all scalar values in the column.
849  // The argument dataPtr is in fact a const Vector<T>*, but a const void*
850  // is needed to be generic.
851  // The vector pointed to by dataPtr has to have the correct length
852  // (which is guaranteed by the ScalarColumn putColumn function).
853  // The default implementation throws an "invalid operation" exception.
854  virtual void putScalarColumnV (const void* dataPtr);
855 
856  // Get some scalar values in the column.
857  // The argument dataPtr is in fact a Vector<T>*, but a void*
858  // is needed to be generic.
859  // The vector pointed to by dataPtr has to have the correct length
860  // (which is guaranteed by the ScalarColumn getColumn function).
861  // The default implementation throws an "invalid operation" exception.
862  virtual void getScalarColumnCellsV (const RefRows& rownrs,
863  void* dataPtr);
864 
865  // Put some scalar values in the column.
866  // The argument dataPtr is in fact a const Vector<T>*, but a const void*
867  // is needed to be generic.
868  // The vector pointed to by dataPtr has to have the correct length
869  // (which is guaranteed by the ScalarColumn getColumn function).
870  // The default implementation throws an "invalid operation" exception.
871  virtual void putScalarColumnCellsV (const RefRows& rownrs,
872  const void* dataPtr);
873 
874  // Get scalars from the given row on with a maximum of nrmax values.
875  // It returns the actual number of values got.
876  // This can be used to get an entire column of scalars or to get
877  // a part of a column (for a cache for example).
878  // The argument dataPtr is in fact a T*, but a void*
879  // is needed to be generic.
880  // The default implementation throws an "invalid operation" exception.
881  virtual uInt getBlockV (uInt rownr, uInt nrmax, void* dataPtr);
882 
883  // Put nrmax scalars from the given row on.
884  // It returns the actual number of values put.
885  // This can be used to put an entire column of scalars or to put
886  // a part of a column (for a cache for example).
887  // The argument dataPtr is in fact a const T*, but a const void*
888  // is needed to be generic.
889  // The default implementation throws an "invalid operation" exception.
890  virtual void putBlockV (uInt rownr, uInt nrmax, const void* dataPtr);
891 
892  // Get the array value in the given row.
893  // The argument dataPtr is in fact an Array<T>*, but a void*
894  // is needed to be generic.
895  // The array pointed to by dataPtr has to have the correct shape
896  // (which is guaranteed by the ArrayColumn get function).
897  // The default implementation throws an "invalid operation" exception.
898  virtual void getArrayV (uInt rownr, void* dataPtr);
899 
900  // Put the array value into the given row.
901  // The argument dataPtr is in fact a const Array<T>*, but a const void*
902  // is needed to be generic.
903  // The array pointed to by dataPtr has to have the correct shape
904  // (which is guaranteed by the ArrayColumn put function).
905  // The default implementation throws an "invalid operation" exception.
906  virtual void putArrayV (uInt rownr, const void* dataPtr);
907 
908  // Get all array values in the column.
909  // The argument dataPtr is in fact an Array<T>*, but a void*
910  // is needed to be generic.
911  // The vector pointed to by dataPtr has to have the correct length
912  // (which is guaranteed by the ArrayColumn getColumn function).
913  // The default implementation throws an "invalid operation" exception.
914  virtual void getArrayColumnV (void* dataPtr);
915 
916  // Put all array values in the column.
917  // The argument dataPtr is in fact a const Array<T>*, but a const void*
918  // is needed to be generic.
919  // The vector pointed to by dataPtr has to have the correct length
920  // (which is guaranteed by the ArrayColumn putColumn function).
921  // The default implementation throws an "invalid operation" exception.
922  virtual void putArrayColumnV (const void* dataPtr);
923 
924  // Get some array values in the column.
925  // The argument dataPtr is in fact an Array<T>*, but a void*
926  // is needed to be generic.
927  // The vector pointed to by dataPtr has to have the correct length
928  // (which is guaranteed by the ArrayColumn getColumn function).
929  // The default implementation throws an "invalid operation" exception.
930  virtual void getArrayColumnCellsV (const RefRows& rownrs,
931  void* dataPtr);
932 
933  // Put some array values in the column.
934  // The argument dataPtr is in fact an const Array<T>*, but a const void*
935  // is needed to be generic.
936  // The vector pointed to by dataPtr has to have the correct length
937  // (which is guaranteed by the ArrayColumn getColumn function).
938  // The default implementation throws an "invalid operation" exception.
939  virtual void putArrayColumnCellsV (const RefRows& rownrs,
940  const void* dataPtr);
941 
942  // Get a section of the array in the given row.
943  // The argument dataPtr is in fact an Array<T>*, but a void*
944  // is needed to be generic.
945  // The array pointed to by dataPtr has to have the correct shape
946  // (which is guaranteed by the ArrayColumn getSlice function).
947  // The default implementation throws an "invalid operation" exception.
948  virtual void getSliceV (uInt rownr, const Slicer& slicer, void* dataPtr);
949 
950  // Put into a section of the array in the given row.
951  // The argument dataPtr is in fact a const Array<T>*, but a const void*
952  // is needed to be generic.
953  // The array pointed to by dataPtr has to have the correct shape
954  // (which is guaranteed by the ArrayColumn putSlice function).
955  // The default implementation throws an "invalid operation" exception.
956  virtual void putSliceV (uInt rownr, const Slicer& slicer,
957  const void* dataPtr);
958 
959  // Get a section of all arrays in the column.
960  // The argument dataPtr is in fact an Array<T>*, but a void*
961  // is needed to be generic.
962  // The array pointed to by dataPtr has to have the correct shape
963  // (which is guaranteed by the ArrayColumn getColumn function).
964  // The default implementation throws an "invalid operation" exception.
965  virtual void getColumnSliceV (const Slicer& slicer, void* dataPtr);
966 
967  // Put into a section of all arrays in the column.
968  // The argument dataPtr is in fact a const Array<T>*, but a const void*
969  // is needed to be generic.
970  // The array pointed to by dataPtr has to have the correct shape
971  // (which is guaranteed by the ArrayColumn putColumn function).
972  // The default implementation throws an "invalid operation" exception.
973  virtual void putColumnSliceV (const Slicer& slicer, const void* dataPtr);
974 
975  // Get a section of some arrays in the column.
976  // The argument dataPtr is in fact an Array<T>*, but a void*
977  // is needed to be generic.
978  // The array pointed to by dataPtr has to have the correct shape
979  // (which is guaranteed by the ArrayColumn getColumn function).
980  // The default implementation throws an "invalid operation" exception.
981  virtual void getColumnSliceCellsV (const RefRows& rownrs,
982  const Slicer& slicer, void* dataPtr);
983 
984  // Put into a section of some arrays in the column.
985  // The argument dataPtr is in fact a const Array<T>*, but a const void*
986  // is needed to be generic.
987  // The array pointed to by dataPtr has to have the correct shape
988  // (which is guaranteed by the ArrayColumn putColumn function).
989  // The default implementation throws an "invalid operation" exception.
990  virtual void putColumnSliceCellsV (const RefRows& rownrs,
991  const Slicer& slicer,
992  const void* dataPtr);
993 
994  // Throw an "invalid operation" exception for the default
995  // implementation of get.
996  void throwGet() const;
997 
998  // Throw an "invalid operation" exception for the default
999  // implementation of put.
1000  void throwPut() const;
1001 
1002  // Set the column name.
1003  void setColumnName (const String& colName)
1004  { colName_p = colName; }
1005 
1006  // Get rhe column name.
1007  const String& columnName() const
1008  { return colName_p; }
1009 
1010 protected:
1011  // Get the scalar value in the given row.
1012  // The default implementation throws an "invalid operation" exception.
1013  // <group>
1014  virtual void getBoolV (uInt rownr, Bool* dataPtr);
1015  virtual void getuCharV (uInt rownr, uChar* dataPtr);
1016  virtual void getShortV (uInt rownr, Short* dataPtr);
1017  virtual void getuShortV (uInt rownr, uShort* dataPtr);
1018  virtual void getIntV (uInt rownr, Int* dataPtr);
1019  virtual void getuIntV (uInt rownr, uInt* dataPtr);
1020  virtual void getfloatV (uInt rownr, float* dataPtr);
1021  virtual void getdoubleV (uInt rownr, double* dataPtr);
1022  virtual void getComplexV (uInt rownr, Complex* dataPtr);
1023  virtual void getDComplexV (uInt rownr, DComplex* dataPtr);
1024  virtual void getStringV (uInt rownr, String* dataPtr);
1025  // This function is the get for all non-standard data types.
1026  virtual void getOtherV (uInt rownr, void* dataPtr);
1027  // </group>
1028 
1029  // Put the scalar value into the given row.
1030  // The default implementation throws an "invalid operation" exception.
1031  // <group>
1032  virtual void putBoolV (uInt rownr, const Bool* dataPtr);
1033  virtual void putuCharV (uInt rownr, const uChar* dataPtr);
1034  virtual void putShortV (uInt rownr, const Short* dataPtr);
1035  virtual void putuShortV (uInt rownr, const uShort* dataPtr);
1036  virtual void putIntV (uInt rownr, const Int* dataPtr);
1037  virtual void putuIntV (uInt rownr, const uInt* dataPtr);
1038  virtual void putfloatV (uInt rownr, const float* dataPtr);
1039  virtual void putdoubleV (uInt rownr, const double* dataPtr);
1040  virtual void putComplexV (uInt rownr, const Complex* dataPtr);
1041  virtual void putDComplexV (uInt rownr, const DComplex* dataPtr);
1042  virtual void putStringV (uInt rownr, const String* dataPtr);
1043  // This function is the put for all non-standard data types.
1044  virtual void putOtherV (uInt rownr, const void* dataPtr);
1045  // </group>
1046 
1047 private:
1051 
1052  // Set the shape of all (fixed-shaped) arrays in the column.
1053  // By default it throws a "not possible" exception.
1054  virtual void setShapeColumn (const IPosition& shape);
1055 
1056  // The copy constructor cannot be used for this base class.
1057  // The private declaration of this constructor makes it unusable.
1059 
1060  // Assignment cannot be used for this base class.
1061  // The private declaration of this operator makes it unusable.
1063 };
1064 
1065 
1066 
1067 } //# NAMESPACE CASACORE - END
1068 
1069 #endif
void put(uInt rownr, const uInt *dataPtr)
Definition: DataManager.h:823
A Vector of integers, for indexing into Array<T> objects.
Definition: IPosition.h:119
void setMultiFile(MultiFileBase *mfile)
Tell the data manager that MultiFile can be used.
void setColumnName(const String &colName)
Set the column name.
Definition: DataManager.h:1003
virtual Bool canRenameColumn() const
Does the data manager allow to rename columns? (default yes)
const TSMOption & tsmOption() const
Get the TSM option.
Definition: DataManager.h:295
int Int
Definition: aipstype.h:50
static void registerCtor(const String &type, DataManagerCtor func)
Register a mapping of a data manager type to its static construction function.
void setFixedShapeColumn(const IPosition &shape)
Set the shape of all (fixed-shaped) arrays in the column.
Definition: DataManager.h:661
Create a new table - define shapes, data managers, etc.
Definition: SetupNewTab.h:346
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...
Bool isFixedShape() const
Is this a fixed shape column?
Definition: DataManager.h:635
ColumnCache colCache_p
Definition: ConcatColumn.h:290
Main interface class to a read/write table.
Definition: Table.h:149
void put(uInt rownr, const double *dataPtr)
Definition: DataManager.h:827
void decrementNcolumn()
Decrement number of columns (in case a column is deleted).
Definition: DataManager.h:381
const ColumnCache * columnCachePtr() const
Definition: DataManager.h:766
virtual uInt open1(uInt nrrow, AipsIO &ios)
Open as above.
virtual Bool flush(AipsIO &ios, Bool fsync)=0
Flush and optionally fsync the data.
virtual Record getProperties() const
Get data manager properties that can be modified.
Abstract base class to combine multiple files in a single one.
virtual Bool isRegular() const
Is this a regular storage manager? It is regular if it allows addition of rows and writing data in th...
AipsIO is the object persistency mechanism of Casacore.
Definition: AipsIO.h:168
virtual void removeRow(uInt rownr)
Delete a row from all columns.
virtual void showCacheStatistics(std::ostream &) const
Show the data manager&#39;s IO statistics.
Abstract base class for a column in a data manager.
Definition: DataManager.h:619
void put(uInt rownr, const Int *dataPtr)
Definition: DataManager.h:821
virtual void open(uInt nrrow, AipsIO &ios)=0
Let the data manager initialize itself for an existing table.
virtual void reopenRW()
Reopen the data manager for read/write access.
virtual Bool canRemoveColumn() const
Does the data manager allow to delete columns? (default no)
unsigned char uChar
Definition: aipstype.h:47
void put(uInt rownr, const void *dataPtr)
This function is the put for all non-standard data types.
Definition: DataManager.h:836
static DataManagerCtor getCtor(const String &dataManagerType)
Get the "constructor" of a data manager (thread-safe).
const String & columnName() const
Get rhe column name.
Definition: DataManager.h:1007
virtual void deleteManager()=0
The data manager will be deleted (because all its columns are requested to be deleted).
virtual Bool canRemoveRow() const
Does the data manager allow to delete rows? (default no)
virtual void setMaximumCacheSize(uInt nbytes)
Set the maximum cache size (in bytes) to be used by a storage manager.
virtual Bool canAddColumn() const
Does the data manager allow to add columns? (default no)
virtual void addRow(uInt nrrow)
Add rows to all columns.
MultiFileBase * multiFile()
Get the MultiFile pointer (can be 0).
Definition: DataManager.h:299
void put(uInt rownr, const Bool *dataPtr)
Put the scalar value into the given row.
Definition: DataManager.h:813
Thread-safe initialization of global variables.
Definition: Mutex.h:161
uInt ncolumn() const
Get the nr of columns in this data manager (can be zero).
Definition: DataManager.h:287
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.
ColumnCache & columnCache()
Get access to the ColumnCache object.
Definition: DataManager.h:764
uInt sequenceNr() const
Get the (unique) sequence nr of this data manager.
Definition: DataManager.h:283
static void registerMainCtor()
Register the main data managers (if not done yet).
Definition: DataManager.h:541
Bool asBigEndian() const
Have the data to be stored in big or little endian canonical format?
Definition: DataManager.h:291
short Short
Definition: aipstype.h:48
Table & table() const
Get the table this object is associated with.
Definition: DataManager.h:320
void dataManagerInfo(Record &info) const
Add SEQNR and SPEC (the DataManagerSpec subrecord) to the info.
static void unlockedRegisterCtor(const String &type, DataManagerCtor func)
Register a data manager constructor.
Definition: DataManager.h:554
DataManager * getClone() const
Has the object already been cloned?
Definition: DataManager.h:522
static Bool isRegistered(const String &dataManagerType)
Test if a data manager is registered (thread-safe).
Simple map with keys ordered.
Definition: SimOrdMap.h:69
DataManagerColumn()
Create a column.
Definition: DataManager.h:624
void put(uInt rownr, const DComplex *dataPtr)
Definition: DataManager.h:831
DataManager * clone_p
Definition: DataManager.h:414
ByteIO::OpenOption fileOption() const
Get the AipsIO option of the underlying file.
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 resync(uInt nrrow)=0
Resync the data by rereading cached data from the file.
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.
Class holding the row numbers in a RefTable.
Definition: RefRows.h:85
LatticeExprNode ndim(const LatticeExprNode &expr)
1-argument function to get the dimensionality of a lattice.
void put(uInt rownr, const float *dataPtr)
Definition: DataManager.h:825
virtual DataManagerColumn * makeIndArrColumn(const String &columnName, int dataType, const String &dataTypeId)=0
Create an indirect array column.
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
static SimpleOrderedMap< String, DataManagerCtor > theirRegisterMap
Declare the mapping of the data manager type name to a static "makeObject" function.
Definition: DataManager.h:517
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void setClone(DataManager *clone) const
Set the pointer to the clone.
Definition: DataManager.h:526
void linkToTable(Table &tab)
Link the data manager to the Table object.
void put(uInt rownr, const uChar *dataPtr)
Definition: DataManager.h:815
virtual void removeColumn(DataManagerColumn *)
Delete a column.
A caching object for a table column.
Definition: ColumnCache.h:83
virtual Bool isStorageManager() const
Is the data manager a storage manager? The default is yes.
virtual DataManagerColumn * reallocateColumn(DataManagerColumn *column)
Reallocate the column object if it is part of this data manager.
const Bool False
Definition: aipstype.h:44
static MutexedInit theirMutexedInit
Definition: DataManager.h:518
TableExprNode shape(const TableExprNode &array)
Function operating on any scalar or array resulting in a Double array containing the shape...
Definition: ExprNode.h:2151
void put(uInt rownr, const Short *dataPtr)
Definition: DataManager.h:817
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 DataManagerColumn * makeDirArrColumn(const String &columnName, int dataType, const String &dataTypeId)=0
Create a direct array column.
virtual void create(uInt nrrow)=0
Let the data manager initialize itself for a new table.
void exec()
Execute the initialization function if not done yet.
Definition: Mutex.h:171
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:289
DataManager()
Default constructor.
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.
void put(uInt rownr, const uShort *dataPtr)
Definition: DataManager.h:819
OpenOption
Define the possible ByteIO open options.
Definition: ByteIO.h:65
Abstract base class for a data manager.
Definition: DataManager.h:222
virtual Bool canAddRow() const
Does the data manager allow to add rows? (default no)
void setIsFixedShape(Bool isFixedShape)
Set the isFixedShape flag.
Definition: DataManager.h:631
virtual uInt resync1(uInt nrrow)
Resync as above.
static void doRegisterMainCtor(void *)
Do the actual (thread-safe) registration of the main data managers.
String fileName() const
Compose a unique filename from the table name and sequence number.
void setEndian(Bool bigEndian)
Tell the data manager if big or little endian format is needed.
Definition: DataManager.h:385
void put(uInt rownr, const String *dataPtr)
Definition: DataManager.h:833
void put(uInt rownr, const Complex *dataPtr)
Definition: DataManager.h:829
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual Record dataManagerSpec() const
Return a record containing data manager specifications.
MultiFileBase * multiFile_p
Definition: DataManager.h:412
DataManagerColumn * createDirArrColumn(const String &columnName, int dataType, const String &dataTypeId)
Create a direct array column.
DataManagerColumn * createScalarColumn(const String &columnName, int dataType, const String &dataTypeId)
Create a column in the data manager on behalf of a table column.
virtual String dataManagerName() const
Return the name of the data manager.
void setSeqnr(uInt nr)
Set the sequence number of this data manager.
Definition: DataManager.h:466
V & define(const K &, const V &)
Defines a mapping (ie.
const Bool True
Definition: aipstype.h:43
this file contains all the compiler specific defines
Definition: mainpage.dox:28
virtual Bool canReallocateColumns() const
Tell if the data manager wants to reallocate the data manager column objects.
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
unsigned short uShort
Definition: aipstype.h:49
String keywordName(const String &keyword) const
Compose a keyword name from the given keyword appended with the sequence number (e.g.