SAGA API  v9.6
table.h
Go to the documentation of this file.
1 
3 // //
4 // SAGA //
5 // //
6 // System for Automated Geoscientific Analyses //
7 // //
8 // Application Programming Interface //
9 // //
10 // Library: SAGA_API //
11 // //
12 //-------------------------------------------------------//
13 // //
14 // table.h //
15 // //
16 // Copyright (C) 2005 by Olaf Conrad //
17 // //
18 //-------------------------------------------------------//
19 // //
20 // This file is part of 'SAGA - System for Automated //
21 // Geoscientific Analyses'. //
22 // //
23 // This library is free software; you can redistribute //
24 // it and/or modify it under the terms of the GNU Lesser //
25 // General Public License as published by the Free //
26 // Software Foundation, either version 2.1 of the //
27 // License, or (at your option) any later version. //
28 // //
29 // This library is distributed in the hope that it will //
30 // be useful, but WITHOUT ANY WARRANTY; without even the //
31 // implied warranty of MERCHANTABILITY or FITNESS FOR A //
32 // PARTICULAR PURPOSE. See the GNU Lesser General Public //
33 // License for more details. //
34 // //
35 // You should have received a copy of the GNU Lesser //
36 // General Public License along with this program; if //
37 // not, see <http://www.gnu.org/licenses/>. //
38 // //
39 //-------------------------------------------------------//
40 // //
41 // contact: Olaf Conrad //
42 // Institute of Geography //
43 // University of Goettingen //
44 // Goldschmidtstr. 5 //
45 // 37077 Goettingen //
46 // Germany //
47 // //
48 // e-mail: oconrad@saga-gis.org //
49 // //
51 
52 //---------------------------------------------------------
53 #ifndef HEADER_INCLUDED__SAGA_API__table_H
54 #define HEADER_INCLUDED__SAGA_API__table_H
55 
56 
58 // //
59 // //
60 // //
62 
63 //---------------------------------------------------------
74 // //
76 // //
77 // //
79 
80 //---------------------------------------------------------
81 #include "dataobject.h"
82 #include "table_value.h"
83 
84 
86 // //
87 // //
88 // //
90 
91 //---------------------------------------------------------
92 typedef enum
93 {
98 }
100 
101 //---------------------------------------------------------
102 typedef enum
103 {
107 }
109 
110 
112 // //
113 // //
114 // //
116 
117 //---------------------------------------------------------
118 #define SG_TABLE_REC_FLAG_Modified 0x01
119 #define SG_TABLE_REC_FLAG_Selected 0x02
120 
121 
123 // //
124 // //
125 // //
127 
128 //---------------------------------------------------------
130 {
131  friend class CSG_Table; friend class CSG_PointCloud;
132 
133 public:
134 
135  class CSG_Table * Get_Table (void) { return( m_pTable ); }
136  sLong Get_Index (void) const { return( m_Index ); }
137 
138  bool Set_Value (int Field, const CSG_String &Value);
139  bool Set_Value (int Field, const char *Value) { return( Set_Value( Field , CSG_String(Value)) ); }
140  bool Set_Value (int Field, const wchar_t *Value) { return( Set_Value( Field , CSG_String(Value)) ); }
141  bool Set_Value (const CSG_String &Field, const CSG_String &Value);
142  bool Set_Value (const char *Field, const CSG_String &Value) { return( Set_Value(CSG_String(Field), Value ) ); }
143  bool Set_Value (const wchar_t *Field, const CSG_String &Value) { return( Set_Value(CSG_String(Field), Value ) ); }
144  bool Set_Value (const char *Field, const char *Value) { return( Set_Value(CSG_String(Field), CSG_String(Value)) ); }
145  bool Set_Value (const wchar_t *Field, const wchar_t *Value) { return( Set_Value(CSG_String(Field), CSG_String(Value)) ); }
146 
147  bool Set_Value (int Field, const CSG_Bytes &Value);
148  bool Set_Value (const CSG_String &Field, const CSG_Bytes &Value);
149  bool Set_Value (const char *Field, const CSG_Bytes &Value) { return( Set_Value(CSG_String(Field), Value) ); }
150  bool Set_Value (const wchar_t *Field, const CSG_Bytes &Value) { return( Set_Value(CSG_String(Field), Value) ); }
151 
152  bool Set_Value (int Field, double Value);
153  bool Set_Value (const CSG_String &Field, double Value);
154  bool Set_Value (const char *Field, double Value) { return( Set_Value(CSG_String(Field), Value) ); }
155  bool Set_Value (const wchar_t *Field, double Value) { return( Set_Value(CSG_String(Field), Value) ); }
156 
157  bool Set_Value (int Field, sLong Value);
158  bool Set_Value (const CSG_String &Field, sLong Value);
159  bool Set_Value (const char *Field, sLong Value) { return( Set_Value(CSG_String(Field), Value) ); }
160  bool Set_Value (const wchar_t *Field, sLong Value) { return( Set_Value(CSG_String(Field), Value) ); }
161 
162  bool Set_Value (int Field, size_t Value) { return( Set_Value(Field, (double)Value) ); }
163  bool Set_Value (const CSG_String &Field, size_t Value) { return( Set_Value(Field, (double)Value) ); }
164  bool Set_Value (const char *Field, size_t Value) { return( Set_Value(Field, (double)Value) ); }
165  bool Set_Value (const wchar_t *Field, size_t Value) { return( Set_Value(Field, (double)Value) ); }
166 
167  bool Set_Value (int Field, DWORD Value) { return( Set_Value(Field, (double)Value) ); }
168  bool Set_Value (const CSG_String &Field, DWORD Value) { return( Set_Value(Field, (double)Value) ); }
169  bool Set_Value (const char *Field, DWORD Value) { return( Set_Value(Field, (double)Value) ); }
170  bool Set_Value (const wchar_t *Field, DWORD Value) { return( Set_Value(Field, (double)Value) ); }
171 
172  bool Set_Value (int Field, long Value) { return( Set_Value(Field, (double)Value) ); }
173  bool Set_Value (const CSG_String &Field, long Value) { return( Set_Value(Field, (double)Value) ); }
174  bool Set_Value (const char *Field, long Value) { return( Set_Value(Field, (double)Value) ); }
175  bool Set_Value (const wchar_t *Field, long Value) { return( Set_Value(Field, (double)Value) ); }
176 
177  bool Set_Value (int Field, int Value) { return( Set_Value(Field, (double)Value) ); }
178  bool Set_Value (const CSG_String &Field, int Value) { return( Set_Value(Field, (double)Value) ); }
179  bool Set_Value (const char *Field, int Value) { return( Set_Value(Field, (double)Value) ); }
180  bool Set_Value (const wchar_t *Field, int Value) { return( Set_Value(Field, (double)Value) ); }
181 
182  bool Add_Value (int Field, double Value);
183  bool Add_Value (const CSG_String &Field, double Value);
184  bool Add_Value (const char *Field, double Value) { return( Add_Value(CSG_String(Field), Value) ); }
185  bool Add_Value (const wchar_t *Field, double Value) { return( Add_Value(CSG_String(Field), Value) ); }
186 
187  bool Mul_Value (int Field, double Value);
188  bool Mul_Value (const CSG_String &Field, double Value);
189  bool Mul_Value (const char *Field, double Value) { return( Mul_Value(CSG_String(Field), Value) ); }
190  bool Mul_Value (const wchar_t *Field, double Value) { return( Mul_Value(CSG_String(Field), Value) ); }
191 
192  bool Set_NoData (int Field);
193  bool Set_NoData (const CSG_String &Field);
194  bool Set_NoData (const char *Field) { return( Set_NoData(CSG_String(Field)) ); }
195  bool Set_NoData (const wchar_t *Field) { return( Set_NoData(CSG_String(Field)) ); }
196 
197  bool is_NoData (int Field) const;
198  bool is_NoData (const CSG_String &Field) const;
199  bool is_NoData (const char *Field) const { return( is_NoData(CSG_String(Field)) ); }
200  bool is_NoData (const wchar_t *Field) const { return( is_NoData(CSG_String(Field)) ); }
201 
202  const SG_Char * asString (int Field, int Decimals = -99) const;
203  const SG_Char * asString (const CSG_String &Field, int Decimals = -99) const;
204  const SG_Char * asString (const char *Field, int Decimals = -99) const { return( asString(CSG_String(Field), Decimals) ); }
205  const SG_Char * asString (const wchar_t *Field, int Decimals = -99) const { return( asString(CSG_String(Field), Decimals) ); }
206 
207  SG_Char asChar (int Field) const;
208  SG_Char asChar (const CSG_String &Field) const;
209  SG_Char asChar (const char *Field) const { return( asChar (CSG_String(Field)) ); }
210  SG_Char asChar (const wchar_t *Field) const { return( asChar (CSG_String(Field)) ); }
211 
212  short asShort (int Field) const;
213  short asShort (const CSG_String &Field) const;
214  short asShort (const char *Field) const { return( asShort (CSG_String(Field)) ); }
215  short asShort (const wchar_t *Field) const { return( asShort (CSG_String(Field)) ); }
216 
217  int asInt (int Field) const;
218  int asInt (const CSG_String &Field) const;
219  int asInt (const char *Field) const { return( asInt (CSG_String(Field)) ); }
220  int asInt (const wchar_t *Field) const { return( asInt (CSG_String(Field)) ); }
221 
222  sLong asLong (int Field) const;
223  sLong asLong (const CSG_String &Field) const;
224  sLong asLong (const char *Field) const { return( asLong (CSG_String(Field)) ); }
225  sLong asLong (const wchar_t *Field) const { return( asLong (CSG_String(Field)) ); }
226 
227  float asFloat (int iField) const;
228  float asFloat (const CSG_String &Field) const;
229  float asFloat (const char *Field) const { return( asFloat (CSG_String(Field)) ); }
230  float asFloat (const wchar_t *Field) const { return( asFloat (CSG_String(Field)) ); }
231 
232  double asDouble (int Field) const;
233  double asDouble (const CSG_String &Field) const;
234  double asDouble (const char *Field) const { return( asDouble(CSG_String(Field)) ); }
235  double asDouble (const wchar_t *Field) const { return( asDouble(CSG_String(Field)) ); }
236 
237  CSG_Table_Value * Get_Value (int Field) { return( m_Values[Field] ); }
238  CSG_Table_Value & operator [] (int Field) const { return( *m_Values[Field] ); }
239 
240  virtual bool Assign (CSG_Table_Record *pRecord);
241 
242  bool is_Selected (void) const { return( (m_Flags & SG_TABLE_REC_FLAG_Selected) != 0 ); }
243  bool is_Modified (void) const { return( (m_Flags & SG_TABLE_REC_FLAG_Modified) != 0 ); }
244 
245 
246 protected:
247 
248  CSG_Table_Record(class CSG_Table *pTable, sLong Index);
249  virtual ~CSG_Table_Record(void);
250 
251 
252  char m_Flags;
253 
255 
257 
259 
260 
261  void Set_Selected (bool bOn = true);
262  void Set_Modified (bool bOn = true);
263 
264 
265  static CSG_Table_Value * _Create_Value (TSG_Data_Type Type);
266 
267  bool _Add_Field (int add_Field);
268  bool _Del_Field (int del_Field);
269 
270  int _Get_Field (const CSG_String &Field) const;
271 
272 };
273 
274 
276 // //
277 // //
278 // //
280 
281 //---------------------------------------------------------
283 {
284  friend class CSG_Table_Record;
285  friend class CSG_TIN;
286 
287 public:
288 
289  CSG_Table (void);
290  bool Create (void);
291 
292  CSG_Table (const CSG_Table &Table);
293  bool Create (const CSG_Table &Table);
294 
295  CSG_Table (const CSG_Table *pTemplate);
296  bool Create (const CSG_Table *pTemplate);
297 
299  bool Create (const CSG_String &File, TSG_Table_File_Type Format = TABLE_FILETYPE_Undefined, int Encoding = SG_FILE_ENCODING_UNDEFINED);
300  CSG_Table (const char *File, TSG_Table_File_Type Format = TABLE_FILETYPE_Undefined, int Encoding = SG_FILE_ENCODING_UNDEFINED);
301  bool Create (const char *File, TSG_Table_File_Type Format = TABLE_FILETYPE_Undefined, int Encoding = SG_FILE_ENCODING_UNDEFINED);
302  CSG_Table (const wchar_t *File, TSG_Table_File_Type Format = TABLE_FILETYPE_Undefined, int Encoding = SG_FILE_ENCODING_UNDEFINED);
303  bool Create (const wchar_t *File, TSG_Table_File_Type Format = TABLE_FILETYPE_Undefined, int Encoding = SG_FILE_ENCODING_UNDEFINED);
304 
305  CSG_Table (const CSG_String &File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
306  bool Create (const CSG_String &File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
307  CSG_Table (const char *File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
308  bool Create (const char *File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
309  CSG_Table (const wchar_t *File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
310  bool Create (const wchar_t *File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
311 
312  virtual ~CSG_Table(void);
313 
314  virtual bool Destroy (void);
315 
317 
318  CSG_Table & operator = (const CSG_Table &Table);
319  virtual bool Assign (CSG_Data_Object *pTable);
320 
321  bool Assign_Values (const CSG_Table &Table);
322  bool Assign_Values ( CSG_Table *pTable);
323  bool Assign_Values (const SG_Char *File);
324 
325  bool Load (const CSG_String &File, int Format, SG_Char Separator, int Encoding = SG_FILE_ENCODING_UNDEFINED);
326 
327  virtual bool Save (const CSG_String &File, int Format, SG_Char Separator, int Encoding = SG_FILE_ENCODING_UNDEFINED);
328  virtual bool Save (const char *File, int Format, SG_Char Separator, int Encoding = SG_FILE_ENCODING_UNDEFINED) { return( Save(CSG_String(File), Format, Separator, Encoding) ); }
329  virtual bool Save (const wchar_t *File, int Format, SG_Char Separator, int Encoding = SG_FILE_ENCODING_UNDEFINED) { return( Save(CSG_String(File), Format, Separator, Encoding) ); }
330 
331  virtual bool Save (const CSG_String &File, int Format = 0);
332  virtual bool Save (const char *File, int Format = 0) { return( Save(CSG_String(File), Format) ); }
333  virtual bool Save (const wchar_t *File, int Format = 0) { return( Save(CSG_String(File), Format) ); }
334 
335  bool Set_File_Encoding (int Encoding);
336  int Get_File_Encoding (void) const { return( m_Encoding ); }
337 
338  bool Serialize (CSG_File &Stream, bool bSave);
339 
340  //-----------------------------------------------------
341  virtual bool is_Valid (void) const { return( m_nFields > 0 ); }
342 
343  bool is_Compatible (const CSG_Table &Table, bool bExactMatch = false) const;
344  bool is_Compatible ( CSG_Table *pTable, bool bExactMatch = false) const;
345 
346  //-----------------------------------------------------
347  virtual const CSG_Rect & Get_Extent (void) { return( m_Extent ); }
348 
349  //-----------------------------------------------------
350  virtual bool Add_Field (const CSG_String &Name, TSG_Data_Type Type, int Position = -1);
351  virtual bool Add_Field (const char *Name, TSG_Data_Type Type, int Position = -1) { return( Add_Field(CSG_String(Name), Type, Position) ); }
352  virtual bool Add_Field (const wchar_t *Name, TSG_Data_Type Type, int Position = -1) { return( Add_Field(CSG_String(Name), Type, Position) ); }
353  virtual bool Del_Field (int iField);
354  virtual bool Mov_Field (int iField, int Position);
355 
356  int Get_Field_Count (void) const { return( m_nFields ); }
357  const SG_Char * Get_Field_Name (int iField) const { return( iField >= 0 && iField < m_nFields ? m_Field_Name[iField]->c_str() : NULL ); }
358  TSG_Data_Type Get_Field_Type (int iField) const { return( iField >= 0 && iField < m_nFields ? m_Field_Type[iField] : SG_DATATYPE_Undefined ); }
359  int Get_Field_Length (int iField, int Encoding = SG_FILE_ENCODING_UNDEFINED) const; // returns the maximum number of characters for data type string and zero for all other data types.
360  int Get_Field (const CSG_String &Name) const; // returns the zero based position of the field named 'Name' or '-1' if there is no field with such name.
361  int Get_Field (const char *Name) const; // returns the zero based position of the field named 'Name' or '-1' if there is no field with such name.
362  int Get_Field (const wchar_t *Name) const; // returns the zero based position of the field named 'Name' or '-1' if there is no field with such name.
363 
364  bool Set_Field_Name (int iField, const SG_Char *Name);
365  virtual bool Set_Field_Type (int iField, TSG_Data_Type Type);
366 
367  int Find_Field (const CSG_String &Name ) const;
368  int Find_Field (const char *Name ) const { return( Find_Field(CSG_String(Name)) ); }
369  int Find_Field (const wchar_t *Name ) const { return( Find_Field(CSG_String(Name)) ); }
370  bool Find_Field (const CSG_String &Name, int &Index) const;
371  bool Find_Field (const char *Name, int &Index) const { return( Find_Field(CSG_String(Name)) ); }
372  bool Find_Field (const wchar_t *Name, int &Index) const { return( Find_Field(CSG_String(Name)) ); }
373 
374  sLong Get_N (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Count () : 0 ); }
375  double Get_Minimum (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Minimum () : 0. ); }
376  double Get_Maximum (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Maximum () : 0. ); }
377  double Get_Range (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Range () : 0. ); }
378  double Get_Sum (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Sum () : 0. ); }
379  double Get_Mean (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Mean () : 0. ); }
380  double Get_StdDev (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_StdDev () : 0. ); }
381  double Get_Variance (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Variance() : 0. ); }
382  const CSG_Simple_Statistics & Get_Statistics (int iField) const { _Stats_Update(iField); return( *m_Field_Stats[iField] ); }
383 
384  //-----------------------------------------------------
385  virtual CSG_Table_Record * Add_Record ( CSG_Table_Record *pCopy = NULL);
386  virtual CSG_Table_Record * Ins_Record (sLong Index, CSG_Table_Record *pCopy = NULL);
387  virtual bool Set_Record (sLong Index, CSG_Table_Record *pCopy );
388  virtual bool Del_Record (sLong Index);
389  virtual bool Del_Records (void);
390 
391  virtual bool Set_Count (sLong nRecords);
392  sLong Get_Count (void) const { return( m_nRecords ); }
393 
394  virtual CSG_Table_Record * Get_Record (sLong Index) const { return( Index >= 0 && Index < m_nRecords ? m_Records[Index] : NULL ); }
395  virtual CSG_Table_Record & operator [] (sLong Index) const { return( *Get_Record_byIndex(Index) ); }
396 
397  sLong Get_Index (sLong Index) const { return( Index >= 0 && Index < m_nRecords ? (is_Indexed() ? m_Index[Index] : Index) : -1 ); }
398 
400  {
401  return( Index >= 0 && Index < m_nRecords ? Get_Record(is_Indexed() ? m_Index[Index] : Index) : NULL );
402  }
403 
404  //-----------------------------------------------------
405  virtual bool Find_Record (sLong &Index, int iField, const CSG_String &Value, bool bCreateIndex = false);
406  virtual CSG_Table_Record * Find_Record ( int iField, const CSG_String &Value, bool bCreateIndex = false);
407  virtual bool Find_Record (sLong &Index, int iField, double Value, bool bCreateIndex = false);
408  virtual CSG_Table_Record * Find_Record ( int iField, double Value, bool bCreateIndex = false);
409 
410  //-----------------------------------------------------
411  virtual bool Set_Value (sLong Index, int iField, const SG_Char *Value);
412  virtual bool Set_Value (sLong Index, int iField, double Value);
413 
414  virtual bool Get_Value (sLong Index, int iField, CSG_String &Value) const;
415  virtual bool Get_Value (sLong Index, int iField, double &Value) const;
416 
417  virtual void Set_Modified (bool bModified = true);
418 
419  //-----------------------------------------------------
420  sLong Get_Selection_Count (void) const { return( m_Selection.Get_Size() ); }
421  sLong Get_Selection_Index (sLong Index = 0) const { return( Index >= 0 && Index < m_Selection.Get_Size() ? *((sLong *)m_Selection.Get_Entry(Index)) : Get_Count() ); }
422  virtual CSG_Table_Record * Get_Selection (sLong Index = 0) const { return( Index >= 0 && Index < m_Selection.Get_Size() ? Get_Record(Get_Selection_Index(Index)) : NULL ); }
423 
424  virtual bool is_Selected (sLong Index) const { return( Index >= 0 && Index < m_nRecords ? m_Records[Index]->is_Selected() : false ); }
425 
426  virtual bool Select (sLong Index , bool bInvert = false);
427  virtual bool Select (CSG_Table_Record *pRecord = NULL, bool bInvert = false);
428 
429  virtual sLong Del_Selection (void);
430  virtual sLong Inv_Selection (void);
431 
432  //-----------------------------------------------------
433  bool Set_Index (CSG_Index &Index, int Field , bool bAscending = true) const;
434  bool Set_Index (CSG_Index &Index, int Fields[], int nFields, bool bAscending = true) const;
435  bool Set_Index (CSG_Index &Index, const CSG_Array_Int &Fields, bool bAscending = true) const;
436 
437  bool is_Indexed (void) const { return( m_nRecords > 0 && m_Index.Get_Count() == m_nRecords ); }
438  bool Set_Index (int Field_1, TSG_Table_Index_Order Order_1 = TABLE_INDEX_Ascending, int Field_2 = -1, TSG_Table_Index_Order Order_2 = TABLE_INDEX_None, int Field_3 = -1, TSG_Table_Index_Order Order_3 = TABLE_INDEX_None);
439  bool Del_Index (void);
440  bool Toggle_Index (int iField);
441  int Get_Index_Field (int i) const { return( i < 0 || i >= m_Index_Fields.Get_Size() ? -1 : abs(m_Index_Fields[i]) - 1 ); }
442  TSG_Table_Index_Order Get_Index_Order (int i) const { return( i < 0 || i >= m_Index_Fields.Get_Size() ? TABLE_INDEX_None : m_Index_Fields[i] > 0 ? TABLE_INDEX_Ascending : TABLE_INDEX_Descending ); }
443  int Get_Index_Field (size_t i) const { return( Get_Index_Field((int)i) ); }
444  TSG_Table_Index_Order Get_Index_Order (size_t i) const { return( Get_Index_Order((int)i) ); }
445 
446 
447 protected:
448 
450 
452 
454 
456 
458 
460 
462 
463 
464  virtual void _On_Construction (void);
465 
466  virtual CSG_Table_Record * _Get_New_Record (sLong Index);
467 
468  bool _Add_Selection (sLong Index);
469  bool _Set_Selection (sLong Index, sLong Selected);
470  bool _Del_Selection (sLong Index);
471 
472  bool _Stats_Invalidate (void) const;
473  bool _Stats_Invalidate (int iField) const;
474  virtual bool _Stats_Update (int iField) const;
475 
476  bool _Save_Text (const CSG_String &File, bool bHeadline, const SG_Char Separator);
477  bool _Save_DBase (const CSG_String &File);
478 
479  virtual bool On_NoData_Changed (void);
480  virtual bool On_Update (void);
481 
482  virtual bool On_Reload (void);
483  virtual bool On_Delete (void);
484 
485 
486 private:
487 
488  CSG_Index m_Index;
489 
490  CSG_Array_Int m_Index_Fields;
491 
492  CSG_Table_Record **m_Records;
493 
494 
495  bool _Destroy_Selection (void);
496 
497  bool _Inc_Array (void);
498  bool _Dec_Array (void);
499 
500  size_t _Load_Text_Trim ( CSG_String &Text, const SG_Char Separator);
501  size_t _Load_Text_EndQuote (const CSG_String &Text, const SG_Char Separator);
502 
503  bool _Load_Text (const CSG_String &File, bool bHeadline, const SG_Char Separator);
504  bool _Load_DBase (const CSG_String &File);
505 
506  void _Index_Update (void);
507 
508 };
509 
510 
512 // //
513 // //
514 // //
516 
517 //---------------------------------------------------------
520 
523 
526 
533 
535 SAGA_API_DLL_EXPORT CSG_Table * SG_Create_Table (const char *File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
537 SAGA_API_DLL_EXPORT CSG_Table * SG_Create_Table (const wchar_t *File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
539 SAGA_API_DLL_EXPORT CSG_Table * SG_Create_Table (const CSG_String &File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
540 
541 
543 // //
544 // //
545 // //
547 
548 //---------------------------------------------------------
549 #endif // #ifndef HEADER_INCLUDED__SAGA_API__table_H
CSG_Index
Definition: mat_tools.h:200
CSG_Table_Record::Set_Value
bool Set_Value(const char *Field, size_t Value)
Definition: table.h:164
CSG_Table::CSG_Table_Record
friend class CSG_Table_Record
Definition: table.h:284
CSG_Rect
Definition: geo_tools.h:471
CSG_Table::Find_Record
virtual bool Find_Record(sLong &Index, int iField, const CSG_String &Value, bool bCreateIndex=false)
Definition: table.cpp:946
CSG_Data_Object::Assign
virtual bool Assign(CSG_Data_Object *pObject)
Definition: dataobject.cpp:793
CSG_Table::Assign
virtual bool Assign(CSG_Data_Object *pTable)
Definition: table.cpp:377
CSG_Table_Record::Set_Value
bool Set_Value(int Field, long Value)
Definition: table.h:172
SG_DATATYPE_Undefined
@ SG_DATATYPE_Undefined
Definition: api_core.h:1009
CSG_Table::is_Valid
virtual bool is_Valid(void) const
Definition: table.h:341
table_value.h
CSG_Table::Set_Count
virtual bool Set_Count(sLong nRecords)
Definition: table.cpp:926
CSG_Table::Save
virtual bool Save(const wchar_t *File, int Format=0)
Definition: table.h:333
CSG_Table::Del_Records
virtual bool Del_Records(void)
Definition: table.cpp:908
CSG_Table::Get_Index
sLong Get_Index(sLong Index) const
Definition: table.h:397
CSG_Array::Get_Size
sLong Get_Size(void) const
Definition: api_core.h:327
CSG_Data_Object::On_Reload
virtual bool On_Reload(void)=0
CSG_Table_Record::Set_Value
bool Set_Value(const char *Field, int Value)
Definition: table.h:179
CSG_Data_Object::On_Delete
virtual bool On_Delete(void)=0
TABLE_INDEX_None
@ TABLE_INDEX_None
Definition: table.h:104
TABLE_FILETYPE_DBase
@ TABLE_FILETYPE_DBase
Definition: table.h:97
CSG_Table_Record::Set_Value
bool Set_Value(const char *Field, const CSG_String &Value)
Definition: table.h:142
CSG_Table_Record
Definition: table.h:130
CSG_Table::_Stats_Update
virtual bool _Stats_Update(int iField) const
Definition: table.cpp:1224
CSG_Table_Record::Set_Value
bool Set_Value(const wchar_t *Field, double Value)
Definition: table.h:155
CSG_Table::Get_ObjectType
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.
Definition: table.h:316
CSG_Table::Inv_Selection
virtual sLong Inv_Selection(void)
Definition: table_selection.cpp:203
CSG_Table_Record::m_pTable
class CSG_Table * m_pTable
Definition: table.h:258
CSG_Table::Get_Value
virtual bool Get_Value(sLong Index, int iField, CSG_String &Value) const
Definition: table.cpp:1157
CSG_Table::m_Selection
CSG_Array m_Selection
Definition: table.h:459
CSG_Table_Record::Set_Value
bool Set_Value(int Field, const wchar_t *Value)
Definition: table.h:140
CSG_Table::is_Selected
virtual bool is_Selected(sLong Index) const
Definition: table.h:424
CSG_Table::Del_Field
virtual bool Del_Field(int iField)
Definition: table.cpp:520
CSG_Table::Get_Record
virtual CSG_Table_Record * Get_Record(sLong Index) const
Definition: table.h:394
CSG_Table_Record::Set_Value
bool Set_Value(const char *Field, DWORD Value)
Definition: table.h:169
SG_TABLE_REC_FLAG_Selected
#define SG_TABLE_REC_FLAG_Selected
Definition: table.h:119
CSG_Table::m_Field_Name
CSG_String ** m_Field_Name
Definition: table.h:455
CSG_Table_Record::asChar
SG_Char asChar(const char *Field) const
Definition: table.h:209
CSG_Table::Find_Field
bool Find_Field(const wchar_t *Name, int &Index) const
Definition: table.h:372
CSG_Table::operator=
CSG_Table & operator=(const CSG_Table &Table)
Definition: table.cpp:369
CSG_Table_Record::Mul_Value
bool Mul_Value(const char *Field, double Value)
Definition: table.h:189
CSG_Data_Object::Save
virtual bool Save(const CSG_String &File, int Format=0)=0
CSG_Table::Get_Selection
virtual CSG_Table_Record * Get_Selection(sLong Index=0) const
Definition: table.h:422
CSG_Table::~CSG_Table
virtual ~CSG_Table(void)
Definition: table.cpp:326
CSG_Table_Record::asLong
sLong asLong(const wchar_t *Field) const
Definition: table.h:225
CSG_Table_Record::Set_Value
bool Set_Value(const wchar_t *Field, DWORD Value)
Definition: table.h:170
CSG_Table_Record::asShort
short asShort(const char *Field) const
Definition: table.h:214
CSG_Table_Record::is_Selected
bool is_Selected(void) const
Definition: table.h:242
CSG_Table::CSG_Table
CSG_Table(void)
Definition: table.cpp:133
CSG_Table::Get_Index_Order
TSG_Table_Index_Order Get_Index_Order(int i) const
Definition: table.h:442
CSG_Table::Get_Field_Count
int Get_Field_Count(void) const
Definition: table.h:356
CSG_Table_Record::Set_Value
bool Set_Value(const wchar_t *Field, const CSG_String &Value)
Definition: table.h:143
CSG_Table_Record::asShort
short asShort(const wchar_t *Field) const
Definition: table.h:215
CSG_Table::m_Extent
CSG_Rect m_Extent
Definition: table.h:461
CSG_Table::Get_Field_Length
int Get_Field_Length(int iField, int Encoding=SG_FILE_ENCODING_UNDEFINED) const
Definition: table.cpp:659
CSG_Table_Record::m_Values
class CSG_Table_Value ** m_Values
Definition: table.h:256
CSG_Table::Set_Record
virtual bool Set_Record(sLong Index, CSG_Table_Record *pCopy)
Definition: table.cpp:858
CSG_Table_Value
Definition: table_value.h:111
CSG_Table::Find_Field
bool Find_Field(const char *Name, int &Index) const
Definition: table.h:371
TABLE_FILETYPE_Undefined
@ TABLE_FILETYPE_Undefined
Definition: table.h:94
CSG_Table_Record::Get_Table
class CSG_Table * Get_Table(void)
Definition: table.h:135
CSG_Table_Record::is_NoData
bool is_NoData(const char *Field) const
Definition: table.h:199
CSG_Table::operator[]
virtual CSG_Table_Record & operator[](sLong Index) const
Definition: table.h:395
CSG_Table_Record::m_Index
sLong m_Index
Definition: table.h:254
CSG_Table::Get_Index_Field
int Get_Index_Field(size_t i) const
Definition: table.h:443
CSG_File
Definition: api_core.h:1124
CSG_Table::Set_Modified
virtual void Set_Modified(bool bModified=true)
Definition: table.cpp:1113
CSG_Table::_Stats_Invalidate
bool _Stats_Invalidate(void) const
Definition: table.cpp:1200
CSG_Table::m_Field_Type
TSG_Data_Type * m_Field_Type
Definition: table.h:453
CSG_Table_Record::m_Flags
char m_Flags
Definition: table.h:252
CSG_Table::Save
virtual bool Save(const wchar_t *File, int Format, SG_Char Separator, int Encoding=SG_FILE_ENCODING_UNDEFINED)
Definition: table.h:329
CSG_Table::Get_Index_Order
TSG_Table_Index_Order Get_Index_Order(size_t i) const
Definition: table.h:444
CSG_Table::Get_StdDev
double Get_StdDev(int iField) const
Definition: table.h:380
CSG_Table::Add_Field
virtual bool Add_Field(const wchar_t *Name, TSG_Data_Type Type, int Position=-1)
Definition: table.h:352
CSG_Table::Find_Field
int Find_Field(const CSG_String &Name) const
Definition: table.cpp:713
CSG_Table_Record::Set_Value
bool Set_Value(const CSG_String &Field, DWORD Value)
Definition: table.h:168
CSG_Table_Record::Set_Value
bool Set_Value(const CSG_String &Field, int Value)
Definition: table.h:178
CSG_Table::is_Compatible
bool is_Compatible(const CSG_Table &Table, bool bExactMatch=false) const
Definition: table.cpp:430
CSG_Table_Record::Set_Value
bool Set_Value(const CSG_String &Field, size_t Value)
Definition: table.h:163
CSG_TIN
Definition: tin.h:222
CSG_Table_Record::asChar
SG_Char asChar(const wchar_t *Field) const
Definition: table.h:210
CSG_Table::m_Field_Stats
CSG_Simple_Statistics ** m_Field_Stats
Definition: table.h:457
CSG_Table_Record::Add_Value
bool Add_Value(const wchar_t *Field, double Value)
Definition: table.h:185
CSG_Table::Find_Field
int Find_Field(const char *Name) const
Definition: table.h:368
CSG_Table::Add_Field
virtual bool Add_Field(const char *Name, TSG_Data_Type Type, int Position=-1)
Definition: table.h:351
CSG_Data_Object
Definition: dataobject.h:180
CSG_Data_Object::On_NoData_Changed
virtual bool On_NoData_Changed(void)
Definition: dataobject.cpp:601
CSG_Table::Get_Field_Name
const SG_Char * Get_Field_Name(int iField) const
Definition: table.h:357
CSG_Table_Record::Set_Value
bool Set_Value(int Field, size_t Value)
Definition: table.h:162
SG_FILE_ENCODING_UNDEFINED
@ SG_FILE_ENCODING_UNDEFINED
Definition: api_core.h:557
CSG_Table::Set_File_Encoding
bool Set_File_Encoding(int Encoding)
Definition: table_io.cpp:81
CSG_Table::Get_Selection_Count
sLong Get_Selection_Count(void) const
Definition: table.h:420
CSG_Table::Serialize
bool Serialize(CSG_File &Stream, bool bSave)
Definition: table_io.cpp:538
CSG_Table::_Set_Selection
bool _Set_Selection(sLong Index, sLong Selected)
Definition: table_selection.cpp:74
CSG_Table_Record::Set_Value
bool Set_Value(const char *Field, sLong Value)
Definition: table.h:159
SG_TABLE_REC_FLAG_Modified
#define SG_TABLE_REC_FLAG_Modified
Definition: table.h:118
CSG_Table_Record::Set_Value
bool Set_Value(const char *Field, double Value)
Definition: table.h:154
CSG_Table_Record::asInt
int asInt(const char *Field) const
Definition: table.h:219
TSG_Table_Index_Order
TSG_Table_Index_Order
Definition: table.h:103
sLong
signed long long sLong
Definition: api_core.h:158
CSG_Table_Record::asFloat
float asFloat(const char *Field) const
Definition: table.h:229
CSG_Data_Object::On_Update
virtual bool On_Update(void)
Definition: dataobject.h:287
CSG_Table::is_Indexed
bool is_Indexed(void) const
Definition: table.h:437
CSG_Table_Record::Set_Value
bool Set_Value(const wchar_t *Field, long Value)
Definition: table.h:175
CSG_TIN::_On_Construction
void _On_Construction(void)
Definition: tin.cpp:133
CSG_Table::Get_N
sLong Get_N(int iField) const
Definition: table.h:374
CSG_Table::Mov_Field
virtual bool Mov_Field(int iField, int Position)
Definition: table.cpp:558
CSG_Table::Get_Count
sLong Get_Count(void) const
Definition: table.h:392
CSG_Table::Assign_Values
bool Assign_Values(const CSG_Table &Table)
Definition: table.cpp:395
CSG_Table_Record::Set_NoData
bool Set_NoData(const wchar_t *Field)
Definition: table.h:195
TABLE_FILETYPE_Text_NoHeadLine
@ TABLE_FILETYPE_Text_NoHeadLine
Definition: table.h:96
CSG_Array_Int
Definition: api_core.h:423
CSG_Table_Record::Set_Value
bool Set_Value(const wchar_t *Field, size_t Value)
Definition: table.h:165
CSG_Table_Record::Set_Value
bool Set_Value(int Field, int Value)
Definition: table.h:177
CSG_Table::Get_Index_Field
int Get_Index_Field(int i) const
Definition: table.h:441
CSG_Table::Get_Maximum
double Get_Maximum(int iField) const
Definition: table.h:376
CSG_Table::Del_Index
bool Del_Index(void)
Definition: table.cpp:1337
CSG_Table_Record::Set_Value
bool Set_Value(const char *Field, const CSG_Bytes &Value)
Definition: table.h:149
SAGA_API_DLL_EXPORT
#define SAGA_API_DLL_EXPORT
Definition: api_core.h:94
CSG_Table_Record::asLong
sLong asLong(const char *Field) const
Definition: table.h:224
CSG_Table::m_nBuffer
sLong m_nBuffer
Definition: table.h:451
CSG_Data_Object::Set_Modified
virtual void Set_Modified(bool bOn=true)
Definition: dataobject.h:227
CSG_Table::Set_Value
virtual bool Set_Value(sLong Index, int iField, const SG_Char *Value)
Definition: table.cpp:1131
CSG_Table::Get_Statistics
const CSG_Simple_Statistics & Get_Statistics(int iField) const
Definition: table.h:382
CSG_Table::Save
virtual bool Save(const char *File, int Format=0)
Definition: table.h:332
CSG_Table_Record::asDouble
double asDouble(const wchar_t *Field) const
Definition: table.h:235
dataobject.h
CSG_Table::Get_Record_byIndex
CSG_Table_Record * Get_Record_byIndex(sLong Index) const
Definition: table.h:399
CSG_Table_Record::is_NoData
bool is_NoData(const wchar_t *Field) const
Definition: table.h:200
CSG_Bytes
Definition: api_core.h:812
CSG_Table::m_Encoding
int m_Encoding
Definition: table.h:449
CSG_Table::Get_Extent
virtual const CSG_Rect & Get_Extent(void)
Definition: table.h:347
CSG_Table::_Del_Selection
bool _Del_Selection(sLong Index)
Definition: table_selection.cpp:87
CSG_Table::Get_Variance
double Get_Variance(int iField) const
Definition: table.h:381
CSG_Table_Record::asDouble
double asDouble(const char *Field) const
Definition: table.h:234
CSG_Table::Get_Sum
double Get_Sum(int iField) const
Definition: table.h:378
CSG_Table_Record::Set_Value
bool Set_Value(int Field, const char *Value)
Definition: table.h:139
CSG_Table::Set_Field_Name
bool Set_Field_Name(int iField, const SG_Char *Name)
Definition: table.cpp:611
CSG_Table::Add_Field
virtual bool Add_Field(const CSG_String &Name, TSG_Data_Type Type, int Position=-1)
Definition: table.cpp:481
CSG_Table
Definition: table.h:283
SG_Create_Table
SAGA_API_DLL_EXPORT CSG_Table * SG_Create_Table(void)
Definition: table.cpp:65
CSG_Table_Record::Set_Value
bool Set_Value(const wchar_t *Field, const CSG_Bytes &Value)
Definition: table.h:150
TABLE_INDEX_Descending
@ TABLE_INDEX_Descending
Definition: table.h:106
CSG_Table::_Save_DBase
bool _Save_DBase(const CSG_String &File)
Definition: table_io.cpp:523
CSG_Table_Record::asInt
int asInt(const wchar_t *Field) const
Definition: table.h:220
CSG_Table::_Add_Selection
bool _Add_Selection(sLong Index)
Definition: table_selection.cpp:63
CSG_Table_Record::Mul_Value
bool Mul_Value(const wchar_t *Field, double Value)
Definition: table.h:190
CSG_Table_Record::Add_Value
bool Add_Value(const char *Field, double Value)
Definition: table.h:184
CSG_Table_Record::Set_Value
bool Set_Value(const CSG_String &Field, long Value)
Definition: table.h:173
CSG_Table_Record::Set_Value
bool Set_Value(int Field, DWORD Value)
Definition: table.h:167
CSG_Table::Get_Mean
double Get_Mean(int iField) const
Definition: table.h:379
CSG_Table::Del_Record
virtual bool Del_Record(sLong Index)
Definition: table.cpp:869
SG_Char
#define SG_Char
Definition: api_core.h:536
CSG_Table::Load
bool Load(const CSG_String &File, int Format, SG_Char Separator, int Encoding=SG_FILE_ENCODING_UNDEFINED)
Definition: table_io.cpp:99
TSG_Data_Object_Type
TSG_Data_Object_Type
Definition: dataobject.h:117
CSG_Array
Definition: api_core.h:308
CSG_String
Definition: api_core.h:563
SG_DATAOBJECT_TYPE_Table
@ SG_DATAOBJECT_TYPE_Table
Definition: dataobject.h:120
CSG_Table::Get_Minimum
double Get_Minimum(int iField) const
Definition: table.h:375
CSG_Table_Record::Set_NoData
bool Set_NoData(const char *Field)
Definition: table.h:194
TSG_Table_File_Type
TSG_Table_File_Type
Definition: table.h:93
CSG_TIN::m_Extent
CSG_Rect m_Extent
Definition: tin.h:295
CSG_Table::Get_Selection_Index
sLong Get_Selection_Index(sLong Index=0) const
Definition: table.h:421
CSG_Table::m_nFields
int m_nFields
Definition: table.h:449
CSG_Table::Ins_Record
virtual CSG_Table_Record * Ins_Record(sLong Index, CSG_Table_Record *pCopy=NULL)
Definition: table.cpp:801
CSG_Table_Record::Set_Value
bool Set_Value(const char *Field, long Value)
Definition: table.h:174
CSG_Table_Record::asString
const SG_Char * asString(const char *Field, int Decimals=-99) const
Definition: table.h:204
CSG_Table_Record::Get_Index
sLong Get_Index(void) const
Definition: table.h:136
CSG_Table_Record::Set_Value
bool Set_Value(const char *Field, const char *Value)
Definition: table.h:144
TABLE_INDEX_Ascending
@ TABLE_INDEX_Ascending
Definition: table.h:105
CSG_Table::Get_Range
double Get_Range(int iField) const
Definition: table.h:377
CSG_Table::Create
bool Create(void)
Definition: table.cpp:139
CSG_TIN::_Get_New_Record
virtual CSG_Table_Record * _Get_New_Record(sLong Index)
Definition: tin.cpp:404
CSG_Table_Record::Get_Value
CSG_Table_Value * Get_Value(int Field)
Definition: table.h:237
CSG_PointCloud
Definition: pointcloud.h:105
CSG_Table::Save
virtual bool Save(const char *File, int Format, SG_Char Separator, int Encoding=SG_FILE_ENCODING_UNDEFINED)
Definition: table.h:328
CSG_Table_Record::Set_Value
bool Set_Value(const wchar_t *Field, sLong Value)
Definition: table.h:160
TABLE_FILETYPE_Text
@ TABLE_FILETYPE_Text
Definition: table.h:95
CSG_Table_Record::Set_Value
bool Set_Value(const wchar_t *Field, int Value)
Definition: table.h:180
TSG_Data_Type
TSG_Data_Type
Definition: api_core.h:993
CSG_Table::Select
virtual bool Select(sLong Index, bool bInvert=false)
Definition: table_selection.cpp:136
CSG_Table::Set_Index
bool Set_Index(CSG_Index &Index, int Field, bool bAscending=true) const
Definition: table.cpp:1426
CSG_Table::Get_Field_Type
TSG_Data_Type Get_Field_Type(int iField) const
Definition: table.h:358
CSG_Table::Add_Record
virtual CSG_Table_Record * Add_Record(CSG_Table_Record *pCopy=NULL)
Definition: table.cpp:795
CSG_Table_Record::Set_Value
bool Set_Value(const wchar_t *Field, const wchar_t *Value)
Definition: table.h:145
CSG_Table::Get_Field
int Get_Field(const CSG_String &Name) const
Definition: table.cpp:695
CSG_Table::Del_Selection
virtual sLong Del_Selection(void)
Definition: table_selection.cpp:178
CSG_Simple_Statistics
Definition: mat_tools.h:723
CSG_Table::Set_Field_Type
virtual bool Set_Field_Type(int iField, TSG_Data_Type Type)
Definition: table.cpp:626
CSG_Table_Record::is_Modified
bool is_Modified(void) const
Definition: table.h:243
CSG_Data_Object::Destroy
virtual bool Destroy(void)
Definition: dataobject.cpp:281
CSG_Table::_Save_Text
bool _Save_Text(const CSG_String &File, bool bHeadline, const SG_Char Separator)
Definition: table_io.cpp:453
CSG_Table_Record::asFloat
float asFloat(const wchar_t *Field) const
Definition: table.h:230
CSG_Table::Toggle_Index
bool Toggle_Index(int iField)
Definition: table.cpp:1347
CSG_Table_Record::asString
const SG_Char * asString(const wchar_t *Field, int Decimals=-99) const
Definition: table.h:205
CSG_Table::m_nRecords
sLong m_nRecords
Definition: table.h:451
CSG_Table::Find_Field
int Find_Field(const wchar_t *Name) const
Definition: table.h:369
CSG_Array::Get_Entry
void * Get_Entry(sLong Index) const
Returns a pointer to the memory address of the requested variable. You have to type cast and derefere...
Definition: api_core.h:331
CSG_Table::Get_File_Encoding
int Get_File_Encoding(void) const
Definition: table.h:336