casacore
Loading...
Searching...
No Matches
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: 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 IMAGES_IMAGEATTRGROUPCASA_H
27#define IMAGES_IMAGEATTRGROUPCASA_H
28
29// # Includes
30#include <casacore/casa/aips.h>
31#include <casacore/images/Images/ImageAttrGroup.h>
32#include <casacore/tables/Tables/TableProxy.h>
33
34namespace casacore {
35
36// <summary>
37// Attribute group for a CASA image.
38// </summary>
39//
40// <use visibility=export>
41//
42// <reviewed reviewer="" date="" tests="tPagedmage.cc" demos="dPagedImage.cc">
43// </reviewed>
44//
45// <prerequisite>
46// <li> <linkto class=ImageAttrGroup>ImageAttrGroup</linkto>
47// </prerequisite>
48//
49// <synopsis>
50// This is the implementation of base class class ImageAttrGroup for an image
51// stored in the casacore table format.
52// See the base class for more information.
53// </synopsis>
54
56 public:
57 // The default constructor creates a null object.
59
60 // Construct the object for an attribute group in the image table.
61 // Note that the group name is the name of a subtable containing the info.
62 ImageAttrGroupCasa(const Table& image, const String& attrGroupName);
63
65
66 // Test if it is a null object.
67 Bool isNull() const { return itsTable.table().isNull(); }
68
69 // Flush the attibrutes if needed.
70 void flush();
71
72 // Get the number of rows in the group.
73 virtual uInt nrows() const;
74
75 // Test if an attribute exists.
76 virtual Bool hasAttr(const String& attrName) const;
77
78 // Get all attribute names.
79 virtual Vector<String> attrNames() const;
80
81 // Get the datatype of a attribute.
82 // It returns TpOther if the attribute is not defined.
83 virtual DataType dataType(const String& attrName) const;
84
85 // Get the data of the given attribute.
86 virtual ValueHolder getData(const String& attrName, uInt rownr);
87
88 // Get the data of all attributes in a rows.
89 virtual Record getDataRow(uInt rownr);
90
91 // Get the possible units of the values.
92 // An empty vector is returned if the attribute has no units.
93 virtual Vector<String> getUnit(const String& attrName);
94
95 // Get the possible measure info as type and Ref.
96 // An empty vector is returned if the attribute has no MEASINFO.
97 virtual Vector<String> getMeasInfo(const String& attrName);
98
99 // Put the data of the given attribute.
100 // If the table does not contain data yet, it will be sized to the size
101 // of the vector. Otherwise the vector size has to match the table size.
102 // <br>If not empty, the units and MEASINFO will be put as column keywords.
103 // The MEASINFO vector must be given as type,Ref.
104 virtual void putData(const String& attrName, uInt rownr, const ValueHolder& data,
105 const Vector<String>& units = Vector<String>(),
106 const Vector<String>& measInfo = Vector<String>());
107
108 private:
109 // Check if the size matches the number of rows.
110 // Add rows if the table is still empty.
111 void checkRows(const std::string& attrName, uInt size);
112
113 // Add a new column for the given attribute for the data type in the value.
114 Bool addNewColumn(const String& attrName, const ValueHolder&);
115
116 // # Data members.
118};
119
120} // namespace casacore
121
122#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.
virtual Vector< String > getUnit(const String &attrName)
Get the possible units of the values.
virtual DataType dataType(const String &attrName) const
Get the datatype of a attribute.
Bool addNewColumn(const String &attrName, const ValueHolder &)
Add a new column for the given attribute for the data type in the value.
void checkRows(const std::string &attrName, uInt size)
Check if the size matches the number of rows.
Bool isNull() const
Test if it is a null object.
void flush()
Flush the attibrutes if needed.
ImageAttrGroupCasa()
The default constructor creates a null object.
virtual Vector< String > attrNames() const
Get all attribute names.
ImageAttrGroupCasa(const Table &image, const String &attrGroupName)
Construct the object for an attribute group in the image table.
virtual Bool hasAttr(const String &attrName) const
Test if an attribute exists.
virtual uInt nrows() const
Get the number of rows in the group.
virtual Record getDataRow(uInt rownr)
Get the data of all attributes in a rows.
virtual ValueHolder getData(const String &attrName, uInt rownr)
Get the data of the given attribute.
virtual Vector< String > getMeasInfo(const String &attrName)
Get the possible measure info as type and Ref.
ImageAttrGroup()
Default constructor.
String: the storage and methods of handling collections of characters.
Definition String.h:355
For temporary backward namespace compatibility, use casa as alias for casacore.
Definition mainpage.dox:28
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40
size_t size() const
Definition Block.h:566