- This is a cross-platform library software library about c, c++, unix4, posix.
- This library has been continuously developed for more than three years, and it serves as the underlying support for many large projects.
- Incorporate unit test, benchmark test, cmake, process monitoring, daemon, asynchronous libraries libuv, lua, cpython, re2, json, yaml, mysql, redis, opencv, qt, lz4, oci ...
- This is a cross-platform library software library about c, c++, unix4, posix.
- This library has been under continuous development for more than three years, and it provides basic support for many large-scale projects.
- Incorporated unit tests, benchmarks, cmake, process monitoring, daemons, async libraries libuv, lua, cpython, re2, json, yaml, mysql, redis, opencv, qt, lz4, oci...
The library should be lightweight and streamlined. Try to use one file to complete each module. Try to have no dependencies between modules. Try to copy a few files alone to complete the target function. On the basis of achieving efficiency, the order of using the library -> clib ->stl -> unix api -> posix -> os api. It is necessary to write more unit tests, benchmarks, docker in k8s parallel distributed tests.
The library should be lightweight and streamlined, and one module should be completed with one file as much as possible. There should be no dependencies between the modules. Try to copy several files separately to complete the target function. On the basis of efficiency, the order of use of the library-> clib-> stl-> unix api-> posix-> os api. To write more unit test, benchmark, docker in k8s parallel distributed testing.
The core library code of ccxx is in the ccxx folder in the root directory, and it is about 14MB in size. Most modules use a file .cpp to complete their functions, and the default static class method is called directly). For examples, please refer to the sample and test directories.
- cxappenv.h: Running environment (running program name, working directory, environment variables)
- cxinterinfo.h: Information input and output interface of the program. Implementations include: cxlog.h (log), CxConsoleInterinfo (terminal)
- cxfile.h: file system
- cxsocket.h: Network communication
- cxthread.h: thread signal, IPC
- cxapplication.h is similar to Event Loop in (Node.js). The wait signal mechanism is used to poll the event queue and execute it. Currently involved in Event Loop are (cxchannel.h, cxtimer.h). cxapplication_qt.h is Qt's participation in Qt's Event Loop.
- cxchannel.h: (to be instantiated for use) opens an independent thread for sending, receiving and monitoring. The received data and events are pushed to the Event Loop of the main thread, so the data does not need to be locked across lines. The implementations are: cxchannel_udp.h, cxchannel_tcpserver.h, cxchannel_tcpclient.h, cxchannel_serial.h
- cxcrc.h: Data verification
- cxdatabase.h: (to be instantiated for use) an interface class that unifies data operations in the form of tables. The implementations include: cxdatabase_odbc.h, cxdatabase_sqlite.h (directly call official sqlite3.c to implement related functions)
- cxprocess.h: system process
- cxprocmutex.h: process lock
- cxtimer.h: (to be instantiated for use) timer
- cxtime.h: time and date
- cxuuid.h: GUID, UUID
- cxsharememory.h: Shared memory, inter-process communication IPC (InterProcess Communication)
- cxprofile.h: (to be instantiated for use) the configuration file is closed in the form of a table. The implementations include: cxprofile_skv_json.h, cxprofile_skv_xml.h. (skv: section key value)
- cxencoding.h: Implement conversion between GBK and UTF-8
- cxlua folder: exposes the ccxx function block in lua mode, lua_run.h is the entrance to main.
- Other third-party packages include (cxhiredis.h (Redis closure), cxtinyxml.h (Xml file reading and writing), cxrapidjson.h (regular expression), lz4.h (compression and decompression))
- The source code of gtest, luv, benchmark, and yaml has been placed in 3rd.
- openssl and curl add libraries using header files
- c++ call python(callpython)(./ccxx/sample/callpython), python call c++(cxpython)(./ccxx/ccxx/cxpython). referto https://github.com/oudream/hello-cmake
- The official sample code of opencv has been included with cmake and can be compiled to facilitate testing.
The core library code of ccxx is located in the ccxx folder in the root directory (about 14MB). Modules mostly use a file .cpp to complete the function, and the default static class method is called directly). For examples, please refer to the directory of sample and test.
- cxappenv.h: running environment (run program name, working directory, environment variables)
- cxinterinfo.h: program information input and output interface. Implementations are: cxlog.h (log), CxConsoleInterinfo (terminal)
- cxfile.h: file system
- cxsocket.h: network communication
- cxthread.h: thread signal, IPC
- cxapplication.h is similar to the Event Loop in (Node.js). The wait signal mechanism is used to poll and execute the event queue. participating Currently in the Event Loop (cxchannel.h, cxtimer.h). cxapplication_qt.h is the event loop where Qt participates in Qt.
- cxchannel.h: (to be instantiated to use) open a separate thread to send and receive and monitor, receive data and events push to the Event Loop of the main thread, so the data does not need to be locked across lines. Implementations are : cxchannel_udp.h, cxchannel_tcpserver.h, cxchannel_tcpclient.h, cxchannel_serial.h
- cxcrc.h: data check
- cxdatabase.h: (to be instantiated for use) interface class that unifies data operations in a table. The implementations are: cxdatabase_odbc.h, cxdatabase_sqlite.h (directly call the official sqlite3.c to achieve related functions)
- cxprocess.h: system process
- cxprocmutex.h: process lock
- cxtimer.h: (to be instantiated to use) timer
- cxtime.h: time and date
- cxuuid.h: GUID, UUID
- cxsharememory.h: shared memory, IPC (InterProcess Communication)
- cxprofile.h: (to be instantiated for use) The profile is closed for use as a table. The implementations are: cxprofile_skv_json.h, cxprofile_skv_xml.h. (skv: section key value)
- cxencoding.h: convert between GBK and UTF-8
- cxlua folder: exposes ccxx function blocks in lua, lua_run.h is the main entry.
- Other third-party packages include (cxhiredis.h (closed by Redis), cxtinyxml.h (Xml file read and write), cxrapidjson.h (regular expression), lz4.h (compression and decompression))
- gtest, luv, benchmark, yaml's own source code has been placed in 3rd.
- openssl, curl is a header file plus library
- c++ call python (callpython) (./ccxx/sample/callpython), python call c++ (cxpython) (./ccxx/ccxx/cxpython). Referto [https://github.com/oudream/hello- cmake ] (https://github.com/oudream/hello-cmake)
- The official sample code for opencv has been included with cmake and can be compiled for easy testing.
git clone https://github.com/oudream/ccxx.git
# You can extract several related files for use as needed
# 可以根据需要提取其中几个相关文件来用的
docker run -d -p 2235:22 oudream/ubuntu-ccxx-env:18.04.12
ssh root@localhost -p 2235 -AXY -v
# password is: 123456
# You can run the following examples to experiment (可以运行以下样例来试验)
/opt/ccxx/build/deploy/unix/bin_d/cxtest_timer
# or
/opt/ccxx/build/deploy/unix/bin_d/cxtest_channel_udp_client1
# or
/opt/ccxx/build/deploy/unix/bin_d/cxtest_channel_udp_server1
# or
/opt/ccxx/build/deploy/unix/bin_d/cxsample_lua
# or
/opt/ccxx/build/deploy/unix/bin_d/benchmark_cxstring
# ctrl + c to exit
^c
- ODBC: ccxx_database_odbc is a library for connecting databases with odbc
- ODBC: ccxx_database_odbc is a library that uses odbc to connect to the database
- UUID : Except for windows, CxUuid (uuid) is implemented using the libuuid library
- UUID: Except for windows, CxUuid (uuid) is implemented using the libuuid library
# ## mac
brew install unixodbc
# ## Ubuntu: -D"OTL_ODBC_UNIX" -lodbc
sudo apt-get install unixodbc unixodbc-dev
sudo apt-get install uuid-dev
# ## CentOS: -D"OTL_ODBC_UNIX" -lodbc
sudo yum install unixODBC-devel
sudo yum install libuuid-devel
# git and compile
git clone https://github.com/oudream/ccxx.git
cd ccxx
cmake . -DCMAKE_BUILD_TYPE=Debug --build . -B " ./build/cmake-gcc "
cd ./build/cmake-gcc && make
# try run gtest (google test)
make test
# try run app
cd /opt/ccxx/build/deploy/unix/bin_d
./cxtest_timer
./cxtest_channel_udp_client1
./cxtest_channel_udp_server1
./cxsample_lua
./benchmark_cxstring
# ...
vim /opt/ccxx/build/cmake/local.all.config.cmake
# e.g. modify -> set(gs_project_enable_uv 1) to set(gs_project_enable_uv 0)
# e.g. modify -> set(gs_project_enable_openssl 1) to set(gs_project_enable_openssl 0)
Compiled pictures for each operating system (cn)
# ## 1 step: build and install OpenCV 4.1.2 (4c71dbf)
# # https://docs.opencv.org/master/d7/d9f/tutorial_linux_install.html
# # https://opencv.org/releases/
# cd /opt/<my_working_directory>
# ## 1 step: apt insall depend libs
# libopencv-dev
sudo echo " deb http://security.ubuntu.com/ubuntu xenial-security main " | tee /etc/apt/sources.list.d/libjasper.list &&
sudo apt update -y ; apt upgrade -y &&
sudo apt install -y gcc g++ cmake build-essential gdb gdbserver git
unixodbc unixodbc-dev libcurl4-openssl-dev uuid uuid-dev libssl-dev libncurses5-dev
qt5-default libqt5svg5 libqt5svg5-dev qtcreator
libssl-dev libncurses5-dev
libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
python3-dev python3-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
software-properties-common
# ## 2 step: git code and make it
cd /opt &&
git clone https://github.com/opencv/opencv.git &&
cd /opt/opencv && git reset --hard 4c71dbf &&
mkdir build && cd build &&
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. &&
make -j7 && sudo make install
# ## 3 step: down source and compile
cd /opt &&
git clone https://github.com/oudream/ccxx.git &&
cd ccxx &&
cmake . -DCMAKE_BUILD_TYPE=Debug -DCCXX_BUILD_TYPE=all --build . -B " ./build/cmake-gcc " &&
cd build/cmake-gcc && make
# ## 4 step: run apps
/opt/ccxx/build/deploy/unix/bin_d/cxtest_timer
# or
/opt/ccxx/build/deploy/unix/bin_d/cxtest_channel_udp_client1
# or
/opt/ccxx/build/deploy/unix/bin_d/cxtest_channel_udp_server1
# or
/opt/ccxx/build/deploy/unix/bin_d/cxsample_lua
# or
/opt/ccxx/build/deploy/unix/bin_d/benchmark_cxstring
# ctrl + c to exit
^c
# ...
todo: CxDatabase::loadSql : if loaded count > max return
todo: add libuv channel
todo: exit or signal: reentrant function eg: CxLog() <<