Utility Library

The project contains portable C++ code for

  • encoding/decoding numeric values to/from raw bytes
  • sharing pointer on embedded platforms
  • storing data in AVL tree
  • managing raw data in a buffer with read/write pointers, auto-resizing
  • improving output from unit tests
  • tracking number ranges for calculating delta, mean or median

Build

Set up the build following an example from cmake-helpers project.

Utility Classes

AvlTree

Implements an AVL tree. See usage examples in avl_tree_test.cpp

Buff

Implements dynamicaly resizable buffer. Provides read/write pointer tracking. See usage examples in buff_test.cpp

Misc

Implements various utility functions such as

  • Translation between value ranges
  • Calculation of angle delta squared
  • Computing modulo with negative numbers
  • Setting/clearing bits at given byte addresses
  • Converting degrees to radians and vice versa
  • Converting binary data to human-readable hex representation

See usage examples in misc_test.cpp

SharedPtr

Implements basic shared pointer to be used on an embedded platform. See usage examples in shared_ptr_test.cpp

Sorters

Implements sorting algorithms for sorting a plain-old-data array. See usage examples in sorters_test.cpp

SpinLock

Implements a basic spin lock for x86.

TestHelpers

Implements useful facilities for when unit testing. See usage examples in unit tests, example: value_codec_test.cpp

ValueCodec

Implements number encoding and decoding facilities accounting for target host order. See usage examples in value_codec_test.cpp

ValueTracker

The class keeps track of numeric values so as to calculate the delta, mean or median between them. See usage examples in value_tracker_test.cpp