Skip to content

Commit

Permalink
All changes for v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nullnullfix committed Jul 22, 2022
1 parent c578b94 commit 5928329
Show file tree
Hide file tree
Showing 170 changed files with 20,800 additions and 3,978 deletions.
4 changes: 4 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
#Checks: '*'
WarningsAsErrors: 'False'
HeaderFilterRegex: '.*'
38 changes: 12 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,6 @@ if (NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()

# if Conan is used, we have to include the generated file and doing some basic setup
if(CONAN_COMPILER)
if ( EXISTS ${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake)
include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake)
elseif ( EXISTS ${CMAKE_CURRENT_BINARY_DIR}/../conanbuildinfo.cmake)
include(${CMAKE_CURRENT_BINARY_DIR}/../conanbuildinfo.cmake)
elseif ( EXISTS ${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo_multi.cmake)
include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo_multi.cmake)
elseif ( EXISTS ${CMAKE_CURRENT_BINARY_DIR}/../conanbuildinfo_multi.cmake)
include(${CMAKE_CURRENT_BINARY_DIR}/../conanbuildinfo_multi.cmake)
else()
message(FATAL_ERROR "Conan build info can't be found.")
endif()

if(CORTEX_WORKSPACE)
conan_basic_setup(TARGETS)
else()
conan_basic_setup(TARGETS NO_OUTPUT_DIRS)
endif()
endif(CONAN_COMPILER)

set(dev_essential_cmake_include_components "." CACHE STRING "List of components to build, separated\
by whitespace or semicolon (default: '.', meaning all components are built).")

Expand Down Expand Up @@ -87,14 +66,21 @@ if(dev_essential_cmake_enable_integrated_tests)
endif()
endmacro(find_package)

find_package(GTest PATHS ${CONAN_TESTING_ROOT})
if (NOT GTest_FOUND)
message(WARNING "Googletest not found. Integrated tests disabled.")
else (NOT GTest_FOUND)
message(CHECK_START "Checking third-party packages")
list(APPEND CMAKE_MESSAGE_INDENT " ")
message(CHECK_START "GTest")
find_package(GTest)
if(NOT GTest_FOUND)
message(CHECK_FAIL "not found. Integrated tests disabled.")
else()
message(CHECK_PASS "found ['${GTest_DIR}']")
endif()
list(POP_BACK CMAKE_MESSAGE_INDENT)
if (GTest_FOUND)
enable_testing()
include(scripts/cmake/stub_generation.cmake)
add_subdirectory(test/function)
endif (NOT GTest_FOUND)
endif()
add_subdirectory(test/sca)
endif(dev_essential_cmake_enable_integrated_tests)

Expand Down
6 changes: 4 additions & 2 deletions doc/extern/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = dev_essential
PROJECT_NUMBER = v1.1.4
PROJECT_NUMBER = v1.2.0
PROJECT_BRIEF = "Documentation for essential C++ libraries and interfaces"
OUTPUT_DIRECTORY =
STRIP_FROM_PATH = include/
Expand Down Expand Up @@ -48,7 +48,8 @@ WARN_AS_ERROR = YES
#---------------------------------------------------------------------------
# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = include doc/extern README.md a_util.md rpc.md ddl.md ddl_capi.md
INPUT = include doc/extern README.md a_util.md rpc.md ddl.md ddl_capi.md \
include/a_util/base/detail/error.inc
FILE_PATTERNS = *.h *.md *.dox
RECURSIVE = YES
EXCLUDE_PATTERNS = *_impl.h
Expand Down Expand Up @@ -103,6 +104,7 @@ GENERATE_LATEX = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
MACRO_EXPANSION = YES

#---------------------------------------------------------------------------
# Configuration options related to external references
Expand Down
86 changes: 86 additions & 0 deletions doc/extern/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ The format is based on [Keep a Changelog][] and this project adheres to [Semanti

## Version history
### [Dev essentials libraries](#dev_essential_libraries)
* [1.2.0](#dev_essential_1_2_0) \| [Changes](#dev_essential_1_2_0_changes) \|
[Fixes](#dev_essential_1_2_0_fixes) \| [Known issues](#dev_essential_1_2_0_known_issues) \|
Release date: 2022/07/15
* [1.1.4](#dev_essential_1_1_4) \| Changes \|
[Fixes](#dev_essential_1_1_4_fixes) \| [Known issues](#dev_essential_1_1_4_known_issues) \|
Release date: 2022/05/20
Expand Down Expand Up @@ -86,6 +89,89 @@ The format is based on [Keep a Changelog][] and this project adheres to [Semanti

<a name="dev_essential_libraries"></a>
## Dev essential libraries

<a name="dev_essential_1_2_0"></a>
### [dev_essential 1.2.0][] - 2022/07/15

<a name="dev_essential_1_2_0_changes"></a>
#### Changes
_**Done**_
- [ODAUTIL-214][] - Use clang-tidy as static code analyzer
- [ODAUTIL-217][] - Add `a_util::ScopeGuard` class
- Adds scope guards based on Andrei Alexandrescu's talk &quot;Declarative Control Flow&quot;
- [ODAUTIL-306][] - Enable TCP_NODELAY in httplib for faster RPC
- [ODAUTIL-420][] - [ddl] Merge StructLayout (of Codec API) and StructTypeAccess
- [ODAUTIL-430][] - [Tests] Create automated memory leak tests
- [ODAUTIL-456][] - [filesystem] Refactor `a_util::filesystem::Path::getRoot()` to be consistent with std naming
- Deprecates `a_util::filesystem::Path::getRoot()` and adds
- `a_util::filesystem::Path::getRootName()` and
- `a_util::filesystem::Path::getRootPath()`
- [ODAUTIL-484][] - [build] Decouple conan and CMake
- [ODAUTIL-493][] - Provide common error codes and types
- Introduces `enum a_util::errc`
- [ODAUTIL-541][] - [ddl] Extend type reflection API to support all optional DDL struct and element information
- Extends `ddl::DDStructure` with methods
- `ddl::DDStructure::setStructInfo()`
- `ddl::DDStructure::setElementInfo()`
- `ddl::DDStructure::setElementUnit()`
- [ODAUTIL-543][] - [memory] Add `a_util::memory::makeStackPtr()` function equivalent to `std::make_unique`
- [ODAUTIL-548][] - [ddl] Description files saved by the xml writer always follow the same pattern
- [ODAUTIL-554][] - [xml] Add possibility to sort xml nodes
- Adds function overload `a_util::strings::replace()` and new methods
`a_util::xml::DOMElement::sortNodes()`
- [ODAUTIL-577][] - Add a small LeafCodecIndex to raise performance for default decoding
- Introduces `ddl::codec::LeafCodecIndex` class for high performant ddl coder/decoder access
- Introduces type traits file with the following function/types:
- `std::is_enum_v` and `std::void_t` as std backports only for non C++17 compliant compilers
- `a_util::underlying_type_or_type` and `a_util::underlying_type_or_type_t`
- `a_util::is_explicitly_convertible_to` and `a_util::is_explicitly_convertible_to_v`

_**Won't Do**_
- [ODAUTIL-5][] - Add Solution for old cFile \(AUL-70\)
- [ODAUTIL-85][] - [concurrency] Implement method `semaphore::wait_until`
- [ODAUTIL-107][] - Add child process control functions
- [ODAUTIL-117][] - Provide solution for further requirements regarding `a_util::process`
- [ODAUTIL-118][] - Array Support for As*-Methods of Variant
- [ODAUTIL-128][] - Use `_nullptr` instead of `nullptr` in public headers
- [ODAUTIL-134][] - Cleanup usage of defines and preprocessor macros
- [ODAUTIL-146][] - [process] Create possibility to interact with child process \(stdIn\)
- [ODAUTIL-264][] - [DOC] Methods, Variables, Classes need documentation
- [ODAUTIL-387][] - [ddl] Add Functionality to define 'aliases' to predefined data types in \<datatypes/\> section
- Superseded by [ODAUTIL-426][]
- [ODAUTIL-505][] - Try sending RPC with SendRPCMessage in a predefined IP first
- [ODAUTIL-506][] - Add a thread safe queue

_**Duplicate**_
- [ODAUTIL-173][] - [process] Add functionality to resolve environment variables
- Duplicated by [ODAUTIL-108][]
- [ODAUTIL-249][] - Change to new coding style and use clang tidy to convert user code
- Duplicates by [ODAUTIL-214][]
- [ODAUTIL-475][] - Redesign of the `ddl::access_element` API and CodecFactory internal data to increase creation performance
- Duplicated by [ODAUTIL-420][]
- [ODAUTIL-502][] - Predefined error codes for cross-project use
- Duplicated by [ODAUTIL-493][]
- [ODAUTIL-551][] - [ddl2header] Preserve ddl struct namespaces
- Duplicated by [DDLUTILITY-111][]

<a name="dev_essential_1_2_0_fixes"></a>
#### Fixes
_**Fixed**_
- [ODAUTIL-135][] - [Result] Construction with 'ResultInfo<void>' doesn't call desired constructor
- **Please note:** This change might lead to compile time errors when using `_MAKE_RESULT()`
with a value of `0` in customer code. For hints how to fix/deactivate this behavior, consult
the resulting compiler message.
- [ODAUTIL-381][] - `ddl::getType()` does not return a meaningful error message
- [ODAUTIL-509][] - dev_essential cannot be built with clang 10.0.0 and mingw32 frontend
- [ODAUTIL-512][] - [ddl] compare for enums does not check for equivalence
- [ODAUTIL-571][] - [build] No SCA stage for develop branch executed
- [ODAUTIL-575][] - threaded_http_server doesn't wait for detached threads on call to StopListening

_**Won't Do**_
- [ODAUTIL-233][] - [HTTP Parser] The used http parser is too minimal
- Fixed with [ODAUTIL-250][]
- [ODAUTIL-565][] - [ddl] TesterOODDL::checkTypeCalculationPerformance test fails for gcc5 and gcc7
- Fixed with [ODAUTIL-420][]

<a name="dev_essential_1_1_4"></a>
### [dev_essential 1.1.4][] - 2022/05/20

Expand Down
27 changes: 23 additions & 4 deletions extern/3rdparty/cpp-httplib/httplib/httplib.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
#define S_ISREG(m) (((m)&S_IFREG)==S_IFREG)
#define S_ISDIR(m) (((m)&S_IFDIR)==S_IFDIR)

#endif // _MSC_VER

#ifdef _WIN32

#include <fcntl.h>
#include <io.h>
#include <winsock2.h>
Expand All @@ -33,18 +37,22 @@
#undef max

typedef SOCKET socket_t;

#else

#include <pthread.h>
#include <unistd.h>
#include <netdb.h>
#include <cstring>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <sys/select.h> // fd_set

typedef int socket_t;
#endif

#endif // _WIN32

#include <fstream>
#include <map>
Expand Down Expand Up @@ -272,11 +280,17 @@ inline bool wait_for_socket_readable(socket_t sock, size_t timeout_us)

inline int shutdown_socket(socket_t sock)
{
#ifdef _MSC_VER
#ifdef _WIN32
return shutdown(sock, SD_BOTH);
#else
return shutdown(sock, SHUT_RDWR);
#endif
#endif // _WIN32
}

inline void enable_tcp_no_delay(socket_t sock)
{
int tcp_no_delay = 1;
setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char*)&tcp_no_delay, sizeof(tcp_no_delay));
}

inline socket_t create_socket(const char* host, int port, bool server, int reuse)
Expand Down Expand Up @@ -304,9 +318,12 @@ inline socket_t create_socket(const char* host, int port, bool server, int reuse
continue;
}

// we want faster RTTs
enable_tcp_no_delay(sock);

// Make 'reuse address' option available
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char*)&reuse, sizeof(reuse));
#ifdef WIN32
#ifdef _WIN32
reuse ^= 1;
setsockopt(sock, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char*)&reuse, sizeof(reuse));
#endif
Expand Down Expand Up @@ -833,6 +850,8 @@ inline void Server::accept(ProcessFunctor& processor)
break;
}

detail::enable_tcp_no_delay(sock);

processor(*this, sock);
}
}
Expand Down
7 changes: 6 additions & 1 deletion extern/3rdparty/libjson-rpc-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,18 @@ add_library(libjson-rpc-cpp OBJECT ${jsonrpccpp_SRC})
# dynamic_cast in jsonrpccpp/server/abstractserver.h
target_compile_options(libjson-rpc-cpp PRIVATE $<$<AND:$<NOT:$<CXX_COMPILER_ID:MSVC>>,$<COMPILE_LANGUAGE:CXX>>:-frtti -Wno-deprecated-declarations>
$<$<AND:$<CXX_COMPILER_ID:MSVC>,$<COMPILE_LANGUAGE:CXX>>:/GR>)
target_include_directories(libjson-rpc-cpp
target_include_directories(libjson-rpc-cpp SYSTEM
PRIVATE $<BUILD_INTERFACE:${jsonrpccpp_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/configured/>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/configured/jsonrpccpp/common>
${JSONCPP_INCLUDE_DIRECTORIES})
if(MSVC)
target_include_directories(libjson-rpc-cpp PRIVATE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/compat/msvc>)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
# See: https://github.com/msys2/MINGW-packages/issues/5786
target_compile_options(libjson-rpc-cpp PRIVATE -femulated-tls)
endif()
endif()
target_compile_features(libjson-rpc-cpp PRIVATE cxx_std_11) # C++11 for self
set_target_properties(libjson-rpc-cpp PROPERTIES FOLDER 3rdparty/object_libraries)
Expand Down
2 changes: 1 addition & 1 deletion extern/3rdparty/uuid/uuid-1.6.2/uuid_prng.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#include "uuid_prng.h"
#include "uuid_md5.h"

#ifdef WIN32
#if defined(WIN32) && !defined(__MINGW32__)
typedef int pid_t;
#endif

Expand Down
3 changes: 3 additions & 0 deletions include/a_util/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ namespace experimental {
} // namespace a_util

#include <a_util/base/delegate.h>
#include <a_util/base/error.h>
#include <a_util/base/scopeguard.h>
#include <a_util/base/type_traits.h>
#include <a_util/base/types.h>

#endif // A_UTIL_BASE_HEADER_INCLUDED
54 changes: 54 additions & 0 deletions include/a_util/base/detail/error.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/// @file
/// Common error conditions for multilanguage support - DO NOT INCLUDE DIRECTLY
///
/// @copyright
/// @verbatim
/// Copyright @ 2022 VW Group. All rights reserved.
///
/// This Source Code Form is subject to the terms of the Mozilla
/// Public License, v. 2.0. If a copy of the MPL was not distributed
/// with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
///
/// If it is not possible or desirable to put the notice in a particular file, then
/// You may include the notice in a location (such as a LICENSE file in a
/// relevant directory) where a recipient would be likely to look for such a notice.
///
/// You may add additional accurate notices of copyright ownership.@endverbatim

// If new values are added, also add a test in file test/function/base/errc_test.inc
// Exising values MUST NOT BE CHANGED!

/// This scoped enumeration defines the values of portable error conditions for cross-project usage
DEV_ESSENTIAL_ENUM_CLASS errc{
unknown = -2, //!< Unknown error
unexpected = -3, //!< Unexpected error
invalid_pointer = -4, //!< Invalid pointer (e.g. nullptr)
invalid_argument = -5, //!< Invalid argument
invalid_address = -7, //!< The memory address is invalid
invalid_file = -11, //!< The file is invalid
memory = -12, //!< No memory left
timeout = -13, //!< Operation timed out
resource_in_use = -15, //!< A resource is already in use
not_impl = -16, //!< A callable is not implemented (e.g. a function)
no_interface = -17, //!< The requested interface does not exist
not_supported = -19, //!< Operation not supported
not_found = -20, //!< Resource (e.g. some chunk of memory) is not found
canceled = -21, //!< Operation canceled
retry = -22, //!< Retry
file_not_found = -23, //!< File not found
path_not_found = -24, //!< Requested path not found
access_denied = -25, //!< Access denied
bad_device = -31, //!< Bad device
device_io = -32, //!< I/O error on device
device_not_ready = -33, //!< Device not ready
not_connected = -35, //!< A connection could not be established
unknown_format = -36, //!< File has unknown format
not_initialized = -37, //!< Not initialized
failed = -38, //!< Failed
invalid_state = -40, //!< A resource is in an invalid state
exception_raised = -41, //!< An exception was raised
invalid_type = -42, //!< A given type is invalid
empty = -43, //!< File empty
out_of_range = -49, //!< Out of range
known_problem = -50 //!< Known problem
};
36 changes: 36 additions & 0 deletions include/a_util/base/enums.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* @file
* Several enums for project wide use
*
* @copyright
* @verbatim
Copyright @ 2022 VW Group. All rights reserved.
This Source Code Form is subject to the terms of the Mozilla
Public License, v. 2.0. If a copy of the MPL was not distributed
with this file, You can obtain one at https://mozilla.org/MPL/2.0/.
If it is not possible or desirable to put the notice in a particular file, then
You may include the notice in a location (such as a LICENSE file in a
relevant directory) where a recipient would be likely to look for such a notice.
You may add additional accurate notices of copyright ownership.
@endverbatim
*/

#ifndef A_UTIL_BASE_ENUMS_HEADER_INCLUDED
#define A_UTIL_BASE_ENUMS_HEADER_INCLUDED

#include <cstdint>

namespace a_util {

/// Flags for functions that need to sort elements
enum class SortingOrder : std::int32_t {
ascending = 0x00, //!< Sort in ascending order
descending = 0x01 //!< Sort in descending order
};

} // namespace a_util

#endif // A_UTIL_BASE_ENUMS_HEADER_INCLUDED
Loading

0 comments on commit 5928329

Please sign in to comment.