casacore
TableRecord.h
Go to the documentation of this file.
1 //# TableRecord.h: A hierarchical collection of named fields of various types
2 //# Copyright (C) 1996,1997,1998,2000,2001,2002
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id$
28 
29 
30 #ifndef TABLES_TABLERECORD_H
31 #define TABLES_TABLERECORD_H
32 
33 //# Includes
34 #include <casacore/casa/aips.h>
35 #include <casacore/casa/Containers/RecordInterface.h>
36 #include <casacore/tables/Tables/TableRecordRep.h>
37 #include <casacore/casa/Containers/RecordDesc.h>
38 #include <casacore/casa/Utilities/COWPtr.h>
39 
40 namespace casacore { //# NAMESPACE CASACORE - BEGIN
41 
42 //# Forward Declarations
43 template<class T> class Array;
44 class IPosition;
45 class AipsIO;
46 class TableLock;
47 
48 
49 // <summary>
50 // A hierarchical collection of named fields of various types
51 // </summary>
52 
53 // <use visibility=export>
54 // <reviewed reviewer="Mark Wieringa" date="1996/04/15" tests="tTableRecord">
55 // </reviewed>
56 
57 // <prerequisite>
58 // <li> <linkto class="RecordDesc">RecordDesc</linkto>.
59 // <li> <linkto class="RecordFieldPtr">RecordFieldPtr</linkto>.
60 // </prerequisite>
61 //
62 // <etymology>
63 // TableRecord is a Record to be used in the Table system.
64 // </etymology>
65 //
66 // <synopsis>
67 // Class <linkto class=RecordInterface>RecordInterface</linkto> describes
68 // the fundamental properties of records.
69 // <br>
70 // The TableRecord class is a particular type of a record class.
71 // The fields in TableRecord may be of scalar type, array type, a Table
72 // or a TableRecord.
73 // The types are chosen to be compatible with the native
74 // types of the Table system, viz: Bool, uChar, Short, Int, uInt, Int64, Float,
75 // Double, Complex, DComplex, String.
76 // Arrays of all these types are also available.
77 // Note that a TableRecord is not a space-efficient way of storing
78 // small objects.
79 // <p>
80 // The structure of a TableRecord is defined by the
81 // <linkto class="RecordDesc">RecordDesc</linkto> class.
82 // The structure of the TableRecord can be defined at
83 // construction time. It can thereafter be restructured. This has the
84 // effect, however, that any existing RecordFieldPtr objects become
85 // invalid (using the <linkto file="Notice.h">Notice</linkto> classes).
86 // <br>
87 // It is possible to add or remove fields once a TableRecord is constructed.
88 // However, this is not possible when the TableRecord is constructed with a
89 // fixed structure (i.e. with the fixedStructure flag set).
90 // <p>
91 // A TableRecord is an hierarchical structure, because it can have fields
92 // containing TableRecord's (as layed out in the RecordDesc). A subrecord
93 // has a variable structure, when its RecordDesc is empty (i.e. contains
94 // no fields). It is fixed when its RecordDesc contains fields.
95 // <p>
96 // A TableRecord may be assigned to another only if they conform; that is if
97 // their fields have the identical type in the identical order.
98 // The field names do not need to be identical however, only the types.
99 // That is, the structure needs to be identical, but
100 // not the labels. Note that field order is significant,
101 // <src>[ifield(type=Int),ffield(type=Float)]</src>
102 // is not the same as <src>[ffield(type=Float),ifield(type=Int)]</src>
103 // <br>
104 // Conformance is checked recursively for fixed subrecords. That is, a
105 // variable structured subrecord is not checked, because any record
106 // can be assigned to it. A fixed structured subrecord has to
107 // conform the corresponding subrecord in the source.
108 // <br> A Table field is conforming when the name of the table
109 // description of the source table matches the table description name
110 // defined in the RecordDesc field. When that name is blank, every
111 // table matches. In fact, defining a table description name is identical
112 // to defining an array shape..
113 // <p>
114 // When a TableRecord is read back, possible Tables contained in fields
115 // are only opended and read back when they are accessed for the first time.
116 // In that way no needless table opens are done.
117 // When a table has been opened, it is possible to close it. This
118 // can be useful to save memory usage.
119 // <p>
120 // TableRecord uses copy-on-write semantics. This means that when a
121 // TableRecord is copied, only the pointer to the underlying
122 // TableRecordRep object is copied.
123 // Only when the TableRecord gets changed (i.e. when a non-const
124 // TableRecord member function is called), the TableRecordRep object is copied.
125 // This results in a cheap copy behaviour.
126 // </synopsis>
127 //
128 // <example>
129 // <srcblock>
130 // {
131 // TableDesc td ("td", TableDesc::Scratch);
132 // td.addColumn (ScalarColumnDesc<Int> ("col1"));
133 // td.addColumn (ScalarColumnDesc<float> ("col2"));
134 // SetupNewTable newtab ("tTableRecord_tmp.tab1", td1, Table::New);
135 // Table tab (newtab, 10);
136 // RecordDesc rd;
137 // rd.addTable ("tab1", "td"); // with description name
138 // rd.addField ("tab2", TpTable); // without description name
139 // TableRecord rec (rd, RecordInterface::Variable);
140 // // Both define's are possible.
141 // // The first one because the table description name matches.
142 // // The second one because that field has no table description name,
143 // // thus every table description matches.
144 // rec.defineTable (rec.fieldNumber("tab1"), tab1);
145 // rec.defineTable (rec.fieldNumber("tab2"), tab1);
146 // Table t1 = rec.asTable ("tab1");
147 // AlwaysAssertExit (t1.nrow() == 10 && t1.tableDesc().ncolumn() == 2);
148 // Table t2 = rec.asTable ("tab2");
149 // AlwaysAssertExit (t2.nrow() == 10 && t2.tableDesc().ncolumn() == 2);
150 // AipsIO aos ("file.name", ByteIO::New);
151 // aos << rec;
152 // }
153 // // Note that he above is put in a separate scope to be sure that
154 // // all objects are deleted and tables are written.
155 // {
156 // TableRecord rec;
157 // AipsIO aos ("file.name");
158 // aos >> rec;
159 // // At this point the record is read back, but the tables are not opened.
160 // // The next statement accesses the table resulting in its open.
161 // Table t1 = rec.asTable ("tab1");
162 // // The following statement closes it again.
163 // rec.closeTable ("tab1");
164 // </srcblock>
165 // </example>
166 //
167 // <motivation>
168 // In principle the class Record could also support data type Table.
169 // However, this would have had the big disadvantage that all the
170 // Table code would have be linked in when only a simple Record is needed.
171 // It was decided that for that reason it was better to support tables
172 // in a separate class.
173 // </motivation>
174 //
175 // <todo asof="1995/08/22">
176 // <li> A record reference class, which contains some fields from another
177 // record, would likely be useful. This would be analagous to a
178 // subarray sliced from an existing array.
179 // </todo>
180 
181 
183 {
184 friend class TableRecordRep;
185 
186 public:
187  // Create a record with no fields.
188  // The record has a variable structure.
190 
191  // Create a record with no fields.
192  // The type determines if the record has a fixed or variable structure.
193  // The callback function is called when a field is added to the Record.
194  // That function can check the name and of data type of the new field
195  // (for instance, the Table system uses it to ensure that table columns
196  // and keywords have different names).
198  CheckFieldFunction* = 0,
199  const void* checkArgument = 0);
200 
201  // Create a record with the given description. If it is not possible to
202  // create all fields (for example, if a field with an unsupported data
203  // type is requested), an exception is thrown.
204  // The type determines if the record has a fixed or variable structure.
205  // All fields are checked by the field checking function (if defined)
206  // (for instance, the Table system uses it to ensure that table columns
207  // and keywords have different names).
210  CheckFieldFunction* = 0,
211  const void* checkArgument = 0);
212 
213  // Create a copy of other using copy semantics.
214  TableRecord (const TableRecord& other);
215 
216  // Create a TableRecord from another type of record.
217  // It uses copy-on-write semantics if possible (i.e. if
218  // <src>other</src> is a TableRecord), otherwise each field is copied.
219  // Subrecords are also copied and converted to TableRecords if needed.
220  TableRecord (const RecordInterface& other);
221 
222  // Copy the data in the other record to this record.
223  // It can operate in 2 ways depending on the TableRecord structure flag.
224  // <ul>
225  // <li> For variable structured records the existing fields are
226  // thrown away and replaced by the new fields.
227  // This means that RecordFieldPtr's using this record get invalidated.
228  // Because copy-on-write semantics are used, this kind of
229  // assignment is a very efficient operation.
230  // <li> For fixed structured records the existing values are replaced
231  // by the new values. This means that RecordFieldPtr's using this
232  // record remain valid.
233  // The structure of the other record has to conform this record
234  // or this record has to be empty, otherwise an exception is thrown.
235  // This assignment is less efficient, because it has to check the
236  // conformance and because each value has to be copied.
237  // </ul>
238  // <note role=warning>
239  // Attributes like fixed structure flag and check function will not
240  // be copied.
241  // </note>
243 
244  // Release resources associated with this object.
246 
247  // Make a copy of this object.
248  virtual RecordInterface* clone() const;
249 
250  // Assign that RecordInterface object to this one.
251  // If <src>that</src> is a TableRecord, copy-on-write is used.
252  // Otherwise each individual field is copied.
253  virtual void assign (const RecordInterface& that);
254 
255  // Convert the TableRecord to a Record (recursively).
256  // A possible Table object is converted to a string containing
257  // the table name preceeded by 'Table: ' (as used by TableProxy).
258  Record toRecord() const;
259 
260  // Fill the TableRecord from the given Record.
261  // The fields are appended to the TableRecord.
262  // It is the opposite of toRecord, so a String containing 'Table: '
263  // is handled as a Table (if it exists).
264  void fromRecord (const Record& rec);
265 
266  // Get or define the value as a ValueHolder.
267  // This is useful to pass around a value of any supported type.
268  // <group>
269  virtual ValueHolder asValueHolder (const RecordFieldId&) const;
270  virtual void defineFromValueHolder (const RecordFieldId&,
271  const ValueHolder&);
272  // </group>
273 
274  // Get the comment for this field.
275  virtual const String& comment (const RecordFieldId&) const;
276 
277  // Set the comment for this field.
278  virtual void setComment (const RecordFieldId&, const String& comment);
279 
280  // Describes the current structure of this TableRecord.
281  const RecordDesc& description() const;
282 
283  // Change the structure of this TableRecord to contain the fields in
284  // newDescription. After calling restructure, <src>description() ==
285  // newDescription</src>. Any existing RecordFieldPtr objects are
286  // invalidated (their <src>isAttached()</src> members return False) after
287  // this call.
288  // <br>When the new description contains subrecords, those subrecords
289  // will be restructured if <src>recursive=True</src> is given.
290  // Otherwise the subrecord is a variable empty record.
291  // Subrecords will be variable if their description is empty (i.e. does
292  // not contain any field), otherwise they are fixed.
293  // <br>Restructuring is not possible and an exception is thrown
294  // if the Record has a fixed structure.
295  virtual void restructure (const RecordDesc& newDescription,
296  Bool recursive=True);
297 
298  // Returns True if this and other have the same RecordDesc, other
299  // than different names for the fields. That is, the number, type and the
300  // order of the fields must be identical (recursively for fixed
301  // structured sub-Records in this).
302  // <note role=caution>
303  // <src>thisRecord.conform(thatRecord) == True</src> does not imply
304  // <br><src>thatRecord.conform(thisRecord) == True</src>, because
305  // a variable record in one conforms a fixed record in that, but
306  // not vice-versa.
307  // </note>
308  Bool conform (const TableRecord& other) const;
309 
310  // How many fields does this structure have? A convenient synonym for
311  // <src>description().nfields()</src>.
312  virtual uInt nfields() const;
313 
314  // Get the field number from the field name.
315  // -1 is returned if the field name is unknown.
316  virtual Int fieldNumber (const String& fieldName) const;
317 
318  // Get the data type of this field.
319  virtual DataType type (Int whichField) const;
320 
321  // Remove a field from the record.
322  // <note role=caution>
323  // Removing a field means that the field number of the fields following
324  // it will be decremented. Only the RecordFieldPtr's
325  // pointing to the removed field will be invalidated.
326  // </note>
327  void removeField (const RecordFieldId&);
328 
329  // Rename the given field.
330  void renameField (const String& newName, const RecordFieldId&);
331 
332  // Define a value for the given field.
333  // When the field is unknown, it will be added to the record.
334  // The second version is meant for any type of record (e.g. Record,
335  // TableRecord, GlishRecord). It is converted to a TableRecord using the
336  // TableRecord constructor taking a RecordInterface object.
337  // <group>
340  virtual void defineRecord (const RecordFieldId&,
341  const RecordInterface& value,
342  RecordType = Variable);
343  void defineTable (const RecordFieldId&, const Table& value,
345  // </group>
346 
347  // Get the subrecord or table from the given field.
348  // <note>
349  // The non-const version has a different name to prevent that the
350  // copy-on-write mechanism makes a copy when not necessary.
351  // </note>
352  // <group>
353  const TableRecord& subRecord (const RecordFieldId&) const;
355  virtual const RecordInterface& asRecord (const RecordFieldId&) const;
357  // </group>
358 
359  // Get the table from the given field.
360  // By default the read/write option and lock options are inherited
361  // from the parent table.
362  // If openWritable=True, the table is still opened as readonly if the file
363  // permissions do not permit write access.
364  // <group>
365  Table asTable (const RecordFieldId&) const;
366  Table asTable (const RecordFieldId&, const TableLock& lockOptions) const;
367  // </group>
368 
369  // Get the attributes of a table field.
370  const TableAttr& tableAttributes (const RecordFieldId&) const;
371 
372  // Merge a field from another record into this record.
373  // The DuplicatesFlag (as described in
374  // <linkto class=RecordInterface>RecordInterface</linkto>) determines
375  // what will be done in case the field name already exists.
376  void mergeField (const TableRecord& other, const RecordFieldId&,
378 
379  // Merge all fields from the other record into this record.
380  // The DuplicatesFlag (as described in
381  // <linkto class=RecordInterface>RecordInterface</linkto>) determines
382  // what will be done in case a field name already exists.
383  // An exception will be thrown if other is the same as this
384  // (i.e. if merging the record itself).
386 
387  // Close the table in the given field.
388  // When accessed again, it will be opened automatically.
389  // This can be useful to save memory usage.
390  void closeTable (const RecordFieldId&) const;
391 
392  // Close all open tables.
393  // When accessed again, it will be opened automatically.
394  // This can be useful to save memory usage.
395  void closeTables() const;
396 
397  // Flush all open subtables.
398  void flushTables (Bool fsync=False) const;
399 
400  // Rename the subtables with a path containing the old parent table name.
401  void renameTables (const String& newParentName,
402  const String& oldParentName);
403 
404  // Are subtables used in other processes.
405  Bool areTablesMultiUsed() const;
406 
407  // Write the TableRecord to an output stream.
408  friend AipsIO& operator<< (AipsIO& os, const TableRecord& rec);
409 
410  // Read the TableRecord from an input stream.
411  friend AipsIO& operator>> (AipsIO& os, TableRecord& rec);
412 
413  // Put the data of a record.
414  // This is used to write a subrecord, whose description has
415  // not been written.
416  void putRecord (AipsIO& os, const TableAttr&) const;
417 
418  // Read a record.
419  // This is used to read a subrecord, whose description has
420  // not been read.
421  void getRecord (AipsIO& os, const TableAttr&);
422 
423  // Put the data of a record.
424  // This is used to write a subrecord, whose description has
425  // already been written.
426  void putData (AipsIO& os, const TableAttr&) const;
427 
428  // Read the data of a record.
429  // This is used to read a subrecord, whose description has
430  // already been read.
431  void getData (AipsIO& os, uInt version, const TableAttr&);
432 
433  // Print the contents of the record.
434  // Only the first <src>maxNrValues</src> of an array will be printed.
435  // A value < 0 means the entire array.
436  virtual void print (std::ostream&,
437  Int maxNrValues = 25,
438  const String& indent="") const;
439 
440  // Reopen possible tables in keywords as read/write.
441  // Tables are not reopened if they are not writable.
442  void reopenRW();
443 
444  // Recursively set the attributes of subtables to the ones in the other
445  // record for matching subtable field names. Otherwise set it to defaultAttr.
446  // The name attribute is not changed.
447  // It is primarily a helper function for PlainTable::syncTable
448  // and ColumnSet::syncColumns.
449  // <br>However, it can also be used to achieve that all subtables of a
450  // read/write table are opened as readonly. E.g.:
451  // <srcblock>
452  // TableAttr newAttr(String(), False, mainTable.lockOptions());
453  // mainTable.keywordSet().setTableAttr (TableRecord(), newAttr);
454  // </srcblock>
455  void setTableAttr (const TableRecord& other, const TableAttr& defaultAttr);
456 
457  // Make a unique record representation
458  // (to do copy-on-write in RecordFieldPtr).
459  virtual void makeUnique();
460 
461 
462 protected:
463  // Used by the RecordField classes to attach in a type-safe way to the
464  // correct field.
465  // <group>
466  virtual void* get_pointer (Int whichField, DataType type) const;
467  virtual void* get_pointer (Int whichField, DataType type,
468  const String& recordType) const;
469  // </group>
470 
471  // Return a const reference to the underlying TableRecordRep.
472  const TableRecordRep& ref() const;
473 
474  // Return a non-const reference to the underlying TableRecordRep.
475  // When needed, the TableRecordRep will be copied and all RecordField
476  // objects will be notified.
478 
479  // Add a field to the record.
480  virtual void addDataField (const String& name, DataType type,
481  const IPosition& shape, Bool fixedShape,
482  const void* value);
483 
484  // Define a value in the given field.
485  virtual void defineDataField (Int whichField, DataType type,
486  const void* value);
487 
488 private:
489  // Get the description of this record.
490  virtual RecordDesc getDescription() const;
491 
492  // Create TableRecord as a subrecord.
493  // When the description is empty, the record has a variable structure.
494  // Otherwise it is fixed.
495  // <group>
498  // </group>
499 
500  // Set the recordtype of this record and all its subrecords (recursively).
502 
503  // The TableRecord representation.
505  // The parent TableRecord.
507 };
508 
509 
510 
511 inline const TableRecordRep& TableRecord::ref() const
512 {
513  return rep_p.ref();
514 }
516 {
517  return ref().description();
518 }
519 
520 inline Bool TableRecord::conform (const TableRecord& other) const
521 {
522  return ref().conform (other.ref());
523 }
524 
525 inline void TableRecord::putData (AipsIO& os,
526  const TableAttr& parentAttr) const
527 {
528  ref().putData (os, parentAttr);
529 }
530 
531 inline void TableRecord::getData (AipsIO& os, uInt version,
532  const TableAttr& parentAttr)
533 {
534  rwRef().getData (os, version, parentAttr);
535 }
536 
538 {
539  rwRef().reopenRW();
540 }
541 
542 inline void TableRecord::closeTables() const
543 {
544  ref().closeTables();
545 }
546 
547 inline void TableRecord::flushTables (Bool fsync) const
548 {
549  ref().flushTables (fsync);
550 }
551 
552 inline void TableRecord::renameTables (const String& newParentName,
553  const String& oldParentName)
554 {
555  rwRef().renameTables (newParentName, oldParentName);
556 }
557 
559 {
560  return ref().areTablesMultiUsed();
561 }
562 
563 
564 
565 } //# NAMESPACE CASACORE - END
566 
567 #endif
casacore::TableRecord::getData
void getData(AipsIO &os, uInt version, const TableAttr &)
Read the data of a record.
Definition: TableRecord.h:531
casacore::TableRecord::TableRecord
TableRecord()
Create a record with no fields.
casacore::RecordDesc
Definition: RecordDesc.h:106
casacore::TableRecord::fieldNumber
virtual Int fieldNumber(const String &fieldName) const
Get the field number from the field name.
casacore::TableRecord::comment
virtual const String & comment(const RecordFieldId &) const
Get the comment for this field.
casacore::IPosition
Definition: IPosition.h:120
casacore::TableRecordRep::areTablesMultiUsed
Bool areTablesMultiUsed() const
Are subtables used in other processes.
casacore::RecordInterface::recordType
RecordType & recordType()
Give access to the RecordType flag (write-access is needed when a record is read back).
Definition: RecordInterface.h:559
casacore::RecordInterface::shape
IPosition shape(const RecordFieldId &) const
Get the actual shape of this field.
casacore::TableRecordRep::closeTables
void closeTables() const
Close all open tables.
casacore::AipsIO
Definition: AipsIO.h:169
casacore::TableRecord::get_pointer
virtual void * get_pointer(Int whichField, DataType type) const
Used by the RecordField classes to attach in a type-safe way to the correct field.
casacore::TableRecordRep
Definition: TableRecordRep.h:99
casacore::TableRecord::operator>>
friend AipsIO & operator>>(AipsIO &os, TableRecord &rec)
Read the TableRecord from an input stream.
casacore::TableRecord::ref
const TableRecordRep & ref() const
Return a const reference to the underlying TableRecordRep.
Definition: TableRecord.h:511
casacore::TableRecord::setRecordType
void setRecordType(RecordType type)
Set the recordtype of this record and all its subrecords (recursively).
casacore::TableRecord::~TableRecord
~TableRecord()
Release resources associated with this object.
casacore::RecordInterface::DuplicatesFlag
DuplicatesFlag
Define the Duplicates flag for the function merge in the various record classes.
Definition: RecordInterface.h:162
casacore::TableRecord::TableRecord
TableRecord(TableRecordRep *parent, RecordType type)
casacore::TableRecord::operator=
TableRecord & operator=(const TableRecord &other)
Copy the data in the other record to this record.
casacore::TableRecord
Definition: TableRecord.h:183
casacore::TableRecord::defineRecord
virtual void defineRecord(const RecordFieldId &, const RecordInterface &value, RecordType=Variable)
casacore::RecordInterface::Fixed
@ Fixed
Record has a fixed structure; that is, no fields can be added or removed once the Record is created.
Definition: RecordInterface.h:152
casacore::TableRecord::closeTables
void closeTables() const
Close all open tables.
Definition: TableRecord.h:542
casacore::TableRecord::areTablesMultiUsed
Bool areTablesMultiUsed() const
Are subtables used in other processes.
Definition: TableRecord.h:558
casacore::TableRecord::description
const RecordDesc & description() const
Describes the current structure of this TableRecord.
Definition: TableRecord.h:515
casacore::TableRecord::fromRecord
void fromRecord(const Record &rec)
Fill the TableRecord from the given Record.
casacore::TableRecord::renameTables
void renameTables(const String &newParentName, const String &oldParentName)
Rename the subtables with a path containing the old parent table name.
Definition: TableRecord.h:552
casacore::TableRecord::defineFromValueHolder
virtual void defineFromValueHolder(const RecordFieldId &, const ValueHolder &)
casacore::TableRecord::defineTable
void defineTable(const RecordFieldId &, const Table &value, RecordType type=Variable)
casacore::TableRecord::getRecord
void getRecord(AipsIO &os, const TableAttr &)
Read a record.
casacore::TableRecord::TableRecord
TableRecord(const TableRecord &other)
Create a copy of other using copy semantics.
casacore::TableRecord::defineRecord
void defineRecord(const RecordFieldId &, const TableRecord &value, RecordType type=Variable)
Define a value for the given field.
casacore::TableRecord::subRecord
const TableRecord & subRecord(const RecordFieldId &) const
Get the subrecord or table from the given field.
casacore::TableRecord::makeUnique
virtual void makeUnique()
Make a unique record representation (to do copy-on-write in RecordFieldPtr).
casacore::TableRecordRep::conform
Bool conform(const TableRecordRep &other) const
Returns True if this and other have the same RecordDesc, other than different names for the fields.
casacore::TableRecord::closeTable
void closeTable(const RecordFieldId &) const
Close the table in the given field.
casacore::Table
Definition: Table.h:154
casacore::TableRecord::renameField
void renameField(const String &newName, const RecordFieldId &)
Rename the given field.
casacore::TableRecord::setTableAttr
void setTableAttr(const TableRecord &other, const TableAttr &defaultAttr)
Recursively set the attributes of subtables to the ones in the other record for matching subtable fie...
casacore::value
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
casacore::TableRecord::rwRef
TableRecordRep & rwRef()
Return a non-const reference to the underlying TableRecordRep.
casacore::RecordInterface::RecordType
RecordType
Define the flag telling if a Record has a fixed or variable structure.
Definition: RecordInterface.h:149
casacore::TableRecord::nfields
virtual uInt nfields() const
How many fields does this structure have? A convenient synonym for description().nfields().
casacore::TableRecord::restructure
virtual void restructure(const RecordDesc &newDescription, Bool recursive=True)
Change the structure of this TableRecord to contain the fields in newDescription.
casacore::False
const Bool False
Definition: aipstype.h:44
casacore::uInt
unsigned int uInt
Definition: aipstype.h:51
casacore::RecordInterface::name
String name(const RecordFieldId &) const
Get the name of this field.
casacore::TableRecord::merge
void merge(const TableRecord &other, DuplicatesFlag=ThrowOnDuplicates)
Merge all fields from the other record into this record.
casacore::TableRecord::print
virtual void print(std::ostream &, Int maxNrValues=25, const String &indent="") const
Print the contents of the record.
casacore::TableRecord::assign
virtual void assign(const RecordInterface &that)
Assign that RecordInterface object to this one.
casacore::TableRecord::tableAttributes
const TableAttr & tableAttributes(const RecordFieldId &) const
Get the attributes of a table field.
casacore::TableRecord::TableRecord
TableRecord(TableRecordRep *parent, const RecordDesc &description)
Create TableRecord as a subrecord.
casacore::TableRecord::clone
virtual RecordInterface * clone() const
Make a copy of this object.
casacore::TableRecordRep::reopenRW
void reopenRW()
Reopen possible tables in keywords as read/write.
casacore::TableLock
Definition: TableLock.h:69
casacore::Int
int Int
Definition: aipstype.h:50
casacore
this file contains all the compiler specific defines
Definition: mainpage.dox:28
casacore::TableRecord::flushTables
void flushTables(Bool fsync=False) const
Flush all open subtables.
Definition: TableRecord.h:547
casacore::TableRecord::operator<<
friend AipsIO & operator<<(AipsIO &os, const TableRecord &rec)
Write the TableRecord to an output stream.
casacore::TableRecord::toRecord
Record toRecord() const
Convert the TableRecord to a Record (recursively).
casacore::COWPtr
Definition: COWPtr.h:186
casacore::TableRecord::conform
Bool conform(const TableRecord &other) const
Returns True if this and other have the same RecordDesc, other than different names for the fields.
Definition: TableRecord.h:520
casacore::TableRecordRep::flushTables
void flushTables(Bool fsync) const
Flush all open subtables.
casacore::TableRecord::putRecord
void putRecord(AipsIO &os, const TableAttr &) const
Put the data of a record.
casacore::True
const Bool True
Definition: aipstype.h:43
casacore::TableRecordRep::renameTables
void renameTables(const String &newParentName, const String &oldParentName)
Rename the subtables with a path containing the old parent table name.
casacore::TableRecord::asrwRecord
virtual RecordInterface & asrwRecord(const RecordFieldId &)
casacore::TableRecord::rep_p
COWPtr< TableRecordRep > rep_p
The TableRecord representation.
Definition: TableRecord.h:504
casacore::TableRecord::TableRecord
TableRecord(const RecordInterface &other)
Create a TableRecord from another type of record.
casacore::TableRecord::asRecord
virtual const RecordInterface & asRecord(const RecordFieldId &) const
casacore::TableRecord::TableRecord
TableRecord(RecordType type, CheckFieldFunction *=0, const void *checkArgument=0)
Create a record with no fields.
casacore::RecordInterface
Definition: RecordInterface.h:145
casacore::TableRecordRep::description
const RecordDesc & description() const
Describes the current structure of this Record.
Definition: TableRecordRep.h:278
casacore::TableRecordRep::putData
void putData(AipsIO &os, const TableAttr &) const
Put the data of a record.
casacore::TableRecord::get_pointer
virtual void * get_pointer(Int whichField, DataType type, const String &recordType) const
casacore::TableRecord::putData
void putData(AipsIO &os, const TableAttr &) const
Put the data of a record.
Definition: TableRecord.h:525
casacore::TableRecord::setComment
virtual void setComment(const RecordFieldId &, const String &comment)
Set the comment for this field.
casacore::TableRecord::defineDataField
virtual void defineDataField(Int whichField, DataType type, const void *value)
Define a value in the given field.
casacore::TableRecord::addDataField
virtual void addDataField(const String &name, DataType type, const IPosition &shape, Bool fixedShape, const void *value)
Add a field to the record.
casacore::TableRecord::mergeField
void mergeField(const TableRecord &other, const RecordFieldId &, DuplicatesFlag=ThrowOnDuplicates)
Merge a field from another record into this record.
casacore::TableRecordRep::getData
void getData(AipsIO &os, uInt version, const TableAttr &)
Read the data of a record.
casacore::TableRecord::getDescription
virtual RecordDesc getDescription() const
Get the description of this record.
casacore::String
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Bool
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::ValueHolder
Definition: ValueHolder.h:68
casacore::TableRecord::removeField
void removeField(const RecordFieldId &)
Remove a field from the record.
casacore::Record
Definition: Record.h:181
casacore::TableRecord::asTable
Table asTable(const RecordFieldId &) const
Get the table from the given field.
casacore::TableRecord::asTable
Table asTable(const RecordFieldId &, const TableLock &lockOptions) const
casacore::TableRecord::reopenRW
void reopenRW()
Reopen possible tables in keywords as read/write.
Definition: TableRecord.h:537
casacore::RecordInterface::CheckFieldFunction
Bool CheckFieldFunction(const String &fieldName, DataType dataType, const void *extraArgument, String &message)
Define the signature of the add callback function.
Definition: RecordInterface.h:183
casacore::RecordInterface::ThrowOnDuplicates
@ ThrowOnDuplicates
Throw an exception.
Definition: RecordInterface.h:172
casacore::TableRecord::parent_p
TableRecordRep * parent_p
The parent TableRecord.
Definition: TableRecord.h:506
casacore::TableAttr
Definition: TableAttr.h:78
casacore::TableRecord::TableRecord
TableRecord(const RecordDesc &description, RecordType type=Fixed, CheckFieldFunction *=0, const void *checkArgument=0)
Create a record with the given description.
casacore::TableRecord::type
virtual DataType type(Int whichField) const
Get the data type of this field.
casacore::RecordFieldId
Definition: RecordFieldId.h:92
casacore::TableRecord::rwSubRecord
TableRecord & rwSubRecord(const RecordFieldId &)
casacore::RecordInterface::Variable
@ Variable
Record has a variable structure; after Record creation fields can be added or removed at will.
Definition: RecordInterface.h:155
casacore::TableRecord::asValueHolder
virtual ValueHolder asValueHolder(const RecordFieldId &) const
Get or define the value as a ValueHolder.