Skip to content

Library of Data Container Structures

License

GPL-3.0, GPL-3.0 licenses found

Licenses found

GPL-3.0
LICENSE
GPL-3.0
COPYING
Notifications You must be signed in to change notification settings

SzigetiJ/BilisDcs

Folders and files

NameName
Last commit message
Last commit date
Mar 4, 2024
Mar 5, 2024
Mar 4, 2024
Mar 4, 2024
Mar 5, 2024
Jul 6, 2020
Mar 4, 2024
Jun 1, 2020
Jun 1, 2020
Jun 1, 2020
Jun 1, 2020
Jun 1, 2020
Oct 4, 2020
Jun 1, 2020
Jun 1, 2020
Mar 5, 2024
Oct 4, 2020

Repository files navigation

GitHub C/C++ CI Codacy Badge codecov GitHub code size GitHub repo size GitHub commit activity GitHub issues GitHub closed issues

BilisDcs

Collection of Reliable Data Container Structures for Standard C

Quick Intro

  1. Define your type
typedef struct {
 char name[20];
 int param_a;
 unsigned int param_b;
} NameAndValue;
  1. Allocate space for the container
#define STACKSIZE 16
NameAndValue name_and_values[STACKSIZE];
  1. Initialize the container
DcsStack nv_stack = dcsstack_init(sizeof(NameAndValue), STACKSIZE, name_and_values);
  1. Use the container
NameAndValue nv0 = {"Foo", -123, 4};
dcsstack_push(&nv_stack, &nv0);
int nv_size = dcsstack_size(&nv_stack);
// etc.

Installation

Get the source

Either clone the git source or download and extract the zip. Cloning git source is preferred.

Autotools preparation

First, you need to run aclocal.

Next, run autoconf.

Finally, run automake --add-missing.

aclocal
autoconf
automake --add-missing

Configure & Install

The INSTALL file already describes how to run the configure script.

Installation prefix, compiler, target platform, etc. can be overridden at this step.

./configure
make
make install

Check examples

The make process compiles -along with other source files- the example files. The example binaries are placed in the examples directory. Check them out, e.g.,

examples/dcshashset_xmpl1_demo

Provided Structures

Structure Description Implementation Documentation Tests Examples
DcsFIFO Circular buffer based FIFO missing missing missing missing
DcsHashSet Capacity constrained hashset READY READY missing 2
DcsHS Size optimized hashset missing missing missing missing
DcsHoF Hall of Fame -- stores Top N elements READY READY missing 1
DcsLinSet Array based, ordered set READY in progress missing missing
DcsHashMultiMap Multiple values with the same key missing missing missing missing
DcsStack Simple, size constrained stack READY missing missing 1

Key Features

  • No dynamic memory allocation

    Memory area has to be allocated by the user. Initializer functions take a reference to the pre-allocated memory area as parameter.

  • Access to container elements via byte pointers

    Standard C language does not support templates. There are multiple ways to overcome this gap. BilisDcs has chosen to employ the generic type: byte pointer (ElementPtr). Also, the size of the stored type (itemsize) always must be given at initialization of the container structure.

  • Iterators and iterator functions

    Functions ~_begin() and ~_end() are defined for each container. Since the standard C language does not support operator overload, operators on iterators are also defined as functions:

    • ~_iterator_equals()
    • ~_next_iterator()
    • ~_deref_iterator()

About

Library of Data Container Structures

Topics

Resources

License

GPL-3.0, GPL-3.0 licenses found

Licenses found

GPL-3.0
LICENSE
GPL-3.0
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published