casacore
Loading...
Searching...
No Matches
ImageAttrGroupHDF5.h
Go to the documentation of this file.
1//# ImageAttrGroupHDF5.h: Attribute group for a HDF5 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_IMAGEATTRGROUPHDF5_H
27#define IMAGES_IMAGEATTRGROUPHDF5_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#include <casacore/casa/HDF5/HDF5Group.h>
34
35namespace casacore {
36
37// <summary>
38// Attribute group for a HDF5 image.
39// </summary>
40//
41// <use visibility=export>
42//
43// <reviewed reviewer="" date="" tests="tPagedmage.cc" demos="dPagedImage.cc">
44// </reviewed>
45//
46// <prerequisite>
47// <li> <linkto class=ImageAttrGroup>ImageAttrGroup</linkto>
48// </prerequisite>
49//
50// <synopsis>
51// This is the implementation of base class class ImageAttrGroup for an image
52// stored in the HDF5 format.
53// See the base class for more information.
54// </synopsis>
55
57{
58public:
59 // The default constructor creates a null object.
60 explicit ImageAttrGroupHDF5 (Bool isWritable=False)
61 : itsChanged (False),
62 itsCanWrite (isWritable)
63 {}
64
65 // Construct the object for an attribute group in the image.
66 // If present, it reads all attributes.
67 ImageAttrGroupHDF5 (const HDF5Group& image, const String& attrGroupName,
68 Bool writable);
69
71
72 // Test if it is a null object.
73 Bool isNull() const
74 { return itsRecord.empty(); }
75
76 // Flush the attibrutes if needed.
77 void flush (HDF5Group& image, const String& attrGroupName);
78
79 // Get the number of rows in the group.
80 virtual uInt nrows() const;
81
82 // Test if an attribute exists.
83 virtual Bool hasAttr (const String& attrName) const;
84
85 // Get all attribute names.
86 virtual Vector<String> attrNames() const;
87
88 // Get the datatype of a attribute.
89 // It returns TpOther if the attribute is not defined.
90 virtual DataType dataType (const String& attrName) const;
91
92 // Get the data of the given attribute in the given row.
93 virtual ValueHolder getData (const String& attrName, uInt rownr);
94
95 // Get the data of all attributes in a rows.
96 virtual Record getDataRow (uInt rownr);
97
98 // Get the possible units of the values (stored as attrName_UNIT).
99 // An empty vector is returned if the attribute has no units.
100 virtual Vector<String> getUnit (const String& attrName);
101
102 // Get the possible measure info as type,Ref (stored as attrName_MEASINFO).
103 // An empty vector is returned if the attribute has no MEASINFO.
104 virtual Vector<String> getMeasInfo (const String& attrName);
105
106 // Put the data of the given attribute.
107 // If the table does not contain data yet, it will be sized to the size
108 // of the vector. Otherwise the vector size has to match the table size.
109 // <br>If not empty, the units and MEASINFO will be put as column keywords.
110 // The MEASINFO vector must be given as type,Ref.
111 virtual void putData (const String& attrName, uInt rownr,
112 const ValueHolder& data,
113 const Vector<String>& units = Vector<String>(),
114 const Vector<String>& measInfo = Vector<String>());
115
116private:
117 // Check the rownr and add a row if needed.
118 void checkRows (const String& attrName, uInt rownr);
119
120 //# Data members.
121 Record itsRecord; //# Record containing all attributes (subrecord per row)
122 Bool itsChanged; //# Has the Record changed?
123 Bool itsCanWrite; //# Can attributes be written?
124};
125
126} //# NAMESPACE CASACORE - END
127
128#endif
virtual uInt nrows() const
Get the number of rows in the group.
virtual Bool hasAttr(const String &attrName) const
Test if an attribute exists.
ImageAttrGroupHDF5(const HDF5Group &image, const String &attrGroupName, Bool writable)
Construct the object for an attribute group in the image.
void flush(HDF5Group &image, const String &attrGroupName)
Flush the attibrutes if needed.
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.
void checkRows(const String &attrName, uInt rownr)
Check the rownr and add a row if needed.
virtual Vector< String > getMeasInfo(const String &attrName)
Get the possible measure info as type,Ref (stored as attrName_MEASINFO).
virtual Vector< String > attrNames() const
Get all attribute names.
ImageAttrGroupHDF5(Bool isWritable=False)
The default constructor creates a null object.
virtual DataType dataType(const String &attrName) const
Get the datatype of a attribute.
Bool isNull() const
Test if it is a null object.
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 in the given row.
virtual Vector< String > getUnit(const String &attrName)
Get the possible units of the values (stored as attrName_UNIT).
bool empty() const
Is the record empty?
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
const Bool False
Definition aipstype.h:42
unsigned int uInt
Definition aipstype.h:49
bool Bool
Define the standard types used by Casacore.
Definition aipstype.h:40