keyset.pxd 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. from lakesuperior.model.base cimport (
  2. Key, Key, DoubleKey, TripleKey, Buffer
  3. )
  4. ctypedef bint (*key_cmp_fn_t)(
  5. const TripleKey* spok, const Key k1, const Key k2
  6. )
  7. cdef class Keyset:
  8. cdef:
  9. TripleKey* data
  10. size_t capacity
  11. size_t cur # Index cursor used to look up values.
  12. size_t free_i # Index of next free slot.
  13. float expand_ratio # By how much storage is automatically expanded when
  14. # full. 1 means the size doubles, 0.5 a 50%
  15. # increase. 0 means that storage won't be
  16. # automatically expanded and adding above capacity
  17. # will raise an error.
  18. void seek(self, size_t idx=*)
  19. size_t size(self)
  20. size_t tell(self)
  21. bint get_next(self, TripleKey* item)
  22. void add(self, const TripleKey* val, bint check_dup=*) except *
  23. void remove(self, const TripleKey* val) except *
  24. bint contains(self, const TripleKey* val) nogil
  25. Keyset copy(self)
  26. Keyset sparse_copy(self)
  27. void resize(self, size_t size=*) except *
  28. Keyset lookup(self, const Key sk, const Key pk, const Key ok)
  29. cdef:
  30. Keyset merge(Keyset ks1, Keyset ks2)
  31. Keyset subtract(Keyset ks1, Keyset ks2)
  32. Keyset intersect(Keyset ks1, Keyset ks2)
  33. Keyset xor(Keyset ks1, Keyset ks2)