SAGA API  v9.6
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 //---------------------------------------------------------
71 // //
73 // //
74 // //
76 
77 //---------------------------------------------------------
78 #include "parameters.h"
79 
80 
82 // //
83 // //
84 // //
86 
87 //---------------------------------------------------------
89 {
90  friend class CSG_Data_Manager;
91 
92 public:
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 
108 protected:
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 {
130 public:
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 
151  CSG_Data_Object * Add (const char *File, TSG_Data_Object_Type Type = SG_DATAOBJECT_TYPE_Undefined);
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 
194 private:
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
CSG_Data_Manager::TIN
CSG_TIN & TIN(size_t i) const
Definition: data_manager.h:142
CSG_Data_Collection::Get
CSG_Data_Object * Get(size_t i) const
Definition: data_manager.h:97
CSG_Data_Manager::Grids
CSG_Grids & Grids(size_t i) const
Definition: data_manager.h:146
CSG_Data_Collection::Count
size_t Count(void) const
Definition: data_manager.h:94
CSG_Data_Collection
Definition: data_manager.h:89
CSG_Data_Manager::Exists
bool Exists(CSG_Data_Object *pObject) const
Definition: data_manager.cpp:278
CSG_Data_Manager::Shapes
CSG_Data_Collection & Shapes(void) const
Definition: data_manager.h:137
CSG_TIN
Definition: tin.h:222
CSG_Data_Object
Definition: dataobject.h:180
SAGA_API_DLL_EXPORT
#define SAGA_API_DLL_EXPORT
Definition: api_core.h:94
CSG_Data_Manager::Delete
bool Delete(CSG_Data_Object *pObject, bool bDetach=false)
Definition: data_manager.cpp:623
CSG_Data_Manager::TIN
CSG_Data_Collection & TIN(void) const
Definition: data_manager.h:135
CSG_Data_Manager::Add
CSG_Data_Object * Add(CSG_Data_Object *pObject)
Definition: data_manager.cpp:310
parameters.h
CSG_Table
Definition: table.h:283
SG_Get_Data_Manager
SAGA_API_DLL_EXPORT CSG_Data_Manager & SG_Get_Data_Manager(void)
Definition: data_manager.cpp:65
SG_DATAOBJECT_TYPE_Undefined
@ SG_DATAOBJECT_TYPE_Undefined
Definition: dataobject.h:124
TSG_Data_Object_Type
TSG_Data_Object_Type
Definition: dataobject.h:117
CSG_String
Definition: api_core.h:563
CSG_Array_Pointer
Definition: api_core.h:368
CSG_Data_Manager
Definition: data_manager.h:129
CSG_Data_Manager::PointCloud
CSG_Data_Collection & PointCloud(void) const
Definition: data_manager.h:136
CSG_Data_Manager::Find
CSG_Data_Object * Find(const CSG_String &File, bool bNative=true) const
Definition: data_manager.cpp:263
CSG_Grid
Definition: grid.h:475
CSG_Data_Manager::PointCloud
CSG_PointCloud & PointCloud(size_t i) const
Definition: data_manager.h:143
CSG_Data_Manager::Grids
CSG_Data_Collection & Grids(void) const
Definition: data_manager.h:139
CSG_Data_Manager::Shapes
CSG_Shapes & Shapes(size_t i) const
Definition: data_manager.h:144
CSG_Shapes
Definition: shapes.h:775
CSG_PointCloud
Definition: pointcloud.h:105
CSG_Data_Collection::m_Objects
CSG_Array_Pointer m_Objects
Definition: data_manager.h:118
CSG_Data_Manager::Grid
CSG_Data_Collection & Grid(void) const
Definition: data_manager.h:138
CSG_Data_Collection::m_Type
TSG_Data_Object_Type m_Type
Definition: data_manager.h:116
CSG_Grids
Definition: grids.h:119
CSG_Data_Manager::Table
CSG_Data_Collection & Table(void) const
Definition: data_manager.h:134
CSG_Data_Manager::Grid
CSG_Grid & Grid(size_t i) const
Definition: data_manager.h:145
CSG_Data_Manager::Table
CSG_Table & Table(size_t i) const
Definition: data_manager.h:141