#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <alloca.h>
Description
This file contains commonly used types and some helpful macros.
- Copyright
- Copyright 2017 The University of British Columbia, IonDB Project Contributors (see AUTHORS.md)
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- 1.Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
- 2.Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- 3.Neither the name of the copyright holder nor the names of its contributors
- may be used to endorse or promote products derived from this software without specific prior written permission.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition in file kv_system.h.
Classes | |
struct | ion_status_t |
A status object that describes the result of a dictionary operation. More... | |
struct | record_info |
Struct used to maintain information about size of key and value. More... | |
struct | ion_record |
Struct used to maintain key and value. More... | |
Macros | |
#define | fremove(x) remove(x) |
#define | frewind(x) rewind(x) |
#define | fdeleteall() |
#define | ION_USING_MASTER_TABLE 1 |
#define | ION_USING_ECLIPSE 0 |
#define | ION_DEBUG 0 |
#define | ION_IS_EQUAL 0 |
#define | ION_IS_GREATER 1 |
#define | ION_IS_LESS -1 |
#define | ION_ZERO 0 |
#define | ION_RETURN_VALUE 0x73/* Magic default return value to be easy to spot */ |
#define | ION_MAX_FILENAME_LENGTH 12 |
Since the arduino conforms to 8.3 syntax, that's 8 + 3 = 11 + 1 (null terminator) characters. More... | |
#define | DUMP(varname, format) printf("Variable %s = " format "\n", # varname, varname);fflush(stdout) |
#define | PANIC(stuff) printf("\t\t%s\n", stuff);fflush(stdout) |
#define | IONIZE(something, type) & (type) { (something) } |
#define | NEUTRALIZE(something, type) (*((type *) (something))) |
#define | IONIZE_VAL(varname, size) ion_byte_t varname[size] |
#define | UNUSED(x) (void) ((x)) |
#define | ION_STATUS_CREATE(error, count) |
#define | ION_STATUS_INITIALIZE |
#define | ION_STATUS_ERROR(error) |
#define | ION_STATUS_OK(count) |
Typedefs | |
typedef unsigned char | byte |
A byte type. Do not use this type directly. More... | |
typedef enum ION_KEY_TYPE | ion_key_type_t |
This is the available key types for ION_DB. All types will be based on system defines. More... | |
typedef enum ION_DICTIONARY_TYPE | ion_dictionary_type_t |
This is the available dictionary types for ION_DB. All types will be based on system defines. More... | |
typedef char | ion_err_t |
The error type used to store error codes. More... | |
typedef unsigned char | ion_byte_t |
A byte type. More... | |
typedef long | ion_fpos_t |
A file position type. More... | |
typedef void * | ion_key_t |
A dictionary key. More... | |
typedef void * | ion_value_t |
A dictionary value. More... | |
typedef int | ion_key_size_t |
The size (length) of a dictionary key in bytes. More... | |
typedef int | ion_value_size_t |
The size (length) of a dictionary value in bytes. More... | |
typedef unsigned int | ion_dictionary_size_t |
The implementation specific size of the dictionary. More... | |
typedef char | ion_boolean_t |
A boolean type. More... | |
typedef enum ION_BOOLEAN | ion_boolean_e |
Boolean values. More... | |
typedef int | ion_result_count_t |
A type for the number of results changed during an operation. More... | |
typedef char | ion_record_status_t |
A type for record statuses used in some structures. More... | |
typedef struct record_info | ion_record_info_t |
Struct used to maintain information about size of key and value. More... | |
typedef struct ion_record | ion_record_t |
Struct used to maintain key and value. More... | |
Macro Definition Documentation
#define DUMP | ( | varname, | |
format | |||
) | printf("Variable %s = " format "\n", # varname, varname);fflush(stdout) |
Definition at line 78 of file kv_system.h.
#define fdeleteall | ( | ) |
Definition at line 58 of file kv_system.h.
#define fremove | ( | x | ) | remove(x) |
Definition at line 56 of file kv_system.h.
#define frewind | ( | x | ) | rewind(x) |
Definition at line 57 of file kv_system.h.
#define ION_DEBUG 0 |
Definition at line 63 of file kv_system.h.
#define ION_IS_EQUAL 0 |
Definition at line 64 of file kv_system.h.
#define ION_IS_GREATER 1 |
Definition at line 65 of file kv_system.h.
#define ION_IS_LESS -1 |
Definition at line 66 of file kv_system.h.
#define ION_MAX_FILENAME_LENGTH 12 |
Since the arduino conforms to 8.3 syntax, that's 8 + 3 = 11 + 1 (null terminator) characters.
Definition at line 73 of file kv_system.h.
#define ION_RETURN_VALUE 0x73/* Magic default return value to be easy to spot */ |
Definition at line 68 of file kv_system.h.
#define ION_STATUS_CREATE | ( | error, | |
count | |||
) |
Definition at line 104 of file kv_system.h.
#define ION_STATUS_ERROR | ( | error | ) |
Definition at line 110 of file kv_system.h.
#define ION_STATUS_INITIALIZE |
Definition at line 107 of file kv_system.h.
#define ION_STATUS_OK | ( | count | ) |
Definition at line 113 of file kv_system.h.
#define ION_USING_ECLIPSE 0 |
Definition at line 62 of file kv_system.h.
#define ION_USING_MASTER_TABLE 1 |
Definition at line 61 of file kv_system.h.
#define ION_ZERO 0 |
Definition at line 67 of file kv_system.h.
#define IONIZE | ( | something, | |
type | |||
) | & (type) { (something) } |
Definition at line 98 of file kv_system.h.
#define IONIZE_VAL | ( | varname, | |
size | |||
) | ion_byte_t varname[size] |
Definition at line 100 of file kv_system.h.
#define NEUTRALIZE | ( | something, | |
type | |||
) | (*((type *) (something))) |
Definition at line 99 of file kv_system.h.
#define PANIC | ( | stuff | ) | printf("\t\t%s\n", stuff);fflush(stdout) |
Definition at line 79 of file kv_system.h.
#define UNUSED | ( | x | ) | (void) ((x)) |
Definition at line 102 of file kv_system.h.
Typedef Documentation
typedef unsigned char byte |
A byte type. Do not use this type directly.
This type is only provided for compatibility with the Arduino. If you want a byte type, use ion_byte_t instead.
Definition at line 93 of file kv_system.h.
typedef enum ION_BOOLEAN ion_boolean_e |
Boolean values.
typedef char ion_boolean_t |
A boolean type.
Definition at line 269 of file kv_system.h.
typedef unsigned char ion_byte_t |
A byte type.
This is an unsigned, integral value capable of holding the range of a byte.
Definition at line 232 of file kv_system.h.
typedef unsigned int ion_dictionary_size_t |
The implementation specific size of the dictionary.
Each implementation uses the dictionary size variable differently. It may be important to preserve the ability for variables of this type to become negative.
Definition at line 264 of file kv_system.h.
typedef enum ION_DICTIONARY_TYPE ion_dictionary_type_t |
This is the available dictionary types for ION_DB. All types will be based on system defines.
typedef char ion_err_t |
The error type used to store error codes.
This allows us to have finite control over the size of error codes returned.
Definition at line 226 of file kv_system.h.
typedef long ion_fpos_t |
A file position type.
Definition at line 237 of file kv_system.h.
typedef int ion_key_size_t |
The size (length) of a dictionary key in bytes.
Definition at line 251 of file kv_system.h.
typedef void* ion_key_t |
A dictionary key.
Definition at line 241 of file kv_system.h.
typedef enum ION_KEY_TYPE ion_key_type_t |
This is the available key types for ION_DB. All types will be based on system defines.
typedef struct record_info ion_record_info_t |
Struct used to maintain information about size of key and value.
typedef char ion_record_status_t |
A type for record statuses used in some structures.
This is used in at least the open address hash tables and the flat file dictionaries.
Definition at line 301 of file kv_system.h.
typedef struct ion_record ion_record_t |
Struct used to maintain key and value.
typedef int ion_result_count_t |
A type for the number of results changed during an operation.
Definition at line 284 of file kv_system.h.
typedef int ion_value_size_t |
The size (length) of a dictionary value in bytes.
Definition at line 256 of file kv_system.h.
typedef void* ion_value_t |
A dictionary value.
Definition at line 246 of file kv_system.h.
Enumeration Type Documentation
enum ION_BOOLEAN |
Boolean values.
Enumerator | |
---|---|
boolean_false |
|
boolean_true |
|
Definition at line 274 of file kv_system.h.
enum ION_DICTIONARY_TYPE |
This is the available dictionary types for ION_DB. All types will be based on system defines.
Enumerator | |
---|---|
dictionary_type_bpp_tree_t |
|
dictionary_type_flat_file_t |
|
dictionary_type_open_address_file_hash_t |
|
dictionary_type_open_address_hash_t |
|
dictionary_type_skip_list_t |
|
dictionary_type_linear_hash_t |
|
dictionary_type_error_t |
|
Definition at line 137 of file kv_system.h.
enum ION_ERROR |
The list of all possible errors generated by any IonDB operation.
Definition at line 158 of file kv_system.h.
enum ION_KEY_TYPE |
This is the available key types for ION_DB. All types will be based on system defines.
Definition at line 121 of file kv_system.h.