From b5956c4dc6b065d664908104d5fc6752a87e3364 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 31 Mar 2023 17:17:41 -0400 Subject: Add model and serd-sort utility With all the new functionality, the complexity of the serd-pipe command-line interface is starting to push the limits of available flags. So, instead of grafting on further options to control a model, this commit adds a new tool, serd-sort, which acts somewhat like a stripped-down serd-pipe that stores statements in a model in memory. This keeps the complexity (including the user-facing complexity) of any one tool down, since other more focused tools can be used for streaming tasks in a pipeline. In other words, abandon Swissarmyknifeism, take a page from the Unix philosophy, and try to expose the model functionality to the command-line in a dedicated focused tool. The model implementation is tested by using this tool to run a subset of the usual test suites, and a special suite to test statement sorting. --- src/model.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/model.h (limited to 'src/model.h') diff --git a/src/model.h b/src/model.h new file mode 100644 index 00000000..a67ba087 --- /dev/null +++ b/src/model.h @@ -0,0 +1,29 @@ +// Copyright 2011-2020 David Robillard +// SPDX-License-Identifier: ISC + +#ifndef SERD_SRC_MODEL_H +#define SERD_SRC_MODEL_H + +#include "cursor.h" + +#include "serd/cursor.h" +#include "serd/memory.h" +#include "serd/model.h" +#include "serd/nodes.h" +#include "serd/world.h" +#include "zix/btree.h" + +#include + +struct SerdModelImpl { + SerdAllocator* allocator; ///< Allocator for everything in this model + SerdWorld* world; ///< World this model is a part of + SerdNodes* nodes; ///< Interned nodes in this model + ZixBTree* indices[12]; ///< Trees of SerdStatement pointers + SerdCursor end; ///< End cursor (always the same) + size_t version; ///< Version incremented on every change + SerdStatementOrder default_order; ///< Order for main statement-owning index + SerdModelFlags flags; ///< Active indices and features +}; + +#endif // SERD_SRC_MODEL_H -- cgit v1.2.1