/* Copyright (c) 2022 Alex Diener This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Alex Diener alex@ludobloom.com */ #ifndef __ReverseIndexLookup_H__ #define __ReverseIndexLookup_H__ typedef struct ReverseIndexLookup ReverseIndexLookup; #define ReverseIndexLookup_superclass StemObject #include "stemobject/StemObject.h" #include "utilities/HashTable.h" struct ReverseIndexLookup_entry { unsigned int count; unsigned int allocatedCount; unsigned int * values; }; #define ReverseIndexLookup_ivars \ StemObject_ivars \ \ HashTable * hashTable; #define ReverseIndexLookup_vtable(self_type) \ StemObject_vtable(self_type) stemobject_declare(ReverseIndexLookup) ReverseIndexLookup * ReverseIndexLookup_create(void); bool ReverseIndexLookup_init(ReverseIndexLookup * self); void ReverseIndexLookup_dispose(ReverseIndexLookup * self); void ReverseIndexLookup_empty(ReverseIndexLookup * self); void ReverseIndexLookup_set(ReverseIndexLookup * self, unsigned int key, unsigned int value); void ReverseIndexLookup_unset(ReverseIndexLookup * self, unsigned int key, unsigned int value); struct ReverseIndexLookup_entry * ReverseIndexLookup_get(ReverseIndexLookup * self, unsigned int key); unsigned int ReverseIndexLookup_getCount(ReverseIndexLookup * self, unsigned int key); unsigned int ReverseIndexLookup_getValue(ReverseIndexLookup * self, unsigned int key, unsigned int valueIndex); #endif