Dictionary< K, V > Class Template Reference

#include <Dictionary.h>

Inheritance diagram for Dictionary< K, V >:
Collaboration diagram for Dictionary< K, V >:

Public Member Functions

 ~Dictionary ()
 
ion_err_t initializeDictionary (ion_dictionary_id_t dict_id, ion_key_type_t k_type, ion_key_size_t k_size, ion_value_size_t v_size, ion_dictionary_size_t dictionary_size)
 Creates a dictionary with a specific identifier (for use through the master table). More...
 
ion_status_t insert (K key, V value)
 Insert a value into a dictionary. More...
 
get (K key)
 Retrieve a value given a key. More...
 
ion_status_t deleteRecord (K key)
 Delete a value given a key. More...
 
ion_status_t update (K key, V value)
 Update all records with a given key. More...
 
ion_err_t deleteDictionary ()
 Deletes dictionary. More...
 
ion_err_t destroyDictionary (ion_dictionary_id_t id)
 Destroys dictionary. More...
 
ion_err_t open (ion_dictionary_config_info_t config_info)
 Opens a dictionary, given the desired config. More...
 
ion_err_t close ()
 Closes a dictionary. More...
 
Cursor< K, V > * range (K min_key, K max_key)
 Sets up cursor and predicate to perform a range query on a dictionary. More...
 
Cursor< K, V > * equality (K key)
 Sets up cursor and predicate perform an equality query on a dictionary for a given key. More...
 
Cursor< K, V > * allRecords ()
 Sets up cursor and predicate in order to find all records present in the dictionary. More...
 

Public Attributes

ion_dictionary_handler_t handler
 
ion_dictionary_t dict
 
ion_key_type_t key_type
 
ion_key_size_t key_size
 
ion_value_size_t value_size
 
ion_dictionary_size_t dict_size
 
ion_status_t last_status
 

Detailed Description

template<typename K, typename V>
class Dictionary< K, V >

Definition at line 48 of file Dictionary.h.

Constructor & Destructor Documentation

template<typename K, typename V>
Dictionary< K, V >::~Dictionary ( )
inline

Definition at line 59 of file Dictionary.h.

60  {
61  this->deleteDictionary();
62 }
ion_err_t deleteDictionary()
Deletes dictionary.
Definition: Dictionary.h:193

Here is the call graph for this function:

Member Function Documentation

template<typename K, typename V>
Cursor<K, V>* Dictionary< K, V >::allRecords ( )
inline

Sets up cursor and predicate in order to find all records present in the dictionary.

Returns
An initialized cursor for the particular query.

Definition at line 291 of file Dictionary.h.

292  {
294 
296  return new Cursor<K, V>(&dict, &predicate);
297 }
Definition: Cursor.h:42
A supertype for cursor predicate objects.
ion_dictionary_t dict
Definition: Dictionary.h:52
ion_err_t dictionary_build_predicate(ion_predicate_t *predicate, ion_predicate_type_t type,...)
Builds a predicate based on the type given.
Definition: dictionary.c:512

Here is the call graph for this function:

template<typename K, typename V>
ion_err_t Dictionary< K, V >::close ( )
inline

Closes a dictionary.

Definition at line 235 of file Dictionary.h.

236  {
238 
239  return err;
240 }
char ion_err_t
The error type used to store error codes.
Definition: kv_system.h:226
ion_err_t dictionary_close(ion_dictionary_t *dictionary)
Closes a dictionary.
Definition: dictionary.c:372
ion_dictionary_t dict
Definition: Dictionary.h:52

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename K, typename V>
ion_err_t Dictionary< K, V >::deleteDictionary ( )
inline

Deletes dictionary.

Returns
An error message describing the total destruction of the dictionary.

Definition at line 193 of file Dictionary.h.

194  {
196 
197  return err;
198 }
char ion_err_t
The error type used to store error codes.
Definition: kv_system.h:226
ion_err_t dictionary_delete_dictionary(ion_dictionary_t *dictionary)
Destroys dictionary.
Definition: dictionary.c:178
ion_dictionary_t dict
Definition: Dictionary.h:52

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename K, typename V>
ion_status_t Dictionary< K, V >::deleteRecord ( key)
inline

Delete a value given a key.

Parameters
keyThe key to be deleted.
Returns
An error message describing the result of the deletion.

Definition at line 153 of file Dictionary.h.

155  {
156  ion_key_t ion_key = &key;
157  ion_status_t status = dictionary_delete(&dict, ion_key);
158 
159  this->last_status = status;
160 
161  return status;
162 }
#define key(k)
Definition: bpp_tree.c:75
ion_status_t dictionary_delete(ion_dictionary_t *dictionary, ion_key_t key)
Delete a value given a key.
Definition: dictionary.c:199
void * ion_key_t
A dictionary key.
Definition: kv_system.h:241
ion_status_t last_status
Definition: Dictionary.h:57
ion_dictionary_t dict
Definition: Dictionary.h:52
A status object that describes the result of a dictionary operation.
Definition: kv_system.h:290

Here is the call graph for this function:

template<typename K, typename V>
ion_err_t Dictionary< K, V >::destroyDictionary ( ion_dictionary_id_t  id)
inline

Destroys dictionary.

Parameters
idThe identifier identifying the dictionary to destroy.
Returns
The status of the total destruction of the dictionary.

Definition at line 207 of file Dictionary.h.

209  {
211 
212  return error;
213 }
char ion_err_t
The error type used to store error codes.
Definition: kv_system.h:226
ion_err_t dictionary_destroy_dictionary(ion_dictionary_handler_t *handler, ion_dictionary_id_t id)
Destroys dictionary.
Definition: dictionary.c:185
ion_dictionary_handler_t handler
Definition: Dictionary.h:51
#define error(rc)
Definition: bpp_tree.c:139

Here is the call graph for this function:

template<typename K, typename V>
Cursor<K, V>* Dictionary< K, V >::equality ( key)
inline

Sets up cursor and predicate perform an equality query on a dictionary for a given key.

Parameters
keyThe key used to determine equality.
Returns
An initialized cursor for the particular query.

Definition at line 274 of file Dictionary.h.

276  {
278  ion_key_t ion_key = &key;
279 
280  dictionary_build_predicate(&predicate, predicate_equality, ion_key);
281  return new Cursor<K, V>(&dict, &predicate);
282 }
#define key(k)
Definition: bpp_tree.c:75
void * ion_key_t
A dictionary key.
Definition: kv_system.h:241
Definition: Cursor.h:42
A supertype for cursor predicate objects.
ion_dictionary_t dict
Definition: Dictionary.h:52
ion_err_t dictionary_build_predicate(ion_predicate_t *predicate, ion_predicate_type_t type,...)
Builds a predicate based on the type given.
Definition: dictionary.c:512

Here is the call graph for this function:

template<typename K, typename V>
V Dictionary< K, V >::get ( key)
inline

Retrieve a value given a key.

Parameters
keyThe key to retrieve the value for.
Returns
value A pointer to the value byte array to copy data into.

Definition at line 134 of file Dictionary.h.

136  {
137  ion_key_t ion_key = &key;
139 
140  this->last_status = dictionary_get(&dict, ion_key, ion_value);
141 
142  return *((V *) ion_value);
143 }
unsigned char ion_byte_t
A byte type.
Definition: kv_system.h:232
ion_record_info_t record
ion_dictionary_parent_t * instance
#define key(k)
Definition: bpp_tree.c:75
void * ion_key_t
A dictionary key.
Definition: kv_system.h:241
ion_status_t dictionary_get(ion_dictionary_t *dictionary, ion_key_t key, ion_value_t value)
Retrieve a value given a key.
Definition: dictionary.c:160
ion_status_t last_status
Definition: Dictionary.h:57
ion_dictionary_t dict
Definition: Dictionary.h:52
ion_value_size_t value_size
Definition: kv_system.h:309

Here is the call graph for this function:

template<typename K, typename V>
ion_err_t Dictionary< K, V >::initializeDictionary ( ion_dictionary_id_t  dict_id,
ion_key_type_t  k_type,
ion_key_size_t  k_size,
ion_value_size_t  v_size,
ion_dictionary_size_t  dictionary_size 
)
inline

Creates a dictionary with a specific identifier (for use through the master table).

Parameters
dict_idA unique identifier important for use of the dictionary through the master table. If the dictionary is being created without the master table, this identifier can be 0.
k_typeThe type of key to be used with this dictionary, which determines the key comparison operator.
k_sizeThe size of the key type to be used with this dictionary.
v_sizeThe size of the value type to be used with this dictionary.
dictionary_sizeThe dictionary implementation specific dictionary size parameter.
Returns
An error code describing the result of the operation.

Definition at line 84 of file Dictionary.h.

90  {
91  key_type = k_type;
92  key_size = k_size;
93  value_size = v_size;
94  dict_size = dictionary_size;
95 
96  ion_err_t err = dictionary_create(&handler, &dict, dict_id, k_type, k_size, v_size, dictionary_size);
97 
98  return err;
99 }
ion_key_type_t key_type
Definition: Dictionary.h:53
ion_value_size_t value_size
Definition: Dictionary.h:55
char ion_err_t
The error type used to store error codes.
Definition: kv_system.h:226
ion_err_t dictionary_create(ion_dictionary_handler_t *handler, ion_dictionary_t *dictionary, ion_dictionary_id_t id, ion_key_type_t key_type, ion_key_size_t key_size, ion_value_size_t value_size, ion_dictionary_size_t dictionary_size)
Creates as instance of a specific type of dictionary.
Definition: dictionary.c:125
ion_key_size_t key_size
Definition: Dictionary.h:54
ion_dictionary_handler_t handler
Definition: Dictionary.h:51
ion_dictionary_t dict
Definition: Dictionary.h:52
ion_dictionary_size_t dict_size
Definition: Dictionary.h:56

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename K, typename V>
ion_status_t Dictionary< K, V >::insert ( key,
value 
)
inline

Insert a value into a dictionary.

Parameters
keyThe key that identifies value.
valueThe value to store under key.
Returns
An error message describing the result of the insertion.

Definition at line 111 of file Dictionary.h.

114  {
115  ion_key_t ion_key = &key;
116  ion_value_t ion_value = &value;
117 
118  ion_status_t status = dictionary_insert(&dict, ion_key, ion_value);
119 
120  this->last_status = status;
121 
122  return status;
123 }
#define key(k)
Definition: bpp_tree.c:75
ion_status_t dictionary_insert(ion_dictionary_t *dictionary, ion_key_t key, ion_value_t value)
Insert a value into a dictionary.
Definition: dictionary.c:151
void * ion_key_t
A dictionary key.
Definition: kv_system.h:241
void * ion_value_t
A dictionary value.
Definition: kv_system.h:246
ion_status_t last_status
Definition: Dictionary.h:57
ion_dictionary_t dict
Definition: Dictionary.h:52
A status object that describes the result of a dictionary operation.
Definition: kv_system.h:290

Here is the call graph for this function:

template<typename K, typename V>
ion_err_t Dictionary< K, V >::open ( ion_dictionary_config_info_t  config_info)
inline

Opens a dictionary, given the desired config.

Parameters
config_infoThe configuration of the dictionary to be opened.
Returns
An error message describing the result of of the open.

Definition at line 223 of file Dictionary.h.

225  {
226  ion_err_t err = dictionary_open(&handler, &dict, &config_info);
227 
228  return err;
229 }
char ion_err_t
The error type used to store error codes.
Definition: kv_system.h:226
ion_dictionary_handler_t handler
Definition: Dictionary.h:51
ion_err_t dictionary_open(ion_dictionary_handler_t *handler, ion_dictionary_t *dictionary, ion_dictionary_config_info_t *config)
Opens a dictionary, given the desired config.
Definition: dictionary.c:287
ion_dictionary_t dict
Definition: Dictionary.h:52

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename K, typename V>
Cursor<K, V>* Dictionary< K, V >::range ( min_key,
max_key 
)
inline

Sets up cursor and predicate to perform a range query on a dictionary.

Parameters
min_keyThe minimum key to be included in the query.
max_keyThe maximum key to be included in the query.
Returns
An initialized cursor for the particular query.

Definition at line 253 of file Dictionary.h.

256  {
258  ion_key_t ion_min_key = &min_key;
259  ion_key_t ion_max_key = &max_key;
260 
261  dictionary_build_predicate(&predicate, predicate_range, ion_min_key, ion_max_key);
262  return new Cursor<K, V>(&dict, &predicate);
263 }
void * ion_key_t
A dictionary key.
Definition: kv_system.h:241
Definition: Cursor.h:42
A supertype for cursor predicate objects.
ion_dictionary_t dict
Definition: Dictionary.h:52
ion_err_t dictionary_build_predicate(ion_predicate_t *predicate, ion_predicate_type_t type,...)
Builds a predicate based on the type given.
Definition: dictionary.c:512

Here is the call graph for this function:

template<typename K, typename V>
ion_status_t Dictionary< K, V >::update ( key,
value 
)
inline

Update all records with a given key.

Parameters
keyThe key to identify records for updating.
valueThe value to update records with.
Returns
An error message describing the result of the update.

Definition at line 174 of file Dictionary.h.

177  {
178  ion_key_t ion_key = &key;
179  ion_value_t ion_value = &value;
180  ion_status_t status = dictionary_update(&dict, ion_key, ion_value);
181 
182  this->last_status = status;
183 
184  return status;
185 }
#define key(k)
Definition: bpp_tree.c:75
ion_status_t dictionary_update(ion_dictionary_t *dictionary, ion_key_t key, ion_value_t value)
Update all records with a given key.
Definition: dictionary.c:169
void * ion_key_t
A dictionary key.
Definition: kv_system.h:241
void * ion_value_t
A dictionary value.
Definition: kv_system.h:246
ion_status_t last_status
Definition: Dictionary.h:57
ion_dictionary_t dict
Definition: Dictionary.h:52
A status object that describes the result of a dictionary operation.
Definition: kv_system.h:290

Here is the call graph for this function:

Member Data Documentation

template<typename K, typename V>
ion_dictionary_t Dictionary< K, V >::dict

Definition at line 52 of file Dictionary.h.

template<typename K, typename V>
ion_dictionary_size_t Dictionary< K, V >::dict_size

Definition at line 56 of file Dictionary.h.

template<typename K, typename V>
ion_dictionary_handler_t Dictionary< K, V >::handler

Definition at line 51 of file Dictionary.h.

template<typename K, typename V>
ion_key_size_t Dictionary< K, V >::key_size

Definition at line 54 of file Dictionary.h.

template<typename K, typename V>
ion_key_type_t Dictionary< K, V >::key_type

Definition at line 53 of file Dictionary.h.

template<typename K, typename V>
ion_status_t Dictionary< K, V >::last_status

Definition at line 57 of file Dictionary.h.

template<typename K, typename V>
ion_value_size_t Dictionary< K, V >::value_size

Definition at line 55 of file Dictionary.h.


The documentation for this class was generated from the following file: