niklas-ourmachinery / bitsquid-foundation

A minimalistic foundation library with functions for memory allocation, basic collections, etc. The library has been written with a data-oriented philosophy: POD structures are preferred over classes, flat arrays are the preferred data structure, etc.
109 stars 15 forks source link

foundation

foundation is a minimalistic foundation library with functions for memory allocation, data manipulation, etc released under the very permissive MIT license - for your pleasure.

Library Design

foundation has been written with data-oriented programming in mind (POD data is preferred over complicated classes, flat arrays are the preferred data structure, etc).

foundation is written in a "back-to-C" style of C++ programming. This means that there is a clear separation between data and code. Data defitions are found in _types.h header files. Function definitions are found in .h header files.

When you are writing a system using foundation, your header files typically only need to include the _types.h files. These are designed to be as compact as possible, meaning your compile times will be short. In the .cpp files you can include the heavier .h files.

foundation uses the following types of data:

// Open structs
struct Vector3 {
    float x, y, z;
};

// Closed structs
struct Object {
    Object(); 
    unsigned _data;
};

// Abstract classes
class Allocator;

class Allocator {
    public:
        void *allocate(uint32_t size, uint32_t align) = 0;
};

Compiler flags

Systems

Memory

Collection

Math