filegdb 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/.travis.yml +4 -0
- data/Gemfile +3 -0
- data/LICENSE +28 -0
- data/Makefile +12 -0
- data/README.md +27 -0
- data/Rakefile +24 -0
- data/ext/filegdb/base.hpp +126 -0
- data/ext/filegdb/extconf.rb +13 -0
- data/ext/filegdb/filegdb.cpp +27 -0
- data/ext/filegdb/filegdb.hpp +44 -0
- data/ext/filegdb/filegdb/include/FileGDBAPI.h +30 -0
- data/ext/filegdb/filegdb/include/FileGDBCore.h +226 -0
- data/ext/filegdb/filegdb/include/Geodatabase.h +291 -0
- data/ext/filegdb/filegdb/include/GeodatabaseManagement.h +79 -0
- data/ext/filegdb/filegdb/include/Raster.h +101 -0
- data/ext/filegdb/filegdb/include/Row.h +336 -0
- data/ext/filegdb/filegdb/include/Table.h +296 -0
- data/ext/filegdb/filegdb/include/Util.h +936 -0
- data/ext/filegdb/filegdb/include/make.include +98 -0
- data/ext/filegdb/filegdb/lib/libFileGDBAPI.dylib +0 -0
- data/ext/filegdb/filegdb/lib/libFileGDBAPI.so +0 -0
- data/ext/filegdb/filegdb/lib/libfgdbunixrtl.dylib +0 -0
- data/ext/filegdb/filegdb/lib/libfgdbunixrtl.so +0 -0
- data/ext/filegdb/geodatabase.cpp +529 -0
- data/ext/filegdb/geodatabase.hpp +53 -0
- data/ext/filegdb/multi_point_shape_buffer.cpp +254 -0
- data/ext/filegdb/multi_point_shape_buffer.hpp +35 -0
- data/ext/filegdb/point.cpp +44 -0
- data/ext/filegdb/point.hpp +31 -0
- data/ext/filegdb/point_shape_buffer.cpp +162 -0
- data/ext/filegdb/point_shape_buffer.hpp +32 -0
- data/ext/filegdb/row.cpp +222 -0
- data/ext/filegdb/row.hpp +37 -0
- data/ext/filegdb/shape_buffer.cpp +19 -0
- data/ext/filegdb/shape_buffer.hpp +20 -0
- data/ext/filegdb/shape_buffer_base.hpp +33 -0
- data/ext/filegdb/table.cpp +65 -0
- data/ext/filegdb/table.hpp +29 -0
- data/ext/filegdb/util.cpp +16 -0
- data/filegdb.gemspec +23 -0
- data/lib/filegdb.rb +2 -0
- data/lib/filegdb/version.rb +3 -0
- data/spec/data/domain_definition.xml +22 -0
- data/spec/data/domain_definition_altered.xml +26 -0
- data/spec/data/feature_dataset_definition.xml +25 -0
- data/spec/data/table_definition.xml +177 -0
- data/spec/filegdb_spec.rb +36 -0
- data/spec/geodatabase_spec.rb +107 -0
- data/spec/multi_point_shape_buffer_spec.rb +58 -0
- data/spec/point_shape_buffer_spec.rb +39 -0
- data/spec/row_spec.rb +76 -0
- data/spec/spec_helper.rb +41 -0
- metadata +153 -0
@@ -0,0 +1,336 @@
|
|
1
|
+
//
|
2
|
+
// Row.h
|
3
|
+
//
|
4
|
+
|
5
|
+
/*
|
6
|
+
COPYRIGHT � 2012 ESRI
|
7
|
+
TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
|
8
|
+
Unpublished material - all rights reserved under the
|
9
|
+
Copyright Laws of the United States and applicable international
|
10
|
+
laws, treaties, and conventions.
|
11
|
+
|
12
|
+
For additional information, contact:
|
13
|
+
Environmental Systems Research Institute, Inc.
|
14
|
+
Attn: Contracts and Legal Services Department
|
15
|
+
380 New York Street
|
16
|
+
Redlands, California, 92373
|
17
|
+
USA
|
18
|
+
|
19
|
+
email: contracts@esri.com
|
20
|
+
*/
|
21
|
+
|
22
|
+
#pragma once
|
23
|
+
|
24
|
+
#include <string>
|
25
|
+
#include <vector>
|
26
|
+
|
27
|
+
#ifndef EXPORT_FILEGDB_API
|
28
|
+
# if defined linux || defined __APPLE__
|
29
|
+
# define EXT_FILEGDB_API
|
30
|
+
# else
|
31
|
+
# define EXT_FILEGDB_API _declspec(dllimport)
|
32
|
+
# endif
|
33
|
+
#else
|
34
|
+
# if defined linux || defined __APPLE__
|
35
|
+
# define EXT_FILEGDB_API __attribute__((visibility("default")))
|
36
|
+
# else
|
37
|
+
# define EXT_FILEGDB_API _declspec(dllexport)
|
38
|
+
# endif
|
39
|
+
#endif
|
40
|
+
|
41
|
+
#include "FileGDBCore.h"
|
42
|
+
|
43
|
+
struct IFields;
|
44
|
+
struct FieldValue;
|
45
|
+
class FieldValues;
|
46
|
+
|
47
|
+
namespace FileGDBAPI
|
48
|
+
{
|
49
|
+
|
50
|
+
class ShapeBuffer;
|
51
|
+
class ByteArray;
|
52
|
+
class Raster;
|
53
|
+
class EnumRows;
|
54
|
+
class FieldInfo;
|
55
|
+
class FieldDef;
|
56
|
+
class Guid;
|
57
|
+
|
58
|
+
/// Provides methods to get and set data on table rows.
|
59
|
+
class EXT_FILEGDB_API Row
|
60
|
+
{
|
61
|
+
public:
|
62
|
+
|
63
|
+
/// @name Getters and setters
|
64
|
+
//@{
|
65
|
+
/// Indicates whether the specified field contains a null value.
|
66
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field
|
67
|
+
/// was not found or could not be retrieved properly).
|
68
|
+
/// @param[in] field The field to check for a null value.
|
69
|
+
/// @param[out] isNull Indicates whether the specified field contains a null value.
|
70
|
+
/// @return Error code indicating whether the method finished successfully.
|
71
|
+
fgdbError IsNull(const std::wstring& field, bool& isNull) const;
|
72
|
+
|
73
|
+
/// Assigns a null value to the specified field.
|
74
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not
|
75
|
+
/// found or could not be retrieved properly).
|
76
|
+
/// If the field is not nullable, this will fail with an error code of -2147219879 (The field is not nullable).
|
77
|
+
/// @param[in] field The field to set as null.
|
78
|
+
/// @return Error code indicating whether the method finished successfully.
|
79
|
+
fgdbError SetNull(const std::wstring& field);
|
80
|
+
|
81
|
+
/// Gets the row's Object ID.
|
82
|
+
/// If the row's table does not have an Object ID column, this will fail with an error code of -2147219885
|
83
|
+
/// (An expected Field was not found or could not be retrieved properly).
|
84
|
+
/// @param[out] objectID The row's Object ID.
|
85
|
+
/// @return Error code indicating whether the method finished successfully.
|
86
|
+
fgdbError GetOID(int32& objectID) const;
|
87
|
+
|
88
|
+
/// Gets the row's Global ID.
|
89
|
+
/// If the row's table does not have an Global ID column, this will fail with an error code of -2147219885
|
90
|
+
/// (An expected Field was not found or could not be retrieved properly).
|
91
|
+
/// @param[out] globalID The row's Global ID.
|
92
|
+
/// @return Error code indicating whether the method finished successfully.
|
93
|
+
fgdbError GetGlobalID(Guid& globalID) const;
|
94
|
+
|
95
|
+
/// Gets the row's geometry. The buffer is a shape record as defined in the ESRI Shapefile Technical
|
96
|
+
/// Description, which is included in the documentation. The Editing and Querying samples write and
|
97
|
+
/// read a point shape buffer. Other shape types can be read based on the shapefile specification.
|
98
|
+
/// If the row's table does not have a geometry column, this will fail with an error code of -2147219885
|
99
|
+
/// (An expected Field was not found or could not be retrieved properly).
|
100
|
+
/// @param[out] shapeBuffer The row's geometry.
|
101
|
+
/// @return Error code indicating whether the method finished successfully.
|
102
|
+
fgdbError GetGeometry(ShapeBuffer& shapeBuffer) const;
|
103
|
+
|
104
|
+
/// Sets the row's geometry. The buffer is a shape record as defined in the ESRI Shapefile Technical
|
105
|
+
/// Description, which is included in the documentation. The Editing and Querying samples write and
|
106
|
+
/// read a point shape buffer. If the row's table does not have a geometry column, this will fail with
|
107
|
+
/// an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
108
|
+
/// If the geometry has an invalid geometry type, this will fail with an error code of E_FAIL.
|
109
|
+
/// @param[in] shapeBuffer The geometry to assign to the row.
|
110
|
+
/// @return Error code indicating whether the method finished successfully.
|
111
|
+
fgdbError SetGeometry(const ShapeBuffer& shapeBuffer);
|
112
|
+
|
113
|
+
/// Gets a short value from the specified field.
|
114
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
115
|
+
/// If the field is has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
116
|
+
/// If the field contains a null value, this will fail with an error code of E_FAIL.
|
117
|
+
/// @param[in] field The name of the field to get the value from.
|
118
|
+
/// @param[out] value The field's value.
|
119
|
+
/// @return Error code indicating whether the method finished successfully.
|
120
|
+
fgdbError GetShort(const std::wstring& field, short& value) const;
|
121
|
+
|
122
|
+
/// Assigns a short value to the specified field.
|
123
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
124
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
125
|
+
/// @param[in] field The name of the field to assign the value to.
|
126
|
+
/// @param[out] value The value to assign to the field.
|
127
|
+
/// @return Error code indicating whether the method finished successfully.
|
128
|
+
fgdbError SetShort(const std::wstring& field, short value);
|
129
|
+
|
130
|
+
/// Gets an integer value from the specified field.
|
131
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
132
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
133
|
+
/// If the field contains a null value, this will fail with an error code of E_FAIL.
|
134
|
+
/// @param[in] field The name of the field to get the value from.
|
135
|
+
/// @param[out] value The field's value.
|
136
|
+
/// @return Error code indicating whether the method finished successfully.
|
137
|
+
fgdbError GetInteger(const std::wstring& field, int32& value) const;
|
138
|
+
|
139
|
+
/// Assigns an integer value to the specified field.
|
140
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
141
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
142
|
+
/// @param[in] field The name of the field to assign the value to.
|
143
|
+
/// @param[in] value The value to assign to the field.
|
144
|
+
/// @return Error code indicating whether the method finished successfully.
|
145
|
+
fgdbError SetInteger(const std::wstring& field, int32 value);
|
146
|
+
|
147
|
+
/// Gets a float value from the specified field.
|
148
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
149
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
150
|
+
/// If the field contains a null value, this will fail with an error code of E_FAIL.
|
151
|
+
/// @param[in] field The name of the field to get the value from.
|
152
|
+
/// @param[out] value The field's value.
|
153
|
+
/// @return Error code indicating whether the method finished successfully.
|
154
|
+
fgdbError GetFloat(const std::wstring& field, float& value) const;
|
155
|
+
|
156
|
+
/// Assigns a float value to the specified field.
|
157
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
158
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
159
|
+
/// @param[in] field The name of the field to assign the value to.
|
160
|
+
/// @param[in] value The value to assign to the field.
|
161
|
+
/// @return Error code indicating whether the method finished successfully.
|
162
|
+
fgdbError SetFloat(const std::wstring& field, float value);
|
163
|
+
|
164
|
+
/// Gets a double value from the specified field.
|
165
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
166
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
167
|
+
/// If the field contains a null value, this will fail with an error code of E_FAIL.
|
168
|
+
/// @param[in] field The name of the field to get the value from.
|
169
|
+
/// @param[out] value The field's value.
|
170
|
+
/// @return Error code indicating whether the method finished successfully.
|
171
|
+
fgdbError GetDouble(const std::wstring& field, double& value) const;
|
172
|
+
|
173
|
+
/// Assigns a double value to the specified field.
|
174
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
175
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
176
|
+
/// @param[in] field The name of the field to assign the value to.
|
177
|
+
/// @param[in] value The value to assign to the field.
|
178
|
+
/// @return Error code indicating whether the method finished successfully.
|
179
|
+
fgdbError SetDouble(const std::wstring& field, double value);
|
180
|
+
|
181
|
+
/// Gets a date/time value from the specified field.
|
182
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
183
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
184
|
+
/// If the field contains a null value, this will fail with an error code of E_FAIL.
|
185
|
+
/// @param[in] field The name of the field to get the value from.
|
186
|
+
/// @param[out] value The field's value.
|
187
|
+
/// @return Error code indicating whether the method finished successfully.
|
188
|
+
fgdbError GetDate(const std::wstring& field, struct tm& value) const;
|
189
|
+
|
190
|
+
/// Assigns a date/time value to the specified field.
|
191
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
192
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
193
|
+
/// @param[in] field The name of the field to get the value from.
|
194
|
+
/// @param[in] value The value to assign to the field.
|
195
|
+
/// @return Error code indicating whether the method finished successfully.
|
196
|
+
fgdbError SetDate(const std::wstring& field, const struct tm& value);
|
197
|
+
|
198
|
+
/// Gets a string value from the specified field.
|
199
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
200
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
201
|
+
/// If the field contains a null value, this will fail with an error code of E_FAIL.
|
202
|
+
/// @param[in] field The name of the field to get the value from.
|
203
|
+
/// @param[out] value The field's value.
|
204
|
+
/// @return Error code indicating whether the method finished successfully.
|
205
|
+
fgdbError GetString(const std::wstring& field, std::wstring& value) const;
|
206
|
+
|
207
|
+
/// Assigns a string value to the specified field.
|
208
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
209
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
210
|
+
/// @param[in] field The name of the field to assign the value to.
|
211
|
+
/// @param[in] value The value to assign to the field.
|
212
|
+
/// @return Error code indicating whether the method finished successfully.
|
213
|
+
fgdbError SetString(const std::wstring& field, const std::wstring& value);
|
214
|
+
|
215
|
+
/// Gets a GUID value from the specified field.
|
216
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
217
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
218
|
+
/// If the field contains a null value, this will fail with an error code of E_FAIL.
|
219
|
+
/// @param[in] field The name of the field to get the value from.
|
220
|
+
/// @param[out] value The field's value.
|
221
|
+
/// @return Error code indicating whether the method finished successfully.
|
222
|
+
fgdbError GetGUID(const std::wstring& field, Guid& value) const;
|
223
|
+
|
224
|
+
/// Assigns a GUID value to the specified field.
|
225
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
226
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
227
|
+
/// @param[in] field The name of the field to assign the value to.
|
228
|
+
/// @param[in] value The value to assign to the field.
|
229
|
+
/// @return Error code indicating whether the method finished successfully.
|
230
|
+
fgdbError SetGUID(const std::wstring& field, const Guid& value);
|
231
|
+
|
232
|
+
/// Gets an XML value from the specified field.
|
233
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
234
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
235
|
+
/// If the field contains a null value, this will fail with an error code of E_FAIL.
|
236
|
+
/// @param[in] field The name of the field to get the value from.
|
237
|
+
/// @param[out] value The field's value.
|
238
|
+
/// @return Error code indicating whether the method finished successfully.
|
239
|
+
fgdbError GetXML(const std::wstring& field, std::string& value) const;
|
240
|
+
|
241
|
+
/// Assigns an XML value to the specified field.
|
242
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
243
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
244
|
+
/// @param[in] field The name of the field to assign the value to.
|
245
|
+
/// @param[in] value The value to assign to the field.
|
246
|
+
/// @return Error code indicating whether the method finished successfully.
|
247
|
+
fgdbError SetXML(const std::wstring& field, const std::string& value);
|
248
|
+
|
249
|
+
/// Gets a raster from the specified field.
|
250
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
251
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
252
|
+
/// @param[in] field The name of the field to get the value from.
|
253
|
+
/// @param[out] raster The field's value.
|
254
|
+
/// @return Error code indicating whether the method finished successfully.
|
255
|
+
fgdbError GetRaster(const std::wstring& field, Raster& raster) const;
|
256
|
+
|
257
|
+
/// Assigns a raster to the specified field.
|
258
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
259
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
260
|
+
/// @param[in] field The name of the field to assign the value to.
|
261
|
+
/// @param[in] raster The value to assign to the field.
|
262
|
+
/// @return Error code indicating whether the method finished successfully.
|
263
|
+
fgdbError SetRaster(const std::wstring& field, const Raster& raster);
|
264
|
+
|
265
|
+
/// Gets a byte array from the specified field.
|
266
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
267
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
268
|
+
/// If the field contains a null value, this will fail with an error code of E_FAIL.
|
269
|
+
/// @param[in] field The name of the field to get the value from.
|
270
|
+
/// @param[out] binaryBuf The field's value.
|
271
|
+
/// @return Error code indicating whether the method finished successfully.
|
272
|
+
fgdbError GetBinary(const std::wstring& field, ByteArray& binaryBuf) const;
|
273
|
+
|
274
|
+
/// Assigns a byte array to the specified field.
|
275
|
+
/// If the field does not exist, this will fail with an error code of -2147219885 (An expected Field was not found or could not be retrieved properly).
|
276
|
+
/// If the field has an incompatible data type, this will fail with an error code of -2147217395 (The value type is incompatible with the field type).
|
277
|
+
/// @param[in] field The name of the field to assign the value to.
|
278
|
+
/// @param[in] binaryBuf The value to assign to the field.
|
279
|
+
/// @return Error code indicating whether the method finished successfully.
|
280
|
+
fgdbError SetBinary(const std::wstring& field, const ByteArray& binaryBuf);
|
281
|
+
//@}
|
282
|
+
|
283
|
+
/// @name Field properties
|
284
|
+
//@{
|
285
|
+
/// Return information about the fields in the row.
|
286
|
+
/// @param[out] fieldInfo The field information.
|
287
|
+
/// @return Error code indicating whether the method finished successfully.
|
288
|
+
fgdbError GetFieldInformation(FieldInfo& fieldInfo) const;
|
289
|
+
|
290
|
+
/// Returns an array of FieldDef objects of the table's field collection.
|
291
|
+
/// @param[out] fieldDefs An array of FieldDef objects containing a collection of field definitions.
|
292
|
+
/// @return Error code indicating whether the method finished successfully.
|
293
|
+
fgdbError GetFields(std::vector<FieldDef>& fieldDefs) const;
|
294
|
+
//@}
|
295
|
+
|
296
|
+
/// @name Constructors and Destructors
|
297
|
+
//@{
|
298
|
+
/// The class constructor.
|
299
|
+
Row();
|
300
|
+
|
301
|
+
/// The class destructor.
|
302
|
+
~Row();
|
303
|
+
//@}
|
304
|
+
|
305
|
+
private:
|
306
|
+
|
307
|
+
/// @cond PRIVATE
|
308
|
+
fgdbError SetupRow(IFields* pFields, FieldValues* pFieldValues, bool takeOwnership);
|
309
|
+
bool IsSetup() const;
|
310
|
+
|
311
|
+
fgdbError FindField(const std::wstring& field, int& fieldNumber, FieldType& fieldType) const;
|
312
|
+
fgdbError GetFieldIsNullable(int fieldNumber, bool& isNullable) const;
|
313
|
+
|
314
|
+
fgdbError SetOID(int32 objectID);
|
315
|
+
fgdbError SetGlobalID(const Guid& globalID);
|
316
|
+
|
317
|
+
int m_numFields;
|
318
|
+
int* m_pFieldMap;
|
319
|
+
FieldValue* m_pValues;
|
320
|
+
int m_oidFieldNumber;
|
321
|
+
int m_globalIDFieldNumber;
|
322
|
+
int m_shpFieldNumber;
|
323
|
+
IFields* m_pFields;
|
324
|
+
|
325
|
+
FieldValues* m_pFieldValues;
|
326
|
+
bool m_ownsFieldValues;
|
327
|
+
|
328
|
+
friend class EnumRows;
|
329
|
+
friend class Table;
|
330
|
+
|
331
|
+
Row(const Row&) { }
|
332
|
+
Row& operator=(const Row&) { return *this; }
|
333
|
+
/// @endcond
|
334
|
+
};
|
335
|
+
|
336
|
+
}; // namespace FileGDBAPI
|
@@ -0,0 +1,296 @@
|
|
1
|
+
//
|
2
|
+
// Table.h
|
3
|
+
//
|
4
|
+
|
5
|
+
/*
|
6
|
+
COPYRIGHT � 2012 ESRI
|
7
|
+
TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
|
8
|
+
Unpublished material - all rights reserved under the
|
9
|
+
Copyright Laws of the United States and applicable international
|
10
|
+
laws, treaties, and conventions.
|
11
|
+
|
12
|
+
For additional information, contact:
|
13
|
+
Environmental Systems Research Institute, Inc.
|
14
|
+
Attn: Contracts and Legal Services Department
|
15
|
+
380 New York Street
|
16
|
+
Redlands, California, 92373
|
17
|
+
USA
|
18
|
+
|
19
|
+
email: contracts@esri.com
|
20
|
+
*/
|
21
|
+
|
22
|
+
#pragma once
|
23
|
+
|
24
|
+
#include <string>
|
25
|
+
#include <vector>
|
26
|
+
|
27
|
+
#ifndef EXPORT_FILEGDB_API
|
28
|
+
# if defined linux || defined __APPLE__
|
29
|
+
# define EXT_FILEGDB_API
|
30
|
+
# else
|
31
|
+
# define EXT_FILEGDB_API _declspec(dllimport)
|
32
|
+
# endif
|
33
|
+
#else
|
34
|
+
# if defined linux || defined __APPLE__
|
35
|
+
# define EXT_FILEGDB_API __attribute__((visibility("default")))
|
36
|
+
# else
|
37
|
+
# define EXT_FILEGDB_API _declspec(dllexport)
|
38
|
+
# endif
|
39
|
+
#endif
|
40
|
+
|
41
|
+
#include "FileGDBCore.h"
|
42
|
+
|
43
|
+
class Datafile;
|
44
|
+
class AutoLock;
|
45
|
+
|
46
|
+
namespace FileGDBAPI
|
47
|
+
{
|
48
|
+
|
49
|
+
class EnumRows;
|
50
|
+
class Envelope;
|
51
|
+
class Row;
|
52
|
+
class Geodatabase;
|
53
|
+
class FieldInfo;
|
54
|
+
class IndexDef;
|
55
|
+
class FieldDef;
|
56
|
+
|
57
|
+
/// Provides methods to work with tables, such as querying and modifying both schema and data.
|
58
|
+
class EXT_FILEGDB_API Table
|
59
|
+
{
|
60
|
+
public:
|
61
|
+
|
62
|
+
/// @name Schema
|
63
|
+
//@{
|
64
|
+
/// Gets the table's definition as an XML document.
|
65
|
+
/// @param[out] tableDef An XML document than defines the table's schema.
|
66
|
+
/// @return Error code indicating whether the method finished successfully.
|
67
|
+
fgdbError GetDefinition(std::string& tableDef) const;
|
68
|
+
|
69
|
+
/// Gets the table's metadata as XML.
|
70
|
+
/// @param[out] documentation The table's metadata as XML.
|
71
|
+
/// @return Error code indicating whether the method finished successfully.
|
72
|
+
fgdbError GetDocumentation(std::string& documentation) const;
|
73
|
+
|
74
|
+
/// Assigns metadata to the table.
|
75
|
+
/// @param[in] documentation An XML document that will be the table's metadata.
|
76
|
+
/// @return Error code indicating whether the method finished successfully.
|
77
|
+
fgdbError SetDocumentation(const std::string& documentation);
|
78
|
+
|
79
|
+
/// Return information about the fields in the table.
|
80
|
+
/// @param[out] fieldInfo The field information.
|
81
|
+
/// @return Error code indicating whether the method finished successfully.
|
82
|
+
fgdbError GetFieldInformation(FieldInfo& fieldInfo) const;
|
83
|
+
|
84
|
+
/// Returns an array of FieldDef objects of the table's field collection.
|
85
|
+
/// @param[out] fieldDefs An array of FieldDef objects containing a collection of field definitions.
|
86
|
+
/// @return Error code indicating whether the method finished successfully.
|
87
|
+
fgdbError GetFields(std::vector<FieldDef>& fieldDefs) const;
|
88
|
+
|
89
|
+
/// Adds a field to the table.
|
90
|
+
/// If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).<br/>
|
91
|
+
/// If you are adding an OBJECTID field and one already exists, a -2147219707 (The Fields collection contained multiple OID fields)
|
92
|
+
/// error will be returned. Only one OBJECTID field is allowed.<br/>
|
93
|
+
/// If you are adding an GLOBALID field and one already exists, a -2147219703 (The Fields collection contained multiple Global ID fields)
|
94
|
+
/// error will be returned. Only one GLOBALID field is allowed.<br/>
|
95
|
+
/// If you attempt to add a NOT NULLABLE field to a table already contains rows,
|
96
|
+
/// a -2147219879 (The field is not nullable) will be returned. <br/>
|
97
|
+
/// If the field already exists, a -2147219884 (The Field already exists) will be returned.<br/>
|
98
|
+
/// <a href="esriFieldTypes.txt">FieldTypes</a> <a href="Field.xml">XML</a>
|
99
|
+
/// @param[in] fieldDef An XML document defining the field's properties.
|
100
|
+
/// @return Error code indicating whether the method finished successfully.
|
101
|
+
fgdbError AddField(const std::string& fieldDef);
|
102
|
+
|
103
|
+
/// Adds a field to the table.
|
104
|
+
/// @param[in] fieldDef A FieldDef object defining the field's properties.
|
105
|
+
/// @return Error code indicating whether the method finished successfully.
|
106
|
+
fgdbError AddField(const FieldDef& fieldDef);
|
107
|
+
|
108
|
+
/// Modifies a field in the table.
|
109
|
+
/// If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).<br/>
|
110
|
+
/// @param[in] fieldDef An XML document defining the field's properties.
|
111
|
+
/// @return Error code indicating whether the method finished successfully.
|
112
|
+
fgdbError AlterField(const std::string& fieldDef);
|
113
|
+
|
114
|
+
/// Deletes a field from the table.
|
115
|
+
/// If the field does not exist, an -2147219885 (An expected Field was not found or could not be retrieved properly) error will be returned.<br/>
|
116
|
+
/// @param[in] fieldName The name of the field to delete.
|
117
|
+
/// @return Error code indicating whether the method finished successfully.
|
118
|
+
fgdbError DeleteField(const std::wstring& fieldName);
|
119
|
+
|
120
|
+
/// Returns an XML definition of the table's index collection.
|
121
|
+
/// @param[out] indexDefs An XML document containing a collection of index definitions.
|
122
|
+
/// @return Error code indicating whether the method finished successfully.
|
123
|
+
fgdbError GetIndexes(std::vector<std::string>& indexDefs) const;
|
124
|
+
|
125
|
+
/// Returns an array of IndexDef objects of the table's index collection.
|
126
|
+
/// @param[out] indexDefs An array of IndexDef objects containing a collection of index definitions.
|
127
|
+
/// @return Error code indicating whether the method finished successfully.
|
128
|
+
fgdbError GetIndexes(std::vector<IndexDef>& indexDefs) const;
|
129
|
+
|
130
|
+
/// Adds an index to the table.
|
131
|
+
/// If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).<br/>
|
132
|
+
/// <a href="Index.xml">XML</a>
|
133
|
+
/// @param[in] indexDef An XML document defining the index's properties.
|
134
|
+
/// @return Error code indicating whether the method finished successfully.
|
135
|
+
fgdbError AddIndex(const std::string& indexDef);
|
136
|
+
|
137
|
+
/// Adds an index to the table.
|
138
|
+
/// @param[in] indexDef An IndexDef object defining the index's properties.
|
139
|
+
/// @return Error code indicating whether the method finished successfully.
|
140
|
+
fgdbError AddIndex(const IndexDef& indexDef);
|
141
|
+
|
142
|
+
/// Deletes an index from the table.
|
143
|
+
/// If the index is not found, an -2147219629 (The index was not found) error will be returned.<br/>
|
144
|
+
/// @param[in] indexName The name of the index to delete.
|
145
|
+
/// @return Error code indicating whether the method finished successfully.
|
146
|
+
fgdbError DeleteIndex(const std::wstring& indexName);
|
147
|
+
|
148
|
+
/// Creates a new subtype to the table.
|
149
|
+
/// If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).<br/>
|
150
|
+
/// <a href="SubType.xml">XML</a>
|
151
|
+
/// @param[in] subtypeDef An XML document defining the subtype's properties.
|
152
|
+
/// @return Error code indicating whether the method finished successfully.
|
153
|
+
fgdbError CreateSubtype(const std::string& subtypeDef);
|
154
|
+
|
155
|
+
/// Modifies an existing subtype of the table.
|
156
|
+
/// If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).<br/>
|
157
|
+
/// @param[in] subtypeDef An XML document defining the subtype's properties.
|
158
|
+
/// @return Error code indicating whether the method finished successfully.
|
159
|
+
fgdbError AlterSubtype(const std::string& subtypeDef);
|
160
|
+
|
161
|
+
/// Deletes a subtype from the table.
|
162
|
+
/// @param[in] subtypeName The name of the subtype to delete.
|
163
|
+
/// @return Error code indicating whether the method finished successfully.
|
164
|
+
fgdbError DeleteSubtype(const std::wstring& subtypeName);
|
165
|
+
|
166
|
+
/// Enables subtypes on a table.
|
167
|
+
/// If the XML is not UTF-8 encoded, create will fail with an error code of -2147024809 (Invalid function arguments).<br/>
|
168
|
+
/// <a href="esriFieldTypes.txt">FieldTypes</a> <a href="Field.xml">XML</a>
|
169
|
+
/// @param[in] subtypeFieldName The field to use as the subtype field.
|
170
|
+
/// @param[in] subtypeDef The field to use as the subtype Def.
|
171
|
+
/// @return Error code indicating whether the method finished successfully.
|
172
|
+
fgdbError EnableSubtypes(const std::wstring& subtypeFieldName, const std::string& subtypeDef);
|
173
|
+
|
174
|
+
/// Returns the default subtype code.
|
175
|
+
/// @param[out] defaultCode The table's default subtype code.
|
176
|
+
/// @return Error code indicating whether the method finished successfully.
|
177
|
+
fgdbError GetDefaultSubtypeCode(int& defaultCode) const;
|
178
|
+
|
179
|
+
/// Sets the default subtype code.
|
180
|
+
/// @param[out] defaultCode The code to assign as the default subtype code.
|
181
|
+
/// @return Error code indicating whether the method finished successfully.
|
182
|
+
fgdbError SetDefaultSubtypeCode(int defaultCode);
|
183
|
+
|
184
|
+
/// Drops the table's subtypes.
|
185
|
+
/// @return Error code indicating whether the method finished successfully.
|
186
|
+
fgdbError DisableSubtypes();
|
187
|
+
//@}
|
188
|
+
|
189
|
+
/// @name Data
|
190
|
+
//@{
|
191
|
+
/// Performs a spatial query (envelope intersects) on the table.
|
192
|
+
/// @param[in] subfields (Optional) The fields that should be fetched by the query's returned rows. Must
|
193
|
+
/// include a comma delimited list of fields or a "*". Passing in blank will return a -2147220985 (An invalid SQL statement was used) error.
|
194
|
+
/// @param[in] whereClause (Optional) Attribute constraints to apply to the query.
|
195
|
+
/// @param[in] envelope The spatial extent of the query.
|
196
|
+
/// @param[in] recycling Indicates whether row memory should be recycled.
|
197
|
+
/// @param[out] rows The results of the query.
|
198
|
+
/// @return Error code indicating whether the method finished successfully.
|
199
|
+
fgdbError Search(const std::wstring& subfields, const std::wstring& whereClause, const Envelope& envelope, bool recycling, EnumRows& rows);
|
200
|
+
|
201
|
+
/// Performs an attribute query on the table.
|
202
|
+
/// @param[in] subfields (Optional) The fields that should be fetched by the query's returned rows. Must
|
203
|
+
/// include a comma delimited list of fields or a "*". A blank will return a -2147220985 (An invalid SQL statement was used) error.
|
204
|
+
/// @param[in] whereClause (Optional) Attribute constraints to apply to the query.
|
205
|
+
/// @param[in] recycling Indicates whether row memory should be recycled.
|
206
|
+
/// @param[out] rows The results of the query.
|
207
|
+
/// @return Error code indicating whether the method finished successfully.
|
208
|
+
fgdbError Search(const std::wstring& subfields, const std::wstring& whereClause, bool recycling, EnumRows& rows);
|
209
|
+
|
210
|
+
/// Creates a new row in memory for the table.
|
211
|
+
/// @param[out] row The newly-created row.
|
212
|
+
/// @return Error code indicating whether the method finished successfully.
|
213
|
+
fgdbError CreateRowObject(Row& row);
|
214
|
+
|
215
|
+
/// Inserts a newly-created and populated row into the table. When bulk inserting rows use LoadOnlyMode and SetWriteLock\FreeWriteLock to improve performance.
|
216
|
+
/// @param[in] row The row to insert.
|
217
|
+
/// @return Error code indicating whether the method finished successfully.
|
218
|
+
fgdbError Insert(Row& row);
|
219
|
+
|
220
|
+
/// Updates an existing row in the table.
|
221
|
+
/// @param[in] row The row to update.
|
222
|
+
/// @return Error code indicating whether the method finished successfully.
|
223
|
+
fgdbError Update(Row& row);
|
224
|
+
|
225
|
+
/// Deletes a row from the table.
|
226
|
+
/// @param[in] row The row to delete.
|
227
|
+
/// @return Error code indicating whether the method finished successfully.
|
228
|
+
fgdbError Delete(Row& row);
|
229
|
+
|
230
|
+
/// Indicates whether the table should be edited.
|
231
|
+
/// @param[out] isEditable True if the table can safely be edited.
|
232
|
+
/// @return Error code indicating whether the method finished successfully.
|
233
|
+
fgdbError IsEditable(bool& isEditable);
|
234
|
+
|
235
|
+
/// Returns the number of rows in the table.
|
236
|
+
/// @param[out] rowCount The number of rows in the table.
|
237
|
+
/// @return Error code indicating whether the method finished successfully.
|
238
|
+
fgdbError GetRowCount(int& rowCount) const;
|
239
|
+
|
240
|
+
/// Returns the extent of the feature class.
|
241
|
+
/// If the table is not a feature class an error of 1 will be returned.
|
242
|
+
/// @param[out] extent The extent of the feature class.
|
243
|
+
/// @return Error code indicating whether the method finished successfully.
|
244
|
+
fgdbError GetExtent(Envelope& extent) const;
|
245
|
+
|
246
|
+
/// Sets a write lock on a table.
|
247
|
+
/// This should be used when performing bulk updates and inserts. Otherwise a
|
248
|
+
/// lock will be created for each update or insert. Should be followed by a call
|
249
|
+
/// to FreeWriteLock.
|
250
|
+
fgdbError SetWriteLock(void);
|
251
|
+
|
252
|
+
/// Frees a write lock on a table.
|
253
|
+
/// This should be used when performing bulk updates and inserts. Otherwise a
|
254
|
+
/// lock will be created for each update or insert. Should be preceded by a call
|
255
|
+
/// to SetWriteLock.
|
256
|
+
fgdbError FreeWriteLock(void);
|
257
|
+
|
258
|
+
/// Begin or End load only mode.
|
259
|
+
/// @param[in] loadOnlyMode true to begin LoadOnlyMode, false to end.
|
260
|
+
fgdbError LoadOnlyMode(bool loadOnlyMode);
|
261
|
+
//@}
|
262
|
+
|
263
|
+
/// @name Constructors and destructors
|
264
|
+
//@{
|
265
|
+
/// The class constructor.
|
266
|
+
Table();
|
267
|
+
|
268
|
+
/// The class destructor.
|
269
|
+
~Table();
|
270
|
+
//@}
|
271
|
+
|
272
|
+
private:
|
273
|
+
|
274
|
+
/// @cond PRIVATE
|
275
|
+
fgdbError SetupTable(const std::wstring& path, Geodatabase* pGeodatabase, Datafile* pDatafile);
|
276
|
+
bool IsSetup() const;
|
277
|
+
|
278
|
+
#pragma warning(push)
|
279
|
+
#pragma warning(disable : 4251)
|
280
|
+
|
281
|
+
Geodatabase* m_pGeodatabase;
|
282
|
+
Datafile* m_pDatafile;
|
283
|
+
std::wstring m_Path;
|
284
|
+
AutoLock* m_pWriteLock;
|
285
|
+
int m_isEditable;
|
286
|
+
|
287
|
+
#pragma warning(pop)
|
288
|
+
|
289
|
+
friend class Geodatabase;
|
290
|
+
|
291
|
+
Table(const Table&) { }
|
292
|
+
Table& operator=(const Table&) { return *this; }
|
293
|
+
/// @endcond
|
294
|
+
};
|
295
|
+
|
296
|
+
}; // namespace FileGDBAPI
|