Skip to content
Merged

Dev #87

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
# SPDX-FileCopyrightText: 2020-2024 Jochem Rutgers
#
# SPDX-License-Identifier: CC0-1.0

launch.json
5 changes: 4 additions & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/include",
"${workspaceFolder}/**"
],
"defines": [
Expand All @@ -16,6 +17,7 @@
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/include",
"${workspaceFolder}/**"
],
"defines": [
Expand All @@ -27,6 +29,7 @@
{
"name": "Mac",
"includePath": [
"${workspaceFolder}/include",
"${workspaceFolder}/**"
],
"defines": [
Expand All @@ -39,4 +42,4 @@
}
],
"version": 4
}
}
8 changes: 6 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@
"C_Cpp.doxygen.generatedStyle": "/*!",
"files.exclude": {
"**/.git": true,
"**/dist/venv/**": true
"**/dist/venv/**": true,
"python/libstored/data/**": true,
"python/libstored-*/**": true
},
"clang-format.executable": "clang-format-15",
"cmakeFormat.env": {
"PYTHONPATH": "${workspaceFolder}/dist/venv"
},
"python.analysis.typeCheckingMode": "standard",
"python.defaultInterpreterPath": "${workspaceFolder}/dist/venv/bin/python3"
"python.defaultInterpreterPath": "${workspaceFolder}/dist/venv/bin/python3",
"vim.textwidth": 100,
"vim.tabstop": 8,
}
10 changes: 9 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ The format is based on `Keep a Changelog`_, and this project adheres to
Added
`````

...
- Operations such as ``-=`` and ``++`` for store variables in C++.
- YAML export of store meta-data.

Changed
```````

- Don't auto-retransmit on encode by the ``stored::ArqLayer``. Only retransmit
on ``keepAlive()``.
- Improve reconnection behavior on protocol layers.

.. _Unreleased: https://github.com/DEMCON/libstored/compare/v2.0.0...HEAD

Expand Down
5 changes: 3 additions & 2 deletions examples/8_sync/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# SPDX-FileCopyrightText: 2020-2024 Jochem Rutgers
# SPDX-FileCopyrightText: 2020-2025 Jochem Rutgers
#
# SPDX-License-Identifier: CC0-1.0

if(LIBSTORED_HAVE_LIBZMQ)
add_executable(8_sync main.cpp getopt_mini.cpp)
add_executable(8_sync main.cpp)
target_link_libraries(8_sync PRIVATE example_lib)
libstored_generate(TARGET 8_sync STORES ExampleSync1.st ExampleSync2.st)
install(TARGETS 8_sync RUNTIME DESTINATION bin)
add_launch_json(8_sync)
Expand Down
4 changes: 2 additions & 2 deletions examples/8_sync/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2020-2023 Jochem Rutgers
// SPDX-FileCopyrightText: 2020-2025 Jochem Rutgers
//
// SPDX-License-Identifier: CC0-1.0

Expand All @@ -25,7 +25,7 @@
#include <stored>
#include <string.h>

#include "getopt_mini.h"
#include <getopt_mini.h>

static stored::Synchronizer synchronizer;

Expand Down
28 changes: 19 additions & 9 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
endif()

if(NOT CMAKE_CXX_STANDARD)
foreach(cxx cxx_std_17 cxx_std_14 cxx_std_11 cxx_std_98)
list(FIND CMAKE_CXX_COMPILE_FEATURES "${cxx}" _cxx)
if(${_cxx} GREATER -1)
string(REPLACE "cxx_std_" "" _std "${cxx}")
set(CMAKE_CXX_STANDARD "${_std}")
break()
endif()
endforeach()
endif()

add_subdirectory(lib)

add_subdirectory(1_hello)
add_subdirectory(2_basic)
add_subdirectory(3_scope)
Expand All @@ -61,6 +74,10 @@ if(LIBSTORED_HAVE_LIBZMQ)
add_subdirectory(components)
add_subdirectory(control)
add_subdirectory(zmqserver)

if(CMAKE_CXX_STANDARD LESS 98 AND CMAKE_CXX_STANDARD GREATER_EQUAL 11)
add_subdirectory(lossy_sync)
endif()
endif()

if(LIBSTORED_HAVE_ZTH AND LIBSTORED_HAVE_LIBZMQ)
Expand All @@ -71,13 +88,6 @@ if(LIBSTORED_PYLIBSTORED AND TARGET pylibstored-install)
add_subdirectory(int_pip)
endif()

list(FIND CMAKE_CXX_COMPILE_FEATURES "cxx_std_17" _cxx17)
if(${_cxx17} GREATER -1)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()

if(CMAKE_CXX_STANDARD GREATER_EQUAL 17 AND CMAKE_CXX_STANDARD LESS 98)
add_subdirectory(pipes)
endif()
if(CMAKE_CXX_STANDARD GREATER_EQUAL 17 AND CMAKE_CXX_STANDARD LESS 98)
add_subdirectory(pipes)
endif()
6 changes: 6 additions & 0 deletions examples/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-FileCopyrightText: 2020-2025 Jochem Rutgers
#
# SPDX-License-Identifier: CC0-1.0

add_library(example_lib STATIC include/getopt_mini.h src/getopt_mini.cpp)
target_include_directories(example_lib PUBLIC include)
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#ifndef GETOPT_MINI_H
#define GETOPT_MINI_H
// SPDX-FileCopyrightText: 2020-2023 Jochem Rutgers
// SPDX-FileCopyrightText: 2020-2025 Jochem Rutgers
//
// SPDX-License-Identifier: MIT

#include <libstored/macros.h>

#ifdef STORED_OS_POSIX
#if defined(__linux__) || defined(__APPLE__) || defined(__MINGW32__) || defined(__MINGW64__)
// Just use glibc's one.
# include <unistd.h>
#else // STORED_OS_POSIX
# include <unistd.h>
#else // !POSIX

extern int opterr;
extern int optopt;
Expand All @@ -19,5 +17,5 @@ extern char* optarg;
// flawfinder: ignore
int getopt(int argc, char* const* argv, char const* options);

#endif // !STORED_OS_POSIX
#endif // !POSIX
#endif // GETOPT_MINI_H
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// SPDX-FileCopyrightText: 2020-2023 Jochem Rutgers
// SPDX-FileCopyrightText: 2020-2025 Jochem Rutgers
//
// SPDX-License-Identifier: MIT

#include "getopt_mini.h"
#include <getopt_mini.h>

#ifdef STORED_COMPILER_MSVC
#if !defined(__linux__) && !defined(__APPLE__) && !defined(__MINGW32__) && !defined(__MINGW64__)

# include <stddef.h>
# include <stddef.h>

int opterr = 1;
int optopt = 0;
int optind = 1;
char* optarg = nullptr;
char* optarg = NULL;

// flawfinder: ignore
int getopt(int argc, char* const* argv, char const* options)
Expand Down Expand Up @@ -61,4 +61,4 @@ int getopt(int argc, char* const* argv, char const* options)
return optopt;
}

#endif // STORED_COMPILER_MSVC
#endif // !POSIX
5 changes: 5 additions & 0 deletions examples/lossy_sync/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2020-2025 Jochem Rutgers
#
# SPDX-License-Identifier: CC0-1.0

/libstored/
12 changes: 12 additions & 0 deletions examples/lossy_sync/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# SPDX-FileCopyrightText: 2020-2025 Jochem Rutgers
#
# SPDX-License-Identifier: CC0-1.0

if(LIBSTORED_HAVE_LIBZMQ)
add_executable(lossy_sync main.cpp)
set_target_properties(lossy_sync PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED YES)
target_link_libraries(lossy_sync PRIVATE example_lib)
libstored_generate(TARGET lossy_sync STORES ExampleSync.st)
install(TARGETS lossy_sync RUNTIME DESTINATION bin)
add_launch_json(lossy_sync)
endif()
13 changes: 13 additions & 0 deletions examples/lossy_sync/ExampleSync.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// SPDX-FileCopyrightText: 2020-2025 Jochem Rutgers
//
// SPDX-License-Identifier: CC0-1.0

uint32 client heartbeat
uint32 server heartbeat

int32 restarted
int32 i
double d

(float) ber
(uint32) errors
Loading
Loading