casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TBField.h
Go to the documentation of this file.
00001 //# TBField.h: Representation of a table field.
00002 //# Copyright (C) 2005
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 #ifndef TBFIELD_H_
00028 #define TBFIELD_H_
00029 
00030 #include <vector>
00031 
00032 #include <casa/BasicSL/String.h>
00033 
00034 #include <casa/namespace.h>
00035 using namespace std;
00036 
00037 namespace casa {
00038 
00039 //# Forward Declarations
00040 class TBKeyword;
00041 
00042 // <summary>
00043 // Representation of a table field.
00044 // <summary>
00045 //
00046 // <synopsis>
00047 // A TBField consists of a name, a type, a potentially empty list of keywords,
00048 // and some other potentially empty properties.
00049 // </synopsis>
00050 
00051 class TBField {
00052 public:
00053     // Constructor to take the name and type.  Other properties must be added
00054     // via method calls.
00055     TBField(String name, String type);
00056 
00057     ~TBField();
00058 
00059     
00060     // Returns this field's name.
00061     String getName();
00062 
00063     // Returns this field's type.
00064     String getType();
00065 
00066     // Returns this field's keywords.
00067     vector<TBKeyword*>* getKeywords();
00068     
00069     // Returns the keyword at index i, or NULL if there is none.
00070     TBKeyword* keyword(int i);
00071     
00072     // Returns the keyword with name i, or NULL if there is none.
00073     TBKeyword* keyword(String name);
00074 
00075     // Returns the number of keywords this field has.
00076     unsigned int numKeywords();
00077 
00078     // Returns the keyword at index i.
00079     TBKeyword* keywordAt(unsigned int i);
00080 
00081     // Adds the given keyword to this field's keyword list.
00082     void addKeyword(TBKeyword* keyword);
00083 
00084     // Sets this field's UCD property.
00085     void setUCD(String ucd);
00086 
00087     // Returns this field's UCD property, or an empty String if it is not set.
00088     String getUCD();
00089 
00090     // Sets this field's ref property.
00091     void setRef(String ref);
00092 
00093     // Returns this field's ref property, or an empty String if it is not set.
00094     String getRef();
00095 
00096     // Sets this field's unit property.
00097     void setUnit(String unit);
00098     
00099     // Returns this field's unit property, or an empty String if it is not set.
00100     String getUnit();
00101 
00102     // Sets this field's precision property.
00103     void setPrecision(String precision);
00104     
00105     // Returns this field's precision property, or an empty String if it is not
00106     // set.
00107     String getPrecision();
00108 
00109     // Sets this field's width property.
00110     void setWidth(String width);
00111     
00112     // Returns this field's width property, or an empty String if it is not
00113     // set.
00114     String getWidth();
00115 
00116 private:
00117     // Field name.
00118     String name;
00119 
00120     // Field type.
00121     String type;
00122 
00123     // Field keywords.
00124     vector<TBKeyword*> keywords;
00125 
00126     // Field UCD.
00127     String ucd;
00128 
00129     // Field ref.
00130     String ref;
00131 
00132     // Field unit.
00133     String unit;
00134 
00135     // Field precision.
00136     String precision;
00137 
00138     // Field width.
00139     String width;
00140 };
00141 
00142 }
00143 
00144 #endif /* TBFIELD_H_ */