Hash :
0b5042ee
Author :
Thomas de Grivel
Date :
2022-12-25T03:59:33
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
/* c3
* Copyright 2022 kmx.io <contact@kmx.io>
*
* Permission is hereby granted to use this software excepted
* on Apple computers granted the above copyright notice and
* this permission paragraph are included in all copies and
* substantial portions of this software.
*
* THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
* PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
* AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
* THIS SOFTWARE.
*/
#ifndef FACTS_H
#define FACTS_H
#include "types.h"
#define facts_count(facts) (facts->facts.count)
/* Stack allocation compatible functions */
void facts_clean (s_facts *facts);
s_facts * facts_init (s_facts *facts, s_buf *log);
/* Constructors */
s_facts * facts_new (s_buf *log);
/* Destructor */
void facts_delete (s_facts *facts);
/* Modifiers */
s_fact * facts_add_fact (s_facts *facts, const s_fact *fact);
s_fact * facts_add_tags (s_facts *facts, const s_tag *subject,
const s_tag *predicate,
const s_tag *object);
void facts_close (s_facts *facts);
sw facts_load (s_facts *facts, s_buf *buf);
sw facts_load_file (s_facts *facts, const s8 *path);
sw facts_open_file (s_facts *facts, const s8 *path);
s_tag * facts_ref_tag (s_facts *facts, const s_tag *tag);
e_bool facts_remove_fact (s_facts *facts, const s_fact *fact);
sw facts_save (s_facts *facts, const s8 *path);
e_bool facts_unref_tag (s_facts *facts, const s_tag *tag);
/* Observers */
sw facts_dump (const s_facts *facts, s_buf *buf);
sw facts_dump_file (const s_facts *facts, const s8 *path);
s_fact * facts_find_fact (const s_facts *facts, const s_fact *fact);
s_tag * facts_find_tag (const s_facts *facts, const s_tag *tag);
sw facts_log_add (s_buf *log, const s_fact *fact);
sw facts_log_remove (s_buf *log, const s_fact *fact);
sw facts_save_header (const s_facts *facts, s_buf *buf,
u64 digest, u64 dump_pos, u64 log_pos);
#endif /* FACTS_H */