diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f6c7ace4..398f215b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,8 +28,8 @@ on: jobs: build_windows: - runs-on: windows-2019 - name: "Windows 2019 Arch: ${{ matrix.arch }}, Shared: ${{ matrix.shared }}" + runs-on: windows-2022 + name: "Windows 2022 Arch: ${{ matrix.arch }}, Shared: ${{ matrix.shared }}" strategy: matrix: arch: ["x86", "amd64"] diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f12fed4..d746f3d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ set(AGENT_VERSION_MAJOR 2) set(AGENT_VERSION_MINOR 4) set(AGENT_VERSION_PATCH 0) -set(AGENT_VERSION_BUILD 2) +set(AGENT_VERSION_BUILD 3) set(AGENT_VERSION_RC "") # This minimum version is to support Visual Studio 2019 and C++ feature checking and FetchContent @@ -21,14 +21,15 @@ set(AGENT_PREFIX "" CACHE STRING "Prefix for the name of the agent and the agent set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATADIR}/mtconnect") message(INFO " Shared build: ${SHARED_AGENT_LIB}") +set(CMAKE_OSX_DEPLOYMENT_TARGET 13.3) project(cppagent LANGUAGES C CXX) # We will define these properties by default for each CMake target to be created. -set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(CXX_COMPILE_FEATURES cxx_std_17) +set(CXX_COMPILE_FEATURES cxx_std_20) set(WITH_RUBY ON CACHE STRING "With Ruby Support") diff --git a/conan/profiles/clang b/conan/profiles/clang index d80d9b6c..7a37344e 100644 --- a/conan/profiles/clang +++ b/conan/profiles/clang @@ -2,6 +2,7 @@ include(default) [settings] compiler.libcxx=libstdc++11 +compiler.cppstd=20 [env] CC=/usr/bin/clang diff --git a/conan/profiles/docker b/conan/profiles/docker index 2759a86d..9a48de72 100644 --- a/conan/profiles/docker +++ b/conan/profiles/docker @@ -2,6 +2,7 @@ include(default) [settings] compiler.libcxx=libstdc++11 +compiler.cppstd=20 [options] without_ipv6=True diff --git a/conan/profiles/gcc b/conan/profiles/gcc index 698cc39b..cac1ad8f 100644 --- a/conan/profiles/gcc +++ b/conan/profiles/gcc @@ -2,6 +2,7 @@ include(default) [settings] compiler.libcxx=libstdc++11 +compiler.cppstd=20 [system_tools] cmake/>3.23.0 \ No newline at end of file diff --git a/conan/profiles/gcc-appveyor b/conan/profiles/gcc-appveyor index 84c3ca1d..24716a3e 100644 --- a/conan/profiles/gcc-appveyor +++ b/conan/profiles/gcc-appveyor @@ -3,4 +3,5 @@ include(default) [settings] compiler.libcxx=libstdc++11 compiler.version=11 +compiler.cppstd=20 diff --git a/conan/profiles/macos b/conan/profiles/macos index f0920993..ccec9a4c 100644 --- a/conan/profiles/macos +++ b/conan/profiles/macos @@ -2,7 +2,8 @@ include(default) [settings] compiler=apple-clang -compiler.cppstd=gnu17 +compiler.cppstd=20 +os.version=13.3 [system_tools] cmake/>3.26.0 \ No newline at end of file diff --git a/conan/profiles/vs32 b/conan/profiles/vs32 index 8b20a3bf..e11e9fbe 100644 --- a/conan/profiles/vs32 +++ b/conan/profiles/vs32 @@ -2,10 +2,11 @@ include(default) [settings] compiler=msvc -compiler.cppstd=17 +compiler.cppstd=20 arch=x86 compiler.runtime=static compiler.runtime_type=Release build_type=Release +compiler.version=194 diff --git a/conan/profiles/vs32debug b/conan/profiles/vs32debug index 505fc71b..12079f6c 100644 --- a/conan/profiles/vs32debug +++ b/conan/profiles/vs32debug @@ -2,9 +2,10 @@ include(default) [settings] compiler=msvc -compiler.cppstd=17 +compiler.cppstd=20 arch=x86 compiler.runtime=static compiler.runtime_type=Debug build_type=Debug +compiler.version=194 diff --git a/conan/profiles/vs32shared b/conan/profiles/vs32shared index 52ac0b1e..873cd8e9 100644 --- a/conan/profiles/vs32shared +++ b/conan/profiles/vs32shared @@ -2,11 +2,12 @@ include(default) [settings] compiler=msvc -compiler.cppstd=17 +compiler.cppstd=20 arch=x86 compiler.runtime=dynamic compiler.runtime_type=Release build_type=Release +compiler.version=194 [options] diff --git a/conan/profiles/vs64 b/conan/profiles/vs64 index 729464e4..cdbd0f47 100644 --- a/conan/profiles/vs64 +++ b/conan/profiles/vs64 @@ -2,8 +2,9 @@ include(default) [settings] compiler=msvc -compiler.cppstd=17 +compiler.cppstd=20 arch=x86_64 compiler.runtime=static compiler.runtime_type=Release build_type=Release +compiler.version=194 diff --git a/conan/profiles/vs64debug b/conan/profiles/vs64debug index 226a6a3f..2d2435ff 100644 --- a/conan/profiles/vs64debug +++ b/conan/profiles/vs64debug @@ -2,8 +2,10 @@ include(default) [settings] compiler=msvc -compiler.cppstd=17 +compiler.cppstd=20 arch=x86_64 compiler.runtime=static compiler.runtime_type=Debug build_type=Debug +compiler.version=194 + diff --git a/conan/profiles/vs64shared b/conan/profiles/vs64shared index ebea4cd9..cee8b7ea 100644 --- a/conan/profiles/vs64shared +++ b/conan/profiles/vs64shared @@ -2,11 +2,12 @@ include(default) [settings] compiler=msvc -compiler.cppstd=17 +compiler.cppstd=20 arch=x86_64 compiler.runtime=dynamic compiler.runtime_type=Release build_type=Release +compiler.version=194 [options] shared=True diff --git a/conan/profiles/vsxp b/conan/profiles/vsxp index 10d64e4a..fb821809 100644 --- a/conan/profiles/vsxp +++ b/conan/profiles/vsxp @@ -3,11 +3,12 @@ include(default) [settings] compiler=msvc arch=x86 -compiler.cppstd=17 +compiler.cppstd=20 compiler.runtime=static compiler.runtime_type=Release build_type=Release compiler.toolset=v141_xp +compiler.version=194 [options] winver=0x0501 diff --git a/conan/profiles/xcode b/conan/profiles/xcode index 63866076..0e2ea6f8 100644 --- a/conan/profiles/xcode +++ b/conan/profiles/xcode @@ -1,7 +1,8 @@ include(default) [settings] -compiler.cppstd=17 +compiler.cppstd=20 +os.version=13.3 [system_tools] cmake/>3.23.0 diff --git a/conanfile.py b/conanfile.py index 745600d7..f8f302b1 100644 --- a/conanfile.py +++ b/conanfile.py @@ -130,7 +130,7 @@ def requirements(self): if self.options.with_ruby: self.requires("mruby/3.2.0", headers=True, libs=True, transitive_headers=True, transitive_libs=True) - self.requires("gtest/1.10.0", headers=True, libs=True, transitive_headers=True, transitive_libs=True, test=True) + self.requires("gtest/1.15.0", headers=True, libs=True, transitive_headers=True, transitive_libs=True, test=True) def configure(self): if self.options.shared: diff --git a/src/mtconnect/agent.cpp b/src/mtconnect/agent.cpp index d350f92c..02de75eb 100644 --- a/src/mtconnect/agent.cpp +++ b/src/mtconnect/agent.cpp @@ -446,7 +446,7 @@ namespace mtconnect { return; } - auto callback = [=](config::AsyncContext &context) { + auto callback = [=, this](config::AsyncContext &context) { try { bool changed = false; @@ -573,7 +573,7 @@ namespace mtconnect { createUniqueIds(device); LOG(info) << "Checking if device " << *uuid << " has changed"; - if (*device != *oldDev) + if (!device->equal(*oldDev)) { LOG(info) << "Device " << *uuid << " changed, updating model"; diff --git a/src/mtconnect/buffer/circular_buffer.hpp b/src/mtconnect/buffer/circular_buffer.hpp index e9b934ae..c87faf89 100644 --- a/src/mtconnect/buffer/circular_buffer.hpp +++ b/src/mtconnect/buffer/circular_buffer.hpp @@ -326,8 +326,8 @@ namespace mtconnect::buffer { mutable std::recursive_mutex m_sequenceLock; // Sequence number - volatile SequenceNumber_t m_sequence; - volatile SequenceNumber_t m_firstSequence; + SequenceNumber_t m_sequence; + SequenceNumber_t m_firstSequence; // The sliding/circular buffer to hold all of the events/sample data unsigned int m_slidingBufferSize; diff --git a/src/mtconnect/entity/data_set.hpp b/src/mtconnect/entity/data_set.hpp index 1602efb4..630a3904 100644 --- a/src/mtconnect/entity/data_set.hpp +++ b/src/mtconnect/entity/data_set.hpp @@ -17,13 +17,9 @@ #pragma once -#include -#include -#include +#include #include -#include #include -#include #include "mtconnect/config.hpp" #include "mtconnect/logging.hpp" @@ -33,10 +29,10 @@ namespace mtconnect::entity { struct DataSetEntry; /// @brief A set of data set entries - class AGENT_LIB_API DataSet : public std::set + class DataSet : public boost::container::set { public: - using base = std::set; + using base = boost::container::set; using base::base; /// @brief Get a entry for a key @@ -55,7 +51,7 @@ namespace mtconnect::entity { /// @brief Split the data set entries by space delimiters and account for the /// use of single and double quotes as well as curly braces - bool parse(const std::string &s, bool table); + bool AGENT_LIB_API parse(const std::string &s, bool table); }; /// @brief Data Set Value type enumeration diff --git a/src/mtconnect/entity/entity.hpp b/src/mtconnect/entity/entity.hpp index b56eec38..15d2e254 100644 --- a/src/mtconnect/entity/entity.hpp +++ b/src/mtconnect/entity/entity.hpp @@ -352,16 +352,21 @@ namespace mtconnect { /// @brief get the attributes for XML generation /// @return attribute set const auto &getAttributes() const { return m_attributes; } - + /// @brief compare two entities for equality /// @param other the other entity /// @return `true` if they have equal name and properties - bool operator==(const Entity &other) const; + bool equal(const Entity &other) const; + + /// @brief cover method for equal + /// @param other the other entity + /// @return `true` if they have equal name and properties + bool operator==(const Entity &other) const { return equal(other); } /// @brief compare two entities for inequality /// @param other the other entity /// @return `true` if they have unequal name and properties - bool operator!=(const Entity &other) const { return !(*this == other); } + bool operator!=(const Entity &other) const { return !equal(other); } /// @brief update this entity to be the same as other /// @param other the other entity @@ -446,7 +451,7 @@ namespace mtconnect { bool operator()(const EntityPtr &other) { - return *std::get(m_this) == *(other.get()); + return std::get(m_this)->equal(*(other.get())); } bool operator()(const EntityList &other) @@ -463,7 +468,7 @@ namespace mtconnect { auto id = (*it)->getIdentity(); auto oit = boost::find_if(other, [&id](const auto &e) { return id == e->getIdentity(); }); - if (oit == other.end() || *(it->get()) != *(oit->get())) + if (oit == other.end() || !(it->get())->equal(*(oit->get()))) return false; } } @@ -471,7 +476,7 @@ namespace mtconnect { { for (auto oit = other.cbegin(); it != list.cend(); it++, oit++) { - if (*(it->get()) != *(oit->get())) + if (!(it->get())->equal(*(oit->get()))) return false; } } @@ -499,7 +504,7 @@ namespace mtconnect { inline bool operator!=(const Value &v1, const Value &v2) { return !(v1 == v2); } - inline bool Entity::operator==(const Entity &other) const + inline bool Entity::equal(const Entity &other) const { if (m_name != other.m_name) return false;