Skip to content

Jacob-C-Smith/queue

Repository files navigation

queue

CMake

Dependencies:
sync

A minimal queue implementation written in C.

1 Download

2 Build

3 Example

3.1 Example output

4 Tester

5 Definitions

5.1 Type definitions

5.2 Function definitions

Download

To download queue, execute the following command

$ git clone https://github.com/Jacob-C-Smith/queue

Build

To build on UNIX like machines, execute the following commands in the same directory

$ cd queue
$ cmake .
$ make

This will build the example program, the tester program, and dynamic / shared libraries

To build queue for Windows machines, open the base directory in Visual Studio, and build your desired target(s)

Example

To run the example program, execute this command

$ ./queue_example

Example output

First!
Second!
Third!

Fourth!
Fifth!
Sixth!
Detected queue underflow!

Source

Tester

To run the tester program, execute this command after building

$ ./queue_test

Source

Definitions

Type definitions

typedef struct queue_s queue;

Function definitions

// Allocaters
DLLEXPORT int  queue_create        ( queue **pp_queue );

// Constructors
DLLEXPORT int  queue_construct     ( queue **pp_queue );
DLLEXPORT int  queue_from_contents ( queue **pp_queue, void **pp_contents, size_t size );

// Accessors
DLLEXPORT int  queue_front         ( queue  *p_queue , void **pp_value );
DLLEXPORT int  queue_rear          ( queue  *p_queue , void **pp_value );
DLLEXPORT bool queue_empty         ( queue  *p_queue );

// Mutators
DLLEXPORT int  queue_enqueue       ( queue  *p_queue , void  *data );
DLLEXPORT int  queue_dequeue       ( queue  *p_queue , void **pp_value );

// Destructors
DLLEXPORT int  queue_destroy       ( queue **pp_queue );

Releases

No releases published

Packages

No packages published