4 #ifndef GloriaTableColumn_h
5 #define GloriaTableColumn_h 1
22 #include "GloriaSTLTypes.h"
47 { UndefinedColumn = 0,
60 TableColumnType GetValueType(T val);
67 string GetValueTypeName(T val);
85 _name(Name), _unit(Unit), _comment(Comment){}
90 inline string&
Name() {
return _name; }
93 inline string&
Unit() {
return _unit; }
96 inline string&
Comment() {
return _comment; }
105 virtual int Size() = 0;
108 virtual void Clear() = 0;
111 virtual void AddRow() = 0;
114 virtual void Resize(
int Nrow) = 0;
117 virtual void DeleteRow(
int iRow) = 0;
125 virtual int ValSize(
int i) = 0;
132 virtual long LongVal(
int i,
int j=0) = 0;
139 virtual double DoubleVal(
int i,
int j=0) = 0;
146 virtual string StringVal(
int i) = 0;
153 virtual string StringVal(
int i,
int j) = 0;
165 virtual void CopyCellValue(
GloriaTableColumn* source,
int isource,
int itarget=-1) = 0;
169 virtual long* CreateSortIndex(
bool reverse=
false) = 0;
172 virtual void SortByIndex(
long* index) = 0;
195 inline vector<T>&
Data() {
return _data;}
198 inline T&
At(
int i) {
return _data.at(i); }
204 inline int Size() {
return _data.size(); }
207 inline void Clear() { _data.clear(); }
213 inline void AddRow() { _data.push_back(_emptyVal); }
216 inline void Resize(
int Nrow){_data.resize(Nrow,_emptyVal); }
219 inline void DeleteRow(
int iRow) { _data.erase(_data.begin()+iRow); }
236 long LongVal(
int i,
int j=0);
244 double DoubleVal(
int i,
int j=0);
252 string StringVal(
int i);
259 string StringVal(
int i,
int j);
271 long* CreateSortIndex(
bool reverse=
false);
274 void SortByIndex(
long* index);
TableColumnType
Enumerator for allowed column type classes.
Definition: GloriaTableColumn.h:46
namespace for data storing and exchange formats
Definition: GloriaAstrometry.h:15
Abstract class. Used for deriving classes with different column types.
Definition: GloriaTableColumn.h:80
TableColumnType GetValueType(T val)
Helper function recognizing column type.
Definition: GloriaTableColumn.cc:22
void Push_Back(T val)
Add element to the column.
Definition: GloriaTableColumn.h:210
Table column class for different content types.
Definition: GloriaTableColumn.h:185
vector< T > & Data()
Direct access to the data stored in the table.
Definition: GloriaTableColumn.h:195
void DeleteRow(int iRow)
Delete given cell.
Definition: GloriaTableColumn.h:219
T & EmptyVal()
Element used to initialize empty cells when new row is added.
Definition: GloriaTableColumn.h:201
void Resize(int Nrow)
Resize column to given number of rows.
Definition: GloriaTableColumn.h:216
string & Name()
Column name. Used to address columns in the table.
Definition: GloriaTableColumn.h:90
string & Comment()
Column comment, can be used to store additional information.
Definition: GloriaTableColumn.h:96
void Clear()
Clear column (clear vector of column elements)
Definition: GloriaTableColumn.h:207
void AddRow()
Add empty cell at the end of the column.
Definition: GloriaTableColumn.h:213
int Size()
Column size (size of vector storing column elements)
Definition: GloriaTableColumn.h:204
TableColumnType & Type()
Column type defining type of elements stored.
Definition: GloriaTableColumn.h:99
string & Unit()
Units for values stored in this column.
Definition: GloriaTableColumn.h:93
T & At(int i)
Direct access to single cell.
Definition: GloriaTableColumn.h:198