filegdb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +18 -0
  3. data/.travis.yml +4 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE +28 -0
  6. data/Makefile +12 -0
  7. data/README.md +27 -0
  8. data/Rakefile +24 -0
  9. data/ext/filegdb/base.hpp +126 -0
  10. data/ext/filegdb/extconf.rb +13 -0
  11. data/ext/filegdb/filegdb.cpp +27 -0
  12. data/ext/filegdb/filegdb.hpp +44 -0
  13. data/ext/filegdb/filegdb/include/FileGDBAPI.h +30 -0
  14. data/ext/filegdb/filegdb/include/FileGDBCore.h +226 -0
  15. data/ext/filegdb/filegdb/include/Geodatabase.h +291 -0
  16. data/ext/filegdb/filegdb/include/GeodatabaseManagement.h +79 -0
  17. data/ext/filegdb/filegdb/include/Raster.h +101 -0
  18. data/ext/filegdb/filegdb/include/Row.h +336 -0
  19. data/ext/filegdb/filegdb/include/Table.h +296 -0
  20. data/ext/filegdb/filegdb/include/Util.h +936 -0
  21. data/ext/filegdb/filegdb/include/make.include +98 -0
  22. data/ext/filegdb/filegdb/lib/libFileGDBAPI.dylib +0 -0
  23. data/ext/filegdb/filegdb/lib/libFileGDBAPI.so +0 -0
  24. data/ext/filegdb/filegdb/lib/libfgdbunixrtl.dylib +0 -0
  25. data/ext/filegdb/filegdb/lib/libfgdbunixrtl.so +0 -0
  26. data/ext/filegdb/geodatabase.cpp +529 -0
  27. data/ext/filegdb/geodatabase.hpp +53 -0
  28. data/ext/filegdb/multi_point_shape_buffer.cpp +254 -0
  29. data/ext/filegdb/multi_point_shape_buffer.hpp +35 -0
  30. data/ext/filegdb/point.cpp +44 -0
  31. data/ext/filegdb/point.hpp +31 -0
  32. data/ext/filegdb/point_shape_buffer.cpp +162 -0
  33. data/ext/filegdb/point_shape_buffer.hpp +32 -0
  34. data/ext/filegdb/row.cpp +222 -0
  35. data/ext/filegdb/row.hpp +37 -0
  36. data/ext/filegdb/shape_buffer.cpp +19 -0
  37. data/ext/filegdb/shape_buffer.hpp +20 -0
  38. data/ext/filegdb/shape_buffer_base.hpp +33 -0
  39. data/ext/filegdb/table.cpp +65 -0
  40. data/ext/filegdb/table.hpp +29 -0
  41. data/ext/filegdb/util.cpp +16 -0
  42. data/filegdb.gemspec +23 -0
  43. data/lib/filegdb.rb +2 -0
  44. data/lib/filegdb/version.rb +3 -0
  45. data/spec/data/domain_definition.xml +22 -0
  46. data/spec/data/domain_definition_altered.xml +26 -0
  47. data/spec/data/feature_dataset_definition.xml +25 -0
  48. data/spec/data/table_definition.xml +177 -0
  49. data/spec/filegdb_spec.rb +36 -0
  50. data/spec/geodatabase_spec.rb +107 -0
  51. data/spec/multi_point_shape_buffer_spec.rb +58 -0
  52. data/spec/point_shape_buffer_spec.rb +39 -0
  53. data/spec/row_spec.rb +76 -0
  54. data/spec/spec_helper.rb +41 -0
  55. metadata +153 -0
@@ -0,0 +1,98 @@
1
+ # Variables used in this file:
2
+ # CFG - The build mode; Release or Debug.
3
+ # Default value if unspecified - Release.
4
+ # ARCH - The target bitset for the architecture, 32 or 64.
5
+ # Default value if unspecified - Default for your machine as
6
+ # reported by 'uname -m'.
7
+ #
8
+ # Target option examples:
9
+ # Linux 32-bit on 32-bit Linux - make
10
+ # Linux 32-bit on 64-bit Linux - make ARCH=32
11
+ # Linux 64-bit on 64-bit Linux - make
12
+ # Mac 64-bit on 64-bit Mac - make
13
+ #
14
+ # Supported build configurations:
15
+ # Linux 32-bit, 64-bit
16
+ # Mac 64-bit
17
+
18
+ ifndef CFG
19
+ CFG=Release
20
+ endif
21
+
22
+ CXDEF=-DUNICODE -D_UNICODE -DUNIX -D_REENTRANT -DFILEGDB_API \
23
+ -D__USE_FILE_OFFSET64 -DUNIX_FILEGDB_API -D_FILE_OFFSET_BITS=64\
24
+ -D_LARGEFILE64_SOURCE
25
+
26
+ CFLAGS=-fPIC
27
+
28
+ ifndef OS
29
+ OS := $(shell uname)
30
+ endif
31
+
32
+ # choose default architecture if unspecified
33
+ ifndef ARCH
34
+ ARCH=32
35
+ machineArch := $(shell uname -m)
36
+ ifeq "$(machineArch)" "x86_64"
37
+ ARCH=64
38
+ endif
39
+ endif
40
+
41
+ ifdef API_BUILD
42
+ CFLAGS+=-fvisibility=hidden
43
+
44
+ ifndef RedHat5
45
+ RedHat5 := $(shell grep -s -c 'release 5' /etc/redhat-release)
46
+ endif
47
+
48
+ ifeq "$(RedHat5)" "1"
49
+ CFLAGS+=-Wno-attributes
50
+ endif
51
+ endif
52
+
53
+ ifeq "$(CFG)" "Release"
54
+ ifndef HOST_ARCH
55
+ CFLAGS+=-O3
56
+ endif
57
+ endif
58
+
59
+ ifeq "$(CFG)" "Debug"
60
+ CFLAGS+=-g
61
+ endif
62
+
63
+ ifndef HOST_ARCH
64
+ ifeq "$(ARCH)" "32"
65
+ CFLAGS+=-m32
66
+ LDFLAGS=-m32
67
+ 3PLIBDIR=.
68
+ endif
69
+ ifeq "$(ARCH)" "64"
70
+ CFLAGS+=-m64
71
+ LDFLAGS=-m64
72
+ ifeq "$(OS)" "Darwin"
73
+ 3PLIBDIR=mac/x64
74
+ CFLAGS+=-arch x86_64
75
+ LDFLAGS+=-arch x86_64
76
+ else
77
+ 3PLIBDIR=x64
78
+ endif
79
+ endif
80
+ endif
81
+
82
+ ifndef CX
83
+ CX=g++
84
+ endif
85
+
86
+ CXX=$(CX)
87
+ CXOTHER=-I.
88
+
89
+ SLIBEXT=so
90
+ ifeq "$(OS)" "Darwin"
91
+ SLIBEXT=dylib
92
+ endif
93
+
94
+ AR=ar
95
+ ARFLAGS=-rcs
96
+
97
+ CXX=$(CX)
98
+ CXOTHER=-I.
@@ -0,0 +1,529 @@
1
+
2
+ #include "geodatabase.hpp"
3
+ #include "table.hpp"
4
+
5
+ namespace filegdb {
6
+
7
+ VALUE geodatabase::_klass = Qnil;
8
+
9
+ VALUE geodatabase::klass() {
10
+ return geodatabase::_klass;
11
+ }
12
+
13
+ geodatabase::geodatabase()
14
+ :
15
+ _gdb(NULL),
16
+ _tables()
17
+ {
18
+ }
19
+
20
+ geodatabase::~geodatabase()
21
+ {
22
+ for (std::vector<table *>::iterator it = _tables.begin(); it != _tables.end(); ++it) {
23
+ delete *it;
24
+ }
25
+
26
+ if (_gdb) {
27
+ CloseGeodatabase(*_gdb);
28
+ }
29
+ }
30
+
31
+ void geodatabase::mark() {
32
+ }
33
+
34
+ VALUE geodatabase::create(VALUE klass, VALUE filename) {
35
+ fgdbError hr;
36
+ Geodatabase *gdb = new Geodatabase();
37
+ std::wstring name = to_wstring(RSTRING_PTR(filename));
38
+
39
+ hr = CreateGeodatabase(name, *gdb);
40
+
41
+ if (FGDB_IS_FAILURE(hr)) {
42
+ rb_raise(rb_eRuntimeError, fgdb_error_string(hr));
43
+ }
44
+
45
+ geodatabase *db = new geodatabase();
46
+
47
+ db->_gdb = gdb;
48
+
49
+ return db->wrapped();
50
+ }
51
+
52
+ VALUE geodatabase::open(VALUE klass, VALUE filename) {
53
+ fgdbError hr;
54
+ Geodatabase *gdb = new Geodatabase();
55
+ std::wstring name = to_wstring(RSTRING_PTR(filename));
56
+
57
+ hr = OpenGeodatabase(name, *gdb);
58
+
59
+ if (FGDB_IS_FAILURE(hr)) {
60
+ FGDB_RAISE_ERROR(hr);
61
+ return Qnil;
62
+ }
63
+
64
+ geodatabase *db = new geodatabase();
65
+
66
+ db->_gdb = gdb;
67
+
68
+ return db->wrapped();
69
+ }
70
+
71
+ VALUE geodatabase::delete_database(VALUE klass, VALUE filename) {
72
+ fgdbError hr;
73
+ std::wstring name = to_wstring(RSTRING_PTR(filename));
74
+
75
+ hr = DeleteGeodatabase(name);
76
+
77
+ if (FGDB_IS_FAILURE(hr)) {
78
+ FGDB_RAISE_ERROR(hr);
79
+ return Qnil;
80
+ }
81
+
82
+ return Qnil;
83
+ }
84
+
85
+ VALUE geodatabase::close(VALUE self) {
86
+ fgdbError hr;
87
+
88
+ geodatabase *db = unwrap(self);
89
+
90
+ hr = CloseGeodatabase(*db->_gdb);
91
+
92
+ if (FGDB_IS_FAILURE(hr)) {
93
+ FGDB_RAISE_ERROR(hr);
94
+ return Qnil;
95
+ }
96
+
97
+ db->_value = NULL;
98
+
99
+ return Qnil;
100
+ }
101
+
102
+ VALUE geodatabase::create_table(VALUE self, VALUE table_name, VALUE table_definition) {
103
+ geodatabase *db = unwrap(self);
104
+
105
+ filegdb::table *result = new filegdb::table(db);
106
+
107
+ std::wstring name = to_wstring(RSTRING_PTR(table_name));
108
+ std::string table_def = std::string(RSTRING_PTR(table_definition));
109
+
110
+ fgdbError hr = db->_gdb->CreateTable(table_def, name, result->value());
111
+
112
+ if (FGDB_IS_FAILURE(hr)) {
113
+ delete result;
114
+ FGDB_RAISE_ERROR(hr);
115
+ return Qnil;
116
+ }
117
+
118
+ db->add_dependency(result);
119
+
120
+ return result->wrapped();
121
+ }
122
+
123
+ VALUE geodatabase::create_feature_dataset(VALUE self, VALUE featureDatasetDefinition) {
124
+ CHECK_ARGUMENT_STRING(featureDatasetDefinition);
125
+
126
+ geodatabase *db = unwrap(self);
127
+
128
+ fgdbError hr = db->_gdb->CreateFeatureDataset(std::string(RSTRING_PTR(featureDatasetDefinition)));
129
+
130
+ if (FGDB_IS_FAILURE(hr)) {
131
+ FGDB_RAISE_ERROR(hr);
132
+ return Qnil;
133
+ }
134
+
135
+ return Qnil;
136
+ }
137
+
138
+ VALUE geodatabase::open_table(VALUE self, VALUE table_name) {
139
+ geodatabase *db = unwrap(self);
140
+
141
+ table *result = new filegdb::table(db);
142
+
143
+ std::wstring name = to_wstring(RSTRING_PTR(table_name));
144
+
145
+ fgdbError hr = db->_gdb->OpenTable(name, result->value());
146
+
147
+ if (FGDB_IS_FAILURE(hr)) {
148
+ delete result;
149
+ FGDB_RAISE_ERROR(hr);
150
+ return Qnil;
151
+ }
152
+
153
+ db->add_dependency(result);
154
+
155
+ return result->wrapped();
156
+ }
157
+
158
+ VALUE geodatabase::close_table(VALUE self, VALUE tableObject) {
159
+ geodatabase *db = unwrap(self);
160
+ table *t = table::unwrap(tableObject);
161
+
162
+ fgdbError hr = db->_gdb->CloseTable(t->value());
163
+
164
+ if (FGDB_IS_FAILURE(hr)) {
165
+ FGDB_RAISE_ERROR(hr);
166
+ return Qnil;
167
+ }
168
+
169
+ db->remove_dependency(t);
170
+
171
+ return Qnil;
172
+ }
173
+
174
+ VALUE geodatabase::move(VALUE self, VALUE parentPath, VALUE newParentPath) {
175
+ CHECK_ARGUMENT_STRING(parentPath);
176
+ CHECK_ARGUMENT_STRING(newParentPath);
177
+
178
+ geodatabase *db = unwrap(self);
179
+
180
+ std::wstring wparentPath = to_wstring(RSTRING_PTR(parentPath));
181
+ std::wstring wnewParentPath = to_wstring(RSTRING_PTR(newParentPath));
182
+
183
+ fgdbError hr = db->_gdb->Move(wparentPath, wnewParentPath);
184
+
185
+ if (FGDB_IS_FAILURE(hr)) {
186
+ FGDB_RAISE_ERROR(hr);
187
+ return Qnil;
188
+ }
189
+
190
+ return Qnil;
191
+ }
192
+
193
+ VALUE geodatabase::delete_dataset(VALUE self, VALUE path, VALUE datasetType) {
194
+ CHECK_ARGUMENT_STRING(path);
195
+ CHECK_ARGUMENT_STRING(datasetType);
196
+
197
+ geodatabase *db = unwrap(self);
198
+
199
+ std::wstring wpath = to_wstring(RSTRING_PTR(path));
200
+ std::wstring wdatasetType = to_wstring(RSTRING_PTR(datasetType));
201
+
202
+ fgdbError hr = db->_gdb->Delete(wpath, wdatasetType);
203
+
204
+ if (FGDB_IS_FAILURE(hr)) {
205
+ FGDB_RAISE_ERROR(hr);
206
+ return Qnil;
207
+ }
208
+
209
+ return Qnil;
210
+ }
211
+
212
+ VALUE geodatabase::get_child_datasets(VALUE self, VALUE parent_path, VALUE dataset_type) {
213
+ geodatabase *db = unwrap(self);
214
+
215
+ std::vector<std::wstring> children;
216
+
217
+ std::wstring wparent_name = to_wstring(RSTRING_PTR(parent_path));
218
+ std::wstring wdataset_type = to_wstring(RSTRING_PTR(dataset_type));
219
+
220
+ fgdbError hr = db->_gdb->GetChildDatasets(wparent_name, wdataset_type, children);
221
+
222
+ if (FGDB_IS_FAILURE(hr)) {
223
+ FGDB_RAISE_ERROR(hr);
224
+ return Qnil;
225
+ }
226
+
227
+ VALUE result = rb_ary_new();
228
+
229
+ for (std::vector<wstring>::iterator it = children.begin(); it != children.end(); ++it) {
230
+ VALUE name = rb_str_new2(to_char_array(*it));
231
+ rb_ary_push(result, name);
232
+ }
233
+
234
+ return result;
235
+ }
236
+
237
+ VALUE geodatabase::get_dataset_definition(VALUE self, VALUE path, VALUE dataset_type) {
238
+ geodatabase *db = unwrap(self);
239
+
240
+ std::string definition;
241
+ std::wstring wpath = to_wstring(RSTRING_PTR(path));
242
+ std::wstring wdataset_type = to_wstring(RSTRING_PTR(dataset_type));
243
+
244
+ fgdbError hr = db->_gdb->GetDatasetDefinition(wpath, wdataset_type, definition);
245
+
246
+ if (FGDB_IS_FAILURE(hr)) {
247
+ FGDB_RAISE_ERROR(hr);
248
+ return Qnil;
249
+ }
250
+
251
+ return rb_str_new2(definition.c_str());
252
+ }
253
+
254
+ VALUE geodatabase::get_dataset_documentation(VALUE self, VALUE path, VALUE datasetType) {
255
+ CHECK_ARGUMENT_STRING(path);
256
+ CHECK_ARGUMENT_STRING(datasetType);
257
+
258
+ geodatabase *db = unwrap(self);
259
+
260
+ std::string documentation;
261
+ std::wstring wpath = to_wstring(RSTRING_PTR(path));
262
+ std::wstring wdatasetType = to_wstring(RSTRING_PTR(datasetType));
263
+
264
+ fgdbError hr = db->_gdb->GetDatasetDocumentation(wpath, wdatasetType, documentation);
265
+
266
+ if (FGDB_IS_FAILURE(hr)) {
267
+ FGDB_RAISE_ERROR(hr);
268
+ return Qnil;
269
+ }
270
+
271
+ return rb_str_new2(documentation.c_str());
272
+ }
273
+
274
+ VALUE geodatabase::rename(VALUE self, VALUE path, VALUE datasetType, VALUE newName) {
275
+ CHECK_ARGUMENT_STRING(path);
276
+ CHECK_ARGUMENT_STRING(datasetType);
277
+ CHECK_ARGUMENT_STRING(newName);
278
+
279
+ geodatabase *db = unwrap(self);
280
+
281
+ std::wstring wpath = to_wstring(RSTRING_PTR(path));
282
+ std::wstring wdatasetType = to_wstring(RSTRING_PTR(datasetType));
283
+ std::wstring wnewName = to_wstring(RSTRING_PTR(newName));
284
+
285
+ fgdbError hr = db->_gdb->Rename(wpath, wdatasetType, wnewName);
286
+
287
+ if (FGDB_IS_FAILURE(hr)) {
288
+ FGDB_RAISE_ERROR(hr);
289
+ return Qnil;
290
+ }
291
+
292
+ return Qnil;
293
+ }
294
+
295
+ VALUE geodatabase::get_child_dataset_definitions(VALUE self, VALUE parentPath, VALUE datasetType) {
296
+ CHECK_ARGUMENT_STRING(parentPath);
297
+ CHECK_ARGUMENT_STRING(datasetType);
298
+
299
+ geodatabase *db = unwrap(self);
300
+
301
+ std::vector<std::string> definitions;
302
+ std::wstring wparentPath = to_wstring(RSTRING_PTR(parentPath));
303
+ std::wstring wdatasetType = to_wstring(RSTRING_PTR(datasetType));
304
+
305
+ fgdbError hr = db->_gdb->GetChildDatasetDefinitions(wparentPath, wdatasetType, definitions);
306
+
307
+ if (FGDB_IS_FAILURE(hr)) {
308
+ FGDB_RAISE_ERROR(hr);
309
+ return Qnil;
310
+ }
311
+
312
+ VALUE result = rb_ary_new();
313
+
314
+ for (typename std::vector<string>::iterator it = definitions.begin(); it != definitions.end(); ++it) {
315
+ rb_ary_push(result, rb_str_new2((*it).c_str()));
316
+ }
317
+
318
+ return result;
319
+ }
320
+
321
+ VALUE geodatabase::get_related_dataset_definitions(VALUE self, VALUE path, VALUE relType, VALUE datasetType) {
322
+ CHECK_ARGUMENT_STRING(path);
323
+ CHECK_ARGUMENT_STRING(relType);
324
+ CHECK_ARGUMENT_STRING(datasetType);
325
+
326
+ geodatabase *db = unwrap(self);
327
+
328
+ std::vector<std::string> definitions;
329
+ std::wstring wpath = to_wstring(RSTRING_PTR(path));
330
+ std::wstring wrelType = to_wstring(RSTRING_PTR(relType));
331
+ std::wstring wdatasetType = to_wstring(RSTRING_PTR(datasetType));
332
+
333
+ fgdbError hr = db->_gdb->GetRelatedDatasetDefinitions(wpath, wrelType, wdatasetType, definitions);
334
+
335
+ if (FGDB_IS_FAILURE(hr)) {
336
+ FGDB_RAISE_ERROR(hr);
337
+ return Qnil;
338
+ }
339
+
340
+ VALUE result = rb_ary_new();
341
+
342
+ for (typename std::vector<string>::iterator it = definitions.begin(); it != definitions.end(); ++it) {
343
+ rb_ary_push(result, rb_str_new2((*it).c_str()));
344
+ }
345
+
346
+ return result;
347
+ }
348
+
349
+ VALUE geodatabase::get_dataset_types(VALUE self) {
350
+ geodatabase *db = unwrap(self);
351
+
352
+ std::vector<std::wstring> datasetTypes;
353
+
354
+ fgdbError hr = db->_gdb->GetDatasetTypes(datasetTypes);
355
+
356
+ if (FGDB_IS_FAILURE(hr)) {
357
+ FGDB_RAISE_ERROR(hr);
358
+ return Qnil;
359
+ }
360
+
361
+ VALUE result = rb_ary_new();
362
+
363
+ for (typename std::vector<wstring>::iterator it = datasetTypes.begin(); it != datasetTypes.end(); ++it) {
364
+ rb_ary_push(result, rb_str_new2(to_char_array(*it)));
365
+ }
366
+
367
+ return result;
368
+ }
369
+
370
+ VALUE geodatabase::get_dataset_relationship_types(VALUE self) {
371
+ geodatabase *db = unwrap(self);
372
+
373
+ std::vector<std::wstring> datasetTypes;
374
+
375
+ fgdbError hr = db->_gdb->GetDatasetRelationshipTypes(datasetTypes);
376
+
377
+ if (FGDB_IS_FAILURE(hr)) {
378
+ FGDB_RAISE_ERROR(hr);
379
+ return Qnil;
380
+ }
381
+
382
+ VALUE result = rb_ary_new();
383
+
384
+ for (typename std::vector<wstring>::iterator it = datasetTypes.begin(); it != datasetTypes.end(); ++it) {
385
+ rb_ary_push(result, rb_str_new2(to_char_array(*it)));
386
+ }
387
+
388
+ return result;
389
+ }
390
+
391
+ VALUE geodatabase::get_related_datasets(VALUE self, VALUE path, VALUE relType, VALUE datasetType) {
392
+ CHECK_ARGUMENT_STRING(path);
393
+ CHECK_ARGUMENT_STRING(relType);
394
+ CHECK_ARGUMENT_STRING(datasetType);
395
+
396
+ geodatabase *db = unwrap(self);
397
+
398
+ std::vector<std::wstring> datasets;
399
+ std::wstring wpath = to_wstring(RSTRING_PTR(path));
400
+ std::wstring wrelType = to_wstring(RSTRING_PTR(relType));
401
+ std::wstring wdatasetType = to_wstring(RSTRING_PTR(datasetType));
402
+
403
+ fgdbError hr = db->_gdb->GetRelatedDatasets(wpath, wrelType, wdatasetType, datasets);
404
+
405
+ if (FGDB_IS_FAILURE(hr)) {
406
+ FGDB_RAISE_ERROR(hr);
407
+ return Qnil;
408
+ }
409
+
410
+ VALUE result = rb_ary_new();
411
+
412
+ for (typename std::vector<wstring>::iterator it = datasets.begin(); it != datasets.end(); ++it) {
413
+ rb_ary_push(result, rb_str_new2(to_char_array(*it)));
414
+ }
415
+
416
+ return result;
417
+ }
418
+
419
+ VALUE geodatabase::create_domain(VALUE self, VALUE domainDefinition) {
420
+ CHECK_ARGUMENT_STRING(domainDefinition);
421
+
422
+ geodatabase *db = unwrap(self);
423
+
424
+ fgdbError hr = db->_gdb->CreateDomain(std::string(RSTRING_PTR(domainDefinition)));
425
+
426
+ if (FGDB_IS_FAILURE(hr)) {
427
+ FGDB_RAISE_ERROR(hr);
428
+ return Qnil;
429
+ }
430
+
431
+ return Qnil;
432
+ }
433
+
434
+ VALUE geodatabase::alter_domain(VALUE self, VALUE domainDefinition) {
435
+ CHECK_ARGUMENT_STRING(domainDefinition);
436
+
437
+ geodatabase *db = unwrap(self);
438
+
439
+ fgdbError hr = db->_gdb->AlterDomain(std::string(RSTRING_PTR(domainDefinition)));
440
+
441
+ if (FGDB_IS_FAILURE(hr)) {
442
+ FGDB_RAISE_ERROR(hr);
443
+ return Qnil;
444
+ }
445
+
446
+ return Qnil;
447
+ }
448
+
449
+ VALUE geodatabase::delete_domain(VALUE self, VALUE domainName) {
450
+ CHECK_ARGUMENT_STRING(domainName);
451
+
452
+ geodatabase *db = unwrap(self);
453
+
454
+ fgdbError hr = db->_gdb->DeleteDomain(to_wstring(RSTRING_PTR(domainName)));
455
+
456
+ if (FGDB_IS_FAILURE(hr)) {
457
+ FGDB_RAISE_ERROR(hr);
458
+ return Qnil;
459
+ }
460
+
461
+ return Qnil;
462
+ }
463
+
464
+ VALUE geodatabase::get_domain_definition(VALUE self, VALUE domainName) {
465
+ CHECK_ARGUMENT_STRING(domainName);
466
+
467
+ geodatabase *db = unwrap(self);
468
+
469
+ std::string result;
470
+
471
+ fgdbError hr = db->_gdb->GetDomainDefinition(to_wstring(RSTRING_PTR(domainName)), result);
472
+
473
+ if (FGDB_IS_FAILURE(hr)) {
474
+ FGDB_RAISE_ERROR(hr);
475
+ return Qnil;
476
+ }
477
+
478
+ return rb_str_new2(result.c_str());
479
+ }
480
+
481
+ VALUE geodatabase::get_query_name(VALUE self, VALUE path) {
482
+ CHECK_ARGUMENT_STRING(path);
483
+
484
+ geodatabase *db = unwrap(self);
485
+
486
+ std::wstring result;
487
+
488
+ fgdbError hr = db->_gdb->GetQueryName(to_wstring(RSTRING_PTR(path)), result);
489
+
490
+ if (FGDB_IS_FAILURE(hr)) {
491
+ FGDB_RAISE_ERROR(hr);
492
+ return Qnil;
493
+ }
494
+
495
+ return rb_str_new2(to_char_array(result));
496
+ }
497
+
498
+ void geodatabase::define(VALUE module)
499
+ {
500
+ geodatabase::_klass = rb_define_class_under(module, "Geodatabase", rb_cObject);
501
+ base::define(geodatabase::_klass, false);
502
+ rb_define_singleton_method(geodatabase::_klass, "create", FGDB_METHOD(geodatabase::create), 1);
503
+ rb_define_singleton_method(geodatabase::_klass, "open", FGDB_METHOD(geodatabase::open), 1);
504
+ rb_define_singleton_method(geodatabase::_klass, "delete", FGDB_METHOD(geodatabase::delete_database), 1);
505
+ rb_define_method(geodatabase::_klass, "close", FGDB_METHOD(geodatabase::close), 0);
506
+ rb_define_method(geodatabase::_klass, "create_table", FGDB_METHOD(geodatabase::create_table), 2);
507
+ rb_define_method(geodatabase::_klass, "open_table", FGDB_METHOD(geodatabase::open_table), 1);
508
+ rb_define_method(geodatabase::_klass, "close_table", FGDB_METHOD(geodatabase::close_table), 1);
509
+ rb_define_method(geodatabase::_klass, "get_child_datasets", FGDB_METHOD(geodatabase::get_child_datasets), 2);
510
+ rb_define_method(geodatabase::_klass, "get_dataset_definition", FGDB_METHOD(geodatabase::get_dataset_definition), 2);
511
+ rb_define_method(geodatabase::_klass, "get_dataset_documentation", FGDB_METHOD(geodatabase::get_dataset_documentation), 2);
512
+ rb_define_method(geodatabase::_klass, "get_child_dataset_definitions", FGDB_METHOD(geodatabase::get_child_dataset_definitions), 2);
513
+ rb_define_method(geodatabase::_klass, "get_related_dataset_definitions", FGDB_METHOD(geodatabase::get_child_dataset_definitions), 3);
514
+ rb_define_method(geodatabase::_klass, "get_dataset_types", FGDB_METHOD(geodatabase::get_dataset_types), 0);
515
+ rb_define_method(geodatabase::_klass, "get_dataset_relationship_types", FGDB_METHOD(geodatabase::get_dataset_relationship_types), 0);
516
+ rb_define_method(geodatabase::_klass, "get_related_datasets", FGDB_METHOD(geodatabase::get_related_datasets), 3);
517
+ rb_define_method(geodatabase::_klass, "rename", FGDB_METHOD(geodatabase::rename), 3);
518
+ rb_define_method(geodatabase::_klass, "move", FGDB_METHOD(geodatabase::move), 2);
519
+ rb_define_method(geodatabase::_klass, "create_feature_dataset", FGDB_METHOD(geodatabase::create_feature_dataset), 1);
520
+ rb_define_method(geodatabase::_klass, "delete", FGDB_METHOD(geodatabase::delete_dataset), 2);
521
+ rb_define_method(geodatabase::_klass, "create_domain", FGDB_METHOD(geodatabase::create_domain), 1);
522
+ rb_define_method(geodatabase::_klass, "alter_domain", FGDB_METHOD(geodatabase::alter_domain), 1);
523
+ rb_define_method(geodatabase::_klass, "delete_domain", FGDB_METHOD(geodatabase::delete_domain), 1);
524
+ rb_define_method(geodatabase::_klass, "get_domain_definition", FGDB_METHOD(geodatabase::get_domain_definition), 1);
525
+ rb_define_method(geodatabase::_klass, "get_query_name", FGDB_METHOD(geodatabase::get_query_name), 1);
526
+ }
527
+
528
+ }
529
+