Cursor.h
Go to the documentation of this file.
1 /******************************************************************************/
36 /******************************************************************************/
37 
38 #if !defined(CURSOR_H)
39 #define CURSOR_H
40 
41 template<typename K, typename V>
42 class Cursor {
43 public:
47 ) {
48  this->dictionary = dictionary;
49  dictionary_find(dictionary, predicate, &cursor);
50  record.key = malloc(dictionary->instance->record.key_size);
51  record.value = malloc(dictionary->instance->record.value_size);
52 }
53 
55 ) {
57  free(record.key);
58  free(record.value);
59 }
60 
61 bool
63 ) {
65 }
66 
67 bool
69 ) {
71 
72  return status == cs_cursor_initialized || status == cs_cursor_active;
73 }
74 
75 K
77 ) {
78  return *((K *) record.key);
79 }
80 
81 V
83 ) {
84  return *((V *) record.value);
85 }
86 
87 private:
88 
92 };
93 
94 #endif
K getKey()
Definition: Cursor.h:76
ion_cursor_status_t(* next)(ion_dict_cursor_t *, ion_record_t *record)
ion_record_info_t record
bool hasNext()
Definition: Cursor.h:62
ion_dictionary_parent_t * instance
bool next()
Definition: Cursor.h:68
ion_value_t value
Definition: kv_system.h:318
void(* destroy)(ion_dict_cursor_t **)
Struct used to maintain key and value.
Definition: kv_system.h:315
ion_cursor_status_t status
ion_key_t key
Definition: kv_system.h:316
~Cursor()
Definition: Cursor.h:54
A dictionary contains information regarding an instance of the storage element and the associated han...
A supertype for dictionary cursor objects.
Definition: Cursor.h:42
V getValue()
Definition: Cursor.h:82
ion_dict_cursor_t * cursor
Definition: Cursor.h:90
ion_key_size_t key_size
Definition: kv_system.h:307
A supertype for cursor predicate objects.
Cursor(ion_dictionary_t *dictionary, ion_predicate_t *predicate)
Definition: Cursor.h:44
ion_err_t dictionary_find(ion_dictionary_t *dictionary, ion_predicate_t *predicate, ion_dict_cursor_t **cursor)
Uses the given predicate and cursor to search the dictionary.
Definition: dictionary.c:562
ion_dictionary_t * dictionary
Definition: Cursor.h:89
ion_record_t record
Definition: Cursor.h:91
ion_value_size_t value_size
Definition: kv_system.h:309
char ion_cursor_status_t
A type for the status of a cursor.