53#ifndef HEADER_INCLUDED__SAGA_API__table_H
54#define HEADER_INCLUDED__SAGA_API__table_H
118#define SG_TABLE_REC_FLAG_Modified 0x01
119#define SG_TABLE_REC_FLAG_Selected 0x02
138 virtual bool is_Valid (
void)
const {
return(
true ); }
140 bool Set_Value (
int Field,
const CSG_String &Value);
149 bool Set_Value (
int Field,
const CSG_Bytes &Value);
154 bool Set_Value (
int Field,
double Value);
155 bool Set_Value (
const CSG_String &Field,
double Value);
159 bool Set_Value (
int Field,
sLong Value);
184 bool Add_Value (
int Field,
double Value);
185 bool Add_Value (
const CSG_String &Field,
double Value);
189 bool Mul_Value (
int Field,
double Value);
190 bool Mul_Value (
const CSG_String &Field,
double Value);
194 bool Set_NoData (
int Field);
199 bool is_NoData (
int Field)
const;
200 bool is_NoData (
const CSG_String &Field)
const;
204 const SG_Char * asString (
int Field,
int Decimals = -99)
const;
209 SG_Char asChar (
int Field)
const;
214 short asShort (
int Field)
const;
215 short asShort (
const CSG_String &Field)
const;
219 int asInt (
int Field)
const;
224 sLong asLong (
int Field)
const;
229 float asFloat (
int Field)
const;
230 float asFloat (
const CSG_String &Field)
const;
234 double asDouble (
int Field)
const;
235 double asDouble (
const CSG_String &Field)
const;
323 bool Assign_Values (
const CSG_Table &Table);
325 bool Assign_Values (
const SG_Char *File);
333 virtual bool Save (
const CSG_String &File,
int Format = 0);
335 virtual bool Save (
const wchar_t *File,
int Format = 0) {
return(
Save(
CSG_String(File), Format) ); }
337 bool Set_File_Encoding (
int Encoding);
341 CSG_String to_Text (
bool Selection =
false)
const;
343 bool Serialize (
CSG_File &Stream,
bool bSave);
348 bool is_Compatible (
const CSG_Table &Table,
bool bExactMatch =
false)
const;
349 bool is_Compatible (
CSG_Table *pTable,
bool bExactMatch =
false)
const;
358 virtual bool Del_Field (
int Field);
359 virtual bool Mov_Field (
int Field,
int Position);
367 int Get_Field (
const char *Name)
const;
368 int Get_Field (
const wchar_t *Name)
const;
370 bool Set_Field_Name (
int Field,
const SG_Char *Name);
373 int Find_Field (
const CSG_String &Name )
const;
376 bool Find_Field (
const CSG_String &Name,
int &Index)
const;
396 virtual bool Del_Record (
sLong Index);
397 virtual bool Del_Records (
void);
399 virtual bool Set_Count (
sLong nRecords);
413 virtual bool Find_Record (
sLong &Index,
int Field,
const CSG_String &Value,
bool bCreateIndex =
false);
415 virtual bool Find_Record (
sLong &Index,
int Field,
double Value,
bool bCreateIndex =
false);
416 virtual CSG_Table_Record * Find_Record (
int Field,
double Value,
bool bCreateIndex =
false);
419 virtual bool Set_Value (
sLong Index,
int Field,
const SG_Char *Value);
420 virtual bool Set_Value (
sLong Index,
int Field,
double Value);
422 virtual bool Get_Value (
sLong Index,
int Field,
CSG_String &Value)
const;
423 virtual bool Get_Value (
sLong Index,
int Field,
double &Value)
const;
425 virtual void Set_Modified (
bool bModified =
true);
434 virtual bool Select (
sLong Index ,
bool bInvert =
false);
435 virtual bool Select (
CSG_Table_Record *pRecord = NULL,
bool bInvert =
false);
437 virtual sLong Del_Selection (
void);
438 virtual sLong Inv_Selection (
void);
441 bool Sort (
const char *Field,
bool bAscending =
true);
442 bool Sort (
const wchar_t *Field,
bool bAscending =
true);
443 bool Sort (
const CSG_String &Field,
bool bAscending =
true);
444 bool Sort (
int Field,
bool bAscending =
true);
445 virtual bool Sort (
const CSG_Index &Index);
447 bool Set_Index (
CSG_Index &Index,
int Field ,
bool bAscending =
true)
const;
448 bool Set_Index (
CSG_Index &Index,
int Fields[],
int nFields,
bool bAscending =
true)
const;
452 bool Del_Index (
void);
453 bool Toggle_Index (
int Field);
455 int Get_Index_Field (
int i)
const {
return( i < 0 || i >= m_Index_Fields.Get_Size() ? -1 : abs(m_Index_Fields[i]) - 1 ); }
528 bool _Destroy_Selection (
void);
530 bool _Inc_Array (
void);
531 bool _Dec_Array (
void);
536 bool _Load_Text (
const CSG_String &File,
bool bHeadline,
const SG_Char Separator);
539 void _Index_Update (
void);
bool SG_Data_Type_is_Numeric(TSG_Data_Type Type)
#define SAGA_API_DLL_EXPORT
@ SG_FILE_ENCODING_UNDEFINED
bool Reset_Statistics(void)
CSG_Simple_Statistics m_Statistics
CSG_Histogram m_Histogram
void Set_Modified(bool bOn=true)
bool Set_Value(const wchar_t *Field, sLong Value)
SG_Char asChar(const wchar_t *Field) const
bool Set_Value(const char *Field, DWORD Value)
SG_Char asChar(const char *Field) const
bool Set_Value(const wchar_t *Field, int Value)
bool Set_Value(const char *Field, size_t Value)
class CSG_Table_Value ** m_Values
bool Set_Value(const char *Field, long Value)
CSG_Table_Record(class CSG_Table *pTable, sLong Index)
bool Set_Value(const CSG_String &Field, int Value)
bool is_NoData(const wchar_t *Field) const
double asDouble(const wchar_t *Field) const
bool Set_Value(const CSG_String &Field, DWORD Value)
bool _Del_Field(int del_Field)
bool is_NoData(const char *Field) const
bool is_Modified(void) const
void Set_Selected(bool bOn=true)
class CSG_Table * m_pTable
bool Add_Value(const wchar_t *Field, double Value)
sLong Get_Index(void) const
bool Set_Value(int Field, const wchar_t *Value)
sLong asLong(int Field) const
bool Set_Value(const wchar_t *Field, const CSG_Bytes &Value)
bool _Add_Field(int add_Field)
double asDouble(const char *Field) const
const SG_Char * asString(const char *Field, int Decimals=-99) const
bool Set_Value(const wchar_t *Field, const wchar_t *Value)
bool Set_Value(const char *Field, const CSG_Bytes &Value)
float asFloat(const wchar_t *Field) const
friend class CSG_PointCloud
short asShort(const char *Field) const
int asInt(int Field) const
int _Get_Field(const CSG_String &Field) const
float asFloat(const char *Field) const
const SG_Char * asString(const wchar_t *Field, int Decimals=-99) const
bool Set_Value(const wchar_t *Field, const CSG_String &Value)
bool is_Selected(void) const
bool Set_NoData(const char *Field)
bool Add_Value(const char *Field, double Value)
bool Mul_Value(const char *Field, double Value)
int asInt(const char *Field) const
bool Set_Value(int Field, size_t Value)
class CSG_Table * Get_Table(void)
int asInt(const wchar_t *Field) const
bool Set_Value(const CSG_String &Field, size_t Value)
float asFloat(int Field) const
bool Set_Value(const wchar_t *Field, size_t Value)
bool Set_Value(int Field, DWORD Value)
bool Set_Value(const char *Field, int Value)
SG_Char asChar(int Field) const
short asShort(int Field) const
bool Set_Value(const char *Field, double Value)
bool Set_Value(const CSG_String &Field, long Value)
bool Set_Value(int Field, long Value)
bool Set_Value(const char *Field, const CSG_String &Value)
bool Set_Value(const wchar_t *Field, DWORD Value)
short asShort(const wchar_t *Field) const
bool Mul_Value(const wchar_t *Field, double Value)
sLong asLong(const char *Field) const
bool Set_Value(const char *Field, sLong Value)
CSG_Table_Value * Get_Value(int Field)
bool Set_Value(int Field, int Value)
bool Set_Value(const wchar_t *Field, long Value)
static CSG_Table_Value * _Create_Value(TSG_Data_Type Type)
bool Set_Value(int Field, const char *Value)
virtual bool is_Valid(void) const
sLong asLong(const wchar_t *Field) const
bool Set_NoData(const wchar_t *Field)
bool Set_Value(const wchar_t *Field, double Value)
bool Set_Value(const char *Field, const char *Value)
const SG_Char * Get_Field_Name(int Field) const
virtual const CSG_Rect & Get_Extent(void)
int Find_Field(const wchar_t *Name) const
virtual bool _Stats_Update(int Field) const
virtual bool Add_Field(const wchar_t *Name, TSG_Data_Type Type, int Position=-1)
TSG_Table_Index_Order Get_Index_Order(size_t i) const
sLong Get_Count(void) const
int Find_Field(const char *Name) const
virtual bool Destroy(void)
bool _Set_Selection(sLong Index, sLong Selected)
double Get_Minimum(int Field) const
virtual bool Save(const char *File, int Format, SG_Char Separator, int Encoding=SG_FILE_ENCODING_UNDEFINED)
int Get_File_Encoding(void) const
double Get_Mean(int Field) const
virtual bool On_NoData_Changed(void)
virtual bool is_Valid(void) const
double Get_StdDev(int Field) const
sLong Get_N(int Field) const
virtual bool _Histogram_Update(int Field, size_t nClasses) const
bool _Stats_Invalidate(void) const
CSG_Field_Info ** m_Field_Info
virtual bool Save(const wchar_t *File, int Format=0)
TSG_Table_Index_Order Get_Index_Order(int i) const
bool is_Indexed(void) const
virtual bool On_Delete(void)
virtual bool On_Update(void)
friend class CSG_Table_Record
virtual bool Save(const wchar_t *File, int Format, SG_Char Separator, int Encoding=SG_FILE_ENCODING_UNDEFINED)
int Get_Index_Field(size_t i) const
int Get_Index_Field(int i) const
bool _Save_Text(const CSG_String &File, bool bHeadline, const SG_Char Separator)
virtual TSG_Data_Object_Type Get_ObjectType(void) const
Returns the object type as defined by TSG_Data_Object_Type. Used for run time type checking.
bool Find_Field(const char *Name, int &Index) const
virtual CSG_Table_Record * _Get_New_Record(sLong Index)
bool Find_Field(const wchar_t *Name, int &Index) const
virtual bool Add_Field(const char *Name, TSG_Data_Type Type, int Position=-1)
virtual CSG_Table_Record * Get_Record(sLong Index) const
const CSG_Histogram & Get_Histogram(int Field, size_t nClasses=0) const
virtual bool Save(const char *File, int Format=0)
virtual CSG_Table_Record * Get_Selection(sLong Index=0) const
int Get_Field_Count(void) const
double Get_Range(int Field) const
bool _Save_DBase(const CSG_String &File)
bool _Add_Selection(sLong Index)
virtual bool is_Selected(sLong Index) const
virtual bool On_Reload(void)
sLong Get_Selection_Index(sLong Index=0) const
bool is_Field_Numeric(int Field) const
sLong Get_Selection_Count(void) const
double Get_Sum(int Field) const
CSG_Table_Record * Get_Record_byIndex(sLong Index) const
const CSG_Simple_Statistics & Get_Statistics(int Field) const
bool _Del_Selection(sLong Index)
TSG_Data_Type Get_Field_Type(int Field) const
double Get_Variance(int Field) const
sLong Get_Index(sLong Index) const
virtual void _On_Construction(void)
double Get_Maximum(int Field) const
@ SG_DATAOBJECT_TYPE_Table
SAGA_API_DLL_EXPORT CSG_Table * SG_Create_Table(void)
@ TABLE_FILETYPE_Text_NoHeadLine
@ TABLE_FILETYPE_Undefined
#define SG_TABLE_REC_FLAG_Selected
#define SG_TABLE_REC_FLAG_Modified