cdsa-queue 0.1.0
|
CDSA - Queue (cdsa-queue
) is a C module that provides generic implementations of the Queue ADT and related algorithms.
The Queue ADT (or any implementation of generic queue) is presented as the opaque type Queue
. The interface for the Queue ADT is defined in the queue.h
header file. Different implementations of the Queue ADT are compiled into separate static libraries. There're two implementations of the Queue ADT included off the shelf:
queue_circ_array.c
: Circular array based queue – compiled as the libqueuearr
static libraryqueue_linked_list.c
: Singly linked list based queue – compiled as the libqueuenode
static libraryHere's a little program to familiarize you with the interface.
Suppose we'd like to use the circular array based implementation of the Queue ADT in the above sample program myprog.c
. Let's say the corresponding static library is located at /path/to/lib
and is named libqueuearr
(as specified in the Makefile included). To compile the program into an executable myprog
, at the minimum, run
A collection of ADT-implementation-agnostic algorithms on the Queue ADT is included in a dedicated header file algos.h
.
The module is designed to be extensible that developers can write their own implementations and make it a standalone static library with a standardized interface for the Queue ADT, as well as being compatible with the generic algorithms defined in the algos.h
header.
For more details, visit the documentation site.
Here's what you need to get started.
To build the project, you will need
A Makefile is included in this project to simplify the build process.
For all of the following commands, it's assumed that you're at the project root. If not, cd
into it like
or modify the commands with the right path accordingly.
To make the first build or a clean build, run:
On success, it builds both static libraries and demo programs. In that case, you'll find two newly created subdirectories (in the first build) under the project root.
lib/
— contains the static libraries (*.a
archive files).bin/
— contains the executable demo programs (*_demo
) and test programs (test_*
).ASIDE : The header files for the Queue ADT and the related generic algorithms are located in the src/
subdirectory.
Alternatively, you may build only the demo programs, test programs, or libraries individually like so:
If you'd like to have a clean build starting from scratch, you may do so by first running the following a priori:
⚠️ WARNING : It permanently removes all demo programs built using the Makefile, all object files under bin/
, and also all archive files under lib/
. So use it with caution if you choose to save any other files at those locations. Read the clean
target in the Makefile if you're in doubt.
Header and source files for the library and demo programs are located in the src/
subdirectory, whereas those for unit tests are located in the test/
subdirectory.
Install clang-format
and run it with the included .clang-format
config file at the project root.
If you use an IDE, you're strongly revised to configure it to automatically run clang-format
on each save.
All documentation text are written in the Javadoc style /** ... */
with @
as command marker. In multiline form (typically for classes and functions), include aligned leading asterisks *
in each sandwiched lines. For text that can fit in a single line not exceeding 80 characters (including the comment delimiting characters), use the inline form, either succeeding a statement or on the line preceding the code block to document.
To build the documentation site for the project, you will need
With a Doxygen config file included, cd
into the project root and then simply run
The HTML version of the documentation will be saved in the docs/doxygen/html
subdirectory.
The cdsa-queue
project is licensed under the BSD 3-Clause License.
The C++ equivalent – cppdsa-queue
– is the closest cousin of cdsa-queue
. It is the object-oriented version written in C++20 and also supports 100% compile-time polymorphism via template programming.
This project is bootstrapped using Cookiecutter with the cpp-lib-cookiecutter template (built by the same author of this project).
Copyright © 2022 - 2023 KriztoferY. All rights reserved.