#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "rdff.h"
Go to the source code of this file.
|
RDFF | rdff_open (const char *path, bool write) |
|
RDFFStatus | rdff_write_uri (RDFF file, uint32_t id, uint32_t len, const char *uri) |
|
RDFFStatus | rdff_write_triple (RDFF file, uint32_t subject, uint32_t predicate, uint32_t object_type, uint32_t object_size, const void *object) |
|
RDFFStatus | rdff_read_chunk (RDFF file, RDFFChunk **buf) |
|
bool | rdff_chunk_is_uri (RDFFChunk *chunk) |
|
bool | rdff_chunk_is_triple (RDFFChunk *chunk) |
|
void | rdff_close (RDFF file) |
|
#define READ |
( |
|
ptr, |
|
|
|
size, |
|
|
|
nmemb, |
|
|
|
stream |
|
) |
| |
Value:if (fread(ptr, size, nmemb, stream) != nmemb) { \
}
#define WRITE |
( |
|
ptr, |
|
|
|
size, |
|
|
|
nmemb, |
|
|
|
stream |
|
) |
| |
Value:if (fwrite(ptr, size, nmemb, stream) != nmemb) { \
}
Definition at line 84 of file rdff.c.
bool rdff_chunk_is_triple |
( |
RDFFChunk * |
chunk | ) |
|
Return true iff chunk is a Triple chunk.
Definition at line 165 of file rdff.c.
bool rdff_chunk_is_uri |
( |
RDFFChunk * |
chunk | ) |
|
Return true iff chunk is a URI chunk.
Definition at line 158 of file rdff.c.
void rdff_close |
( |
RDFF |
file | ) |
|
Close file. After this call, file is invalid.
Definition at line 171 of file rdff.c.
RDFF rdff_open |
( |
const char * |
path, |
|
|
bool |
write |
|
) |
| |
Open/Create a new RDFF file.
Definition at line 39 of file rdff.c.
Read a chunk from file.
- Parameters
-
buf | MUST point to an RDFFChunk dynamically allocated with malloc. The size field (i.e. (*buf)->size) MUST be set to the amount of available memory in the chunk (not including the header). If this is insufficient, buf will be resized using realloc. |
Definition at line 131 of file rdff.c.
RDFFStatus rdff_write_triple |
( |
RDFF |
file, |
|
|
uint32_t |
subject, |
|
|
uint32_t |
predicate, |
|
|
uint32_t |
object_type, |
|
|
uint32_t |
object_size, |
|
|
const void * |
object |
|
) |
| |
Write a key/value record to file.
Definition at line 108 of file rdff.c.
RDFFStatus rdff_write_uri |
( |
RDFF |
file, |
|
|
uint32_t |
id, |
|
|
uint32_t |
len, |
|
|
const char * |
uri |
|
) |
| |
Write a URI ID to file.
Definition at line 90 of file rdff.c.