SAGA API Version 9.14
Loading...
Searching...
No Matches
data_manager.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// data_manager.h //
15// //
16// Copyright (C) 2013 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 Hamburg //
44// Germany //
45// //
46// e-mail: oconrad@saga-gis.org //
47// //
49
50//---------------------------------------------------------
51#ifndef HEADER_INCLUDED__SAGA_API__data_manager_H
52#define HEADER_INCLUDED__SAGA_API__data_manager_H
53
54
56// //
57// //
58// //
60
61//---------------------------------------------------------
69
70
72// //
73// //
74// //
76
77//---------------------------------------------------------
78#include "parameters.h"
79
80
82// //
83// //
84// //
86
87//---------------------------------------------------------
88class SAGA_API_DLL_EXPORT CSG_Data_Collection
89{
90public:
91
92 size_t Count (void) const { return( (size_t)m_Objects.Get_Size() ); }
93
94 CSG_Data_Object & operator [] (size_t i) const { return( *(CSG_Data_Object *)m_Objects[i] ); }
95 CSG_Data_Object * Get (size_t i) const { return( i < Count() ? (CSG_Data_Object *)m_Objects[i] : NULL ); }
96
97 bool Delete (CSG_Data_Object *pObject, bool bDetach = false);
98 bool Delete (size_t i , bool bDetach = false);
99 bool Delete ( bool bDetach = false, bool bUnsaved = false);
100
101 CSG_Data_Object * Find (const CSG_String &File, bool bNative = true) const;
102
103 bool Exists (CSG_Data_Object *pObject) const;
104
105
106private:
107
108 friend class CSG_Data_Manager;
109
110 CSG_Data_Collection(TSG_Data_Object_Type Type);
111 virtual ~CSG_Data_Collection(void);
112
113 bool Add (CSG_Data_Object *pObject);
114
115
117
118 CSG_Array_Pointer m_Objects;
119
120};
121
122
124// //
126
127//---------------------------------------------------------
129{
130public:
131 CSG_Data_Manager(void);
132 virtual ~CSG_Data_Manager(void);
133
134 CSG_Data_Collection & Table (void) const { return( *m_pTable ); }
135 CSG_Data_Collection & TIN (void) const { return( *m_pTIN ); }
136 CSG_Data_Collection & PointCloud (void) const { return( *m_pPointCloud ); }
137 CSG_Data_Collection & Shapes (void) const { return( *m_pShapes ); }
138 CSG_Data_Collection & Grid (void) const { return( *m_pGrid ); }
139 CSG_Data_Collection & Grids (void) const { return( *m_pGrids ); }
140
141 CSG_Table & Table (size_t i) const { return( *m_pTable ->Get(i)->asTable () ); }
142 CSG_TIN & TIN (size_t i) const { return( *m_pTIN ->Get(i)->asTIN () ); }
143 CSG_PointCloud & PointCloud (size_t i) const { return( *m_pPointCloud->Get(i)->asPointCloud() ); }
144 CSG_Shapes & Shapes (size_t i) const { return( *m_pShapes ->Get(i)->asShapes () ); }
145 CSG_Grid & Grid (size_t i) const { return( *m_pGrid ->Get(i)->asGrid () ); }
146 CSG_Grids & Grids (size_t i) const { return( *m_pGrids ->Get(i)->asGrids () ); }
147
148 CSG_Data_Object * Add (CSG_Data_Object *pObject);
149
152 CSG_Data_Object * Add (const wchar_t *File, TSG_Data_Object_Type Type = SG_DATAOBJECT_TYPE_Undefined);
153
154 CSG_Table * Add_Table (void);
155 CSG_Table * Add_Table (const CSG_String &File);
156 CSG_Table * Add_Table (const char *File);
157 CSG_Table * Add_Table (const wchar_t *File);
158
159 CSG_Shapes * Add_Shapes (void);
160 CSG_Shapes * Add_Shapes (const CSG_String &File);
161 CSG_Shapes * Add_Shapes (const char *File);
162 CSG_Shapes * Add_Shapes (const wchar_t *File);
163
164 CSG_PointCloud * Add_PointCloud (void);
165 CSG_PointCloud * Add_PointCloud (const CSG_String &File);
166 CSG_PointCloud * Add_PointCloud (const char *File);
167 CSG_PointCloud * Add_PointCloud (const wchar_t *File);
168
169 CSG_TIN * Add_TIN (void);
170 CSG_TIN * Add_TIN (const CSG_String &File);
171 CSG_TIN * Add_TIN (const char *File);
172 CSG_TIN * Add_TIN (const wchar_t *File);
173
174 CSG_Grid * Add_Grid (void);
175 CSG_Grid * Add_Grid (const CSG_String &File);
176 CSG_Grid * Add_Grid (const char *File);
177 CSG_Grid * Add_Grid (const wchar_t *File);
178
179 CSG_Grids * Add_Grids (void);
180 CSG_Grids * Add_Grids (const CSG_String &File);
181 CSG_Grids * Add_Grids (const char *File);
182 CSG_Grids * Add_Grids (const wchar_t *File);
183
184 bool Delete (CSG_Data_Object *pObject, bool bDetach = false);
185 bool Delete ( bool bDetach = false, bool bUnsaved = false);
186
187 CSG_Data_Object * Find (const CSG_String &File, bool bNative = true) const;
188
189 bool Exists (CSG_Data_Object *pObject) const;
190
191 CSG_String Get_Summary (void) const;
192
193
194private:
195
196 CSG_Data_Collection *m_pTable = NULL, *m_pShapes = NULL, *m_pPointCloud = NULL, *m_pTIN = NULL, *m_pGrid = NULL, *m_pGrids = NULL;
197
198
199 CSG_Data_Collection * _Get_Collection (CSG_Data_Object *pObject) const;
200
201 CSG_Data_Object * _Add_External (const CSG_String &File);
202
203
204//---------------------------------------------------------
205public:
206
207 class SAGA_API_DLL_EXPORT CSG_Grid_Systems
208 {
209 public:
210
211 bool Destroy (void);
212
213 bool Update (void);
214
215 size_t Count (void) const { return( (size_t)m_Systems.Get_Size() ); }
216
217 const CSG_Grid_System & operator [] (size_t i) const { return( Get_System(i) ); }
218 const CSG_Grid_System & Get_System (size_t i) const;
219
220 const CSG_Data_Collection & Get_Grids (size_t i) const { return( *(CSG_Data_Collection *)m_Systems[i] ); }
221 const CSG_Data_Collection * Get_Grids (const CSG_Grid_System &System) const;
222
223
224 private:
225
226 friend CSG_Data_Manager;
227
228 CSG_Array_Pointer m_Systems;
229
230 CSG_Data_Collection *m_pGrid = NULL, *m_pGrids = NULL;
231
232
233 CSG_Grid_Systems(void);
234 virtual ~CSG_Grid_Systems(void);
235
236
237 bool _Add (CSG_Data_Object *pObject);
238
239 };
240
241 CSG_Grid_Systems & Get_Grid_Systems (bool bUpdate = true) { if( bUpdate ) { m_Grid_Systems.Update(); } return( m_Grid_Systems ); }
242
243
244private:
245
246 CSG_Grid_Systems m_Grid_Systems;
247
248};
249
250
252// //
254
255//---------------------------------------------------------
257
258
260// //
261// //
262// //
264
265//---------------------------------------------------------
266#endif // #ifndef HEADER_INCLUDED__SAGA_API__data_manager_H
#define SAGA_API_DLL_EXPORT
Definition api_core.h:94
size_t Count(void) const
CSG_Data_Object * Get(size_t i) const
friend class CSG_Data_Manager
const CSG_Data_Collection & Get_Grids(size_t i) const
const CSG_Grid_System & Get_System(size_t i) const
CSG_Grid & Grid(size_t i) const
CSG_Grid_Systems & Get_Grid_Systems(bool bUpdate=true)
CSG_Grids & Grids(size_t i) const
CSG_Data_Collection & Grid(void) const
CSG_TIN & TIN(size_t i) const
CSG_Data_Collection & Grids(void) const
CSG_Data_Collection & PointCloud(void) const
CSG_Data_Collection & TIN(void) const
CSG_Table & Table(size_t i) const
CSG_Data_Collection & Table(void) const
CSG_Shapes & Shapes(size_t i) const
CSG_Data_Collection & Shapes(void) const
CSG_PointCloud & PointCloud(size_t i) const
Definition tin.h:222
SAGA_API_DLL_EXPORT CSG_Data_Manager & SG_Get_Data_Manager(void)
TSG_Data_Object_Type
Definition dataobject.h:117
@ SG_DATAOBJECT_TYPE_Undefined
Definition dataobject.h:124