Git Product home page Git Product logo

cppbase's Introduction

workflow Language: C++17 License Open in Visual Studio Code

cppbase

C++17 cross-platform header-only library providing common features for C++ projects, such as variant, logging, serialization, task sequence, thread pool, TCP/UDP client and server, etc.

Features

Variant

Variant allows to store data of any type and convert between these types transparently. The current implementation is based on rttr to get Runtime Type Reflection. We also implemented a userful feature called PropertyPath, which defines a chained PropertyInfos that can be used to access a property of a type. Refer to tests/common/VariantTests.cpp for examples.

Logging

Logging is a wrapper on spdlog and integrated spdlog_setup for static logging configuration. User can create a config file (specified in spdlog_setup) and put it under config/log.conf of the current working directory to configure logging. To get the logger for the current module, just call cppbase::logging::GetLoggerForCurrentModule() and make sure to define MODULE_NAME at compile time.

Serialization

Serialization internally uses cereal to serialize and deserialize data. Serializer provides a set of convenient functions to serialize and deserialize objects to/from a string or a file in binary format, which can be easily changed to JSON or XML.

Sequence

Sequence is a set of classes (Processor, Sequence, Link) that allows user to execute a series of processing unit. It internally uses taskflow as the execution engine. Together with Variant, it provides an easy way to create a sequence that contains multiple processors with different functionalities to finish complex tasks. Refer to tests/common/SequenceTests.cpp and [tests/sequence/ProcessorTests.cpp] for examples.

Processor, Sequence and link

Thread Pool

There are two threadpools in this library: ThreadPool and ForkJoinPool. The former is based on https://github.com/progschj/ThreadPool.git and the latter is based on asio's fork join pool.

TCP/UDP Client and Server

Our implementation uses non-boost version asio internally.

Others

There are other features that are commonly used in C++ projects, such as BlockingQueue, Encoding, FileSystem (wraps up C++17 std::filesystem), Semaphore, Timer, Uuid.

Please create issues if you find any bugs or have any suggestions.

Thirdparty libraries

thirdparty/README.md

Setup clang-format in QtCreator

  • Enable "Help->Plugin->Beautifier" and restart QtCreator
  • Add the source code directory in "Tools->Options->Beautifier->Clang-Format" and choose command and style
  • Setup hotkeys from "Tools->Options->environment->keyboard->ClangFormat"

cppbase's People

Contributors

bgao avatar bgao-onet avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

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.