ImageAttrGroupCasa.h

Go to the documentation of this file.
00001 //# ImageAttrGroupCasa.h: Attribute group for a CASA image
00002 //# Copyright (C) 2012
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be addressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //# $Id$
00027 
00028 #ifndef IMAGES_IMAGEATTRGROUPCASA_H
00029 #define IMAGES_IMAGEATTRGROUPCASA_H
00030 
00031 //# Includes
00032 #include <casacore/casa/aips.h>
00033 #include <casacore/images/Images/ImageAttrGroup.h>
00034 #include <casacore/tables/Tables/TableProxy.h>
00035 
00036 namespace casacore {
00037 
00038 // <summary>
00039 // Attribute group for a CASA image.
00040 // </summary>
00041 //
00042 // <use visibility=export>
00043 //
00044 // <reviewed reviewer="" date="" tests="tPagedmage.cc" demos="dPagedImage.cc">
00045 // </reviewed>
00046 //
00047 // <prerequisite>
00048 //   <li> <linkto class=ImageAttrGroup>ImageAttrGroup</linkto>
00049 // </prerequisite>
00050 //
00051 // <synopsis> 
00052 // This is the implementation of base class class ImageAttrGroup for an image
00053 // stored in the casacore table format.
00054 // See the base class for more information.
00055 // </synopsis>
00056 
00057 class ImageAttrGroupCasa : public ImageAttrGroup
00058 {
00059 public: 
00060   // The default constructor creates a null object.
00061   ImageAttrGroupCasa()
00062   {}
00063 
00064   // Construct the object for an attribute group in the image table.
00065   // Note that the group name is the name of a subtable containing the info.
00066   ImageAttrGroupCasa (const Table& image, const String& attrGroupName);
00067 
00068   virtual ~ImageAttrGroupCasa();
00069 
00070   // Test if it is a null object.
00071   Bool isNull() const
00072     { return itsTable.table().isNull(); }
00073 
00074   // Flush the attibrutes if needed.
00075   void flush();
00076 
00077   // Get the number of rows in the group.
00078   virtual uInt nrows() const;
00079 
00080   // Test if an attribute exists.
00081   virtual Bool hasAttr (const String& attrName) const;
00082 
00083   // Get all attribute names.
00084   virtual Vector<String> attrNames() const;
00085 
00086   // Get the datatype of a attribute.
00087   // It returns TpOther if the attribute is not defined.
00088   virtual DataType dataType (const String& attrName) const;
00089 
00090   // Get the data of the given attribute.
00091   virtual ValueHolder getData (const String& attrName, uInt rownr);
00092 
00093   // Get the data of all attributes in a rows.
00094   virtual Record getDataRow (uInt rownr);
00095 
00096   // Get the possible units of the values.
00097   // An empty vector is returned if the attribute has no units.
00098   virtual Vector<String> getUnit (const String& attrName);
00099 
00100   // Get the possible measure info as type and Ref.
00101   // An empty vector is returned if the attribute has no MEASINFO.
00102   virtual Vector<String> getMeasInfo (const String& attrName);
00103 
00104   // Put the data of the given attribute.
00105   // If the table does not contain data yet, it will be sized to the size
00106   // of the vector. Otherwise the vector size has to match the table size.
00107   // <br>If not empty, the units and MEASINFO will be put as column keywords.
00108   // The MEASINFO vector must be given as type,Ref.
00109   virtual void putData (const String& attrName, uInt rownr,
00110                         const ValueHolder& data,
00111                         const Vector<String>& units = Vector<String>(),
00112                         const Vector<String>& measInfo = Vector<String>());
00113 
00114 private:
00115   // Check if the size matches the number of rows.
00116   // Add rows if the table is still empty.
00117   void checkRows (const String& attrName, uInt size);
00118 
00119   // Add a new column for the given attribute for the data type in the value.
00120   Bool addNewColumn (const String& attrName, const ValueHolder&);
00121 
00122   //# Data members.
00123   TableProxy itsTable;
00124 };
00125 
00126 } //# NAMESPACE CASACORE - END
00127 
00128 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1