mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-06 17:52:51 -06:00
get rid of the destructive updates for seq_ids
This commit is contained in:
@@ -5,6 +5,41 @@ class PgfSequence;
|
||||
class PgfSequenceItor;
|
||||
typedef ref<Node<PgfSequence>> PgfPhrasetable;
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wattributes"
|
||||
|
||||
struct PgfPhrasetableIds {
|
||||
public:
|
||||
PGF_INTERNAL_DECL PgfPhrasetableIds();
|
||||
PGF_INTERNAL_DECL ~PgfPhrasetableIds() { end(); }
|
||||
|
||||
PGF_INTERNAL_DECL void start(ref<PgfConcr> concr);
|
||||
PGF_INTERNAL_DECL size_t add(ref<PgfSequence> seq);
|
||||
PGF_INTERNAL_DECL size_t get(ref<PgfSequence> seq);
|
||||
PGF_INTERNAL_DECL void end();
|
||||
|
||||
private:
|
||||
size_t next_id;
|
||||
|
||||
struct PGF_INTERNAL_DECL SeqIdChain;
|
||||
|
||||
struct PGF_INTERNAL_DECL SeqIdPair {
|
||||
SeqIdChain *chain;
|
||||
ref<PgfSequence> seq;
|
||||
size_t seq_id;
|
||||
};
|
||||
|
||||
struct PGF_INTERNAL_DECL SeqIdChain : public SeqIdPair {
|
||||
SeqIdChain *next;
|
||||
};
|
||||
|
||||
size_t n_pairs;
|
||||
SeqIdPair *pairs;
|
||||
SeqIdChain *chains;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
PGF_INTERNAL_DECL
|
||||
PgfPhrasetable phrasetable_internalize(PgfPhrasetable table, ref<PgfSequence> *seq);
|
||||
|
||||
@@ -12,7 +47,8 @@ PGF_INTERNAL_DECL
|
||||
ref<PgfSequence> phrasetable_get(PgfPhrasetable table, size_t seq_id);
|
||||
|
||||
PGF_INTERNAL_DECL
|
||||
void phrasetable_iter(PgfPhrasetable table, PgfSequenceItor* itor, size_t *p_next_id, PgfExn *err);
|
||||
void phrasetable_iter(PgfPhrasetable table, PgfSequenceItor* itor,
|
||||
PgfPhrasetableIds *seq_ids, PgfExn *err);
|
||||
|
||||
PGF_INTERNAL_DECL
|
||||
void phrasetable_release(PgfPhrasetable table);
|
||||
|
||||
Reference in New Issue
Block a user