summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorhiddenalpha.ch2026-07-12 02:31:08 +0200
committerhiddenalpha.ch2026-07-12 02:31:08 +0200
commit007b23db8e6e57da59e0821dea3c95508c0f7003 (patch)
tree4a13416e80ab1710a344755941e47942e67a0895 /include
parent31e00a3697cdebc36395411f17655a729395033c (diff)
downloadQntan-007b23db8e6e57da59e0821dea3c95508c0f7003.tar.gz
Qntan-007b23db8e6e57da59e0821dea3c95508c0f7003.zip
Introduce `HshIdx`
Introduce `HshIdx`, a multi-dimensional HashTable. WARN: Early draft, not really usable yet.
Diffstat (limited to 'include')
-rw-r--r--include/qntan/Qntan.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/include/qntan/Qntan.h b/include/qntan/Qntan.h
index e159546..d5e77a7 100644
--- a/include/qntan/Qntan.h
+++ b/include/qntan/Qntan.h
@@ -73,6 +73,7 @@ struct Qntan_FileSystem_Dirent;
struct Qntan_FileSystem;
struct Qntan_FourierTransform;
struct Qntan_Process;
+struct Qntan_HshIdx;
struct Qntan_HshTbl;
struct Qntan_HshTbl_Cursor;
struct Qntan_Socket;
@@ -819,6 +820,39 @@ struct Qntan_Process {
+struct Qntan_HshIdx {
+ /* An n-dimensional HashTable. Where as many properties as wanted
+ * can be used to index into the table.
+ * BUT: ONLY the 1st index is considered to be unique (for
+ * consistency reasons, only ONE index can be used to decide if an
+ * object already exists for exmaple. Allowing multiple would cause
+ * conflicts as soon indexes disagree in such a case).
+ */
+ size_t (*getCnt)( struct Qntan_HshIdx** );
+ /* Returns number of objects currently present in this collection.
+ */
+ int (*addIfNew)( struct Qntan_HshIdx**, void*elm );
+ /* Returns 0 if 'elm' got copied into the hashtable.
+ * Returns '-EEXIST' (yep, negated) if 'elm' already exists. Nothing got
+ * copied anywhere.
+ * Returns negative values to indicate errors.
+ */
+ int (*get)( struct Qntan_HshIdx**, void*srch, void*ptrToDst, int idx );
+ /* Returns 0 if there's no object matching 'srch'.
+ * Returns 1 if found object got copied to 'ptrToDst'. The element itelf
+ * will swill be present in the table.
+ */
+};
+
+
+
+
+
+
+
+
+
+
struct Qntan_HshTbl {
/**/
int (*swap)( struct Qntan_HshTbl**, void*elm, void*ptrToDst );