SAGA API  v9.2
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 
291  CSG_Table (const CSG_Table &Table);
292  bool Create (const CSG_Table &Table);
293 
294  CSG_Table (const CSG_Table *pTemplate);
295  bool Create (const CSG_Table *pTemplate);
296 
298  bool Create (const CSG_String &File, TSG_Table_File_Type Format = TABLE_FILETYPE_Undefined, int Encoding = SG_FILE_ENCODING_UNDEFINED);
299  CSG_Table (const char *File, TSG_Table_File_Type Format = TABLE_FILETYPE_Undefined, int Encoding = SG_FILE_ENCODING_UNDEFINED);
300  bool Create (const char *File, TSG_Table_File_Type Format = TABLE_FILETYPE_Undefined, int Encoding = SG_FILE_ENCODING_UNDEFINED);
301  CSG_Table (const wchar_t *File, TSG_Table_File_Type Format = TABLE_FILETYPE_Undefined, int Encoding = SG_FILE_ENCODING_UNDEFINED);
302  bool Create (const wchar_t *File, TSG_Table_File_Type Format = TABLE_FILETYPE_Undefined, int Encoding = SG_FILE_ENCODING_UNDEFINED);
303 
304  CSG_Table (const CSG_String &File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
305  bool Create (const CSG_String &File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
306  CSG_Table (const char *File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
307  bool Create (const char *File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
308  CSG_Table (const wchar_t *File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
309  bool Create (const wchar_t *File, TSG_Table_File_Type Format, const SG_Char Separator , int Encoding = SG_FILE_ENCODING_UNDEFINED);
310 
311  virtual ~CSG_Table(void);
312 
313  virtual bool Destroy (void);
314 
316 
317  CSG_Table & operator = (const CSG_Table &Table);
318  virtual bool Assign (CSG_Data_Object *pTable);
319 
320  bool Assign_Values (const CSG_Table &Table);
321  bool Assign_Values ( CSG_Table *pTable);
322  bool Assign_Values (const SG_Char *File);
323 
324  bool Load (const CSG_String &File, int Format, SG_Char Separator, int Encoding = SG_FILE_ENCODING_UNDEFINED);
325 
326  virtual bool Save (const CSG_String &File, int Format, SG_Char Separator, int Encoding = SG_FILE_ENCODING_UNDEFINED);
327  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) ); }
328  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) ); }
329 
330  virtual bool Save (const CSG_String &File, int Format = 0);
331  virtual bool Save (const char *File, int Format = 0) { return( Save(CSG_String(File), Format) ); }
332  virtual bool Save (const wchar_t *File, int Format = 0) { return( Save(CSG_String(File), Format) ); }
333 
334  bool Set_File_Encoding (int Encoding);
335  int Get_File_Encoding (void) const { return( m_Encoding ); }
336 
337  bool Serialize (CSG_File &Stream, bool bSave);
338 
339  //-----------------------------------------------------
340  virtual bool is_Valid (void) const { return( m_nFields > 0 ); }
341 
342  bool is_Compatible (const CSG_Table &Table, bool bExactMatch = false) const;
343  bool is_Compatible ( CSG_Table *pTable, bool bExactMatch = false) const;
344 
345  //-----------------------------------------------------
346  virtual const CSG_Rect & Get_Extent (void) { return( m_Extent ); }
347 
348  //-----------------------------------------------------
349  virtual bool Add_Field (const CSG_String &Name, TSG_Data_Type Type, int Position = -1);
350  virtual bool Add_Field (const char *Name, TSG_Data_Type Type, int Position = -1) { return( Add_Field(CSG_String(Name), Type, Position) ); }
351  virtual bool Add_Field (const wchar_t *Name, TSG_Data_Type Type, int Position = -1) { return( Add_Field(CSG_String(Name), Type, Position) ); }
352  virtual bool Del_Field (int iField);
353  virtual bool Mov_Field (int iField, int Position);
354 
355  int Get_Field_Count (void) const { return( m_nFields ); }
356  const SG_Char * Get_Field_Name (int iField) const { return( iField >= 0 && iField < m_nFields ? m_Field_Name[iField]->c_str() : NULL ); }
357  TSG_Data_Type Get_Field_Type (int iField) const { return( iField >= 0 && iField < m_nFields ? m_Field_Type[iField] : SG_DATATYPE_Undefined ); }
358  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.
359  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.
360 
361  bool Set_Field_Name (int iField, const SG_Char *Name);
362  virtual bool Set_Field_Type (int iField, TSG_Data_Type Type);
363 
364  int Find_Field (const CSG_String &Name ) const;
365  bool Find_Field (const CSG_String &Name, int &Index) const;
366 
367  sLong Get_N (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Count () : 0 ); }
368  double Get_Minimum (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Minimum () : 0. ); }
369  double Get_Maximum (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Maximum () : 0. ); }
370  double Get_Range (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Range () : 0. ); }
371  double Get_Sum (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Sum () : 0. ); }
372  double Get_Mean (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Mean () : 0. ); }
373  double Get_StdDev (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_StdDev () : 0. ); }
374  double Get_Variance (int iField) const { return( _Stats_Update(iField) ? m_Field_Stats[iField]->Get_Variance() : 0. ); }
375  const CSG_Simple_Statistics & Get_Statistics (int iField) const { _Stats_Update(iField); return( *m_Field_Stats[iField] ); }
376 
377  //-----------------------------------------------------
378  virtual CSG_Table_Record * Add_Record ( CSG_Table_Record *pCopy = NULL);
379  virtual CSG_Table_Record * Ins_Record (sLong Index, CSG_Table_Record *pCopy = NULL);
380  virtual bool Set_Record (sLong Index, CSG_Table_Record *pCopy );
381  virtual bool Del_Record (sLong Index);
382  virtual bool Del_Records (void);
383 
384  virtual bool Set_Count (sLong nRecords);
385  sLong Get_Count (void) const { return( m_nRecords ); }
386 
387  virtual CSG_Table_Record * Get_Record (sLong Index) const { return( Index >= 0 && Index < m_nRecords ? m_Records[Index] : NULL ); }
388  virtual CSG_Table_Record & operator [] (sLong Index) const { return( *Get_Record_byIndex(Index) ); }
389 
390  sLong Get_Index (sLong Index) const { return( Index >= 0 && Index < m_nRecords ? (is_Indexed() ? m_Index[Index] : Index) : -1 ); }
391 
393  {
394  return( Index >= 0 && Index < m_nRecords ? Get_Record(is_Indexed() ? m_Index[Index] : Index) : NULL );
395  }
396 
397  //-----------------------------------------------------
398  virtual bool Find_Record (sLong &Index, int iField, const CSG_String &Value, bool bCreateIndex = false);
399  virtual CSG_Table_Record * Find_Record ( int iField, const CSG_String &Value, bool bCreateIndex = false);
400  virtual bool Find_Record (sLong &Index, int iField, double Value, bool bCreateIndex = false);
401  virtual CSG_Table_Record * Find_Record ( int iField, double Value, bool bCreateIndex = false);
402 
403  //-----------------------------------------------------
404  virtual bool Set_Value (sLong Index, int iField, const SG_Char *Value);
405  virtual bool Set_Value (sLong Index, int iField, double Value);
406 
407  virtual bool Get_Value (sLong Index, int iField, CSG_String &Value) const;
408  virtual bool Get_Value (sLong Index, int iField, double &Value) const;
409 
410  virtual void Set_Modified (bool bModified = true);
411 
412  //-----------------------------------------------------
413  sLong Get_Selection_Count (void) const { return( m_Selection.Get_Size() ); }
414  sLong Get_Selection_Index (sLong Index = 0) const { return( Index >= 0 && Index < m_Selection.Get_Size() ? *((sLong *)m_Selection.Get_Entry(Index)) : Get_Count() ); }
415  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 ); }
416 
417  virtual bool is_Selected (sLong Index) const { return( Index >= 0 && Index < m_nRecords ? m_Records[Index]->is_Selected() : false ); }
418 
419  virtual bool Select (sLong Index , bool bInvert = false);
420  virtual bool Select (CSG_Table_Record *pRecord = NULL, bool bInvert = false);
421 
422  virtual sLong Del_Selection (void);
423  virtual sLong Inv_Selection (void);
424 
425  //-----------------------------------------------------
426  bool Set_Index (CSG_Index &Index, int Field , bool bAscending = true) const;
427  bool Set_Index (CSG_Index &Index, int Fields[], int nFields, bool bAscending = true) const;
428  bool Set_Index (CSG_Index &Index, const CSG_Array_Int &Fields, bool bAscending = true) const;
429 
430  bool is_Indexed (void) const { return( m_nRecords > 0 && m_Index.Get_Count() == m_nRecords ); }
431  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);
432  bool Del_Index (void);
433  bool Toggle_Index (int iField);
434  int Get_Index_Field (int i) const { return( i < 0 || i >= m_Index_Fields.Get_Size() ? -1 : abs(m_Index_Fields[i]) - 1 ); }
435  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 ); }
436  int Get_Index_Field (size_t i) const { return( Get_Index_Field((int)i) ); }
437  TSG_Table_Index_Order Get_Index_Order (size_t i) const { return( Get_Index_Order((int)i) ); }
438 
439 
440 protected:
441 
443 
445 
447 
449 
451 
453 
455 
456 
457  virtual void _On_Construction (void);
458 
459  virtual CSG_Table_Record * _Get_New_Record (sLong Index);
460 
461  bool _Add_Selection (sLong Index);
462  bool _Set_Selection (sLong Index, sLong Selected);
463  bool _Del_Selection (sLong Index);
464 
465  bool _Stats_Invalidate (void) const;
466  bool _Stats_Invalidate (int iField) const;
467  virtual bool _Stats_Update (int iField) const;
468 
469  virtual bool On_NoData_Changed (void);
470  virtual bool On_Update (void);
471 
472  virtual bool On_Reload (void);
473  virtual bool On_Delete (void);
474 
475 
476 private:
477 
478  CSG_Index m_Index;
479 
480  CSG_Array_Int m_Index_Fields;
481 
482  CSG_Table_Record **m_Records;
483 
484 
485  bool _Destroy_Selection (void);
486 
487  bool _Inc_Array (void);
488  bool _Dec_Array (void);
489 
490  size_t _Load_Text_Trim ( CSG_String &Text, const SG_Char Separator);
491  size_t _Load_Text_EndQuote (const CSG_String &Text, const SG_Char Separator);
492 
493  bool _Load_Text (const CSG_String &File, bool bHeadline, const SG_Char Separator);
494  bool _Save_Text (const CSG_String &File, bool bHeadline, const SG_Char Separator);
495 
496  bool _Load_DBase (const CSG_String &File);
497  bool _Save_DBase (const CSG_String &File);
498 
499  void _Index_Update (void);
500 
501 };
502 
503 
505 // //
506 // //
507 // //
509 
510 //---------------------------------------------------------
513 
516 
519 
526 
528 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);
530 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);
532 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);
533 
534 
536 // //
537 // //
538 // //
540 
541 //---------------------------------------------------------
542 #endif // #ifndef HEADER_INCLUDED__SAGA_API__table_H
CSG_Index
Definition: mat_tools.h:185
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:950
CSG_Data_Object::Assign
virtual bool Assign(CSG_Data_Object *pObject)
Definition: dataobject.cpp:734
CSG_Table::Assign
virtual bool Assign(CSG_Data_Object *pTable)
Definition: table.cpp:372
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:1001
CSG_Table::is_Valid
virtual bool is_Valid(void) const
Definition: table.h:340
table_value.h
CSG_Table::Set_Count
virtual bool Set_Count(sLong nRecords)
Definition: table.cpp:930
CSG_Table::Save
virtual bool Save(const wchar_t *File, int Format=0)
Definition: table.h:332
CSG_Table::Del_Records
virtual bool Del_Records(void)
Definition: table.cpp:912
CSG_Table::Get_Index
sLong Get_Index(sLong Index) const
Definition: table.h:390
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:1228
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:315
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:1161
CSG_Table::m_Selection
CSG_Array m_Selection
Definition: table.h:452
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:417
CSG_Table::Del_Field
virtual bool Del_Field(int iField)
Definition: table.cpp:526
CSG_Table::Get_Record
virtual CSG_Table_Record * Get_Record(sLong Index) const
Definition: table.h:387
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:448
CSG_Table_Record::asChar
SG_Char asChar(const char *Field) const
Definition: table.h:209
CSG_Table::operator=
CSG_Table & operator=(const CSG_Table &Table)
Definition: table.cpp:364
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:415
CSG_Table::~CSG_Table
virtual ~CSG_Table(void)
Definition: table.cpp:321
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:435
CSG_Table::Get_Field_Count
int Get_Field_Count(void) const
Definition: table.h:355
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:454
CSG_Table::Get_Field_Length
int Get_Field_Length(int iField, int Encoding=SG_FILE_ENCODING_UNDEFINED) const
Definition: table.cpp:665
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:862
CSG_Table_Value
Definition: table_value.h:111
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:388
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:436
CSG_File
Definition: api_core.h:1116
CSG_Table::Set_Modified
virtual void Set_Modified(bool bModified=true)
Definition: table.cpp:1117
CSG_Table::_Stats_Invalidate
bool _Stats_Invalidate(void) const
Definition: table.cpp:1204
CSG_Table::m_Field_Type
TSG_Data_Type * m_Field_Type
Definition: table.h:446
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:328
CSG_Table::Get_Index_Order
TSG_Table_Index_Order Get_Index_Order(size_t i) const
Definition: table.h:437
CSG_Table::Get_StdDev
double Get_StdDev(int iField) const
Definition: table.h:373
CSG_Table::Add_Field
virtual bool Add_Field(const wchar_t *Name, TSG_Data_Type Type, int Position=-1)
Definition: table.h:351
CSG_Table::Find_Field
int Find_Field(const CSG_String &Name) const
Definition: table.cpp:717
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:436
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:450
CSG_Table_Record::Add_Value
bool Add_Value(const wchar_t *Field, double Value)
Definition: table.h:185
CSG_Table::Add_Field
virtual bool Add_Field(const char *Name, TSG_Data_Type Type, int Position=-1)
Definition: table.h:350
CSG_Data_Object
Definition: dataobject.h:180
CSG_Data_Object::On_NoData_Changed
virtual bool On_NoData_Changed(void)
Definition: dataobject.cpp:542
CSG_Table::Get_Field_Name
const SG_Char * Get_Field_Name(int iField) const
Definition: table.h:356
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:551
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:413
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:275
CSG_Table::is_Indexed
bool is_Indexed(void) const
Definition: table.h:430
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:367
CSG_Table::Mov_Field
virtual bool Mov_Field(int iField, int Position)
Definition: table.cpp:564
CSG_Table::Get_Count
sLong Get_Count(void) const
Definition: table.h:385
CSG_Table::Assign_Values
bool Assign_Values(const CSG_Table &Table)
Definition: table.cpp:401
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:421
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:434
CSG_Table::Get_Maximum
double Get_Maximum(int iField) const
Definition: table.h:369
CSG_Table::Del_Index
bool Del_Index(void)
Definition: table.cpp:1341
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:444
CSG_Data_Object::Set_Modified
virtual void Set_Modified(bool bOn=true)
Definition: dataobject.h:218
CSG_Table::Set_Value
virtual bool Set_Value(sLong Index, int iField, const SG_Char *Value)
Definition: table.cpp:1135
CSG_Table::Get_Statistics
const CSG_Simple_Statistics & Get_Statistics(int iField) const
Definition: table.h:375
CSG_Table::Save
virtual bool Save(const char *File, int Format=0)
Definition: table.h:331
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:392
CSG_Table_Record::is_NoData
bool is_NoData(const wchar_t *Field) const
Definition: table.h:200
CSG_Bytes
Definition: api_core.h:804
CSG_Table::m_Encoding
int m_Encoding
Definition: table.h:442
CSG_Table::Get_Extent
virtual const CSG_Rect & Get_Extent(void)
Definition: table.h:346
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:374
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:371
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:617
CSG_Table::Add_Field
virtual bool Add_Field(const CSG_String &Name, TSG_Data_Type Type, int Position=-1)
Definition: table.cpp:487
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_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:372
CSG_Table::Del_Record
virtual bool Del_Record(sLong Index)
Definition: table.cpp:873
SG_Char
#define SG_Char
Definition: api_core.h:530
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:557
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:368
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:290
CSG_Table::Get_Selection_Index
sLong Get_Selection_Index(sLong Index=0) const
Definition: table.h:414
CSG_Table::m_nFields
int m_nFields
Definition: table.h:442
CSG_Table::Ins_Record
virtual CSG_Table_Record * Ins_Record(sLong Index, CSG_Table_Record *pCopy=NULL)
Definition: table.cpp:805
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:370
CSG_TIN::_Get_New_Record
virtual CSG_Table_Record * _Get_New_Record(sLong Index)
Definition: tin.cpp:384
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:327
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:985
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:1430
CSG_Table::Get_Field_Type
TSG_Data_Type Get_Field_Type(int iField) const
Definition: table.h:357
CSG_Table::Add_Record
virtual CSG_Table_Record * Add_Record(CSG_Table_Record *pCopy=NULL)
Definition: table.cpp:799
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:699
CSG_Table::Del_Selection
virtual sLong Del_Selection(void)
Definition: table_selection.cpp:178
CSG_Simple_Statistics
Definition: mat_tools.h:708
CSG_Table::Set_Field_Type
virtual bool Set_Field_Type(int iField, TSG_Data_Type Type)
Definition: table.cpp:632
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:218
CSG_Table_Record::asFloat
float asFloat(const wchar_t *Field) const
Definition: table.h:230
CSG_TIN::Create
bool Create(const CSG_TIN &TIN)
Definition: tin.cpp:150
CSG_Table::Toggle_Index
bool Toggle_Index(int iField)
Definition: table.cpp:1351
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:444
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:335