Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EN-7490] Implement Tools #26

Merged
merged 37 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
56e7f9c
[EN-7490] Implement Tools
AnatolyKalin Sep 7, 2023
164648d
[EN-7412] Implement DXFeedConnect sample
ttldtor Sep 7, 2023
5b7bfbd
[EN-7412] Implement DXFeedConnect sample
ttldtor Sep 7, 2023
0b96b34
[EN-7412] Implement DXFeedConnect sample
ttldtor Sep 7, 2023
185401e
[EN-7490] Implement Tools
ttldtor Sep 7, 2023
ef9ba13
[EN-7490] Implement Tools
ttldtor Sep 10, 2023
9e1b580
[EN-7490] Implement Tools
AnatolyKalin Sep 12, 2023
7d1cab7
[EN-7490] Implement Tools
ttldtor Sep 12, 2023
1b9c6cd
[EN-7490] Implement Tools
ttldtor Sep 12, 2023
2bbe69c
[EN-7490] Implement Tools
ttldtor Sep 12, 2023
2f98234
[EN-7490] Implement Tools
ttldtor Sep 12, 2023
2bd9651
[EN-7490] Implement Tools
AnatolyKalin Sep 13, 2023
06b5f1c
[EN-7490] Implement Tools
AnatolyKalin Sep 13, 2023
ef5c8d9
[EN-7490] Implement Tools
AnatolyKalin Sep 13, 2023
45dadc7
[EN-7490] Implement Tools
ttldtor Sep 15, 2023
79642d7
[EN-7490] Implement Tools
ttldtor Sep 15, 2023
1b150c1
[EN-7490] Implement Tools
ttldtor Sep 16, 2023
4766f6a
[EN-7490] Implement Tools
ttldtor Sep 16, 2023
d5caafc
[EN-7490] Implement Tools
ttldtor Sep 16, 2023
57e3b30
[EN-7490] Implement Tools
ttldtor Sep 17, 2023
bd40929
[EN-7490] Implement Tools
ttldtor Sep 17, 2023
e665a20
[EN-7490] Implement Tools
ttldtor Sep 17, 2023
868058d
[EN-7490] Implement Tools
ttldtor Sep 17, 2023
e3716f9
[EN-7490] Implement Tools
ttldtor Sep 17, 2023
0a92c76
[EN-7490] Implement Tools
ttldtor Sep 17, 2023
b053372
[EN-7490] Implement Tools
ttldtor Sep 17, 2023
3d280b5
[EN-7490] Implement Tools
ttldtor Sep 17, 2023
92b583c
[EN-7490] Implement Tools
ttldtor Sep 18, 2023
9e454bd
[EN-7490] Implement Tools
ttldtor Sep 18, 2023
cf26809
[EN-7490] Implement Tools
ttldtor Sep 18, 2023
191c958
[EN-7490] Implement Tools
ttldtor Sep 18, 2023
87aa39c
[EN-7490] Implement Tools
ttldtor Sep 18, 2023
3980dc4
[EN-7490] Implement Tools
ttldtor Sep 18, 2023
86b7a84
[EN-7490] Implement Tools
ttldtor Sep 19, 2023
5bccce0
[EN-7490] Implement Tools
ttldtor Sep 19, 2023
ce2cd45
[EN-7490] Implement Tools
ttldtor Sep 19, 2023
c79d865
[EN-7490] Implement Tools
ttldtor Sep 19, 2023
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
21 changes: 17 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ option(DXFCXX_INSTALL_LIB "Prepare install the libraries" ON)
option(DXFCXX_INSTALL_SAMPLES "Prepare install the samples" ${DXFCXX_IS_ROOT_PROJECT})
option(DXFCXX_INSTALL_TOOLS "Prepare install the tools" ${DXFCXX_IS_ROOT_PROJECT})
option(DXFCXX_USE_DXFEED_GRAAL_NATIVE_SDK_JFROG "" ON)
set(DXFEED_GRAAL_NATIVE_SDK_VERSION "1.0.2" CACHE STRING "")
set(DXFEED_GRAAL_NATIVE_SDK_VERSION "1.0.4" CACHE STRING "")
set(DXFEED_GRAAL_NATIVE_SDK_JFROG_BASE_URL "https://dxfeed.jfrog.io/artifactory/maven-open/com/dxfeed/graal-native-sdk/" CACHE STRING "")

option(DXFCXX_ENABLE_ASAN_UBSAN "Enable address, UB sanitizers etc" OFF)
Expand All @@ -62,8 +62,13 @@ elseif (APPLE)
set(DXFCXX_TARGET_PLATFORM "x86_64-osx")
endif ()
elseif (UNIX)
set(DXFCXX_GRAAL_TARGET_PLATFORM "amd64-linux")
set(DXFCXX_TARGET_PLATFORM "x86_64-linux")
if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
set(DXFCXX_GRAAL_TARGET_PLATFORM "amd64-linux")
set(DXFCXX_TARGET_PLATFORM "x86_64-linux")
else ()
set(DXFCXX_GRAAL_TARGET_PLATFORM "unknown")
set(DXFCXX_TARGET_PLATFORM "unknown")
endif ()
elseif ()
set(DXFCXX_GRAAL_TARGET_PLATFORM "unknown")
set(DXFCXX_TARGET_PLATFORM "unknown")
Expand All @@ -77,7 +82,7 @@ else ()
endif ()

if (DXFCXX_GRAAL_TARGET_PLATFORM STREQUAL "unknown")
message(ERROR "Unknown platform!")
message(ERROR "Unsupported platform!")
else ()
set(DXFEED_GRAAL_NATIVE_SDK_URL ${DXFEED_GRAAL_NATIVE_SDK_URL}-${DXFCXX_GRAAL_TARGET_PLATFORM}.zip)
endif ()
Expand All @@ -88,6 +93,9 @@ endif ()
FetchContent_MakeAvailable(DxFeedGraalNativeSdk)
# DxFeedGraalNativeSdk_SOURCE_DIR

FetchContent_Declare(Process GIT_REPOSITORY "https://github.com/ttldtor/Process.git" GIT_TAG default)
FetchContent_MakeAvailable(Process)

add_subdirectory(third_party/utfcpp-3.2.3)
set(FMT_INSTALL OFF)
add_subdirectory(third_party/fmt-10.0.0)
Expand All @@ -105,6 +113,8 @@ set(dxFeedGraalCxxApi_Internal_Sources
src/internal/EventClassList.cpp
src/internal/SymbolList.cpp
src/internal/Common.cpp
src/internal/Platform.cpp
src/internal/Console.cpp
)

set(dxFeedGraalCxxApi_InternalUtils_Sources
Expand Down Expand Up @@ -319,6 +329,9 @@ add_custom_command(TARGET ${PROJECT_NAME}_static POST_BUILD COMMAND ${CMAKE_COMM
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:DxFeedGraalNativeSdk> $<TARGET_FILE_DIR:${PROJECT_NAME}>)

target_compile_definitions(${PROJECT_NAME} PUBLIC DXFCXX_VERSION="${DXFCXX_VERSION}")
target_compile_definitions(${PROJECT_NAME}_static PUBLIC DXFCXX_VERSION="${DXFCXX_VERSION}")

if (DXFCXX_BUILD_UNIT_TESTS)
include(CTest)
add_subdirectory(tests)
Expand Down
3 changes: 2 additions & 1 deletion DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
- [fmt](https://github.com/fmtlib/fmt) v10.0.0
- [doctest](https://github.com/doctest/doctest) v2.4.11 (Tests)
- [range-v3](https://github.com/ericniebler/range-v3) v0.12
- [date] (https://github.com/HowardHinnant/date) v3.0.1
- [date](https://github.com/HowardHinnant/date) v3.0.1
- [Process](https://github.com/ttldtor/Process) v1.0.0 (Tools)

## Run-time

Expand Down
244 changes: 128 additions & 116 deletions README.md

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions THIRD_PARTY_LICENSES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
SPDX-License-Identifier: MIT
3. doctest - https://github.com/doctest/doctest/blob/master/LICENSE.txt
SPDX-License-Identifier: MIT
4. range-v3 - https://github.com/ericniebler/range-v3/blob/master/LICENSE.txt
4. range-v3 - https://github.com/ericniebler/range-v3/blob/master/LICENSE.txt
SPDX-License-Identifier: BSL-1.0
5. date - https://github.com/HowardHinnant/date/blob/master/LICENSE.txt
5. date - https://github.com/HowardHinnant/date/blob/master/LICENSE.txt
SPDX-License-Identifier: MIT
6. Process - https://github.com/ttldtor/Process/blob/default/LICENSE
SPDX-License-Identifier: BSL-1.0

6 changes: 5 additions & 1 deletion include/dxfeed_graal_cpp_api/api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@

#include "internal/CEntryPointErrors.hpp"
#include "internal/Common.hpp"
#include "internal/Console.hpp"
#include "internal/Enum.hpp"
#include "internal/EventClassList.hpp"
#include "internal/Id.hpp"
#include "internal/Isolate.hpp"
#include "internal/JavaObjectHandler.hpp"
#include "internal/NonCopyable.hpp"
#include "internal/Platform.hpp"
#include "internal/RawListWrapper.hpp"
#include "internal/StopWatch.hpp"
#include "internal/SymbolList.hpp"
#include "internal/Timer.hpp"
#include "internal/context/ApiContext.hpp"
#include "internal/managers/DXEndpointManager.hpp"
#include "internal/managers/DXFeedSubscriptionManager.hpp"
#include "internal/managers/EntityManager.hpp"
#include "internal/managers/ErrorHandlingManager.hpp"
#include "internal/utils/StringUtils.hpp"
#include "internal/utils/CmdArgsUtils.hpp"
#include "internal/utils/EnumUtils.hpp"
#include "internal/utils/StringUtils.hpp"
#include "internal/utils/TimeFormat.hpp"
#include "internal/utils/debug/Debug.hpp"

Expand Down
6 changes: 6 additions & 0 deletions include/dxfeed_graal_cpp_api/api/DXEndpoint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ struct DXFeed;
* [Javadoc.](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/api/DXEndpoint.html)
*/
struct DXFCPP_EXPORT DXEndpoint : SharedEntity {
/// The alias to a type of shared pointer to the DXEndpoint object
using Ptr = std::shared_ptr<DXEndpoint>;

/// The alias to a type of unique pointer to the DXEndpoint object
using Unique = std::unique_ptr<DXEndpoint>;

/**
* `"name"`
*
Expand Down
6 changes: 6 additions & 0 deletions include/dxfeed_graal_cpp_api/api/DXFeed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ class EventTypeEnum;
* This class is thread-safe and can be used concurrently from multiple threads without external synchronization.
*/
struct DXFCPP_EXPORT DXFeed : SharedEntity {
/// The alias to a type of shared pointer to the DXFeed object
using Ptr = std::shared_ptr<DXFeed>;

/// The alias to a type of unique pointer to the DXFeed object
using Unique = std::unique_ptr<DXFeed>;

friend struct DXEndpoint;

private:
Expand Down
13 changes: 10 additions & 3 deletions include/dxfeed_graal_cpp_api/api/DXFeedSubscription.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <memory>
#include <unordered_set>
#include <concepts>

namespace dxfcpp {

Expand Down Expand Up @@ -49,7 +50,7 @@ class DXFCPP_EXPORT DXFeedSubscription : public SharedEntity {
template <typename EventTypeIt>
#if __cpp_concepts
requires requires(EventTypeIt iter) {
{ *iter } -> std::convertible_to<EventTypeEnum>;
{ *iter } -> dxfcpp::ConvertibleTo<EventTypeEnum>;
}
#endif
DXFeedSubscription(EventTypeIt begin, EventTypeIt end) noexcept
Expand Down Expand Up @@ -106,6 +107,12 @@ class DXFCPP_EXPORT DXFeedSubscription : public SharedEntity {
std::vector<SymbolWrapper> getDecoratedSymbolsImpl() const noexcept;

public:
/// The alias to a type of shared pointer to the DXFeedSubscription object
using Ptr = std::shared_ptr<DXFeedSubscription>;

/// The alias to a type of unique pointer to the DXFeedSubscription object
using Unique = std::unique_ptr<DXFeedSubscription>;

///
std::string toString() const noexcept override;

Expand Down Expand Up @@ -166,7 +173,7 @@ class DXFCPP_EXPORT DXFeedSubscription : public SharedEntity {
template <typename EventTypeIt>
#if __cpp_concepts
requires requires(EventTypeIt iter) {
{ *iter } -> std::convertible_to<EventTypeEnum>;
{ *iter } -> dxfcpp::ConvertibleTo<EventTypeEnum>;
}
#endif
static std::shared_ptr<DXFeedSubscription> create(EventTypeIt begin, EventTypeIt end) noexcept {
Expand Down Expand Up @@ -341,7 +348,7 @@ class DXFCPP_EXPORT DXFeedSubscription : public SharedEntity {
std::size_t addEventListener(std::function<void(const std::vector<std::shared_ptr<EventT>> &)> &&listener) noexcept
#if __cpp_concepts
requires std::is_base_of_v<EventType, EventT> && requires {
{ EventT::TYPE } -> std::convertible_to<EventTypeEnum>;
{ EventT::TYPE } -> dxfcpp::ConvertibleTo<EventTypeEnum>;
}
#endif
{
Expand Down
6 changes: 6 additions & 0 deletions include/dxfeed_graal_cpp_api/api/DXPublisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ class ObservableSubscription;
* This class is thread-safe and can be used concurrently from multiple threads without external synchronization.
*/
struct DXFCPP_EXPORT DXPublisher : SharedEntity {
/// The alias to a type of shared pointer to the DXPublisher object
using Ptr = std::shared_ptr<DXPublisher>;

/// The alias to a type of unique pointer to the DXPublisher object
using Unique = std::unique_ptr<DXPublisher>;

friend struct DXEndpoint;

private:
Expand Down
2 changes: 1 addition & 1 deletion include/dxfeed_graal_cpp_api/entity/SharedEntity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace dxfcpp {

/// Base abstract "shared entity" class. Has some helpers for dynamic polymorphism
struct DXFCPP_EXPORT SharedEntity : public Entity, std::enable_shared_from_this<SharedEntity> {
/// The simple type synonym for the SharedEntity type
/// The alias to a type of shared pointer to the SharedEntity object.
using Ptr = std::shared_ptr<SharedEntity>;

/**
Expand Down
2 changes: 1 addition & 1 deletion include/dxfeed_graal_cpp_api/event/EventType.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace dxfcpp {
* @see DXFeed
*/
struct DXFCPP_EXPORT EventType : public SharedEntity {
/// The alias to a type of shared pointer to the EventType's child object.
/// The alias to a type of shared pointer to the EventType object.
using Ptr = std::shared_ptr<EventType>;

/**
Expand Down
9 changes: 8 additions & 1 deletion include/dxfeed_graal_cpp_api/event/EventTypeEnum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ class DXFCPP_EXPORT EventTypeEnum {
}

public:
using RefSetType =
std::unordered_set<std::reference_wrapper<const EventTypeEnum>, decltype([](auto &&eventTypeRef) {
return static_cast<std::size_t>(eventTypeRef.get().getId());
})>;

static const EventTypeEnum QUOTE;
static const EventTypeEnum PROFILE;
static const EventTypeEnum SUMMARY;
Expand Down Expand Up @@ -74,9 +79,11 @@ class DXFCPP_EXPORT EventTypeEnum {

static const std::unordered_map<std::string, std::reference_wrapper<const EventTypeEnum>> ALL_BY_CLASS_NAME;

explicit EventTypeEnum() noexcept : EventTypeEnum{static_cast<std::uint32_t>(-1), "INVALID", "Invalid", false} {
EventTypeEnum() noexcept : EventTypeEnum{static_cast<std::uint32_t>(-1), "INVALID", "Invalid", false} {
}

virtual ~EventTypeEnum() noexcept = default;

/**
* @return The dxFeed Graal Native C-API event class id
*/
Expand Down
Loading