casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RetypedArrayEngine.h
Go to the documentation of this file.
1 //# RetypedArrayEngine.h: Virtual column engine to retype and reshape arrays
2 //# Copyright (C) 1995,1996,1999,2001
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_RETYPEDARRAYENGINE_H
29 #define TABLES_RETYPEDARRAYENGINE_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
36 namespace casacore { //# NAMESPACE CASACORE - BEGIN
37 
38 //# Forward Declarations
39 
40 
41 // <summary>
42 // Virtual column engine to retype and reshape arrays.
43 // </summary>
44 
45 // <use visibility=export>
46 
47 // <reviewed reviewer="Brian Glendenning" date="1995/12/20" tests="dRetypedArrayEngine.cc" demos=dRetypedArrayEngine.h>
48 // </reviewed>
49 
50 // <prerequisite>
51 //# Classes you should understand before using this one.
52 // <li> <linkto class=BaseMappedArrayEngine>BaseMappedArrayEngine</linkto>
53 // </prerequisite>
54 
55 // <synopsis>
56 // RetypedArrayEngine maps a virtual column containing arrays of objects
57 // to a stored column containing arrays of data of another type. Usually
58 // the dimensionality of the arrays get smaller during this mapping process.
59 // The engine makes it possible to store an array of any type in a table.
60 // <br>
61 // For example, a column with 2D arrays of StokesVector's can be mapped to
62 // a column with 3D arrays of floats (of which the first axes has, say,
63 // length 4). Another example is mapping a 2D array of StokesMatrix's
64 // to a 4D array of floats.
65 // <p>
66 // The mapping process has to be done by a (static) set and get
67 // function in the VirtualType class. When a RetypedArrayEngine object is
68 // constructed, it is possible to pass information in a TableRecord. This
69 // TableRecord is indirectly passed to the set/get functions. This is done by
70 // means of the function newCopyInfo, which can preprocess the information
71 // in the TableRecord and store it in another object. That object is passed to
72 // the set and get functions. At the end a function deleteCopyInfo is called
73 // to delete the object. Of course, it is not needed to allocate such
74 // an object; newCopyInfo can return a null pointer.
75 // <note role=tip> Because the variables have to be generic and because of
76 // limitations in the CFront compiler, several variables have to be
77 // passed as void* and need to be casted in the set/get functions.
78 // </note>
79 //
80 // The virtual column data type class has to contain several functions.
81 // The example shows how they can be implemented.
82 // <dl>
83 // <dt> <src>static String dataTypeId();</src>
84 // <dd> has to give the (unique) name of the class.
85 // <dt> <src>static IPosition shape();</src>
86 // <dd> This has to return the full shape of the elements in the virtual.
87 // E.g. StokesVector will return [4]. StokesMatrix will return [4,4].
88 // <dt> <src>static void* newCopyInfo (const TableRecord& record,
89 // const IPosition& virtualElementShape);</src>
90 // <dd> This function has to setup the set/get functions by preprocessing the
91 // information contained in the TableRecord and storing it in a so-called
92 // "copyInfo" object. A pointer to that object has to be returned, which
93 // is kept by the engine and passed to the set/get functions.
94 // The "copyInfo" class can be a nested class in the VirtualType
95 // (as shown in the StokesVector example), but it can also
96 // be an independent class.
97 // <br>
98 // The supplied TableRecord is the TableRecord given when
99 // constructing the engine.
100 // When no TableRecord was given, it will be empty.
101 // The supplied shape is the shape of a virtual element as given to
102 // the constructor of the engine. This can be a full or partial shape.
103 // E.g. for a StokesVector it will usually be [4], but it can also,
104 // say, [1] if only U is used.
105 // The function could check if the information in the TableRecord
106 // and the shape match.
107 // <br>
108 // Of course, a VirtualType may not need any extra information.
109 // Therefore it is possible to return a null "copyInfo" pointer.
110 // <dt> <src>static void deleteCopyInfo (void* copyInfo);</src>
111 // <dd> This function has to delete the "copyInfo" object allocated
112 // by newCopyInfo. To do so, it needs to cast the pointer to the
113 // correct type.
114 // <dt> <src>static void set (void* copyInfo, void* out,
115 // const Array<StoredType>& in,
116 // const IPosition& virtualElementShape);</src>
117 // <dd> This function is called when an <src>Array<VirtualType></src> is read.
118 // It has to convert the StoredType array to the VirtualType array.
119 // In principle, there are two different cases (which can be deduced
120 // from the given shape):
121 // <ol>
122 // <li> The stored information is complete. For example: suppose the
123 // VirtualType is a StokesVector object (containing I, Q, U and V),
124 // When the stored array contains 4 values per StokesVector,
125 // it is complete.
126 // <br>
127 // In this case the entire virtual array can be directly copied from
128 // the stored array when the VirtualType object contains no
129 // virtual functions and the data are directly contained in it.
130 // The function
131 // <br>
132 // <linkto group=RetypedArraySetGet.h#RetypedArrayEngineSetGet>
133 // <src>
134 // retypedArrayEngineSet (Array<VirtualType>& out,
135 // const Array<StoredType>& in);
136 // </src></linkto><br>
137 // can be used for this purpose.
138 // <li> When in the example above the stored array contains less
139 // than 4 values per StokesVector, the stored information
140 // is incomplete. In this case the set function has to
141 // fill the data in one way or another. The information
142 // in the "copyInfo" object can assist in it.
143 // <br>
144 // Each VirtualType element has to be set individually, so
145 // a loop through the array is required. To assist in this,
146 // the loop has been implemented in the function
147 // <br>
148 // <linkto group=RetypedArraySetGet.h#RetypedArrayEngineSetGet>
149 // <src>
150 // retypedArrayEngineSet (Array<VirtualType>& out,
151 // const Array<StoredType>& in,
152 // const void* extraArgument);
153 // </src></linkto>
154 // <br> It calls the VirtualType function
155 // <srcblock>
156 // void setElem (const StoredType* data, const IPosition& shape,
157 // const void* extraArgument);
158 // </srcblock>
159 // for each VirtualType element. This set function has to
160 // fill the VirtualType object from the data. It can use the
161 // shape and the extraArgument to know how it should do it.
162 // <br>
163 // Note that the 3-argument function retypedArrayEngineSet is
164 // only a convenience function. For optimal performance it may
165 // be needed to handcode the loop instead of using this function.
166 // </ol>
167 // <note role=warning> Note that the given virtual element shape does
168 // not need to match the shape given to the constructor of the engine.
169 // It is possible that the user sets the shape of the stored array
170 // before putting the virtual array. In that case the system uses the
171 // relevant part of the stored array shape as the virtual element shape.
172 // </note>
173 // <note role=tip> If the out argument is declared (as it should be) as
174 // <src>Array<VirtualType>& out</src>,
175 // the CFront compiler complains about unknown size of
176 // VirtualType when instantiating Array<VirtualType>.
177 // Therefore it has to be declared as void* and the set function
178 // needs to cast it to <src>Array<VirtualType>*</src>.
179 // </note>
180 // <dt> <src>static void get (void* copyInfo, Array<float>& out,
181 // const void* in,
182 // const IPosition& virtualElementShape);</src>
183 // <dd> This function is similar to the set function described above, but
184 // is called when an <src>Array<VirtualType></src> is written.
185 // It has to convert the VirtualType array to the StoredType array.
186 // </dl>
187 //
188 // <br>E.g.: A StokesVector has 4 float elements.
189 // <srcblock>
190 // // Construct the column object for the Stokes column.
191 // ArrayColumn<StokesVector> stokesColumn (table, "StokesVirtualColumn");
192 // // Put an array of StokesVector's with shape 512,512.
193 // // This will implicitly set the shape of the underlying
194 // // data column to 4,512,512.
195 // // This put is very quick (it can copy all data in one go).
196 // Array<StokesVector> stokesData (IPosition(2,512,512));
197 // stokesColumn.put (rownr, stokesData);
198 //
199 // // Get the column object for the Data column.
200 // // Set its shape explicitly to 1,512,512,
201 // ArrayColumn<float> dataColumn (table, "DataColumn");
202 // dataColumn.setShape (rownr, IPosition(3,1,512,512));
203 // // Now a put of the data results in calling the StokesVector::getElem
204 // // function for each element with an IPosition(1,1); i.e. the
205 // // data array needs only one value for each StokesVector.
206 // stokesColumn.put (rownr, stokesData);
207 // </srcblock>
208 //
209 // When reading a table back, the engine has to be registered.
210 // Otherwise it will be unknown to the table system.
211 // Similarly, the appropriate ArrayColumnDesc object has to be registered.
212 // This can be done as follows:
213 // <pre>
214 // RetypedArrayEngine<StokesVector,float>::registerClass();
215 // ArrayColumnDesc<StokesVector> tmp(ColumnDesc::registerMap);
216 // </pre>
217 // When they are not registered, the open of the table will fail
218 // telling which class could not be found.
219 // </synopsis>
220 
221 // <motivation>
222 // This class allows one to store arrays of arbitrary objects in a table.
223 // It also allows it to be done it in a very efficient way.
224 // <p>
225 // The class had to be doubly templated. There were 2 reasons:
226 // <ol>
227 // <li> The typedef trick described on page 321 in Barton/Nackman
228 // did not work with the CFront-based ObjectCenter compiler.
229 // <li> It was needed to allow derivation from BaseMappedArrayEngine.
230 // </ol>
231 // <p>
232 // Originally it was the idea to have a mandatory nested CopyInfo class in the
233 // VirtualType class and use syntax like VirtualType::CopyInfo to access
234 // functions in it and to keep a pointer to such an object. Alas, the
235 // CFront compiler could not handle this.
236 // <p>
237 // Because the engine can serve only one column, it was possible to
238 // combine the engine and the column functionality in one class.
239 // This has been achieved using multiple inheritance.
240 // The advantage of this is that only one templated class is used,
241 // so fewer template instantiations are needed.
242 // </motivation>
243 
244 // <example>
245 // The following example shows how a StokesVector could be implemented.
246 // It doesn't check whether the mask is correct.
247 // Two more examples are contained in the demo/test program
248 // <a href="../../../../code/aips/implement/Tables/test/dRetypedArrayEngine.h">
249 // dRetypedArrayEngine.h</a> and its
250 // <a href="../../../../code/aips/implement/Tables/test/dRetypedArrayEngine.cc">
251 // .cc file</a>. Their second example (class RetypedArrayEx2) is similar to
252 // the StokesVector example below, but contains more extensive checking.
253 // <srcblock>
254 // //# Forward Declarations
255 // template<class T> class Array;
256 // template<class T> class Vector;
257 //
258 // class StokesVector
259 // {
260 // public:
261 // StokesVector(): I_p(0), Q_p(0), U_p(0), V_p(0) {}
262 // StokesVector(double i, double q, double u, double v)
263 // : I_p(i), Q_p(q), U_p(u), V_p(v) {}
264 // StokesVector(const StokesVector& that): I_p(that.I_p), Q_p(that.Q_p),
265 // U_p(that.U_p), V_p(that.V_p) {}
266 // StokesVector& operator= (const StokesVector& that)
267 // { I_p=that.I_p; Q_p=that.Q_p; U_p=that.U_p; V_p=that.V_p;
268 // return *this; }
269 //
270 // static String dataTypeId()
271 // { return "StokesVector"; }
272 //
273 // // A StokesVector is 1-dim and contains 4 elements.
274 // static IPosition shape()
275 // { return IPosition (1,4); }
276 //
277 // // Preprocess possible information in the TableRecord.
278 // static void* newCopyInfo (const TableRecord& record,
279 // const IPosition& shape)
280 // { return new CopyInfo(record, shape); }
281 //
282 // // Delete the object containing preprocessed information.
283 // static void* deleteSetDet (void* copyInfo)
284 // { delete (CopyInfo*)copyInfo; }
285 //
286 // // Convert a StoredType array to a VirtualType array.
287 // // Do this in a CopyInfo function to use its preprocessed information.
288 // static void set (void* copyInfo, void* out,
289 // const Array<double>& in, const IPosition& shape)
290 // { ((CopyInfo*)copyInfo)->set (out, in, shape); }
291 //
292 // // Convert a VirtualType array to a StoredType array.
293 // // Do this in a CopyInfo function to use its preprocessed information.
294 // static void get (void* copyInfo, Array<double>& out,
295 // const void* in, const IPosition& shape)
296 // { ((CopyInfo*)copyInfo)->get (out, in, shape); }
297 //
298 // // This nested class is used to hold preprocessed information. It
299 // // holds a mask extracted from the TableRecord supplied to the engine.
300 // // One can imagine that it could also extract a flag telling
301 // // whether the stored data is stored as I,Q,U,V or as XX,YY,XY,YX
302 // // (although such a conversion would probably be better handled
303 // // by a separate virtual column engine).
304 // class CopyInfo {
305 // public:
306 // // The constructor extracts the mask from the record.
307 // void CopyInfo (const TableRecord& record)
308 // {
309 // RORecordFieldRef<Array<Bool> > field (record, 0);
310 // mask_p = new Vector<Bool>;
311 // *mask_p = *field;
312 // }
313 // // The set function fills the StokesVector.
314 // // It uses the general functions for that purpose.
315 // void set (void* vout, const Array<double>& in,
316 // const IPosition& shape)
317 // {
318 // Array<StokesVector>& out = *(Array<StokesVector>*)vout;
319 // if (shape.nelements() == 1 && shape(0) == 4) {
320 // // All values available, copy in one go.
321 // // This can be done because a StokesVector object
322 // // only contains 4 double values (and no virtual
323 // // function table).
324 // retypedArrayEngineSet (out, in);
325 // }else{
326 // // Only some values available. Fill each
327 // // StokesVector object using the shape and mask.
328 // // The set function below is called for each object.
329 // retypedArrayEngineSet (out, in, shape, (void*)mask_p);
330 // }
331 // }
332 // // get is the opposite of set.
333 // void get (Array<double>& out, const void* vin,
334 // const IPosition& shape)
335 // {
336 // const Array<StokesVector>& in =
337 // *(const Array<StokesVector>*)vin;
338 // if (shape.nelements() == 1 && shape(0) == 4) {
339 // retypedArrayEngineGet (out, in);
340 // }else{
341 // retypedArrayEngineGet (out, in, shape, (void*)mask_p);
342 // }
343 // private:
344 // Vector<Bool>* mask_p;
345 // };
346 //
347 // // Set values of StokesVector using the mask.
348 // // The shape is not used here.
349 // void setElem (const double* data, const IPosition&, const void* maskPtr)
350 // {
351 // const Vector<Bool>& mask = *(const Vector<Bool>*)maskPtr;
352 // I_p = Q_p = U_p = V_p = 0;
353 // if (mask(0)) {
354 // I_p = *data++;
355 // }
356 // if (mask(1)) {
357 // Q_p = *data++;
358 // }
359 // if (mask(2)) {
360 // U_p = *data++;
361 // }
362 // if (mask(3)) {
363 // V_p = *data;
364 // }
365 // }
366 // // Get values of StokesVector using the mask (opposite of setElem).
367 // void getElem (double* data, const IPosition&, const void* maskPtr);
368 // private:
369 // double I_p, Q_p, U_p, V_p;
370 // };
371 //
372 // main() {
373 // // First register the virtual column engine.
374 // RetypedArrayEngine<StokesVector,double>::registerClass();
375 // // Add ArrayColumnDesc<StokesVector> to column type map.
376 // ArrayColumnDesc<StokesVector> tmp(ColumnDesc::registerMap);
377 //
378 // // Build the table description.
379 // TableDesc td("", "1", TableDesc::Scratch);
380 // td.addColumn (ArrayColumnDesc<double> ("Data"));
381 // td.addColumn (ArrayColumnDesc<StokesVector> ("Stokes"));
382 //
383 // // Now create a new table from the description.
384 // SetupNewTable newtab("tRetypedArrayEngine_tmp.data", td, Table::New);
385 // // Create the virtual column engine with the stored columns Data.
386 // RetypedArrayEngine<StokesVector,double> engine ("Stokes", "Data");
387 // newtab.bindColumn ("Stokes", engine);
388 // Table tab(newtab, 50);
389 //
390 // // Fill the table via the virtual columns.
391 // ArrayColumn<StokesVector> stokesColumn (tab, "Stokes");
392 // Vector<StokesVector> vec(10);
393 // uInt i;
394 // for (i=0; i<tab.nrow(); i++) {
395 // stokesColumn.put (i, vec);
396 // }
397 // }
398 // </srcblock>
399 // <note role=caution>
400 // Due to instantiation problems with the CFront-based ObjectCenter compiler
401 // (and probably other CFront-based compilers as well) the Array and
402 // Vector have to be forward declared. Array.h and Vector.h should
403 // NOT be included in this StokesVector.h, thus the implementations
404 // should not be inlined (they are too large anyway), but put in a
405 // separate .cc file where Array.h and Vector.h can be included.
406 // </note>
407 // <p>
408 // Another compiler problem is that the variable mask_p is not
409 // automatically converted to a void*, so an explicit cast has to be done.
410 // </example>
411 
412 // <templating arg=VirtualType>
413 // <li> default constructor
414 // <li> copy constructor
415 // <li> assignment operator
416 // <li> <src>static String dataTypeId();</src>
417 // <li> <src>static IPosition shape();</src>
418 // <li> <src>static void* newCopyInfo (const TableRecord& record, const IPosition& virtualElementShape);</src>
419 // <li> <src>static void deleteCopyInfo (void* copyInfo);</src>
420 // <li> <src>static void set (void* copyInfo, void* out,
421 // const Array<StoredType>& in,
422 // const IPosition& shape);</src>
423 // <li> <src>static void get (void* copyInfo, Array<float>& out,
424 // const void* in, const IPosition& shape);</src>
425 // <li> <src>void setElem (const StoredType* data, const IPosition& shape,
426 // const void* extraArgument);</src>
427 // <br>when global function retypedArrayEngineSet is used.
428 // <li> <src>void getElem (StoredType* data, const IPosition& shape,
429 // const void* extraArgument) const;</src>
430 // <br>when global function retypedArrayEngineGet is used.
431 // </templating>
432 // <templating arg=StoredType>
433 // <li> Default constructor
434 // <li> Copy constructor
435 // <li> Assignment operator
436 // </templating>
437 
438 //# <todo asof="1995/12/29">
439 //# </todo>
440 
441 
442 template<class VirtualType, class StoredType> class RetypedArrayEngine : public BaseMappedArrayEngine<VirtualType,StoredType>
443 {
444  //# Make members of parent class known.
445 public:
447 protected:
452 
453 public:
454 
455  // Construct an engine to map a virtual column containing arrays with
456  // an arbitrary data type to arrays in a stored column.
457  // StoredColumnName is the name of the column where the converted
458  // data will be put and must have data type StoredType.
459  // The virtual column using this engine must have data type VirtualType.
460  RetypedArrayEngine (const String& virtualColumnName,
461  const String& storedColumnName);
462 
463  // Construct an engine to map a virtual column containing arrays with
464  // an arbitrary data type to arrays in a stored column.
465  // StoredColumnName is the name of the column where the converted
466  // data will be put and must have data type StoredType.
467  // The virtual column using this engine must have data type VirtualType.
468  // The shape and record provided is handed to the newCopyInfo function
469  // in the VirtualType class. It can be used to determine how an element
470  // has to be handled when the stored data is incomplete.
471  RetypedArrayEngine (const String& virtualColumnName,
472  const String& storedColumnName,
473  const IPosition& virtualElementShape,
474  const TableRecord& extraInformation);
475 
476  // Construct from a record specification as created by getmanagerSpec().
477  RetypedArrayEngine (const Record& spec);
478 
479  // Destructor is mandatory.
481 
482  // Return the type name of the engine (i.e. its class name).
483  virtual String dataManagerType() const;
484 
485  // Get the name given to the engine (is the virtual column name).
486  virtual String dataManagerName() const;
487 
488  // Record a record containing data manager specifications.
489  virtual Record dataManagerSpec() const;
490 
491  // Return the name of the class.
492  // This includes the names of the template arguments.
493  static String className();
494 
495  // Register the class name and the static makeObject "constructor".
496  // This will make the engine known to the table system.
497  // The automatically invoked registration function in DataManReg.cc
498  // contains RetypedArrayEngine<double,Int>.
499  // Any other instantiation of this class must be registered "manually"
500  // (or added to DataManReg.cc).
501  static void registerClass();
502 
503 private:
504  // Copy constructor is only used by clone().
505  // (so it is made private).
507 
508  // Assignment is not needed and therefore forbidden
509  // (so it is made private and not implemented).
512 
513  // Clone the engine object.
514  DataManager* clone() const;
515 
516  // Initialize the object for a new table.
517  // It defines the keywords containing the engine parameters.
518  void create (uInt initialNrrow);
519 
520  // Preparing consists of setting the writable switch and
521  // adding the initial number of rows in case of create.
522  // Furthermore it reads the keywords containing the engine parameters
523  // and allocates a CopyInfo object for the VirtualType.
524  void prepare();
525 
526  // Set the shape of the FixedShape arrays in the column.
527  // This function only gets called if the column has FixedShape arrays.
528  // The shape gets saved and used to set the shape of the arrays
529  // in the stored in case the stored has non-FixedShape arrays.
530  void setShapeColumn (const IPosition& shape);
531 
532  // Define the shape of the array in the given row.
533  // When the shape of the (underlying) stored array has already been
534  // defined, it checks whether its latter dimensions match the given
535  // virtual shape. When matching, nothing will be done.
536  // When mismatching or when the stored shape has not been defined
537  // yet, the stored shape will be defined from the virtual shape and
538  // the virtual element shape.
539  // E.g. in case of a StokesVector a virtual shape of (512,512)
540  // results in a stored shape of (4,512,512).
541  void setShape (uInt rownr, const IPosition& shape);
542 
543  // Get the dimensionality of the array in the given row.
544  uInt ndim (uInt rownr);
545 
546  // Get the shape of the array in the given row.
547  // This is done by stripping the first dimension(s) from the shape
548  // of the underlying stored array.
549  IPosition shape (uInt rownr);
550 
551  // Check if the shapes of virtual and stored match.
552  // Determine the shape of the virtual elements in the stored.
553  IPosition checkShape (const Array<VirtualType>& source,
554  const Array<StoredType>& target);
555 
556  // Map the virtual shape to the stored shape.
557  // By default is returns the virtual shape.
558  virtual IPosition getStoredShape (uInt rownr,
559  const IPosition& virtualShape);
560 
561  // Convert the Slicer for a virtual to a Slicer for the stored.
562  virtual Slicer getStoredSlicer (const Slicer& virtualSlicer) const;
563 
564  // Copy the stored array to the virtual array.
565  // It tries to optimize as much as possible.
566  virtual void mapOnGet (Array<VirtualType>& array,
567  const Array<StoredType>& stored);
568 
569  // Copy the virtual array to the stored array.
570  // It tries to optimize as much as possible.
571  virtual void mapOnPut (const Array<VirtualType>& array,
572  Array<StoredType>& stored);
573 
574  //# Now define the data members.
575  IPosition shape_p; //# shape of a virtual element in the stored
576  IPosition virtualFixedShape_p; //# The shape in case virtual has FixedShape
579 //# VirtualType::CopyInfo* copyInfo_p; //# object used to set/get arrays
580  void* copyInfo_p; //# CFront compiler does not accept above
581 
582 
583 public:
584  //*display 4
585  // Define the "constructor" to construct this engine when a
586  // table is read back.
587  // This "constructor" has to be registered by the user of the engine.
588  // If the engine is commonly used, its registration can be added
589  // to the registerAllCtor function in DataManReg.cc.
590  // That function gets automatically invoked by the table system.
591  static DataManager* makeObject (const String& dataManagerType,
592  const Record& spec);
593 };
594 
595 
596 
597 } //# NAMESPACE CASACORE - END
598 
599 #ifndef CASACORE_NO_AUTO_TEMPLATES
600 #include <casacore/tables/DataMan/RetypedArrayEngine.tcc>
601 #endif //# CASACORE_NO_AUTO_TEMPLATES
602 #endif
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
void setShapeColumn(const IPosition &shape)
Set the shape of the FixedShape arrays in the column.
virtual void mapOnPut(const Array< VirtualType > &array, Array< StoredType > &stored)
Copy the virtual array to the stored array.
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Definition: ExprNode.h:1886
Templated virtual column engine for a table array of any type.
virtual String dataManagerName() const
Get the name given to the engine (is the virtual column name).
RetypedArrayEngine(const String &virtualColumnName, const String &storedColumnName)
Construct an engine to map a virtual column containing arrays with an arbitrary data type to arrays i...
void setShape(uInt rownr, const IPosition &shape)
Define the shape of the array in the given row.
void prepare()
Preparing consists of setting the writable switch and adding the initial number of rows in case of cr...
void create(uInt initialNrrow)
Initialize the object for a new table.
virtual Slicer getStoredSlicer(const Slicer &virtualSlicer) const
Convert the Slicer for a virtual to a Slicer for the stored.
uInt ndim(uInt rownr)
Get the dimensionality of the array in the given row.
virtual String dataManagerType() const
Return the type name of the engine (i.e.
Virtual column engine to retype and reshape arrays.
A hierarchical collection of named fields of various types.
Definition: Record.h:180
static DataManager * makeObject(const String &dataManagerType, const Record &spec)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual void mapOnGet(Array< VirtualType > &array, const Array< StoredType > &stored)
Copy the stored array to the virtual array.
virtual IPosition getStoredShape(uInt rownr, const IPosition &virtualShape)
Map the virtual shape to the stored shape.
A hierarchical collection of named fields of various types.
Definition: TableRecord.h:182
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
IPosition checkShape(const Array< VirtualType > &source, const Array< StoredType > &target)
Check if the shapes of virtual and stored match.
Specify which elements to extract from an n-dimensional array.
Definition: Slicer.h:289
static void registerClass()
Register the class name and the static makeObject &quot;constructor&quot;.
IPosition shape(uInt rownr)
Get the shape of the array in the given row.
Abstract base class for a data manager.
Definition: DataManager.h:224
virtual Record dataManagerSpec() const
Record a record containing data manager specifications.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
static String className()
Return the name of the class.
~RetypedArrayEngine()
Destructor is mandatory.
unsigned int uInt
Definition: aipstype.h:51
DataManager * clone() const
Clone the engine object.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42