# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.7
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.





from sys import version_info
if version_info >= (3, 0, 0):
    new_instancemethod = lambda func, inst, cls: _kdb.SWIG_PyInstanceMethod_New(func)
else:
    from new import instancemethod as new_instancemethod
if version_info >= (2, 6, 0):
    def swig_import_helper():
        from os.path import dirname
        import imp
        fp = None
        try:
            fp, pathname, description = imp.find_module('_kdb', [dirname(__file__)])
        except ImportError:
            import _kdb
            return _kdb
        if fp is not None:
            try:
                _mod = imp.load_module('_kdb', fp, pathname, description)
            finally:
                fp.close()
            return _mod
    _kdb = swig_import_helper()
    del swig_import_helper
else:
    import _kdb
del version_info
try:
    _swig_property = property
except NameError:
    pass  # Python < 2.2 doesn't have 'property'.


def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
    if (name == "thisown"):
        return self.this.own(value)
    if (name == "this"):
        if type(value).__name__ == 'SwigPyObject':
            self.__dict__[name] = value
            return
    method = class_type.__swig_setmethods__.get(name, None)
    if method:
        return method(self, value)
    if (not static):
        object.__setattr__(self, name, value)
    else:
        raise AttributeError("You cannot add attributes to %s" % self)


def _swig_setattr(self, class_type, name, value):
    return _swig_setattr_nondynamic(self, class_type, name, value, 0)


def _swig_getattr_nondynamic(self, class_type, name, static=1):
    if (name == "thisown"):
        return self.this.own()
    method = class_type.__swig_getmethods__.get(name, None)
    if method:
        return method(self)
    if (not static):
        return object.__getattr__(self, name)
    else:
        raise AttributeError(name)

def _swig_getattr(self, class_type, name):
    return _swig_getattr_nondynamic(self, class_type, name, 0)


def _swig_repr(self):
    try:
        strthis = "proxy of " + self.this.__repr__()
    except:
        strthis = ""
    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)

try:
    _object = object
    _newclass = 1
except AttributeError:
    class _object:
        pass
    _newclass = 0



def _swig_setattr_nondynamic_method(set):
    def set_attr(self, name, value):
        if (name == "thisown"):
            return self.this.own(value)
        if hasattr(self, name) or (name == "this"):
            set(self, name, value)
        else:
            raise AttributeError("You cannot add attributes to %s" % self)
    return set_attr


class SwigPyIterator(object):
    thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')

    def __init__(self, *args, **kwargs):
        raise AttributeError("No constructor defined - class is abstract")
    __repr__ = _swig_repr
    __swig_destroy__ = _kdb.delete_SwigPyIterator
    def __iter__(self):
        return self
SwigPyIterator.value = new_instancemethod(_kdb.SwigPyIterator_value, None, SwigPyIterator)
SwigPyIterator.incr = new_instancemethod(_kdb.SwigPyIterator_incr, None, SwigPyIterator)
SwigPyIterator.decr = new_instancemethod(_kdb.SwigPyIterator_decr, None, SwigPyIterator)
SwigPyIterator.distance = new_instancemethod(_kdb.SwigPyIterator_distance, None, SwigPyIterator)
SwigPyIterator.equal = new_instancemethod(_kdb.SwigPyIterator_equal, None, SwigPyIterator)
SwigPyIterator.copy = new_instancemethod(_kdb.SwigPyIterator_copy, None, SwigPyIterator)
SwigPyIterator.next = new_instancemethod(_kdb.SwigPyIterator_next, None, SwigPyIterator)
SwigPyIterator.__next__ = new_instancemethod(_kdb.SwigPyIterator___next__, None, SwigPyIterator)
SwigPyIterator.previous = new_instancemethod(_kdb.SwigPyIterator_previous, None, SwigPyIterator)
SwigPyIterator.advance = new_instancemethod(_kdb.SwigPyIterator_advance, None, SwigPyIterator)
SwigPyIterator.__eq__ = new_instancemethod(_kdb.SwigPyIterator___eq__, None, SwigPyIterator)
SwigPyIterator.__ne__ = new_instancemethod(_kdb.SwigPyIterator___ne__, None, SwigPyIterator)
SwigPyIterator.__iadd__ = new_instancemethod(_kdb.SwigPyIterator___iadd__, None, SwigPyIterator)
SwigPyIterator.__isub__ = new_instancemethod(_kdb.SwigPyIterator___isub__, None, SwigPyIterator)
SwigPyIterator.__add__ = new_instancemethod(_kdb.SwigPyIterator___add__, None, SwigPyIterator)
SwigPyIterator.__sub__ = new_instancemethod(_kdb.SwigPyIterator___sub__, None, SwigPyIterator)
SwigPyIterator_swigregister = _kdb.SwigPyIterator_swigregister
SwigPyIterator_swigregister(SwigPyIterator)


_kdb.DB_SYSTEM_swigconstant(_kdb)
DB_SYSTEM = _kdb.DB_SYSTEM

_kdb.DB_USER_swigconstant(_kdb)
DB_USER = _kdb.DB_USER

_kdb.DB_HOME_swigconstant(_kdb)
DB_HOME = _kdb.DB_HOME

_kdb.DEBUG_swigconstant(_kdb)
DEBUG = _kdb.DEBUG

_kdb.VERBOSE_swigconstant(_kdb)
VERBOSE = _kdb.VERBOSE

_kdb.KS_END_swigconstant(_kdb)
KS_END = _kdb.KS_END

_kdb.VERSION_swigconstant(_kdb)
VERSION = _kdb.VERSION

_kdb.VERSION_MAJOR_swigconstant(_kdb)
VERSION_MAJOR = _kdb.VERSION_MAJOR

_kdb.VERSION_MINOR_swigconstant(_kdb)
VERSION_MINOR = _kdb.VERSION_MINOR

_kdb.VERSION_MICRO_swigconstant(_kdb)
VERSION_MICRO = _kdb.VERSION_MICRO

_kdb.KDB_VERSION_swigconstant(_kdb)
KDB_VERSION = _kdb.KDB_VERSION

_kdb.KDB_VERSION_MAJOR_swigconstant(_kdb)
KDB_VERSION_MAJOR = _kdb.KDB_VERSION_MAJOR

_kdb.KDB_VERSION_MINOR_swigconstant(_kdb)
KDB_VERSION_MINOR = _kdb.KDB_VERSION_MINOR

_kdb.KDB_VERSION_MICRO_swigconstant(_kdb)
KDB_VERSION_MICRO = _kdb.KDB_VERSION_MICRO

_kdb.KEY_FLAGS_swigconstant(_kdb)
KEY_FLAGS = _kdb.KEY_FLAGS

_kdb.KEY_END_swigconstant(_kdb)
KEY_END = _kdb.KEY_END

_kdb.KEY_NAME_swigconstant(_kdb)
KEY_NAME = _kdb.KEY_NAME

_kdb.KEY_VALUE_swigconstant(_kdb)
KEY_VALUE = _kdb.KEY_VALUE

_kdb.KEY_OWNER_swigconstant(_kdb)
KEY_OWNER = _kdb.KEY_OWNER

_kdb.KEY_COMMENT_swigconstant(_kdb)
KEY_COMMENT = _kdb.KEY_COMMENT

_kdb.KEY_BINARY_swigconstant(_kdb)
KEY_BINARY = _kdb.KEY_BINARY

_kdb.KEY_UID_swigconstant(_kdb)
KEY_UID = _kdb.KEY_UID

_kdb.KEY_GID_swigconstant(_kdb)
KEY_GID = _kdb.KEY_GID

_kdb.KEY_MODE_swigconstant(_kdb)
KEY_MODE = _kdb.KEY_MODE

_kdb.KEY_ATIME_swigconstant(_kdb)
KEY_ATIME = _kdb.KEY_ATIME

_kdb.KEY_MTIME_swigconstant(_kdb)
KEY_MTIME = _kdb.KEY_MTIME

_kdb.KEY_CTIME_swigconstant(_kdb)
KEY_CTIME = _kdb.KEY_CTIME

_kdb.KEY_SIZE_swigconstant(_kdb)
KEY_SIZE = _kdb.KEY_SIZE

_kdb.KEY_FUNC_swigconstant(_kdb)
KEY_FUNC = _kdb.KEY_FUNC

_kdb.KEY_DIR_swigconstant(_kdb)
KEY_DIR = _kdb.KEY_DIR

_kdb.KEY_META_swigconstant(_kdb)
KEY_META = _kdb.KEY_META

_kdb.KEY_NULL_swigconstant(_kdb)
KEY_NULL = _kdb.KEY_NULL

_kdb.KEY_CASCADING_NAME_swigconstant(_kdb)
KEY_CASCADING_NAME = _kdb.KEY_CASCADING_NAME

_kdb.KEY_META_NAME_swigconstant(_kdb)
KEY_META_NAME = _kdb.KEY_META_NAME

_kdb.KDB_O_NONE_swigconstant(_kdb)
KDB_O_NONE = _kdb.KDB_O_NONE

_kdb.KDB_O_DEL_swigconstant(_kdb)
KDB_O_DEL = _kdb.KDB_O_DEL

_kdb.KDB_O_POP_swigconstant(_kdb)
KDB_O_POP = _kdb.KDB_O_POP

_kdb.KDB_O_NODIR_swigconstant(_kdb)
KDB_O_NODIR = _kdb.KDB_O_NODIR

_kdb.KDB_O_DIRONLY_swigconstant(_kdb)
KDB_O_DIRONLY = _kdb.KDB_O_DIRONLY

_kdb.KDB_O_NOREMOVE_swigconstant(_kdb)
KDB_O_NOREMOVE = _kdb.KDB_O_NOREMOVE

_kdb.KDB_O_REMOVEONLY_swigconstant(_kdb)
KDB_O_REMOVEONLY = _kdb.KDB_O_REMOVEONLY

_kdb.KDB_O_INACTIVE_swigconstant(_kdb)
KDB_O_INACTIVE = _kdb.KDB_O_INACTIVE

_kdb.KDB_O_SYNC_swigconstant(_kdb)
KDB_O_SYNC = _kdb.KDB_O_SYNC

_kdb.KDB_O_SORT_swigconstant(_kdb)
KDB_O_SORT = _kdb.KDB_O_SORT

_kdb.KDB_O_NORECURSIVE_swigconstant(_kdb)
KDB_O_NORECURSIVE = _kdb.KDB_O_NORECURSIVE

_kdb.KDB_O_NOCASE_swigconstant(_kdb)
KDB_O_NOCASE = _kdb.KDB_O_NOCASE

_kdb.KDB_O_WITHOWNER_swigconstant(_kdb)
KDB_O_WITHOWNER = _kdb.KDB_O_WITHOWNER

_kdb.KDB_O_NOALL_swigconstant(_kdb)
KDB_O_NOALL = _kdb.KDB_O_NOALL

_kdb.KEY_NS_NONE_swigconstant(_kdb)
KEY_NS_NONE = _kdb.KEY_NS_NONE

_kdb.KEY_NS_EMPTY_swigconstant(_kdb)
KEY_NS_EMPTY = _kdb.KEY_NS_EMPTY

_kdb.KEY_NS_META_swigconstant(_kdb)
KEY_NS_META = _kdb.KEY_NS_META

_kdb.KEY_NS_CASCADING_swigconstant(_kdb)
KEY_NS_CASCADING = _kdb.KEY_NS_CASCADING

_kdb.KEY_NS_FIRST_swigconstant(_kdb)
KEY_NS_FIRST = _kdb.KEY_NS_FIRST

_kdb.KEY_NS_SPEC_swigconstant(_kdb)
KEY_NS_SPEC = _kdb.KEY_NS_SPEC

_kdb.KEY_NS_PROC_swigconstant(_kdb)
KEY_NS_PROC = _kdb.KEY_NS_PROC

_kdb.KEY_NS_DIR_swigconstant(_kdb)
KEY_NS_DIR = _kdb.KEY_NS_DIR

_kdb.KEY_NS_USER_swigconstant(_kdb)
KEY_NS_USER = _kdb.KEY_NS_USER

_kdb.KEY_NS_SYSTEM_swigconstant(_kdb)
KEY_NS_SYSTEM = _kdb.KEY_NS_SYSTEM

_kdb.KEY_NS_LAST_swigconstant(_kdb)
KEY_NS_LAST = _kdb.KEY_NS_LAST

import warnings

class Exception(Exception):
    """Proxy of C++ kdb::Exception class"""
    __swig_setmethods__ = {}
    __setattr__ = lambda self, name, value: _swig_setattr(self, Exception, name, value)
    __swig_getmethods__ = {}
    __getattr__ = lambda self, name: _swig_getattr(self, Exception, name)
    __repr__ = _swig_repr

    def what(self):
        """
        what(Exception self) -> char const *

        Parameters:
            self: kdb::Exception const *

        """
        return _kdb.Exception_what(self)


    def __str__(self):
      return self.what()


    def __init__(self):
        """__init__(kdb::Exception self) -> Exception"""
        _kdb.Exception_swiginit(self, _kdb.new_Exception())
    __swig_destroy__ = _kdb.delete_Exception
Exception.what = new_instancemethod(_kdb.Exception_what, None, Exception)
Exception_swigregister = _kdb.Exception_swigregister
Exception_swigregister(Exception)

class KeyException(Exception):
    """Proxy of C++ kdb::KeyException class"""
    thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
    __repr__ = _swig_repr

    def __init__(self):
        """__init__(kdb::KeyException self) -> KeyException"""
        _kdb.KeyException_swiginit(self, _kdb.new_KeyException())
    __swig_destroy__ = _kdb.delete_KeyException
KeyException_swigregister = _kdb.KeyException_swigregister
KeyException_swigregister(KeyException)

class KeyTypeMismatch(KeyException):
    """Proxy of C++ kdb::KeyTypeMismatch class"""
    thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
    __repr__ = _swig_repr

    def __init__(self):
        """__init__(kdb::KeyTypeMismatch self) -> KeyTypeMismatch"""
        _kdb.KeyTypeMismatch_swiginit(self, _kdb.new_KeyTypeMismatch())
    __swig_destroy__ = _kdb.delete_KeyTypeMismatch
KeyTypeMismatch_swigregister = _kdb.KeyTypeMismatch_swigregister
KeyTypeMismatch_swigregister(KeyTypeMismatch)

class KeyTypeConversion(KeyException):
    """Proxy of C++ kdb::KeyTypeConversion class"""
    thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
    __repr__ = _swig_repr

    def __init__(self):
        """__init__(kdb::KeyTypeConversion self) -> KeyTypeConversion"""
        _kdb.KeyTypeConversion_swiginit(self, _kdb.new_KeyTypeConversion())
    __swig_destroy__ = _kdb.delete_KeyTypeConversion
KeyTypeConversion_swigregister = _kdb.KeyTypeConversion_swigregister
KeyTypeConversion_swigregister(KeyTypeConversion)

class KeyInvalidName(KeyException):
    """Proxy of C++ kdb::KeyInvalidName class"""
    thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
    __repr__ = _swig_repr

    def __init__(self):
        """__init__(kdb::KeyInvalidName self) -> KeyInvalidName"""
        _kdb.KeyInvalidName_swiginit(self, _kdb.new_KeyInvalidName())
    __swig_destroy__ = _kdb.delete_KeyInvalidName
KeyInvalidName_swigregister = _kdb.KeyInvalidName_swigregister
KeyInvalidName_swigregister(KeyInvalidName)

class KDBException(Exception):
    """Proxy of C++ kdb::KDBException class"""
    thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
    __repr__ = _swig_repr

    def __init__(self, key):
        """
        __init__(kdb::KDBException self, Key key) -> KDBException

        Parameters:
            key: Key

        """
        _kdb.KDBException_swiginit(self, _kdb.new_KDBException(key))
    __swig_destroy__ = _kdb.delete_KDBException
KDBException_swigregister = _kdb.KDBException_swigregister
KDBException_swigregister(KDBException)

class Key(object):
    """Proxy of C++ kdb::Key class"""
    thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
    __repr__ = _swig_repr

    def _incRef(self):
        """
        _incRef(Key self)

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__incRef(self)


    def _decRef(self):
        """
        _decRef(Key self)

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__decRef(self)


    def getReferenceCounter(self):
        """
        getReferenceCounter(Key self) -> ssize_t

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key_getReferenceCounter(self)


    def copy(self, other):
        """
        copy(Key self, Key other)

        Parameters:
            other: kdb::Key const &

        """
        return _kdb.Key_copy(self, other)


    def clear(self):
        """
        clear(Key self)

        Parameters:
            self: kdb::Key *

        """
        return _kdb.Key_clear(self)


    def getKey(self):
        """
        getKey(Key self) -> ckdb::Key *

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key_getKey(self)


    def __ref__(self):
        """
        __ref__(Key self) -> ckdb::Key *

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key___ref__(self)


    def release(self):
        """
        release(Key self) -> ckdb::Key *

        Parameters:
            self: kdb::Key *

        """
        return _kdb.Key_release(self)


    def dup(self):
        """
        dup(Key self) -> ckdb::Key *

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key_dup(self)

    __swig_destroy__ = _kdb.delete_Key

    def _getName(self):
        """
        _getName(Key self) -> std::string

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__getName(self)


    def _getNameSize(self):
        """
        _getNameSize(Key self) -> ssize_t

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__getNameSize(self)


    def _getBaseName(self):
        """
        _getBaseName(Key self) -> std::string

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__getBaseName(self)


    def _getBaseNameSize(self):
        """
        _getBaseNameSize(Key self) -> ssize_t

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__getBaseNameSize(self)


    def _setName(self, newName):
        """
        _setName(Key self, std::string const & newName)

        Parameters:
            newName: std::string const &

        """
        return _kdb.Key__setName(self, newName)


    def addName(self, addedName):
        """
        addName(Key self, std::string const & addedName)

        Parameters:
            addedName: std::string const &

        """
        return _kdb.Key_addName(self, addedName)


    def _setBaseName(self, baseName):
        """
        _setBaseName(Key self, std::string const & baseName)

        Parameters:
            baseName: std::string const &

        """
        return _kdb.Key__setBaseName(self, baseName)


    def addBaseName(self, baseName):
        """
        addBaseName(Key self, std::string const & baseName)

        Parameters:
            baseName: std::string const &

        """
        return _kdb.Key_addBaseName(self, baseName)


    def _getFullNameSize(self):
        """
        _getFullNameSize(Key self) -> ssize_t

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__getFullNameSize(self)


    def _getFullName(self):
        """
        _getFullName(Key self) -> std::string

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__getFullName(self)


    def __eq__(self, k):
        """
        __eq__(Key self, Key k) -> bool

        Parameters:
            k: kdb::Key const &

        """
        return _kdb.Key___eq__(self, k)


    def __ne__(self, k):
        """
        __ne__(Key self, Key k) -> bool

        Parameters:
            k: kdb::Key const &

        """
        return _kdb.Key___ne__(self, k)


    def __lt__(self, other):
        """
        __lt__(Key self, Key other) -> bool

        Parameters:
            other: kdb::Key const &

        """
        return _kdb.Key___lt__(self, other)


    def __le__(self, other):
        """
        __le__(Key self, Key other) -> bool

        Parameters:
            other: kdb::Key const &

        """
        return _kdb.Key___le__(self, other)


    def __gt__(self, other):
        """
        __gt__(Key self, Key other) -> bool

        Parameters:
            other: kdb::Key const &

        """
        return _kdb.Key___gt__(self, other)


    def __ge__(self, other):
        """
        __ge__(Key self, Key other) -> bool

        Parameters:
            other: kdb::Key const &

        """
        return _kdb.Key___ge__(self, other)


    def isNull(self):
        """
        isNull(Key self) -> bool

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key_isNull(self)


    def __nonzero__(self):
        return _kdb.Key___nonzero__(self)
    __bool__ = __nonzero__



    def needSync(self):
        """
        needSync(Key self) -> bool

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key_needSync(self)


    def _getString(self):
        """
        _getString(Key self) -> std::string

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__getString(self)


    def _setString(self, newString):
        """
        _setString(Key self, std::string newString)

        Parameters:
            newString: std::string

        """
        return _kdb.Key__setString(self, newString)


    def _getStringSize(self):
        """
        _getStringSize(Key self) -> ssize_t

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__getStringSize(self)


    def _getFunc(self):
        """
        _getFunc(Key self) -> kdb::Key::func_t

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__getFunc(self)


    def setCallback(self, fct):
        """
        setCallback(Key self, kdb::Key::callback_t fct)

        Parameters:
            fct: kdb::Key::callback_t

        """
        return _kdb.Key_setCallback(self, fct)


    def _getValue(self):
        """
        _getValue(Key self) -> void const *

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__getValue(self)


    def _getBinary(self):
        """
        _getBinary(Key self) -> std::string

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__getBinary(self)


    def _getBinarySize(self):
        """
        _getBinarySize(Key self) -> ssize_t

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__getBinarySize(self)


    def _setBinary(self, newBinary):
        """
        _setBinary(Key self, void const * newBinary) -> ssize_t

        Parameters:
            newBinary: void const *

        """
        return _kdb.Key__setBinary(self, newBinary)


    def hasMeta(self, metaName):
        """
        hasMeta(Key self, std::string const & metaName) -> bool

        Parameters:
            metaName: std::string const &

        """
        return _kdb.Key_hasMeta(self, metaName)


    def delMeta(self, metaName):
        """
        delMeta(Key self, std::string const & metaName)

        Parameters:
            metaName: std::string const &

        """
        return _kdb.Key_delMeta(self, metaName)


    def copyMeta(self, other, metaName):
        """
        copyMeta(Key self, Key other, std::string const & metaName)

        Parameters:
            other: kdb::Key const &
            metaName: std::string const &

        """
        return _kdb.Key_copyMeta(self, other, metaName)


    def copyAllMeta(self, other):
        """
        copyAllMeta(Key self, Key other)

        Parameters:
            other: kdb::Key const &

        """
        return _kdb.Key_copyAllMeta(self, other)


    def _rewindMeta(self):
        """
        _rewindMeta(Key self)

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__rewindMeta(self)


    def _nextMeta(self):
        """
        _nextMeta(Key self) -> Key

        Parameters:
            self: kdb::Key *

        """
        return _kdb.Key__nextMeta(self)


    def _currentMeta(self):
        """
        _currentMeta(Key self) -> Key

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key__currentMeta(self)


    def isValid(self):
        """
        isValid(Key self) -> bool

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key_isValid(self)


    def getNamespace(self):
        """
        getNamespace(Key self) -> std::string

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key_getNamespace(self)


    def isSystem(self):
        """
        isSystem(Key self) -> bool

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key_isSystem(self)


    def isUser(self):
        """
        isUser(Key self) -> bool

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key_isUser(self)


    def isString(self):
        """
        isString(Key self) -> bool

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key_isString(self)


    def isBinary(self):
        """
        isBinary(Key self) -> bool

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key_isBinary(self)


    def isInactive(self):
        """
        isInactive(Key self) -> bool

        Parameters:
            self: kdb::Key const *

        """
        return _kdb.Key_isInactive(self)


    def isBelow(self, k):
        """
        isBelow(Key self, Key k) -> bool

        Parameters:
            k: kdb::Key const &

        """
        return _kdb.Key_isBelow(self, k)


    def isBelowOrSame(self, k):
        """
        isBelowOrSame(Key self, Key k) -> bool

        Parameters:
            k: kdb::Key const &

        """
        return _kdb.Key_isBelowOrSame(self, k)


    def isDirectBelow(self, k):
        """
        isDirectBelow(Key self, Key k) -> bool

        Parameters:
            k: kdb::Key const &

        """
        return _kdb.Key_isDirectBelow(self, k)


    def __init__(self, *args):
        """
        __init__(kdb::Key self) -> Key
        __init__(kdb::Key self, ckdb::Key * k) -> Key

        Parameters:
            k: ckdb::Key *

        __init__(kdb::Key self, Key k) -> Key

        Parameters:
            k: kdb::Key &

        __init__(kdb::Key self, char const * name, uint64_t flags=0) -> Key

        Parameters:
            name: char const *
            flags: uint64_t

        __init__(kdb::Key self, char const * name) -> Key

        Parameters:
            name: char const *

        """

        value = None
        meta  = {}
        # check for copy constructor
        if len(args) and isinstance(args[0], str):
          arg0, args = args[0], args[1:]

          flags = 0
          args = iter(args)
          for arg in args:
            if arg == KEY_END:
              break
            elif arg == KEY_SIZE:
        # ignore value
              next(args)
            elif arg == KEY_VALUE:
              value = next(args)
            elif arg == KEY_FUNC:
        #TODO swig directors?
              raise TypeError("Unsupported meta type")
            elif arg == KEY_FLAGS:
              flags = next(args)
            elif arg == KEY_META:
              k = next(args)
              meta[k] = next(args)
            elif isinstance(arg, int):
              warnings.warn("Deprecated option in keyNew: {0}".format(arg),
                DeprecationWarning)
              flags |= arg
            else:
              warnings.warn("Unknown option in keyNew {0}".format(arg),
                RuntimeWarning)
          args = [ arg0, flags ]


        _kdb.Key_swiginit(self, _kdb.new_Key(*args))

        if value:
          self.value = value
        for k in meta:
          self.setMeta(k, meta[k])




    def __cmp__(self, o):
        """
        __cmp__(Key self, Key o) -> int

        Parameters:
            o: kdb::Key const *

        """
        return _kdb.Key___cmp__(self, o)


    def __copy__(self):
        """
        __copy__(Key self) -> Key

        Parameters:
            self: kdb::Key *

        """
        return _kdb.Key___copy__(self)


    def get(self):
      """returns the keys value"""
      if self.isBinary():
        return self._getBinary()
      return self._getString()

    def set(self, value):
      """set the keys value. Can be either string or binary"""
      if isinstance(value, bytes):
        return self._setBinary(value)
      return self._setString(str(value))

    def getMeta(self, name = None):
      """returns a meta key given by name. Name can be either string or Key.
      If no meta key is found None is returned.
      If name is omitted an iterator object is returned.
      """
      if name is not None:
        meta = self._getMeta(name)
        return meta if meta else None
      return self.__metaIter()

    def setMeta(self, name, value):
      """set a new meta key consisting of name and value"""
      if isinstance(value, str):
        return self._setMeta(name, value)
      raise TypeError("Unsupported value type")

    def __metaIter(self):
      self._rewindMeta()
      meta = self._nextMeta()
      while meta:
        yield meta
        meta = self._nextMeta()

    name     = property(_kdb.Key__getName, _kdb.Key__setName)
    value    = property(get, set, None, "Key value")
    basename = property(_kdb.Key__getBaseName, _kdb.Key__setBaseName)
    fullname = property(_kdb.Key__getFullName)

    def __str__(self):
      return self.name


    def __iter__(self):
        """
        __iter__(Key self) -> SwigPyIterator

        Parameters:
            self: kdb::Key *

        """
        return _kdb.Key___iter__(self)


    def __reversed__(self):
        """
        __reversed__(Key self) -> SwigPyIterator

        Parameters:
            self: kdb::Key *

        """
        return _kdb.Key___reversed__(self)


    def _getMeta(self, metaName):
        """
        _getMeta(Key self, std::string const & metaName) -> Key

        Parameters:
            metaName: std::string const &

        """
        return _kdb.Key__getMeta(self, metaName)


    def _setMeta(self, metaName, x):
        """
        _setMeta(Key self, std::string const & metaName, std::string x)

        Parameters:
            metaName: std::string const &
            x: std::string

        """
        return _kdb.Key__setMeta(self, metaName, x)

Key._incRef = new_instancemethod(_kdb.Key__incRef, None, Key)
Key._decRef = new_instancemethod(_kdb.Key__decRef, None, Key)
Key.getReferenceCounter = new_instancemethod(_kdb.Key_getReferenceCounter, None, Key)
Key.copy = new_instancemethod(_kdb.Key_copy, None, Key)
Key.clear = new_instancemethod(_kdb.Key_clear, None, Key)
Key.getKey = new_instancemethod(_kdb.Key_getKey, None, Key)
Key.__ref__ = new_instancemethod(_kdb.Key___ref__, None, Key)
Key.release = new_instancemethod(_kdb.Key_release, None, Key)
Key.dup = new_instancemethod(_kdb.Key_dup, None, Key)
Key._getName = new_instancemethod(_kdb.Key__getName, None, Key)
Key._getNameSize = new_instancemethod(_kdb.Key__getNameSize, None, Key)
Key._getBaseName = new_instancemethod(_kdb.Key__getBaseName, None, Key)
Key._getBaseNameSize = new_instancemethod(_kdb.Key__getBaseNameSize, None, Key)
Key._setName = new_instancemethod(_kdb.Key__setName, None, Key)
Key.addName = new_instancemethod(_kdb.Key_addName, None, Key)
Key._setBaseName = new_instancemethod(_kdb.Key__setBaseName, None, Key)
Key.addBaseName = new_instancemethod(_kdb.Key_addBaseName, None, Key)
Key._getFullNameSize = new_instancemethod(_kdb.Key__getFullNameSize, None, Key)
Key._getFullName = new_instancemethod(_kdb.Key__getFullName, None, Key)
Key.__eq__ = new_instancemethod(_kdb.Key___eq__, None, Key)
Key.__ne__ = new_instancemethod(_kdb.Key___ne__, None, Key)
Key.__lt__ = new_instancemethod(_kdb.Key___lt__, None, Key)
Key.__le__ = new_instancemethod(_kdb.Key___le__, None, Key)
Key.__gt__ = new_instancemethod(_kdb.Key___gt__, None, Key)
Key.__ge__ = new_instancemethod(_kdb.Key___ge__, None, Key)
Key.isNull = new_instancemethod(_kdb.Key_isNull, None, Key)
Key.needSync = new_instancemethod(_kdb.Key_needSync, None, Key)
Key._getString = new_instancemethod(_kdb.Key__getString, None, Key)
Key._setString = new_instancemethod(_kdb.Key__setString, None, Key)
Key._getStringSize = new_instancemethod(_kdb.Key__getStringSize, None, Key)
Key._getFunc = new_instancemethod(_kdb.Key__getFunc, None, Key)
Key.setCallback = new_instancemethod(_kdb.Key_setCallback, None, Key)
Key._getValue = new_instancemethod(_kdb.Key__getValue, None, Key)
Key._getBinary = new_instancemethod(_kdb.Key__getBinary, None, Key)
Key._getBinarySize = new_instancemethod(_kdb.Key__getBinarySize, None, Key)
Key._setBinary = new_instancemethod(_kdb.Key__setBinary, None, Key)
Key.hasMeta = new_instancemethod(_kdb.Key_hasMeta, None, Key)
Key.delMeta = new_instancemethod(_kdb.Key_delMeta, None, Key)
Key.copyMeta = new_instancemethod(_kdb.Key_copyMeta, None, Key)
Key.copyAllMeta = new_instancemethod(_kdb.Key_copyAllMeta, None, Key)
Key._rewindMeta = new_instancemethod(_kdb.Key__rewindMeta, None, Key)
Key._nextMeta = new_instancemethod(_kdb.Key__nextMeta, None, Key)
Key._currentMeta = new_instancemethod(_kdb.Key__currentMeta, None, Key)
Key.isValid = new_instancemethod(_kdb.Key_isValid, None, Key)
Key.getNamespace = new_instancemethod(_kdb.Key_getNamespace, None, Key)
Key.isSystem = new_instancemethod(_kdb.Key_isSystem, None, Key)
Key.isUser = new_instancemethod(_kdb.Key_isUser, None, Key)
Key.isString = new_instancemethod(_kdb.Key_isString, None, Key)
Key.isBinary = new_instancemethod(_kdb.Key_isBinary, None, Key)
Key.isInactive = new_instancemethod(_kdb.Key_isInactive, None, Key)
Key.isBelow = new_instancemethod(_kdb.Key_isBelow, None, Key)
Key.isBelowOrSame = new_instancemethod(_kdb.Key_isBelowOrSame, None, Key)
Key.isDirectBelow = new_instancemethod(_kdb.Key_isDirectBelow, None, Key)
Key.__cmp__ = new_instancemethod(_kdb.Key___cmp__, None, Key)
Key.__copy__ = new_instancemethod(_kdb.Key___copy__, None, Key)
Key.__iter__ = new_instancemethod(_kdb.Key___iter__, None, Key)
Key.__reversed__ = new_instancemethod(_kdb.Key___reversed__, None, Key)
Key._getMeta = new_instancemethod(_kdb.Key__getMeta, None, Key)
Key._setMeta = new_instancemethod(_kdb.Key__setMeta, None, Key)
Key_swigregister = _kdb.Key_swigregister
Key_swigregister(Key)

class KeySet(object):
    """Proxy of C++ kdb::KeySet class"""
    thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
    __repr__ = _swig_repr
    __swig_destroy__ = _kdb.delete_KeySet

    def release(self):
        """
        release(KeySet self) -> ckdb::KeySet *

        Parameters:
            self: kdb::KeySet *

        """
        return _kdb.KeySet_release(self)


    def getKeySet(self):
        """
        getKeySet(KeySet self) -> ckdb::KeySet *

        Parameters:
            self: kdb::KeySet const *

        """
        return _kdb.KeySet_getKeySet(self)


    def setKeySet(self, k):
        """
        setKeySet(KeySet self, ckdb::KeySet * k)

        Parameters:
            k: ckdb::KeySet *

        """
        return _kdb.KeySet_setKeySet(self, k)


    def __len__(self):
        """
        __len__(KeySet self) -> ssize_t

        Parameters:
            self: kdb::KeySet const *

        """
        return _kdb.KeySet___len__(self)


    def dup(self):
        """
        dup(KeySet self) -> ckdb::KeySet *

        Parameters:
            self: kdb::KeySet const *

        """
        return _kdb.KeySet_dup(self)


    def copy(self, other):
        """
        copy(KeySet self, KeySet other)

        Parameters:
            other: kdb::KeySet const &

        """
        return _kdb.KeySet_copy(self, other)


    def clear(self):
        """
        clear(KeySet self)

        Parameters:
            self: kdb::KeySet *

        """
        return _kdb.KeySet_clear(self)


    def append(self, *args):
        """
        append(KeySet self, Key toAppend) -> ssize_t

        Parameters:
            toAppend: kdb::Key const &

        append(KeySet self, KeySet toAppend) -> ssize_t

        Parameters:
            toAppend: kdb::KeySet const &

        """
        return _kdb.KeySet_append(self, *args)


    def head(self):
        """
        head(KeySet self) -> Key

        Parameters:
            self: kdb::KeySet const *

        """
        return _kdb.KeySet_head(self)


    def tail(self):
        """
        tail(KeySet self) -> Key

        Parameters:
            self: kdb::KeySet const *

        """
        return _kdb.KeySet_tail(self)


    def setCursor(self, cursor):
        """
        setCursor(KeySet self, cursor_t cursor)

        Parameters:
            cursor: cursor_t

        """
        return _kdb.KeySet_setCursor(self, cursor)


    def getCursor(self):
        """
        getCursor(KeySet self) -> cursor_t

        Parameters:
            self: kdb::KeySet const *

        """
        return _kdb.KeySet_getCursor(self)


    def pop(self):
        """
        pop(KeySet self) -> Key

        Parameters:
            self: kdb::KeySet *

        """
        return _kdb.KeySet_pop(self)


    def cut(self, k):
        """
        cut(KeySet self, Key k) -> KeySet

        Parameters:
            k: kdb::Key

        """
        return _kdb.KeySet_cut(self, k)


    def _lookup(self, *args):
        """
        _lookup(KeySet self, Key k, option_t const options=KDB_O_NONE) -> Key

        Parameters:
            k: kdb::Key const &
            options: option_t const

        _lookup(KeySet self, Key k) -> Key

        Parameters:
            k: kdb::Key const &

        _lookup(KeySet self, std::string const & name, option_t const options=KDB_O_NONE) -> Key

        Parameters:
            name: std::string const &
            options: option_t const

        _lookup(KeySet self, std::string const & name) -> Key

        Parameters:
            name: std::string const &

        _lookup(KeySet self, cursor_t pos) -> Key

        Parameters:
            pos: cursor_t

        """
        return _kdb.KeySet__lookup(self, *args)


    def __init__(self, *args):
        """
        __init__(kdb::KeySet self) -> KeySet
        __init__(kdb::KeySet self, ckdb::KeySet * k) -> KeySet

        Parameters:
            k: ckdb::KeySet *

        __init__(kdb::KeySet self, KeySet other) -> KeySet

        Parameters:
            other: kdb::KeySet const &

        __init__(kdb::KeySet self, size_t alloc) -> KeySet

        Parameters:
            alloc: size_t

        """

        orig = []
        if len(args):
          orig = args[1:]
          args = [ args[0] ]


        _kdb.KeySet_swiginit(self, _kdb.new_KeySet(*args))

        for arg in orig:
          if arg is KS_END:
            break
          self.append(arg)




    def __copy__(self):
        """
        __copy__(KeySet self) -> KeySet

        Parameters:
            self: kdb::KeySet *

        """
        return _kdb.KeySet___copy__(self)


    def __deepcopy__(self, memo):
        """
        __deepcopy__(KeySet self, PyObject * memo) -> KeySet

        Parameters:
            memo: PyObject *

        """
        return _kdb.KeySet___deepcopy__(self, memo)


    def lookup(self, name):
      """Lookup a key by name. Name can be either string, Key or indexes.
      If index is negative, search starts at the end.
      Returns None if no key is found.
      """
      key = self._lookup(name)
      return key if key else None

    def __getitem__(self, key):
      """See lookup(...) for details.
      Slices and negative indexes are supported as well.
      """
      if isinstance(key, slice):
        return [ self[k] for k in range(*key.indices(len(self))) ]
      elif isinstance(key, ( int )):
        item = self.lookup(key)
        if item is None:
          raise IndexError("index out of range")
        return item
      elif isinstance(key, ( str, Key )):
        item = self.lookup(key)
        if item is None:
          raise KeyError(str(key))
        return item
      raise TypeError("Invalid argument type")

    def __contains__(self, item):
      """See lookup(...) for details"""
      if isinstance(item, ( str, Key )):
        key = self._lookup(item)
        return True if key else False
      raise TypeError("Invalid argument type")


    def __iter__(self):
        """
        __iter__(KeySet self) -> SwigPyIterator

        Parameters:
            self: kdb::KeySet *

        """
        return _kdb.KeySet___iter__(self)


    def __reversed__(self):
        """
        __reversed__(KeySet self) -> SwigPyIterator

        Parameters:
            self: kdb::KeySet *

        """
        return _kdb.KeySet___reversed__(self)

KeySet.release = new_instancemethod(_kdb.KeySet_release, None, KeySet)
KeySet.getKeySet = new_instancemethod(_kdb.KeySet_getKeySet, None, KeySet)
KeySet.setKeySet = new_instancemethod(_kdb.KeySet_setKeySet, None, KeySet)
KeySet.__len__ = new_instancemethod(_kdb.KeySet___len__, None, KeySet)
KeySet.dup = new_instancemethod(_kdb.KeySet_dup, None, KeySet)
KeySet.copy = new_instancemethod(_kdb.KeySet_copy, None, KeySet)
KeySet.clear = new_instancemethod(_kdb.KeySet_clear, None, KeySet)
KeySet.append = new_instancemethod(_kdb.KeySet_append, None, KeySet)
KeySet.head = new_instancemethod(_kdb.KeySet_head, None, KeySet)
KeySet.tail = new_instancemethod(_kdb.KeySet_tail, None, KeySet)
KeySet.setCursor = new_instancemethod(_kdb.KeySet_setCursor, None, KeySet)
KeySet.getCursor = new_instancemethod(_kdb.KeySet_getCursor, None, KeySet)
KeySet.pop = new_instancemethod(_kdb.KeySet_pop, None, KeySet)
KeySet.cut = new_instancemethod(_kdb.KeySet_cut, None, KeySet)
KeySet._lookup = new_instancemethod(_kdb.KeySet__lookup, None, KeySet)
KeySet.__copy__ = new_instancemethod(_kdb.KeySet___copy__, None, KeySet)
KeySet.__deepcopy__ = new_instancemethod(_kdb.KeySet___deepcopy__, None, KeySet)
KeySet.__iter__ = new_instancemethod(_kdb.KeySet___iter__, None, KeySet)
KeySet.__reversed__ = new_instancemethod(_kdb.KeySet___reversed__, None, KeySet)
KeySet_swigregister = _kdb.KeySet_swigregister
KeySet_swigregister(KeySet)
cvar = _kdb.cvar
va = cvar.va

class KDB(object):
    """Proxy of C++ kdb::KDB class"""
    thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
    __repr__ = _swig_repr

    def __init__(self, *args):
        """
        __init__(kdb::KDB self) -> KDB
        __init__(kdb::KDB self, Key errorKey) -> KDB

        Parameters:
            errorKey: kdb::Key &

        """
        _kdb.KDB_swiginit(self, _kdb.new_KDB(*args))
    __swig_destroy__ = _kdb.delete_KDB

    def open(self, errorKey):
        """
        open(KDB self, Key errorKey)

        Parameters:
            errorKey: kdb::Key &

        """
        return _kdb.KDB_open(self, errorKey)


    def close(self, errorKey):
        """
        close(KDB self, Key errorKey)

        Parameters:
            errorKey: kdb::Key &

        """
        return _kdb.KDB_close(self, errorKey)


    def get(self, *args):
        """
        get(KDB self, KeySet returned, std::string const & keyname) -> int

        Parameters:
            returned: kdb::KeySet &
            keyname: std::string const &

        get(KDB self, KeySet returned, Key parentKey) -> int

        Parameters:
            returned: kdb::KeySet &
            parentKey: kdb::Key &

        """
        return _kdb.KDB_get(self, *args)


    def set(self, *args):
        """
        set(KDB self, KeySet returned, std::string const & keyname) -> int

        Parameters:
            returned: kdb::KeySet &
            keyname: std::string const &

        set(KDB self, KeySet returned, Key parentKey) -> int

        Parameters:
            returned: kdb::KeySet &
            parentKey: kdb::Key &

        """
        return _kdb.KDB_set(self, *args)


    def __enter__(self):
      """Internal method for usage with context managers"""
      return self

    def __exit__(self, type, value, tb):
      """Internal method for usage with context managers.
      Closes the database.
      """
      try:
        self.close(Key())
      except:
        pass

KDB.open = new_instancemethod(_kdb.KDB_open, None, KDB)
KDB.close = new_instancemethod(_kdb.KDB_close, None, KDB)
KDB.get = new_instancemethod(_kdb.KDB_get, None, KDB)
KDB.set = new_instancemethod(_kdb.KDB_set, None, KDB)
KDB_swigregister = _kdb.KDB_swigregister
KDB_swigregister(KDB)


Key.__oldinit__ = Key.__init__

def __Key_new_init__(self, *args):
  passed = []
  value  = None

  if len(args):
    args = iter(args)
    passed.append(next(args))
    for arg in args:
      if arg == KEY_VALUE:
        value = next(args)
      else:
        passed.append(arg)

  self.__oldinit__(*passed)

  if value:
    if self.isBinary():
      self.binary = value
    else:
      self.string = value

Key.__init__ = __Key_new_init__


del Key.set
Key.value  = property(Key.get, None, None, "Key value")
Key.string = property(Key._getString, Key._setString, None, "Key string value")
Key.binary = property(Key._getBinary, Key._setBinary, None, "Key binary value")



