-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DXFC-402] Implement adding multiple symbols and removing symbols
- Loading branch information
AnatolyKalin
committed
May 24, 2023
1 parent
dfc1219
commit 78eca87
Showing
21 changed files
with
516 additions
and
428 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright (c) 2023 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
#include <utility> | ||
#include <cstdint> | ||
|
||
namespace dxfcpp { | ||
|
||
struct EventClassList { | ||
template <typename EventTypeIt> | ||
static std::unique_ptr<EventClassList> create(EventTypeIt begin, EventTypeIt end) noexcept { | ||
auto size = std::distance(begin, end); | ||
|
||
if (size <= 0) { | ||
return {}; | ||
} | ||
|
||
auto list = create(size); | ||
|
||
if (list->isEmpty()) { | ||
return {}; | ||
} | ||
|
||
std::size_t i = 0; | ||
|
||
for (auto it = begin; it != end; it++, i++) { | ||
list->set(i, it->getId()); | ||
} | ||
|
||
return list; | ||
} | ||
|
||
void set(std::size_t index, std::uint32_t id) noexcept; | ||
|
||
[[nodiscard]] bool isEmpty() const noexcept; | ||
|
||
[[nodiscard]] std::size_t size() const noexcept; | ||
|
||
void *getHandler() noexcept; | ||
|
||
~EventClassList() noexcept; | ||
|
||
private: | ||
static std::unique_ptr<EventClassList> create(std::size_t size) noexcept; | ||
|
||
EventClassList() noexcept; | ||
|
||
struct Impl; | ||
|
||
std::unique_ptr<Impl> impl_; | ||
}; | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
include/dxfeed_graal_cpp_api/internal/JavaObjectHandler.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2023 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#pragma once | ||
|
||
#include "utils/StringUtils.hpp" | ||
|
||
#include <memory> | ||
#include <string> | ||
|
||
namespace dxfcpp { | ||
|
||
template <typename T> struct JavaObjectHandler { | ||
using Type = T; | ||
static void deleter(void *handler) noexcept; | ||
explicit JavaObjectHandler(void *handler = nullptr) noexcept : impl_{handler, &deleter} {} | ||
|
||
JavaObjectHandler(JavaObjectHandler &&) = default; | ||
JavaObjectHandler &operator=(JavaObjectHandler &&) = default; | ||
virtual ~JavaObjectHandler() noexcept = default; | ||
|
||
[[nodiscard]] std::string toString() const noexcept { | ||
if (impl_) | ||
return dxfcpp::toString(impl_.get()); | ||
else | ||
return "nullptr"; | ||
} | ||
|
||
[[nodiscard]] void *get() const noexcept { return impl_.get(); } | ||
|
||
explicit operator bool() const noexcept { return static_cast<bool>(impl_); } | ||
|
||
private: | ||
std::unique_ptr<void, decltype(&deleter)> impl_; | ||
}; | ||
|
||
} // namespace dxfcpp |
Oops, something went wrong.