wangzhengquan
2020-12-30 5eced9fa401e05226309ec9682df4310b18683c3
update
5个文件已添加
59 文件已重命名
4个文件已修改
176 ■■■■■ 已修改文件
.gitignore 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CMakeLists.txt 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Make.common.inc 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
build.sh 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
chsuffix.sh 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
demo/dgram_mod_bus.cpp 补丁 | 查看 | 原始文档 | blame | 历史
demo/dgram_mod_req_rep.cpp 补丁 | 查看 | 原始文档 | blame | 历史
demo/dgram_mod_survey.cpp 补丁 | 查看 | 原始文档 | blame | 历史
demo/queue.cpp 补丁 | 查看 | 原始文档 | blame | 历史
demo/stream_mod_pub_sub.cpp 补丁 | 查看 | 原始文档 | blame | 历史
demo/stream_mod_req_rep.cpp 补丁 | 查看 | 原始文档 | blame | 历史
include/usgcommon/usg_common.h 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/BusConfig.h.in 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/CMakeLists.txt 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Makefile 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/bus_error.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/logger_factory.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/queue/shm_queue_wrapper.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/shm/hashtable.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/shm/mm.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/shm/shm_mm_wrapper.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/bus_server_socket.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/bus_server_socket_wrapper.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/net_conn_pool.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/net_mod_server_socket.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/net_mod_server_socket_wrapper.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/net_mod_socket.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/net_mod_socket_io.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/net_mod_socket_wrapper.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/shm_mod_socket.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/shm_socket.cpp 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/shm_stream_mod_socket.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test/is_little_endian.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test/lambda.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test/protocle_parse.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test/strtok.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test/test.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test/test2.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test/test_set.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test/test_type.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test/test_vector.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_net_socket/heart_beat.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_net_socket/is_seqnum_cl.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_net_socket/is_seqnum_sv.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_net_socket/test_bus_stop.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_net_socket/test_net_mod_socket.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_nng/client.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_nng/test_nng.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_queue/multiple_queue_consumer.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_queue/multiple_queue_productor.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_queue/single_consumer.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_queue/single_productor.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_queue/test_lockfree_queue.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_queue/test_lostdata.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_queue/test_queue.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_queue/test_queue_wrapper.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_queue/test_timeout.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_socket/client.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_socket/dgram_mod_bus.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_socket/dgram_mod_req_rep.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_socket/dgram_socket_test.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_socket/server.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_socket/stream_mod_pub_sub.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_socket/stream_mod_req_rep.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_socket/stream_socket_test.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_socket/survey.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_socket/test_open_close.cpp 补丁 | 查看 | 原始文档 | blame | 历史
test_socket/test_timeout.cpp 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
@@ -43,5 +43,4 @@
build/
*.tmp
*.txt
core
CMakeLists.txt
New file
@@ -0,0 +1,41 @@
cmake_minimum_required(VERSION 3.5)
# set the project name and version
project(B_BUS VERSION 3.0)
# specify the C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# add the MathFunctions library
# if(USE_MYMATH)
#  add_subdirectory(MathFunctions)
#  list(APPEND EXTRA_LIBS MathFunctions)
# endif()
# list(APPEND EXTRA_INCLUDES "${PROJECT_SOURCE_DIR}/include/usgcommon")
# list(APPEND EXTRA_LIBS lib/usgcommon)
add_subdirectory(${PROJECT_SOURCE_DIR}/src)
# list(APPEND EXTRA_LIBS shm_queue)
# target_link_libraries(B_BUS PUBLIC ${EXTRA_LIBS})
# add the binary tree to the search path for include files
# so that we will find BusConfig.h
# target_include_directories(B_BUS PUBLIC
#                            "${PROJECT_BINARY_DIR}"
#                             ${EXTRA_INCLUDES}
#                            )
# add the executable
# add_executable(B_BUS B_BUS.cxx)
# add the install targets
# install(TARGETS B_BUS DESTINATION bin)
# install(FILES "${PROJECT_BINARY_DIR}/BusConfig.h"
#   DESTINATION include
#   )
Make.common.inc
@@ -9,24 +9,24 @@
$(DEST)/%.d: %.c
$(DEST)/%.d: %.cpp
    @echo generating dependences of $< ...
    @test -d $(DEST)/$(shell dirname $<) || mkdir -p $(DEST)/$(shell dirname $<); \
    $(CC) -M $(CPPFLAGS) $< > $@.$$$$;                      \
    sed 's,\($*\)\.o[ :]*,$(DEST)/\1 $(DEST)/\1.o $@ : ,g' < $@.$$$$ > $@;     \
    rm -f $@.$$$$
$(DEST)/%.o: %.c
    $(CC) ${CPPFLAGS} $(CFLAGS) -c $(filter %.c, $^) -o $@
$(DEST)/%.o: %.cpp
    $(CC) ${CPPFLAGS} $(CFLAGS) -c $(filter %.cpp, $^) -o $@
$(DEST)/%/%.o: %.c
    $(CC) ${CPPFLAGS} $(CFLAGS) -c $(filter %.c, $^) -o $@
$(DEST)/%/%.o: %.cpp
    $(CC) ${CPPFLAGS} $(CFLAGS) -c $(filter %.cpp, $^) -o $@
${DEST}/%:    %.o
    $(CC) $(LDFLAGS) $(filter %.o, $^) -o $@ $(LDLIBS)
${DEST}/%:    %.c
    $(CC) ${CPPFLAGS} $(CFLAGS) $(LDFLAGS) $(filter %.c, $^) -o $@ $(LDLIBS)
${DEST}/%:    %.cpp
    $(CC) ${CPPFLAGS} $(CFLAGS) $(LDFLAGS) $(filter %.cpp, $^) -o $@ $(LDLIBS)
gdb:
    gdb -n -x .gdbinit
build.sh
New file
@@ -0,0 +1,14 @@
#! /bin/bash
rm -rf build
mkdir build
cd build
# cmake ../Step2
# cmake ../Step4 -DSUPPORT_RDMA=OFF
cmake -DCMAKE_INSTALL_PREFIX=/home/wzq/tmp2  -DSUPPORT_RDMA=OFF ..
cmake --build .
cmake --build . --target install
chsuffix.sh
New file
@@ -0,0 +1,7 @@
for file in $(find . -name "*.c")
do
    filename=${file%.c}
    echo $filename.cpp
    mv $file $filename.cpp
done
demo/dgram_mod_bus.cpp
demo/dgram_mod_req_rep.cpp
demo/dgram_mod_survey.cpp
demo/queue.cpp
demo/stream_mod_pub_sub.cpp
demo/stream_mod_req_rep.cpp
include/usgcommon/usg_common.h
@@ -101,7 +101,7 @@
/**
 * @ seperator 分割符
 */
char * str_join( const char *seperator, const char *first...);
char * str_join( const char *seperator, const char *first, ...);
/**
 * 把字符串以@delim分割为数组,数组的地址存放在@arr_addr
 */
src/BusConfig.h.in
New file
@@ -0,0 +1,4 @@
// the configured options and settings for Tutorial
#define B_BUS_VERSION_MAJOR @B_BUS_VERSION_MAJOR@
#define B_BUS_VERSION_MINOR @B_BUS_VERSION_MINOR@
#cmakedefine SUPPORT_RDMA
src/CMakeLists.txt
New file
@@ -0,0 +1,85 @@
# should we use our own math functions
option(SUPPORT_RDMA "If support rdma" ON)
# configure a header file to pass some of the CMake settings
# to the source code
configure_file(BusConfig.h.in BusConfig.h)
add_library(shm_queue
        logger_factory.cpp
        socket/bus_server_socket.cpp
        socket/bus_server_socket_wrapper.cpp
        socket/shm_stream_mod_socket.cpp
        socket/shm_socket.cpp
        socket/net_conn_pool.cpp
        socket/shm_mod_socket.cpp
        socket/net_mod_server_socket_wrapper.cpp
        socket/net_mod_socket_wrapper.cpp
        socket/net_mod_socket.cpp
        socket/net_mod_socket_io.cpp
        socket/net_mod_server_socket.cpp
        bus_error.cpp
        queue/shm_queue_wrapper.cpp
        shm/shm_mm_wrapper.cpp
        shm/mm.cpp
        shm/hashtable.cpp
    )
target_include_directories(shm_queue PUBLIC
                           "${PROJECT_BINARY_DIR}"
                           "${PROJECT_SOURCE_DIR}/include/usgcommon"
                           )
target_include_directories(shm_queue PUBLIC
                           ${CMAKE_CURRENT_SOURCE_DIR}
                           ${CMAKE_CURRENT_SOURCE_DIR}/shm
                           ${CMAKE_CURRENT_SOURCE_DIR}/queue
                           ${CMAKE_CURRENT_SOURCE_DIR}/socket
                           )
# state that anybody linking to us needs to include the current source dir
# to find MathFunctions.h, while we don't.
target_include_directories(shm_queue INTERFACE
                                                     ${CMAKE_CURRENT_SOURCE_DIR}
                                           ${CMAKE_CURRENT_SOURCE_DIR}/shm
                                           ${CMAKE_CURRENT_SOURCE_DIR}/queue
                                           ${CMAKE_CURRENT_SOURCE_DIR}/socket
                                          )
# install rules
install(TARGETS shm_queue DESTINATION lib)
install(FILES
    socket/socket_def.h
    socket/net_conn_pool.h
    socket/bus_server_socket.h
    socket/shm_socket.h
    socket/net_mod_socket.h
    socket/shm_stream_mod_socket.h
    socket/net_mod_server_socket_wrapper.h
    socket/net_mod_socket_io.h
    socket/net_mod_server_socket.h
    socket/shm_mod_socket.h
    socket/net_mod_socket_wrapper.h
    socket/bus_server_socket_wrapper.h
    key_def.h
    bus_error.h
    logger_factory.h
    queue/linked_lock_free_queue.h
    queue/array_lock_free_queue2.h
    queue/array_lock_free_queue.h
    queue/shm_queue.h
    queue/shm_queue_wrapper.h
    queue/lock_free_queue.h
    shm/hashtable.h
    shm/mem_pool.h
    shm/mm.h
    shm/shm_allocator.h
    shm/shm_mm_wraper.h
  DESTINATION include)
install(FILES "${PROJECT_BINARY_DIR}/src/BusConfig.h"
    DESTINATION include
)
src/Makefile
@@ -18,9 +18,9 @@
INCLUDES += -I./shm -I./queue -I./socket  -I$(ROOT)/include/usgcommon
SOURCES := $(wildcard *.c ./**/*.c)
OBJS   = $(patsubst %.c, $(DEST)/%.o, $(SOURCES))
DEPENDENCES = $(patsubst %.c, $(DEST)/%.d, $(SOURCES))
SOURCES := $(wildcard *.cpp ./**/*.cpp)
OBJS   = $(patsubst %.cpp, $(DEST)/%.o, $(SOURCES))
DEPENDENCES = $(patsubst %.cpp, $(DEST)/%.d, $(SOURCES))
# MYLIBS = $(LIBCOMMON) $(DLIBCOMMON)
@@ -64,7 +64,7 @@
# 使用方式: g++ test1.c  -lcommon
# 使用方式: g++ test1.cpp  -lcommon
.PHONY: install
install: $(MYLIBS)
    @echo '>>>>>>' installing $^ ...
src/bus_error.cpp
src/logger_factory.cpp
src/queue/shm_queue_wrapper.cpp
src/shm/hashtable.cpp
src/shm/mm.cpp
src/shm/shm_mm_wrapper.cpp
src/socket/bus_server_socket.cpp
src/socket/bus_server_socket_wrapper.cpp
src/socket/net_conn_pool.cpp
src/socket/net_mod_server_socket.cpp
src/socket/net_mod_server_socket_wrapper.cpp
src/socket/net_mod_socket.cpp
src/socket/net_mod_socket_io.cpp
src/socket/net_mod_socket_wrapper.cpp
src/socket/shm_mod_socket.cpp
src/socket/shm_socket.cpp
src/socket/shm_stream_mod_socket.cpp
test/is_little_endian.cpp
test/lambda.cpp
test/protocle_parse.cpp
test/strtok.cpp
test/test.cpp
test/test2.cpp
test/test_set.cpp
test/test_type.cpp
test/test_vector.cpp
test_net_socket/heart_beat.cpp
test_net_socket/is_seqnum_cl.cpp
test_net_socket/is_seqnum_sv.cpp
test_net_socket/test_bus_stop.cpp
test_net_socket/test_net_mod_socket.cpp
test_nng/client.cpp
test_nng/test_nng.cpp
test_queue/multiple_queue_consumer.cpp
test_queue/multiple_queue_productor.cpp
test_queue/single_consumer.cpp
test_queue/single_productor.cpp
test_queue/test_lockfree_queue.cpp
test_queue/test_lostdata.cpp
test_queue/test_queue.cpp
test_queue/test_queue_wrapper.cpp
test_queue/test_timeout.cpp
test_socket/client.cpp
test_socket/dgram_mod_bus.cpp
test_socket/dgram_mod_req_rep.cpp
test_socket/dgram_socket_test.cpp
test_socket/server.cpp
test_socket/stream_mod_pub_sub.cpp
test_socket/stream_mod_req_rep.cpp
test_socket/stream_socket_test.cpp
test_socket/survey.cpp
test_socket/test_open_close.cpp
test_socket/test_timeout.cpp