casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImageAttrGroupCasa.h
Go to the documentation of this file.
1 //# ImageAttrGroupCasa.h: Attribute group for a CASA image
2 //# Copyright (C) 2012
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 IMAGES_IMAGEATTRGROUPCASA_H
29 #define IMAGES_IMAGEATTRGROUPCASA_H
30 
31 //# Includes
32 #include <casacore/casa/aips.h>
35 
36 namespace casacore {
37 
38 // <summary>
39 // Attribute group for a CASA image.
40 // </summary>
41 //
42 // <use visibility=export>
43 //
44 // <reviewed reviewer="" date="" tests="tPagedmage.cc" demos="dPagedImage.cc">
45 // </reviewed>
46 //
47 // <prerequisite>
48 // <li> <linkto class=ImageAttrGroup>ImageAttrGroup</linkto>
49 // </prerequisite>
50 //
51 // <synopsis>
52 // This is the implementation of base class class ImageAttrGroup for an image
53 // stored in the casacore table format.
54 // See the base class for more information.
55 // </synopsis>
56 
58 {
59 public:
60  // The default constructor creates a null object.
62  {}
63 
64  // Construct the object for an attribute group in the image table.
65  // Note that the group name is the name of a subtable containing the info.
66  ImageAttrGroupCasa (const Table& image, const String& attrGroupName);
67 
68  virtual ~ImageAttrGroupCasa();
69 
70  // Test if it is a null object.
71  Bool isNull() const
72  { return itsTable.table().isNull(); }
73 
74  // Flush the attibrutes if needed.
75  void flush();
76 
77  // Get the number of rows in the group.
78  virtual uInt nrows() const;
79 
80  // Test if an attribute exists.
81  virtual Bool hasAttr (const String& attrName) const;
82 
83  // Get all attribute names.
84  virtual Vector<String> attrNames() const;
85 
86  // Get the datatype of a attribute.
87  // It returns TpOther if the attribute is not defined.
88  virtual DataType dataType (const String& attrName) const;
89 
90  // Get the data of the given attribute.
91  virtual ValueHolder getData (const String& attrName, uInt rownr);
92 
93  // Get the data of all attributes in a rows.
94  virtual Record getDataRow (uInt rownr);
95 
96  // Get the possible units of the values.
97  // An empty vector is returned if the attribute has no units.
98  virtual Vector<String> getUnit (const String& attrName);
99 
100  // Get the possible measure info as type and Ref.
101  // An empty vector is returned if the attribute has no MEASINFO.
102  virtual Vector<String> getMeasInfo (const String& attrName);
103 
104  // Put the data of the given attribute.
105  // If the table does not contain data yet, it will be sized to the size
106  // of the vector. Otherwise the vector size has to match the table size.
107  // <br>If not empty, the units and MEASINFO will be put as column keywords.
108  // The MEASINFO vector must be given as type,Ref.
109  virtual void putData (const String& attrName, uInt rownr,
110  const ValueHolder& data,
111  const Vector<String>& units = Vector<String>(),
112  const Vector<String>& measInfo = Vector<String>());
113 
114 private:
115  // Check if the size matches the number of rows.
116  // Add rows if the table is still empty.
117  void checkRows (const String& attrName, uInt size);
118 
119  // Add a new column for the given attribute for the data type in the value.
120  Bool addNewColumn (const String& attrName, const ValueHolder&);
121 
122  //# Data members.
124 };
125 
126 } //# NAMESPACE CASACORE - END
127 
128 #endif
virtual void putData(const String &attrName, uInt rownr, const ValueHolder &data, const Vector< String > &units=Vector< String >(), const Vector< String > &measInfo=Vector< String >())
Put the data of the given attribute.
Bool isNull() const
Test if it is a null object.
A 1-D Specialization of the Array class.
virtual uInt nrows() const
Get the number of rows in the group.
Main interface class to a read/write table.
Definition: Table.h:153
Table & table()
Return the table object.
Definition: TableProxy.h:593
virtual Vector< String > attrNames() const
Get all attribute names.
virtual Vector< String > getMeasInfo(const String &attrName)
Get the possible measure info as type and Ref.
Abstract base class for an image attributes group.
High-level interface to tables.
Definition: TableProxy.h:103
Attribute group for a CASA image.
size_t size() const
virtual Record getDataRow(uInt rownr)
Get the data of all attributes in a rows.
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
void checkRows(const String &attrName, uInt size)
Check if the size matches the number of rows.
virtual DataType dataType(const String &attrName) const
Get the datatype of a attribute.
A holder for a value of any basic Casacore data type.
Definition: ValueHolder.h:67
virtual Bool hasAttr(const String &attrName) const
Test if an attribute exists.
virtual ValueHolder getData(const String &attrName, uInt rownr)
Get the data of the given attribute.
void flush()
Flush the attibrutes if needed.
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Bool addNewColumn(const String &attrName, const ValueHolder &)
Add a new column for the given attribute for the data type in the value.
Bool isNull() const
Test if the object is null, i.e.
Definition: Table.h:526
ImageAttrGroupCasa()
The default constructor creates a null object.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual Vector< String > getUnit(const String &attrName)
Get the possible units of the values.
unsigned int uInt
Definition: aipstype.h:51
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42