/EmbeddedProgramming

Modern C/C++, Boost, Qt, OpenGL with CMake and Makefile.

Primary LanguageCMIT LicenseMIT

Embedded Programming

$$\int_b^d study ,dt= life$$

https://g.dev/xuhua-huang-io

https://github.com/XuhuaHuang/EmbeddedProgramming

#include <>
[c++]<class = lambda_extensions>() {}
std::cout << std::hex << std::showbase << std::internal << std::uppercase << std::setfill('0') << std::setw(8)

wakatime

This repository hopefully can lead you through the modern C++ world, with some of its popular tool chains.
Each topic is placed in individual folder. Projects are placed under each descriptively-named folders.
Most of the directories are provided with a CMakeLists.txt.
Using CMake will be significantly easier than manually compiling all the files with your favorite compiler.
For your comfort, some of the files have required compilation command documented in the source file itself.

Table of Contents

Special Thanks

Prof. Charmaine Jirgens
My mentor to the programming world
Professor, Electronics Engineering and Information Technology
Heritage College, Gatineau, Quebec, Canada

Software does not run in a magic fairy aether powered by the fevered dreams of CS PhDs.

Languages

C/C++, Objective-C/C++

An image for C LanguageAn image for C++ An image for MinGW

class person
{
public:
    explicit person() = default;

    explicit person(const std::string& fn, const std::string& ln)
        : first(fn)
        , last(ln)
    {
    }

    explicit person(std::string&& fn, std::string&& ln)
        : first(std::move(fn))
        , last(std::move(ln))
    {
    }

    person(const person& rhs)                = default;
    person& operator=(const person&)         = default;

    person(person&& rhs) noexcept            = default;
    person& operator=(person&& rhs) noexcept = default;

    virtual ~person() noexcept               = default;

    [[nodiscard]] inline std::string& first_name() { return first; }
    inline const std::string&         first_name() const { return first; }

    [[nodiscard]] inline std::string& last_name() { return last; }
    inline const std::string&         last_name() const { return last; }

private:
    std::string first;
    std::string last;
};

template<typename T>
concept printable = requires(T t) {
    { std::cout << t } -> std::convertible_to<std::ostream&>;
}

struct print
{
    constexpr print() = default;

    template <typename T>
        requires printable<T>
    inline constexpr void operator()(T const& t) const
    {
        std::cout << t << "\n";
    }
};

Getting Started

Example to Compile a File Named get_tie.cpp

g++ --version
cd ./StandardTemplateLibrary/Tuple
g++ -g -Wall -Wextra -Wpedantic -c get_tie.cpp -o get_tie.exe -std=gnu++2b
./get_tie

To Update MinGW on Windows
Run a PowerShell session with administrator privilege and run:

# Get the latest version of mingw
mingw-get update
mingw-get upgrade
# Verify the version of installed gcc and g++
gcc --version
g++ --version

Repository Directories

If you already have a configured CMake for your operating system, simple change to the directory with such CMakeLists.txt and run:

cmake .

or

cmake ./CMakeLists.txt

For example, change to directory ./DesignPatterns:

cd ./DesignPatterns
cmake ./CMakeLists.txt

The convention is to create a folder dedicated to CMake files, for example, build or bin:

cd ./DesignPatterns
mkdir build
cd build
cmake ../CMakeLists.txt -G "Visual Studio 17 2022"

To build with popular Ninja or MinGW generator:

# With Ninja generator
cmake ../CMakeLists.txt -G "Ninja"
# With MinGW generator
cmake ../CMakeLists.txt -G "MinGW Makefiles"

To build the repository and run tests:

cmake . -Bbuild
cd build
cmake --build .
ctest --verbose

Functionality provided by separate module. A namespace util is created to better manage the functions.
Tests and GoogleTest are located within the Util/tests folder.

namespace util {
    namespace data_structure {}
    namespace iife {}
    namespace list {}
    namespace math {
        namespace cartesian_plane {}
        namespace euclidean_space {}
    }
    namespace parse {}
    namespace physics {}
    namespace pointer {}
    namespace range {}
    namespace type {}
    namespace type_safety {}
    namespace vector {}
}

HackerRank

Contains solutions to some of the basic problem solving coding questions. Provided file name most likely describes the content. The README.md has more handy notes when encountering those problems.
Click to see my HackerRank profile

LeetCodePlayground

Contains solutions to some of the basic problem solving coding questions.
Click to see my LeetCode profile

ObjectiveC

Popular concepts in Objective-C. Compiled in Windows using GNUstep Core and provided GNUstep developer tools.

Projects

Contains projects carried along the coursework and includes some personal project as well. For example, building a terminal progress bar for visual effects and working with OpenGL library in C++.

References

Commonly Used Command in CMake