
Data Structures | |
| struct | VOLK_Buffer |
| General-purpose data buffer. More... | |
| struct | VOLK_BufferTriple |
| Triple of byte buffers. More... | |
Macros | |
| #define | BTRP_DUMMY VOLK_btriple_new (BUF_DUMMY, BUF_DUMMY, BUF_DUMMY) |
| Dummy buffer triple. | |
| #define | BUF_DUMMY VOLK_buffer_new (NULL, 0) |
| Dummy buffer to be used with VOLK_buffer_init. | |
| #define | NULL_KEY 0 |
| "NULL" key, a value that is never user-provided. | |
Enumerations | |
| enum | VOLK_BufferFlag { VOLK_BUF_BORROWED = 1<<0 } |
| Buffer flags, stored in buffer structure. More... | |
| enum | VOLK_TriplePos { TRP_POS_S = 0 , TRP_POS_P = 1 , TRP_POS_O = 2 } |
| Triple position of s, p, o. More... | |
Functions | |
| void | VOLK_btriple_done (VOLK_BufferTriple *sspo) |
| Free the internal pointers of a buffer triple. | |
| void | VOLK_btriple_free (VOLK_BufferTriple *sspo) |
| Free a buffer triple and all its internal pointers. | |
| VOLK_Key | VOLK_btriple_hash (const VOLK_BufferTriple *strp) |
| Hash a buffer triple. | |
| VOLK_rc | VOLK_btriple_init (VOLK_BufferTriple *sspo, VOLK_Buffer *s, VOLK_Buffer *p, VOLK_Buffer *o) |
| Initialize internal term pointers in a heap-allocated buffer triple. | |
| VOLK_BufferTriple * | VOLK_btriple_new (VOLK_Buffer *s, VOLK_Buffer *p, VOLK_Buffer *o) |
| Create a new buffer triple. | |
| VOLK_Buffer * | VOLK_btriple_pos (const VOLK_BufferTriple *btrp, VOLK_TriplePos n) |
| Get serialized triple by term position. | |
| char * | VOLK_buffer_as_str (const VOLK_Buffer *buf) |
| Format a buffer into anb ASCII string. | |
| int | VOLK_buffer_cmp (const VOLK_Buffer *buf1, const VOLK_Buffer *buf2) |
| Compare two buffers. | |
| void | VOLK_buffer_done (VOLK_Buffer *buf) |
| Free the content of a buffer. | |
| bool | VOLK_buffer_eq (const VOLK_Buffer *buf1, const VOLK_Buffer *buf2) |
| Return whether two buffers are equal. | |
| void | VOLK_buffer_free (VOLK_Buffer *buf) |
| Free a buffer. | |
| VOLK_Key | VOLK_buffer_hash (const VOLK_Buffer *buf) |
| Hash a buffer. | |
| VOLK_rc | VOLK_buffer_init (VOLK_Buffer *buf, const size_t size, const unsigned char *data) |
| Initialize or reuse a buffer handle. | |
| VOLK_Buffer * | VOLK_buffer_new (const unsigned char *data, const size_t size) |
| Create a new buffer and optionally populate it with data. | |
| VOLK_Buffer * | VOLK_buffer_new_borrowed (unsigned char *data, const size_t size) |
| Create a borrowed buffer (memory view). | |
| void | VOLK_buffer_print (const VOLK_Buffer *buf) |
| Print a byte string of a given length in a human-readable format. | |
Variables | |
| VOLK_Buffer * | VOLK_default_ctx_buf |
| Serialized default context. | |
| #define BTRP_DUMMY VOLK_btriple_new (BUF_DUMMY, BUF_DUMMY, BUF_DUMMY) |
Dummy buffer triple.
Triple of dummy buffer, with VOLK_Buffer size space allocated, but no contents.
Free with VOLK_btriple_free().
| #define BUF_DUMMY VOLK_buffer_new (NULL, 0) |
Dummy buffer to be used with VOLK_buffer_init.
| #define NULL_KEY 0 |
| enum VOLK_BufferFlag |
Buffer flags, stored in buffer structure.
| Enumerator | |
|---|---|
| VOLK_BUF_BORROWED | Borrowed buffer. This indicates that the memory block pointed to by the buffer is owned by another function, and instructs VOLK_buffer_free() to only free the buffer handle, but not the underlying data. |
| enum VOLK_TriplePos |
| void VOLK_btriple_done | ( | VOLK_BufferTriple * | sspo | ) |
| void VOLK_btriple_free | ( | VOLK_BufferTriple * | sspo | ) |
|
inline |
| VOLK_rc VOLK_btriple_init | ( | VOLK_BufferTriple * | sspo, |
| VOLK_Buffer * | s, | ||
| VOLK_Buffer * | p, | ||
| VOLK_Buffer * | o ) |
Initialize internal term pointers in a heap-allocated buffer triple.
| [in] | sspo | Serialized triple pointer to initialize. |
| [in] | s | Subject as a serialized buffer. |
| [in] | p | Predicate as a serialized buffer. |
| [in] | o | Object as a serialized buffer. |
| VOLK_BufferTriple * VOLK_btriple_new | ( | VOLK_Buffer * | s, |
| VOLK_Buffer * | p, | ||
| VOLK_Buffer * | o ) |
Create a new buffer triple.
| [in] | s | Subject as a serialized buffer. |
| [in] | p | Predicate as a serialized buffer. |
| [in] | o | Object as a serialized buffer. |
|
inline |
| char * VOLK_buffer_as_str | ( | const VOLK_Buffer * | buf | ) |
|
inline |
| void VOLK_buffer_done | ( | VOLK_Buffer * | buf | ) |
|
inline |
Return whether two buffers are equal.
This may be faster than VOLK_buffer_cmp() because it does a size comparison first.
| void VOLK_buffer_free | ( | VOLK_Buffer * | buf | ) |
Free a buffer.
|
inline |
| VOLK_rc VOLK_buffer_init | ( | VOLK_Buffer * | buf, |
| const size_t | size, | ||
| const unsigned char * | data ) |
Initialize or reuse a buffer handle.
The handle must have been created with VOLK_buffer_new*().
The data block is resized without being freed first. The handle must be eventually freed with VOLK_buffer_done() after use.
| [in] | buf | A buffer handle obtained with VOLK_buffer_new or by manual allocation. |
| [in] | size | New size. |
| [in] | data | If not NULL, data to replace the existing ones. The size of the data to be copied is determined by the size parameter. If NULL, the existing data are preserved as with a normal realloc(). |
|
inline |
Create a new buffer and optionally populate it with data.
To change the buffer size and/or data later call VOLK_buffer_init.
To copy a buffer just do buf2 = VOLK_buffer_new (buf1->addr, buf1->size);
| [in] | size | Length of the data. |
| [in] | data | Optional data to initially populate the object with. If NULL, the buffer data are garbage. |
|
inline |
Create a borrowed buffer (memory view).
A borrowed buffer does not own the memory block pointed to and should not be freed. It can be identified by the VOLK_BUF_BORROWED flag.
| [in] | data | Address of data handled by the buffer. |
| [in] | size | Length of the data. |
| void VOLK_buffer_print | ( | const VOLK_Buffer * | buf | ) |
|
extern |