File size: 1,502 Bytes
2c3c408
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import tiledb.cc as lt

from .ctx import Ctx, CtxMixin
from .domain import Domain
from .ndrectangle import NDRectangle


class CurrentDomain(CtxMixin, lt.CurrentDomain):
    """
    Represents a TileDB current domain.
    """

    def __init__(self, ctx: Ctx):
        """Class representing the current domain of a TileDB Array.

        :param ctx: A TileDB Context
        :raises tiledb.TileDBError:
        """
        super().__init__(ctx)

    def _set_domain(self, domain: Domain):
        self._domain = domain

    @property
    def type(self):
        """The type of the current domain.

        :rtype: tiledb.CurrentDomainType
        """
        return self._type

    @property
    def is_empty(self):
        """Checks if the current domain is empty.

        :rtype: bool
        """
        return self._is_empty()

    def set_ndrectangle(self, ndrect: NDRectangle):
        """Sets an N-dimensional rectangle representation on a current domain.

        :param ndrect: The N-dimensional rectangle to be used.
        :raises tiledb.TileDBError:
        """
        self._set_ndrectangle(ndrect)
        self._domain = ndrect._get_domain()

    @property
    def ndrectangle(self):
        """Gets the N-dimensional rectangle associated with the current domain object.

        :rtype: NDRectangle
        :raises tiledb.TileDBError:
        """
        ndrect = NDRectangle.from_pybind11(self._ctx, self._ndrectangle())
        ndrect._set_domain(self._domain)
        return ndrect