{"id":21293852,"url":"https://github.com/laumbourassa/gnt","last_synced_at":"2025-03-15T17:10:31.701Z","repository":{"id":262039417,"uuid":"886052305","full_name":"laumbourassa/gnt","owner":"laumbourassa","description":"Generic Nibble Trie (GNT) library in C","archived":false,"fork":false,"pushed_at":"2024-11-22T02:18:27.000Z","size":20,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T06:47:51.721Z","etag":null,"topics":["c","dynamic","generic","trie"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/laumbourassa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-10T04:01:13.000Z","updated_at":"2024-11-22T02:18:31.000Z","dependencies_parsed_at":"2024-11-13T04:27:31.229Z","dependency_job_id":null,"html_url":"https://github.com/laumbourassa/gnt","commit_stats":null,"previous_names":["laumbourassa/gbt","laumbourassa/gnt"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laumbourassa%2Fgnt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laumbourassa%2Fgnt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laumbourassa%2Fgnt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/laumbourassa%2Fgnt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/laumbourassa","download_url":"https://codeload.github.com/laumbourassa/gnt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243762269,"owners_count":20343979,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","dynamic","generic","trie"],"created_at":"2024-11-21T13:56:41.426Z","updated_at":"2025-03-15T17:10:31.674Z","avatar_url":"https://github.com/laumbourassa.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Generic Nibble Trie (GNT) Library\n\n## Overview\n\nThe **Generic Nibble Trie (GNT)** library is designed for efficient storage and retrieval of data using nibble tries. This library is type-agnostic, allowing users to insert and search for data of various types using flexible key representations.\n\n## Features\n- **Generic Key-Value Storage:** Supports different data types (integers, floats, and pointers) for both keys and values using a unified `gnt_key_t` and `gnt_data_t` type.\n- **Memory Management:** Offers user-defined deallocation functions for managing custom data structures.\n\n## Getting Started\n\n### Prerequisites\nTo use the GNT library, ensure you have a C compiler installed and the necessary tools to compile and link C programs.\n\n### Installation\n\n1. Clone the GNT library source files into your project directory.\n2. Include the **gnt.h** header file in your project:\n```c\n#include \"gnt.h\"\n```\n\n### Compilation\nTo compile your program with the GNT library, ensure you link both the **gnt.c** and **gnt.h** files with your program:\n\n```bash\ngcc -o your_program your_program.c gnt.c\n```\n\n### Basic Usage Example\n\n```c\n#include \u003cstdio.h\u003e\n#include \"gnt.h\"\n\nint main()\n{\n  // Create a nibble trie\n  gnt_trie_t* trie = gnt_create(NULL);\n\n  // Insert key-value pairs\n  gnt_insert(trie, GNT_KEY(1), GNT_DATA(100));\n  gnt_insert(trie, GNT_KEY(2), GNT_DATA(200));\n\n  // Search for a value by key\n  printf(\"Value for key 1: %ld\\n\", (long) gnt_search(trie, GNT_KEY(1)));\n\n  // Delete a key-value pair\n  gnt_delete(trie, GNT_KEY(1));\n\n  // Destroy the trie when done\n  gnt_destroy(trie);\n\n  return 0;\n}\n```\n\n### API Documentation\n\n#### Table Management\n- `gnt_trie_t* gnt_create(gnt_cfg_t* cfg);`  \n  Creates and returns a new nibble trie.\n\n- `gnt_status_t gnt_destroy(gnt_trie_t* trie);`  \n  Destroys the trie and frees all allocated memory using a custom deallocator if provided.\n\n#### Data Operations\n- `gnt_status_t gnt_insert(gnt_trie_t* trie, gnt_key_t key, gnt_data_t data);`  \n  Inserts a key-value pair into the trie.\n\n- `gnt_data_t gnt_search(gnt_trie_t* trie, gnt_key_t key);`  \n  Searches and returns the value associated with the given key, or 0 if not found.\n\n- `gnt_status_t gnt_delete(gnt_trie_t* trie, gnt_key_t key);`  \n  Deletes the key-value pair from the trie.\n\n#### Conversion Macros\n- `GNT_DATA(data)`  \n  Converts various data types (integers, floats, pointers) to `gnt_data_t`, which is used in the nibble trie.\n\n- `GNT_KEY(key)`  \n  Converts various data types to `gnt_key_t`, which is used as a key in the nibble trie.\n\n## License\n\nThe GNT library is released under the **MIT License**. You are free to use, modify, and distribute it under the terms of the license. See the [MIT License](https://opensource.org/licenses/MIT) for more details.\n\n## Author\n\nThis library was developed by **Laurent Mailloux-Bourassa**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaumbourassa%2Fgnt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flaumbourassa%2Fgnt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flaumbourassa%2Fgnt/lists"}