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