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