SAGA API v9.10
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//---------------------------------------------------------
89{
90 friend class CSG_Data_Manager;
91
92public:
93
94 size_t Count (void) const { return( m_Objects.Get_Size() ); }
95
96 CSG_Data_Object & operator [] (size_t i) const { return( *(CSG_Data_Object *)m_Objects[i] ); }
97 CSG_Data_Object * Get (size_t i) const { return( i < Count() ? (CSG_Data_Object *)m_Objects[i] : NULL ); }
98
99 bool Delete (CSG_Data_Object *pObject, bool bDetach = false);
100 bool Delete (size_t i , bool bDetach = false);
101 bool Delete ( bool bDetach = false, bool bUnsaved = false);
102
103 CSG_Data_Object * Find (const CSG_String &File, bool bNative = true) const;
104
105 bool Exists (CSG_Data_Object *pObject) const;
106
107
108protected:
109
111 virtual ~CSG_Data_Collection(void);
112
113 bool Add (CSG_Data_Object *pObject);
114
115
117
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, *m_pShapes, *m_pPointCloud, *m_pTIN, *m_pGrid, *m_pGrids;
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
205//---------------------------------------------------------
207
208
210// //
211// //
212// //
214
215//---------------------------------------------------------
216#endif // #ifndef HEADER_INCLUDED__SAGA_API__data_manager_H
#define SAGA_API_DLL_EXPORT
Definition api_core.h:94
CSG_Array_Pointer m_Objects
size_t Count(void) const
CSG_Data_Object * Get(size_t i) const
friend class CSG_Data_Manager
TSG_Data_Object_Type m_Type
CSG_Data_Collection(TSG_Data_Object_Type Type)
CSG_Grid & Grid(size_t i) const
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