Giter Club home page Giter Club logo

utility-rack's Introduction

Utility Rack - Tasty, Useful Header-Only C++ Classes and Functions

Unit Test and Documentation Generation Workflow Status

GH Actions Workflow Status

GH Actions Workflow Status

GH Actions Workflow Status

GH Tag

License

Overview

The C++ classes and functions in this repository are designed for general purpose use. In addition, many of them are used in the Chops ("C"onnective "H"andcrafted "Op"enwork "S"oftware) libraries (e.g. Chops Net IP, an asynchronous IP networking library). The Chops libraries provide networking and distributed processing functionality and are specially useful for efficiently connecting multiple types of devices together.

More info on the utilities is here. It is also the main page of the generated Doxygen documentation.

Generated Documentation

The generated Doxygen documentation for these utilities is here.

Dependencies

The utilities in utility-rack do not have any third-party dependencies. They use C++ standard library headers only. The unit test code does have dependencies as noted below.

C++ Standard

This software is compiled with the C++ 20 standard, although some of the idioms were written for C++ 17 and may have newer and more modern implementations. C++ 20 features such as concepts / requires will be added.

Supported Compilers

Continuous integration workflows build and unit test on g++ (through Ubuntu), MSVC (through Windows), and clang (through macOS).

Unit Test Dependencies

The unit test code uses Catch2. If the UTILITY_RACK_BUILD_TESTS flag is provided to Cmake (see commands below) the Cmake configure / generate will download the Catch2 library as appropriate using the CPM.cmake dependency manager. If Catch2 (v3 or greater) is already installed using a different package manager (such as Conan or vcpkg), the CPM_USE_LOCAL_PACKAGES variable can be set which results in find_package being attempted. Note that v3 (or later) of Catch2 is required.

Specific version (or branch) specs for the Catch2 dependency is in the test/CMakeLists.txt file, look for the CPMAddPackage command.

Build and Run Unit Tests

To build and run the unit test program:

First clone the utility-rack repository, then create a build directory in parallel to the utility-rack directory (this is called "out of source" builds, which is recommended), then cd (change directory) into the build directory. The CMake commands:

cmake -D UTILITY_RACK_BUILD_TESTS:BOOL=ON ../utility-rack

cmake --build .

ctest

For additional test output, run the unit test individually, for example:

test/erase_where_test -s
test/make_byte_array_test -s

The example can be built by adding -D UTILITY_RACK_BUILD_EXAMPLES:BOOL=ON to the CMake configure / generate step.

utility-rack's People

Contributors

cliffg-softwarelibre avatar crghilardi avatar nathandeutsch avatar ragerone avatar tgill880 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

ragerone

utility-rack's Issues

Improve CMake files, including dependency management

There are multiple enhancements and improvements needed in our CMake files:

  • CMake find_package commands need to be fully implemented, and improvements made to the current design. In particular, we should have a modern and consistent approach to our dependent libraries (Asio, Catch2, etc).
  • Options for debug and release (optimized builds) need to be implemented.
  • Options for sanitizers, profilers, etc, need to be implemented.
  • A more consistent CMake design should be implemented, specially in the common CMake code.

Remove Boost dependency in wait_queue_test and example code

Currently (Apr 2019) the only Boost dependency in the utility-rack repository is in the wait_queue_test and shared_buffer_demo.cpp. The wait_queue_test can be changed to use a different circular buffer, and the shared_buffer_demo app can be changed to use the utility marshalling facilities.

A good quality circular buffer to test with (in addition to Martin's ring-span-lite) is:

https://github.com/JustasMasiulis/circular_buffer

It is a high quality, STL style, single header container.

While Boost is an excellent, high quality set of libraries, it simplifies utility-rack dependency management not to have it as a dependency.

Change C-style casts to C++ casts in example programs

All casts should be C++ style, and in general, casting should be avoided (i.e. every cast needs to be analyzed as to why it is there). Data into and out of network buffers (e.g. going into or out of a shared_buffer) should be serialized, rather than "cast in place".

Add missing const to example programs

The demo programs need to be const correct. Methods that do not modify object data need to be const qualified, and literals need to be const or constexpr, as appropriate (with constexpr preferred). Parameters to functions that are not modified or passed by value should be const qualified.

Create variable length integer functions in the low-level marshalling library

Create functions to marshall and unmarshall a variable length integer. The "append" / marshall function will take an integer in native format, and create a 1 or 2 or 3 or 4 (or more) byte integer. The first byte will contain values from 0-127, and the MSB (most significant bit) will designate whether another byte is needed (for larger values). The "extract" / unmarshall function will perform the converse.

One usage of this will be in the MQTT wire protocol (see section 1.5.5 of the MQTT 5.0 spec).

A good place for these functions is in the "extract_append_val.hpp" header in the marshall directory of the utility-rack repo.

Factor out common code in CMake files

There is significant common code in the CMake files which needs to be split out and included as appropriate. Some of it spans multiple repositories so it may make sense to have the master versions in a special place in the utility-rack repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.