18 #include "FitsError.h"
851 RangeError (
const String& msg,
bool silent =
true);
899 UnspecifiedLengths (
const String& diag,
bool silent =
true);
935 NoNullValue (
const String& diag,
bool silent =
true);
955 bool operator==(
const Column &right)
const;
957 bool operator!=(
const Column &right)
const;
959 virtual void readData (
long firstRow,
long nelements,
long firstElem = 1) = 0;
961 virtual Column * clone ()
const = 0;
965 friend std::ostream& operator << (std::ostream& s,
const Column& right);
974 friend bool operator < (
const Column& left,
const Column& right);
976 friend bool operator > (
const Column& left,
const Column& right);
978 void unit (
const String& value);
981 void index (
int value);
985 void width (
long value);
988 double scale ()
const;
989 void scale (
double value);
990 double zero ()
const;
991 void zero (
double value);
992 const String&
display ()
const;
993 const String&
dimen ()
const;
994 void dimen (
const String& value);
997 static const String& TFORM ();
998 static const String& TDISP ();
999 static const String& TSCAL ();
1000 static const String& TZERO ();
1001 static const String& TDIM ();
1002 const String&
format ()
const;
1003 const String&
unit ()
const;
1004 const String&
name ()
const;
1013 template <
typename S>
1014 void write (
const std::vector<S>& indata,
long firstRow);
1016 void write (
const std::vector<std::complex<float> >& indata,
long firstRow);
1018 void write (
const std::vector<std::complex<double> >& indata,
long firstRow);
1020 template <
typename S>
1021 void write (
const std::valarray<S>& indata,
long firstRow);
1023 void write (
const std::valarray<std::complex<float> >& indata,
long firstRow);
1025 void write (
const std::valarray<std::complex<double> >& indata,
long firstRow);
1027 template <
typename S>
1028 void write (S* indata,
long nRows,
long firstRow);
1031 template <
typename S>
1032 void write (
const std::vector<S>& indata,
long firstRow, S* nullValue);
1034 template <
typename S>
1035 void write (
const std::valarray<S>& indata,
long firstRow, S* nullValue);
1037 template <
typename S>
1038 void write (S* indata,
long nRows,
long firstRow, S* nullValue);
1048 template <
typename S>
1049 void write (
const std::valarray<S>& indata,
long nRows,
long firstRow);
1051 void write (
const std::valarray<std::complex<float> >& indata,
long nRows,
long firstRow);
1053 void write (
const std::valarray<std::complex<double> >& indata,
long nRows,
long firstRow);
1056 template <
typename S>
1057 void write (
const std::vector<S>& indata,
long nRows,
long firstRow);
1059 void write (
const std::vector<std::complex<float> >& indata,
long nRows,
long firstRow);
1061 void write (
const std::vector<std::complex<double> >& indata,
long nRows,
long firstRow);
1065 template <
typename S>
1066 void write (S* indata,
long nElements,
long nRows,
long firstRow);
1069 template <
typename S>
1070 void write (
const std::valarray<S>& indata,
long nRows,
long firstRow, S* nullValue);
1073 template <
typename S>
1074 void write (
const std::vector<S>& indata,
long nRows,
long firstRow, S* nullValue);
1076 template <
typename S>
1077 void write (S* indata,
long nElements,
long nRows,
long firstRow, S* nullValue);
1081 template <
typename S>
1082 void write (
const std::valarray<S>& indata,
1083 const std::vector<long>& vectorLengths,
1086 void write (
const std::valarray<std::complex<float> >& indata,
1087 const std::vector<long>& vectorLengths,
1090 void write (
const std::valarray<std::complex<double> >& indata,
1091 const std::vector<long>& vectorLengths,
1094 template <
typename S>
1095 void write (
const std::vector<S>& indata,
1096 const std::vector<long>& vectorLengths,
1101 void write (
const std::vector<std::complex<float> >& indata,
1102 const std::vector<long>& vectorLengths,
1105 void write (
const std::vector<std::complex<double> >& indata,
1106 const std::vector<long>& vectorLengths,
1109 template <
typename S>
1110 void write (S* indata,
long nElements,
1111 const std::vector<long>& vectorLengths,
1114 template <
typename S>
1115 void writeArrays (
const std::vector<std::valarray<S> >& indata,
long firstRow);
1117 void writeArrays (
const std::vector<std::valarray<std::complex<float> > >& indata,
long firstRow);
1119 void writeArrays (
const std::vector<std::valarray<std::complex<double> > >& indata,
long firstRow);
1121 template <
typename S>
1122 void writeArrays (
const std::vector<std::valarray<S> >& indata,
long firstRow, S* nullValue);
1128 template <
typename S>
1129 void read(std::vector<S>& vals,
long first,
long last) ;
1132 void read(std::vector< std::complex<float> >& ,
long first,
long last);
1134 void read(std::vector< std::complex<double> >& ,
long first,
long last);
1136 void read(std::vector<String>& vals,
long first,
long last);
1139 template <
typename S>
1140 void read(std::valarray<S>& vals,
long first,
long last) ;
1142 void read(std::valarray<std::complex<float> >& vals,
long first,
long last) ;
1144 void read(std::valarray<std::complex<double> >& vals,
long first,
long last) ;
1147 template <
typename S>
1148 void read(std::valarray<S>& vals,
long rows) ;
1149 template <
typename S>
1150 void read(std::vector<S>& vals,
long rows);
1151 void read(std::valarray<std::complex<float> >& vals,
long rows) ;
1152 void read(std::valarray<std::complex<double> >& vals,
long rows) ;
1153 void read(std::vector<std::complex<float> >& vals,
long rows) ;
1154 void read(std::vector<std::complex<double> >& vals,
long rows) ;
1157 template <
typename S>
1158 void readArrays(std::vector<std::valarray<S> >& vals,
long first,
long last) ;
1160 void readArrays(std::vector<std::valarray<std::complex<float> > >& vals,
long first,
long last) ;
1162 void readArrays(std::vector<std::valarray<std::complex<double> > >& vals,
long first,
long last) ;
1168 template <
typename S>
1169 void read(std::vector<S>& vals,
long first,
long last, S* nullValue) ;
1172 template <
typename S>
1173 void read(std::valarray<S>& vals,
long first,
long last, S* nullValue);
1176 template <
typename S>
1177 void read(std::valarray<S>& vals,
long rows, S* nullValue) ;
1179 template <
typename S>
1180 void read(std::vector<S>& vals,
long rows, S* nullValue) ;
1183 template <
typename S>
1184 void readArrays(std::vector<std::valarray<S> >& vals,
long first,
long last, S* nullValue);
1187 template <
typename T>
1191 template <
typename T>
1194 void write (
const std::vector<String>& indata,
long firstRow);
1202 friend void Table::initRead();
1204 friend void Table::reindex(
int startNum,
bool isInsert);
1210 const String &columnName,
1214 int rpt = 1,
long w = 1,
const String &
comment =
"");
1217 virtual bool compare (
const Column &right)
const;
1223 virtual std::ostream&
put (std::ostream& s)
const;
1225 static const String& TBCOL ();
1226 static const String& TTYPE ();
1227 static const String& TUNIT ();
1228 static const String& TNULL ();
1229 static const String& TLMIN ();
1230 static const String& TLMAX ();
1231 static const String& TDMAX ();
1232 static const String& TDMIN ();
1233 static const std::vector<String>& columnKeys ();
1234 const String&
comment ()
const;
1242 virtual void insertRows (
long first,
long number = 1) = 0;
1243 virtual void deleteRows (
long first,
long number = 1) = 0;
1244 virtual size_t getStoredDataSize()
const = 0;
1245 static void loadColumnKeys ();
1246 void name (
const String& value);
1247 void format (
const String& value);
1248 long numberOfElements (
long& first,
long& last);
1251 static const String s_TBCOL;
1252 static const String s_TTYPE;
1253 static const String s_TFORM;
1254 static const String s_TDISP;
1255 static const String s_TUNIT;
1256 static const String s_TSCAL;
1257 static const String s_TZERO;
1258 static const String s_TDIM;
1259 static const String s_TNULL;
1260 static const String s_TLMIN;
1261 static const String s_TLMAX;
1262 static const String s_TDMAX;
1263 static const String s_TDMIN;
1279 static const short LLIMITSHORT;
1280 static const long LLIMITLONG;
1281 static const unsigned short LLIMITUSHORT;
1282 static const unsigned long LLIMITULONG;
1283 static const unsigned char LLIMITUCHAR;
1284 static const float LLIMITFLOAT;
1285 static const double LLIMITDOUBLE;
1286 static const short ULIMITSHORT;
1287 static const long ULIMITLONG;
1288 static const unsigned short ULIMITUSHORT;
1289 static const unsigned long ULIMITULONG;
1290 static const unsigned char ULIMITUCHAR;
1291 static const float ULIMITFLOAT;
1292 static const double ULIMITDOUBLE;
1293 static const int LLIMITINT;
1294 static const int ULIMITINT;
1295 static const unsigned int LLIMITUINT;
1296 static const unsigned int ULIMITUINT;
1297 static const LONGLONG LLIMITLONGLONG;
1298 static const LONGLONG ULIMITLONGLONG;
1302 static std::vector<String> s_columnKeys;
1340 return right.
put(s);
1343 inline bool operator < (
const Column& left,
const Column& right)
1346 return left.m_index < right.m_index;
1349 inline bool operator > (
const Column& left,
const Column& right)
1352 return left.m_index > right.m_index;
1447 inline const String& Column::TBCOL ()
1452 inline const String& Column::TTYPE ()
1457 inline const String& Column::TFORM ()
1462 inline const String& Column::TDISP ()
1467 inline const String& Column::TUNIT ()
1472 inline const String& Column::TSCAL ()
1477 inline const String& Column::TZERO ()
1482 inline const String& Column::TDIM ()
1487 inline const String& Column::TNULL ()
1492 inline const String& Column::TLMIN ()
1497 inline const String& Column::TLMAX ()
1502 inline const String& Column::TDMAX ()
1507 inline const String& Column::TDMIN ()
1512 inline const std::vector<String>& Column::columnKeys ()
1514 return s_columnKeys;
virtual ~Column()
destructor.
Definition: Column.cxx:234
Exception thrown if a null value is specified without support from existing column header...
Definition: Column.h:932
const String & name() const
return name of Column (TTYPEn keyword)
Definition: Column.h:1532
InvalidRowNumber(const String &diag, bool silent=true)
Exception ctor, prefixes the string "FitsError: Invalid Row Number - Column: " before the specific me...
Definition: Column.cxx:94
Exception thrown for invalid data type inputs.
Definition: Column.h:860
size_t repeat() const
get the repeat count for the rows
Definition: Column.h:1390
fitsfile * fitsPointer()
fits pointer corresponding to fits file containing column data.
Definition: Column.cxx:264
int rows() const
return the number of rows in the table.
Definition: Column.cxx:275
long width() const
return column data width
Definition: Column.h:1380
void resetRead()
reset the Column's isRead flag to false
Definition: Column.h:1355
void updateRows()
update the number of rows in the table
Definition: Table.cxx:340
void makeHDUCurrent()
make HDU containing this the current HDU of the fits file.
Definition: Column.cxx:270
bool getNullValue(T *nullVal) const
Get the value of the TNULLn keyword for the column.
Definition: ColumnT.h:1520
FitsError is the exception thrown by non-zero cfitsio status codes.
Definition: FitsError.h:112
const String & display() const
return TDISPn keyword
Definition: Column.h:1422
void write(const std::vector< S > &indata, long firstRow)
write a vector of values into a scalar column starting with firstRow
Definition: ColumnT.h:869
Exception thrown if user enters a non-positive number for the number of rows to write.
Definition: Column.h:944
RangeError(const String &msg, bool silent=true)
Exception ctor, prefixes the string "FitsError: Range error in operation " before the specific messag...
Definition: Column.cxx:43
Exception thrown if the data supplied for a write operation is less than declared.
Definition: Column.h:920
const String & dimen() const
return TDIMn keyword
Definition: Column.h:1427
double scale() const
get TSCALn value
Definition: Column.h:1400
void read(std::vector< S > &vals, long first, long last)
Retrieve data from a scalar column into a std::vector.
Definition: ColumnT.h:42
bool isRead() const
flag set to true if the entire column data has been read from disk
Definition: Column.h:1370
exception to be thrown for inputs that cause range errors in column read operations.
Definition: Column.h:848
virtual std::ostream & put(std::ostream &s) const
internal implementation of << operator.
Definition: Column.cxx:302
double zero() const
get TZEROn value
Definition: Column.h:1412
void readArrays(std::vector< std::valarray< S > > &vals, long first, long last)
return a set of rows of a vector column into a vector of valarrays
Definition: ColumnT.h:680
InsufficientElements(const String &msg, bool silent=true)
Exception ctor, prefixes the string "FitsError: not enough elements supplied for write operation: " ...
Definition: Column.cxx:104
FitsException is the base class for all exceptions thrown by this library.
Definition: FitsError.h:93
void writeArrays(const std::vector< std::valarray< S > > &indata, long firstRow)
write a vector of valarray objects to the column, starting at row firstRow >= 1
Definition: ColumnT.h:1257
InvalidRowParameter(const String &diag, bool silent=true)
Exception ctor, prefixes the string "FitsError: row offset or length incompatible with column declara...
Definition: Column.cxx:63
virtual void setDimen()
set the TDIMn keyword.
Definition: Column.h:1332
const String & unit() const
get units of data in Column (TUNITn keyword)
Definition: Column.h:1527
ValueType
CCfits value types and their CFITSIO equivalents (in caps)
Definition: CCfits.h:81
NoNullValue(const String &diag, bool silent=true)
Exception ctor, prefixes the string "Fits Error: No null value specified for column: " before the spe...
Definition: Column.cxx:114
Exception thrown on attempting to access a scalar column as vector data.
Definition: Column.h:884
std::ostream & operator<<(std::ostream &s, const Column &right)
output operator for Column objects.
Definition: Column.h:1337
void setDisplay()
set the TDISPn keyword
Definition: Column.cxx:280
void addNullValue(T nullVal)
Set the TNULLn keyword for the column.
Definition: ColumnT.h:1485
Column(const Column &right)
copy constructor, used in copying Columns to standard library containers.
Definition: Column.cxx:171
int index() const
get the Column index (the n in TTYPEn etc).
Definition: Column.h:1360
InvalidDataType(const String &str=string(), bool silent=true)
Exception ctor, prefixes the string "FitsError: Incorrect data type: " before the specific message...
Definition: Column.cxx:53
WrongColumnType(const String &diag, bool silent=true)
Exception ctor, prefixes the string "FitsError: Attempt to return scalar data from vector column...
Definition: Column.cxx:73
const String & comment() const
retrieve comment for Column
Definition: Column.h:1517
InvalidNumberOfRows(int number, bool silent=true)
Exception ctor, prefixes the string "Fits Error: number of rows to write must be positive " before th...
Definition: Column.cxx:124
Exception thrown on attempting to read a row number beyond the end of a table.
Definition: Column.h:908
ValueType type() const
returns the data type of the column
Definition: Column.h:1437
bool varLength() const
boolean, set to true if Column has variable length vector rows.
Definition: Column.h:1395
const String & format() const
return TFORMn keyword
Definition: Column.h:1522
Abstract base class for Column objects.
Definition: Column.h:841
Exception thrown on incorrect row writing request.
Definition: Column.h:872
virtual void readData(long firstRow, long nelements, long firstElem=1)=0
Read (or reread) data from the disk into the Column object's internal arrays.
void insertRows(long first, long number=1)
insert empty rows into the table
Definition: Table.cxx:400
Table * parent() const
return a pointer to the Table which owns this Column
Definition: Column.cxx:312
void deleteRows(long first, long number=1)
delete a range of rows in a table.
Definition: Table.cxx:419