This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 123
/
kdb.i
732 lines (605 loc) · 19.3 KB
/
kdb.i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
/**
* @file
*
* @brief Swig interface file for KDB Ruby bindings
*
* @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
*/
%feature("autodoc", "3");
%define CPPDOCURL "https://doc.libelektra.org/api/latest/html" %enddef
%define DOCSTRING
"This module is a SWIG generated binding for KDB (https://www.libelektra.org),
therefore the module provides wrapper classes to KDBs C++ interface and is
mainly a 1 to 1 relation. However, to provide a more Ruby-style API to KDB,
this module differs to the C++ API in the following way:
* C++ iterators for Key/KeySet are excluded. Instead KeySet implements
a 'each' method and includes 'Enumerable'. Therefore it is very similar to
a Ruby-Array.
* Access to native C-level KDB structures (such as ckdb::Key) is not
possible, as this does not make much sense within Ruby.
* Method names are renamed to follow Ruby naming conventions
* Key and KeySet methods directly modify the underlying Key/KeySet
Please note, this documentation will show C++ types too (e.g. std::string).
"
%enddef
/* docstring for module implemented for swig >= 3.0.18 */
%module(docstring=DOCSTRING) kdb
#pragma SWIG nowarn=317 // Disable warning: Specialization of non-template
#pragma SWIG nowarn=378 // Disable warning: operator!= ignored
%include "attribute.i"
%include "std_string.i"
%include "stdint.i"
%include "exception.i"
%include "std_except.i"
/* add mapping for std::bad_alloc exception */
namespace std {
%std_exception_map(bad_alloc, SWIG_MemoryError);
}
%{
extern "C" {
#include "kdbconfig.h"
#include "kdb.h"
}
#include "keyexcept.hpp"
#include "kdbexcept.hpp"
#include "key.hpp"
#include "keyset.hpp"
#include "kdb.hpp"
using namespace kdb;
%}
%apply long { ssize_t }
/****************************************************************************
*
* kdb.h
*
****************************************************************************/
%constant void *KEY_END = KEY_END;
%constant void *KS_END = KS_END;
%constant const char *VERSION = KDB_VERSION;
%constant const short VERSION_MAJOR = KDB_VERSION_MAJOR;
%constant const short VERSION_MINOR = KDB_VERSION_MINOR;
%constant const short VERSION_PATCH = KDB_VERSION_PATCH;
/* we only care about the enums. ignore the c functions */
%ignore ckdb;
%include "kdb.h"
/****************************************************************************
*
* kdb::Key
*
****************************************************************************/
%feature("autodoc", "Wrapper class for C++ kdb::Key, thus for a full
documentation see " CPPDOCURL "Key.html.
However, to allow a more Ruby way of programming this class differs from
the original C++ class in the following aspects:
- method names follow ruby naming conventions
- variable length argument list (`va_list`) is implemented using Rubys
parameter Hash method.
- getter methods to underlaying Elektra Key (C) are not included
- Key.meta allows access to the meta data key set
- string length methods are not included (e.g. key.getNameSize())
") kdb::Key;
/*
* Exceptions
*/
%exceptionclass kdb::Exception;
%rename("to_s") kdb::Exception::what;
%exceptionclass kdb::KeyInvalidName;
%exceptionclass kdb::KeyException;
%exceptionclass kdb::KeyNotFoundException;
%exceptionclass kdb::KeyTypeException;
%exceptionclass kdb::KeyTypeConversion;
%include "keyexcept.hpp"
/* define which methods are throwing which exceptions */
%catches (kdb::KeyException) kdb::Key::getName;
%catches (kdb::KeyInvalidName) kdb::Key::setName;
%catches (kdb::KeyInvalidName) kdb::Key::addName;
%catches (kdb::KeyInvalidName) kdb::Key::setBaseName;
%catches (kdb::KeyInvalidName) kdb::Key::addBaseName;
%catches (kdb::KeyTypeMismatch, kdb::KeyException) kdb::Key::getString;
%catches (kdb::KeyTypeMismatch, kdb::KeyException) kdb::Key::getBinary;
%catches (kdb::KeyInvalidName) kdb::Key::Key;
/* ignore certain methods */
%feature("autodoc", "Allocate a new Key
The following variants are available:
call-seq:
Kdb::Key.new
Kdb::Key.new keyname
Kdb::Key.new keyname, options-Hash
k = Kdb::Key.new
k = Kdb::Key.new('user:/myapp/config1',
value: 'hello',
owner: 'me',
meta-data1: 'meta')
") kdb::Key::Key;
//%ignore kdb::Key::Key ();
//%ignore kdb::Key::Key (const std::string keyName, ...);
//%ignore kdb::Key::Key (const char *keyName, va_list ap);
%ignore kdb::Key::Key (char const *keyName, ...);
%ignore kdb::Key::Key (ckdb::Key *k);
%ignore kdb::Key::Key (Key &k);
%ignore kdb::Key::Key (Key const &k);
%ignore kdb::Key::operator++;
%ignore kdb::Key::operator--;
%ignore kdb::Key::operator=;
%ignore kdb::Key::operator->;
%ignore kdb::Key::operator bool;
/* This seems to be implemented in ruby by '! ==' */
%ignore kdb::Key::operator!=;
/* we do not need the raw key */
%ignore kdb::Key::getKey;
%ignore kdb::Key::operator*;
%ignore kdb::Key::release;
/* we do not need the string sizes functions, since the give wrong
* (size + 1) size info */
%ignore kdb::Key::getNameSize;
%ignore kdb::Key::getBaseNameSize;
%ignore kdb::Key::getStringSize;
/* kdb::Key::getBinarySize could be useful */
/* predicate methods rename to "is_xxx?" and return Rubys boolean */
%predicate kdb::Key::isValid;
%predicate kdb::Key::isSystem;
%predicate kdb::Key::isUser;
%predicate kdb::Key::isCascading;
%predicate kdb::Key::isSpec;
%predicate kdb::Key::isProc;
%predicate kdb::Key::isDir;
%predicate kdb::Key::isString;
%predicate kdb::Key::isBinary;
%predicate kdb::Key::isBelow;
%predicate kdb::Key::isBelowOrSame;
%predicate kdb::Key::isDirectBelow;
%predicate kdb::Key::hasMeta;
%predicate kdb::Key::isNull;
%predicate kdb::Key::needSync;
/*
* be more Ruby native:
* for all methods, which return a Key, for which Key.is_null? returns true
* (null-key), return NIL instead */
namespace kdb {
%typemap(out) Key {
if ($1.isNull()) {
$result = Qnil;
} else {
$result = SWIG_NewPointerObj(new kdb::Key($1),
SWIGTYPE_p_kdb__Key,
SWIG_POINTER_OWN | 0);
}
}
}
/* rename some methods to meet the Ruby naming conventions */
%rename("name") kdb::Key::getName;
%rename("name=") kdb::Key::setName;
%rename("basename") kdb::Key::getBaseName;
%rename("basename=") kdb::Key::setBaseName;
%rename("add_basename") kdb::Key::addBaseName;
%rename("namespace") kdb::Key::getNamespace;
/* autorename and templates has some problems */
%rename("get") kdb::Key::get<std::string>;
%rename("set") kdb::Key::set<std::string>;
%alias kdb::Key::get<std::string> "value"
%alias kdb::Key::set<std::string> "value="
%rename("set_meta") kdb::Key::setMeta<std::string>;
%rename("get_meta") kdb::Key::getMeta<std::string>;
%alias kdb::Key::setMeta<std::string> "[]="
%alias kdb::Key::getMeta<std::string> "[]"
/* expose Keys meta KeySet
* this allows Ruby-style meta iterator, e.g. k.meta.each ... */
%feature("autodoc", "allows access to the meta data keyset of the
underlaying key, which allows a Ruby-style iteration over metadata:
k.meta.each { |m| puts 'meta data: %s: %s' % [m.name, m.value] }
") kdb::Key::meta;
/* key.meta will return a newly created object Ruby should garbage collect */
%newobject kdb::Key::meta;
%extend kdb::Key {
kdb::KeySet* meta() {
/* create a new KeySet with all meta keys added */
ckdb::KeySet* curMetaKeys = ckdb::keyMeta ($self->getKey ());
kdb::KeySet* metaKeys = new kdb::KeySet();
ckdb::Key* curMeta;
ssize_t it = 0;
while ((curMeta = ckdb::ksAtCursor (curMetaKeys, it++)) != nullptr) {
kdb::Key keyToAppend (curMeta);
metaKeys->append(keyToAppend);
}
return metaKeys;
}
}
/* getMeta Typemap
* This is used to convert the input argument to a Ruby string. In certain
* cases this is useful, to allow passing in Symbols as meta names. */
%typemap(in) (const std::string & metaName) {
// typemap in for getMeta
$input = rb_funcall($input, rb_intern("to_s"), 0, Qnil);
$1 = new std::string(StringValueCStr($input));
}
%typemap(freearg) (const std::string & metaName) {
// typemap in for getMeta
delete $1;
}
/* Typemap for setBinary
* pass raw data pointer of a Ruby String and its length */
%typemap(in) (const void * newBinary, size_t dataSize) {
$1 = (void *) StringValuePtr($input);
$2 = RSTRING_LEN($input);
}
/* 'imitate' va_list as Ruby Hash
*
* "misuse" the exception feature of SWIG to provide a custom
* method invocation. This allows us to pass a Ruby argument hash
* as a va_list. This way, we can imitate the variable argument
* list (and keyword argument) features
*/
%typemap(in) (va_list ap) {
// we expect to be $input to be a Ruby Hash
Check_Type($input, T_HASH);
}
%feature("except") kdb::Key::Key (const char *keyName, va_list ap) {
/* standard method invocation would be:
$action
*/
/* exception features do not have local variables,
so we define them our selfs */
int hash_size = 0;
VALUE keys_arr;
VALUE key;
VALUE val;
int i;
int flags = 0;
/* $input substitution does not here, so we have to reference
input variables directly */
hash_size = NUM2INT(rb_funcall(argv[1], rb_intern("size"), 0, Qnil));
keys_arr = rb_funcall(argv[1], rb_intern("keys"), 0, Qnil);
if (hash_size > 0) {
/* first we check if we can find the "flags" key.
this has to be passed to the kdb::Key constructor already */
for (i = 0; i < hash_size; i++) {
key = rb_ary_entry(keys_arr, i);
val = rb_hash_aref(argv[1], key);
/* convert key to String, in case of being a Symbol */
key = rb_funcall(key, rb_intern("to_s"), 0, Qnil);
/* check for flags and extract them */
if (strcmp("flags", StringValueCStr(key)) == 0) {
Check_Type(val, T_FIXNUM);
flags = NUM2INT(val);
//printf("got flags: %d\n", flags);
}
}
}
/* invoke method
since we can't use arg2 here (is of type va_list)
we have to do it ourself (not very portable)
*/
try {
result = (kdb::Key *)new kdb::Key((char const *)arg1,
KEY_FLAGS, flags,
KEY_END);
} catch (std::bad_alloc &_e) {
SWIG_exception_fail(SWIG_MemoryError, (&_e)->what());
}
DATA_PTR(self) = result;
if (hash_size > 0) {
/* now treat (nearly) all key-value pairs as meta data, thus
assign it to the newly created kdb::Key object */
for (i = 0; i < hash_size; i++) {
key = rb_ary_entry(keys_arr, i);
val = rb_hash_aref(argv[1], key);
key = rb_funcall(key, rb_intern("to_s"), 0, Qnil);
val = rb_funcall(val, rb_intern("to_s"), 0, Qnil);
/* ignore certain keys */
if (strcmp("flags", StringValueCStr(key)) == 0) continue;
/* 'value' has also a special meaning */
if (strcmp("value", StringValueCStr(key)) == 0) {
if (flags & KEY_BINARY) {
result->setBinary(StringValuePtr(val), RSTRING_LEN(val));
} else {
result->setString(StringValueCStr(val));
}
} else {
result->setMeta(StringValueCStr(key), StringValueCStr(val));
}
}
}
}
/* universal 'get' and 'set' (value) methods
*
* This allows the univeral use of get/set methods, while really
* calling get|setBinary|String depending on the current Key
* type */
%feature("except") kdb::Key::get<std::string> {
// redefine our Key::get
/*
$action
*/
if (((kdb::Key const *)arg1)->isBinary()) {
result = ((kdb::Key const *)arg1)->getBinary();
} else {
result = ((kdb::Key const *)arg1)->getString();
}
}
%feature("except") kdb::Key::set<std::string> {
// redefine our Key::set
/*
$action
*/
if (((kdb::Key const *)arg1)->isBinary()) {
arg1->setBinary(StringValuePtr(argv[0]),
RSTRING_LEN(argv[0]));
} else {
arg1->setString(StringValueCStr(argv[0]));
}
}
/*
* Iterators
*/
#define ELEKTRA_WITHOUT_ITERATOR
/*
* Key clonging
*/
%ignore kdb::Key::dup;
%ignore kdb::Key::copy;
%alias kdb::Key::clone() "dup"
/* clone definitely creates a new object, Ruby shall take ownership */
%newobject kdb::Key::clone;
%extend kdb::Key {
kdb::Key *clone() {
kdb::Key *k;
k = new kdb::Key();
k->copy(*$self);
return k;
}
}
/*
* Key callback methods
* (ignore them for now)
*/
%ignore kdb::Key::setCallback;
%ignore kdb::Key::getFunc;
/*
* spaceship operator, useful for sorting methods
*/
%feature("autodoc", "<=>(Key comp) -> int
aliased to '<=>', implemented for sorting operations.
k1 < k2 : -1
k1 == k2 : 0
k1 > k2 : 1
") kdb::Key::spaceship;
/* this doesn't work here. "Can't wrap unless renamed to a valid identifier"
* %rename("<=>") kdb::Key::spaceship; */
%alias kdb::Key::spaceship "<=>"
%extend kdb::Key {
int spaceship(const kdb::Key &comp) {
int ret = ckdb::keyCmp ($self->getKey(), comp.getKey());
if (ret < 0) return -1;
if (ret > 0) return 1;
return 0;
}
}
/*
* parse key.hpp
*/
%include "key.hpp"
/*
* used Templates
*/
/* value methods */
%template("get") kdb::Key::get<std::string>;
%template("set") kdb::Key::set<std::string>;
/* meta data */
//%template(getMeta) kdb::Key::getMeta<const kdb::Key>;
%template("set_meta") kdb::Key::setMeta<std::string>;
%template("get_meta") kdb::Key::getMeta<std::string>;
/****************************************************************************
*
* kdb::KeySet
*
****************************************************************************/
/* ignore unused constructors */
%ignore kdb::KeySet::KeySet (ckdb::KeySet * k);
%ignore kdb::KeySet::KeySet (size_t alloc, ...);
%ignore kdb::KeySet::KeySet (VaAlloc alloc, va_list ap);
%ignore kdb::KeySet::KeySet (Key, ...);
%ignore kdb::VaAlloc;
/* ignore raw ckdb::KeySet methods */
%ignore kdb::KeySet::getKeySet;
/* ignore unused operators */
%ignore kdb::KeySet::operator=;
/* KeySet == operator see below */
%ignore kdb::operator== (const KeySet &, const KeySet &);
%ignore kdb::operator!= (const KeySet &, const KeySet &);
/*
* Constructors
*/
/* add a custom constructor for KeySet::KeySet(Key)
* to enable passing a single Key, or an Array of Keys.
* This allows KeySet creation in a more Ruby way */
/* first check if we've got a Key or a Ruby-array */
%typemap(in) (kdb::Key*) {
$1 = NULL;
if (!RB_TYPE_P($input, T_ARRAY)){
if (SWIG_ConvertPtr($input, (void**)&$1, SWIGTYPE_p_kdb__Key, 0) == -1) {
rb_raise(rb_eArgError, "Argument has to be of Type Kdb::Key or Array");
SWIG_fail;
}
}
}
/* define a custom KeySet creation to be able to append the given Key
* arguments to the newly created KeySet */
%feature("except") kdb::KeySet::KeySet (Key*) {
if (arg1 != NULL) {
/* we got a kdb::Key argument (see corresponding typemap)
so simply use our custom constructor*/
$action
} else {
/* Ruby-Array */
result = (kdb::KeySet *)new kdb::KeySet();
/* append each array element, while checking if we really got a Key */
for (int i = 0; i < RARRAY_LEN(argv[0]); i++) {
VALUE e;
kdb::Key *ek = NULL;
e = rb_ary_entry(argv[0], i);
if (SWIG_ConvertPtr(e, (void**)&ek, SWIGTYPE_p_kdb__Key, 0) == -1) {
/* delete the new KeySet first, rb_raise will not return */
delete result;
rb_raise(rb_eArgError,
"Array element at index %d is not of Type Kdb::Key", i);
SWIG_fail;
}
result->append(*ek);
}
DATA_PTR(self) = result;
}
}
/* the custom constructor */
%extend kdb::KeySet {
KeySet(Key* key) {
KeySet* ks = new KeySet();
ks->append(*key);
return ks;
}
}
/*
* Ruby-style iteration
*/
/*
* KeySet.each
* Hint: this implementation of 'each' only works wich references to keys
* so any modifications of the keys are persisted
*/
%extend kdb::KeySet {
void each() {
if (rb_block_given_p()) {
for (ssize_t it = 0; $self->at(it); ++it) {
VALUE cur;
Key * t = new Key($self->at(it));
cur = SWIG_NewPointerObj(t, SWIGTYPE_p_kdb__Key, 1);
rb_yield(cur);
/* nothing to free here, Ruby is owner of the new Key obj, which
will be freed by the garbage collector */
}
}
}
}
/* include Enumerable which adds lots of Ruby iter., search... functions */
%mixin kdb::KeySet "Enumerable";
/*
* append methods
*/
%alias kdb::KeySet::append "<<"
/* define special typemap for append(KeySet), to allow
* passing a Ruby-Array also (a little bit hacky) */
%typemap(in) (const kdb::KeySet & toAppend) {
/* in case we have an array, append each element and return */
if (RB_TYPE_P($input, T_ARRAY)) {
int size = RARRAY_LEN($input);
/* ELEKTRA_LOG_DEBUG("append Array of Keys of len %d", size); private API */
for ( int i = 0; i < size; ++i) {
Key* k;
int reskey = 0;
reskey = SWIG_ConvertPtr(
rb_ary_entry($input, i), (void**)&k, SWIGTYPE_p_kdb__Key, 0);
if (!SWIG_IsOK(reskey)) {
rb_raise(rb_eArgError,
"Array element at index %d is not of Type Kdb::Key", i);
SWIG_fail;
}
arg1->append(*k);
}
/* return within the typemap. not the best way, but can be considered
to be an optimization */
return SWIG_From_long(arg1->size());
} else {
/* standard case for KeySet, just convert and check for correct type */
/* ELEKTRA_LOG_DEBUG("append KeySet"); private API */
if (!SWIG_IsOK(
SWIG_ConvertPtr($input, (void**)&$1, SWIGTYPE_p_kdb__KeySet, 0))) {
rb_raise(rb_eArgError,
"Argument not of Type Kdb::KeySet");
SWIG_fail;
}
}
}
/*
* cursor operations
*/
%apply long { elektraCursor }
%alias kdb::KeySet::at "[]"
/*
* comparision operator
* this is required, since operator== is not part of KeySet, thus
* SWIG doesn't add this to class KeySet
* (otherwise 'kdb::== ks1, ks2' would be required)
*/
%alias kdb::KeySet::operator== "eql?"
%extend kdb::KeySet {
bool operator== (const KeySet & rhs) {
return *$self == rhs;
}
}
/*
* lookup
*/
%apply int { elektraLookupFlags }
/*
* delete
*
* add 'delete' and 'delete_at' short cut methods
*/
/* 'delete' is a reserved C++ keyword */
%rename("delete") kdb::KeySet::delete_;
%extend kdb::KeySet {
Key delete_at(elektraCursor pos) {
Key k = $self->at(pos);
if (!k.isNull()) {
$self->lookup(k, KDB_O_POP);
}
return k;
}
Key delete_(const Key & key) {
return $self->lookup(key, KDB_O_POP);
}
Key delete_(std::string const & name) {
return $self->lookup(name, KDB_O_POP);
}
}
/*
* dup, copy, clone
* shallow copy KeySet
*/
/* return a kdb::KeySet instead of a ckdb::KeySet */
%typemap(out) ckdb::KeySet* kdb::KeySet::dup {
$result = SWIG_NewPointerObj(new KeySet($1),
SWIGTYPE_p_kdb__KeySet,
SWIG_POINTER_OWN | 0);
}
%alias kdb::KeySet::dup "clone"
/*
* handy helper methods or common aliases
*/
%rename("empty?") kdb::KeySet::empty;
%extend kdb::KeySet {
bool empty () {
return $self->size() == 0;
}
}
%alias kdb::KeySet::size "length"
/*
* parse keyset.hpp
*/
%include "keyset.hpp"
/****************************************************************************
*
* kdb.hpp
*
****************************************************************************/
%include "kdbexcept.hpp"
%exceptionclass kdb::KDBException;
%catches (kdb::KDBException) kdb::KDB::KDB;
%catches (kdb::KDBException) kdb::KDB::open;
%catches (kdb::KDBException) kdb::KDB::get;
%catches (kdb::KDBException) kdb::KDB::set;
%include "std_vector.i"
%include "std_string.i"
namespace std {
%template(StringVector) vector<string>;
}
%include "kdb.hpp"