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