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);
169 bool Set_Value (
int Field,
const sLong &Value);
174 bool Set_Value (
int Field,
const uLong &Value);
179 bool Set_Value (
int Field,
const double &Value);
184 bool Add_Value (
int Field,
const double &Value);
189 bool Mul_Value (
int Field,
const double &Value);
194 bool Set_NoData (
int Field);
199 bool is_NoData (
int Field)
const;
204 const SG_Char * asString (
int Field,
int Decimals = -99)
const;
229 sLong asLong (
int Field)
const;
234 uLong asULong (
int Field)
const;
244 double asDouble (
int Field)
const;
333 bool Assign_Values (
const CSG_Table &Table);
335 bool Assign_Values (
const SG_Char *File);
343 virtual bool Save (
const CSG_String &File,
int Format = 0);
345 virtual bool Save (
const wchar_t *File,
int Format = 0) {
return(
Save(
CSG_String(File), Format) ); }
347 bool Set_File_Encoding (
int Encoding);
351 CSG_String to_Text (
bool Selection =
false,
bool Header =
true,
bool QuoteStrings =
false)
const;
353 bool Serialize (
CSG_File &Stream,
bool bSave);
358 bool is_Compatible (
const CSG_Table &Table,
bool bExactMatch =
false)
const;
359 bool is_Compatible (
CSG_Table *pTable,
bool bExactMatch =
false)
const;
368 virtual bool Del_Field (
int Field);
369 virtual bool Mov_Field (
int Field,
int Position);
377 int Get_Field (
const char *Name)
const;
378 int Get_Field (
const wchar_t *Name)
const;
380 bool Set_Field_Name (
int Field,
const SG_Char *Name);
383 int Find_Field (
const CSG_String &Name )
const;
386 bool Find_Field (
const CSG_String &Name,
int &Index)
const;
406 virtual bool Del_Record (
sLong Index);
407 virtual bool Del_Records (
void);
409 virtual bool Set_Count (
sLong nRecords);
423 virtual bool Find_Record (
sLong &Index,
int Field,
const CSG_String &Value,
bool bCreateIndex =
false);
425 virtual bool Find_Record (
sLong &Index,
int Field,
double Value,
bool bCreateIndex =
false);
426 virtual CSG_Table_Record * Find_Record (
int Field,
double Value,
bool bCreateIndex =
false);
430 virtual bool Set_Value (
sLong Index,
int Field,
const int &Value) {
return( Index >= 0 && Index < m_nRecords && Field >= 0 && Field <
m_nFields ? m_Records[Index]->
Set_Value(Field, Value) :
false ); }
431 virtual bool Set_Value (
sLong Index,
int Field,
const long &Value) {
return( Index >= 0 && Index < m_nRecords && Field >= 0 && Field <
m_nFields ? m_Records[Index]->
Set_Value(Field, Value) :
false ); }
432 virtual bool Set_Value (
sLong Index,
int Field,
const DWORD &Value) {
return( Index >= 0 && Index < m_nRecords && Field >= 0 && Field <
m_nFields ? m_Records[Index]->
Set_Value(Field, Value) :
false ); }
433 virtual bool Set_Value (
sLong Index,
int Field,
const sLong &Value) {
return( Index >= 0 && Index < m_nRecords && Field >= 0 && Field <
m_nFields ? m_Records[Index]->
Set_Value(Field, Value) :
false ); }
434 virtual bool Set_Value (
sLong Index,
int Field,
const uLong &Value) {
return( Index >= 0 && Index < m_nRecords && Field >= 0 && Field <
m_nFields ? m_Records[Index]->
Set_Value(Field, Value) :
false ); }
435 virtual bool Set_Value (
sLong Index,
int Field,
const double &Value) {
return( Index >= 0 && Index < m_nRecords && Field >= 0 && Field <
m_nFields ? m_Records[Index]->
Set_Value(Field, Value) :
false ); }
437 virtual bool Get_Value (
sLong Index,
int Field,
CSG_String &Value)
const;
438 virtual bool Get_Value (
sLong Index,
int Field,
sLong &Value)
const;
439 virtual bool Get_Value (
sLong Index,
int Field,
double &Value)
const;
441 virtual void Set_Modified (
bool bModified =
true);
450 virtual bool Select (
sLong Index ,
bool bInvert =
false);
451 virtual bool Select (
CSG_Table_Record *pRecord = NULL,
bool bInvert =
false);
453 virtual sLong Del_Selection (
void);
454 virtual sLong Inv_Selection (
void);
457 bool Sort (
const char *Field,
bool bAscending =
true);
458 bool Sort (
const wchar_t *Field,
bool bAscending =
true);
459 bool Sort (
const CSG_String &Field,
bool bAscending =
true);
460 bool Sort (
int Field,
bool bAscending =
true);
461 virtual bool Sort (
const CSG_Index &Index);
463 bool Set_Index (
CSG_Index &Index,
int Field ,
bool bAscending =
true)
const;
464 bool Set_Index (
CSG_Index &Index,
int Fields[],
int nFields,
bool bAscending =
true)
const;
468 bool Del_Index (
void);
469 bool Toggle_Index (
int Field);
471 int Get_Index_Field (
int i)
const {
return( i < 0 || i >= m_Index_Fields.Get_Size() ? -1 : abs(m_Index_Fields[i]) - 1 ); }
544 bool _Destroy_Selection (
void);
546 bool _Inc_Array (
void);
547 bool _Dec_Array (
void);
552 bool _Load_Text (
const CSG_String &File,
bool bHeadline,
const SG_Char Separator);
555 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)
sLong asLong(const CSG_String &Field) const
int asInt(const CSG_String &Field) const
SG_Char asChar(const wchar_t *Field) const
SG_Char asChar(const char *Field) const
const SG_Char * asString(const CSG_String &Field, int Decimals=-99) const
bool Add_Value(const CSG_String &Field, const double &Value)
bool Set_Value(int Field, const CSG_String &Value)
bool Set_Value(const CSG_String &Field, const int &Value)
class CSG_Table_Value ** m_Values
CSG_Table_Record(class CSG_Table *pTable, sLong Index)
bool Add_Value(const wchar_t *Field, const double &Value)
DWORD asDWord(const CSG_String &Field) const
bool Set_Value(const char *Field, const uLong &Value)
double asDouble(const CSG_String &Field) const
bool Add_Value(const char *Field, const double &Value)
SG_Char asChar(const CSG_String &Field) const
bool Set_Value(const char *Field, const double &Value)
bool is_NoData(const wchar_t *Field) const
double asDouble(const wchar_t *Field) const
bool _Del_Field(int del_Field)
bool is_NoData(const char *Field) const
bool is_Modified(void) const
DWORD asDWord(const char *Field) const
void Set_Selected(bool bOn=true)
class CSG_Table * m_pTable
bool Set_Value(const CSG_String &Field, const uLong &Value)
sLong Get_Index(void) const
bool Set_Value(int Field, const wchar_t *Value)
sLong asLong(int Field) const
bool Set_Value(const char *Field, const sLong &Value)
bool Set_Value(const wchar_t *Field, const CSG_Bytes &Value)
bool Set_Value(const CSG_String &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 Mul_Value(const wchar_t *Field, const double &Value)
bool Set_Value(const char *Field, const CSG_Bytes &Value)
bool is_NoData(const CSG_String &Field) const
uLong asULong(int Field) const
bool Mul_Value(const CSG_String &Field, const double &Value)
bool Set_Value(const char *Field, const long &Value)
float asFloat(const wchar_t *Field) const
friend class CSG_PointCloud
double asDouble(int Field) const
bool Set_Value(const CSG_String &Field, const double &Value)
short asShort(const char *Field) const
int asInt(int Field) const
int _Get_Field(const CSG_String &Field) const
bool Set_NoData(const CSG_String &Field)
bool Set_Value(const wchar_t *Field, const long &Value)
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_Value(int Field, const int &Value)
bool Set_Value(const wchar_t *Field, const sLong &Value)
bool Set_NoData(const char *Field)
uLong asULong(const wchar_t *Field) const
bool Set_Value(const CSG_String &Field, const CSG_String &Value)
int asInt(const char *Field) const
float asFloat(const CSG_String &Field) const
bool Set_Value(const CSG_String &Field, const long &Value)
class CSG_Table * Get_Table(void)
int asInt(const wchar_t *Field) const
DWORD asDWord(const wchar_t *Field) const
bool Set_Value(const wchar_t *Field, const uLong &Value)
bool Set_Value(const CSG_String &Field, const sLong &Value)
float asFloat(int Field) const
bool Set_Value(const CSG_String &Field, const DWORD &Value)
bool Set_Value(const char *Field, const int &Value)
bool Set_Value(const wchar_t *Field, const int &Value)
SG_Char asChar(int Field) const
short asShort(int Field) const
short asShort(const CSG_String &Field) const
bool Set_Value(int Field, const long &Value)
bool Set_Value(const wchar_t *Field, const DWORD &Value)
bool Set_Value(const char *Field, const DWORD &Value)
bool Set_Value(const char *Field, const CSG_String &Value)
short asShort(const wchar_t *Field) const
bool Set_Value(int Field, const DWORD &Value)
sLong asLong(const char *Field) const
uLong asULong(const char *Field) const
CSG_Table_Value * Get_Value(int Field)
bool Set_Value(const wchar_t *Field, const double &Value)
bool Mul_Value(const char *Field, const double &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
uLong asULong(const CSG_String &Field) const
sLong asLong(const wchar_t *Field) const
bool Set_NoData(const wchar_t *Field)
DWORD asDWord(int Field) const
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)
virtual bool Set_Value(sLong Index, int Field, const SG_Char *Value)
virtual bool Set_Value(sLong Index, int Field, const DWORD &Value)
virtual bool Save(const char *File, int Format, SG_Char Separator, int Encoding=SG_FILE_ENCODING_UNDEFINED, bool bMetaData=true)
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)
virtual bool Set_Value(sLong Index, int Field, const double &Value)
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
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
virtual bool Set_Value(sLong Index, int Field, const uLong &Value)
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
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.
virtual bool Set_Value(sLong Index, int Field, const int &Value)
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
virtual bool Set_Value(sLong Index, int Field, const sLong &Value)
bool _Save_DBase(const CSG_String &File)
bool _Add_Selection(sLong Index)
virtual bool Save(const wchar_t *File, int Format, SG_Char Separator, int Encoding=SG_FILE_ENCODING_UNDEFINED, bool bMetaData=true)
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
virtual bool Set_Value(sLong Index, int Field, const long &Value)
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