-
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 26, 2023
1 parent
ce4cb2d
commit 2955594
Showing
247 changed files
with
225 additions
and
113,355 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright (c) 2023 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <memory> | ||
#include <utility> | ||
#include <variant> | ||
|
||
namespace dxfcpp { | ||
|
||
struct StringSymbol { | ||
using DataType = typename std::variant<std::string_view, std::string>; | ||
|
||
private: | ||
DataType data_; | ||
|
||
struct Impl; | ||
std::unique_ptr<Impl> impl_; | ||
|
||
public: | ||
StringSymbol() noexcept; | ||
~StringSymbol() noexcept; | ||
|
||
template <typename SymbolType> StringSymbol(SymbolType &&symbol) noexcept : StringSymbol() { | ||
if constexpr (std::is_convertible_v<SymbolType, std::string_view>) { | ||
data_ = std::string_view(std::forward<SymbolType>(symbol)); | ||
} else if constexpr (std::is_convertible_v<SymbolType, std::string>) { | ||
data_ = std::string(std::forward<SymbolType>(symbol)); | ||
} | ||
} | ||
|
||
void *toGraal(); | ||
|
||
std::string toString() const noexcept { | ||
return "StringSymbol{" + std::visit([](auto &&d) { return std::string(d); }, data_) + "}"; | ||
} | ||
|
||
operator std::string() const noexcept { return toString(); } | ||
}; | ||
|
||
template <typename T> | ||
concept ConvertibleToStringSymbol = std::is_convertible_v<T, std::string> || std::is_convertible_v<T, std::string_view>; | ||
|
||
inline namespace literals { | ||
|
||
inline StringSymbol operator""_s(const char *string, size_t length) noexcept { return {std::string_view{string, length}}; } | ||
|
||
} // namespace literals | ||
|
||
} // namespace dxfcpp |
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,14 @@ | ||
// Copyright (c) 2023 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <memory> | ||
#include <utility> | ||
|
||
namespace dxfcpp { | ||
|
||
struct SymbolWrapper {}; | ||
|
||
} // namespace dxfcpp |
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,42 @@ | ||
// Copyright (c) 2023 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#pragma once | ||
|
||
#include <cstdint> | ||
#include <memory> | ||
#include <utility> | ||
|
||
#include "StringSymbol.hpp" | ||
|
||
namespace dxfcpp { | ||
|
||
struct StringSymbol; | ||
|
||
struct WildcardSymbol { | ||
static const WildcardSymbol ALL; | ||
|
||
private: | ||
const std::string symbol; | ||
|
||
WildcardSymbol(std::string symbol) : symbol{std::move(symbol)} {} | ||
|
||
public: | ||
const std::string &getSymbol() const noexcept; | ||
|
||
void *toGraal() const noexcept; | ||
|
||
std::string toString() const noexcept { return getSymbol(); } | ||
|
||
operator std::string() const noexcept { return toString(); } | ||
}; | ||
|
||
inline namespace literals { | ||
|
||
inline WildcardSymbol operator""_ws(const char *string, size_t length) noexcept { return WildcardSymbol::ALL; } | ||
|
||
inline WildcardSymbol operator""_wcs(const char *string, size_t length) noexcept { return WildcardSymbol::ALL; } | ||
|
||
} // namespace literals | ||
|
||
} // namespace dxfcpp |
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,37 @@ | ||
// Copyright (c) 2023 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#include <dxfg_api.h> | ||
|
||
#include <dxfeed_graal_c_api/api.h> | ||
#include <dxfeed_graal_cpp_api/api.hpp> | ||
|
||
#include <memory> | ||
|
||
namespace dxfcpp { | ||
|
||
struct StringSymbol::Impl { | ||
dxfg_string_symbol_t graalSymbol{{STRING}, nullptr}; | ||
}; | ||
|
||
StringSymbol::StringSymbol() noexcept : impl_{std::make_unique<StringSymbol::Impl>()} {} | ||
|
||
StringSymbol::~StringSymbol() noexcept = default; | ||
|
||
void *StringSymbol::toGraal() { | ||
if (impl_->graalSymbol.symbol == nullptr) { | ||
std::visit( | ||
[this]<typename SymbolType>(SymbolType symbol) { | ||
if constexpr (std::is_same_v<SymbolType, std::string>) { | ||
impl_->graalSymbol.symbol = symbol.c_str(); | ||
} else if constexpr (std::is_same_v<SymbolType, std::string_view>) { | ||
impl_->graalSymbol.symbol = symbol.data(); | ||
} | ||
}, | ||
data_); | ||
} | ||
|
||
return bit_cast<void *>(&impl_->graalSymbol); | ||
} | ||
|
||
} // namespace dxfcpp |
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,10 @@ | ||
// Copyright (c) 2023 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#include <dxfeed_graal_c_api/api.h> | ||
#include <dxfeed_graal_cpp_api/api.hpp> | ||
|
||
namespace dxfcpp { | ||
|
||
|
||
} |
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,21 @@ | ||
// Copyright (c) 2023 Devexperts LLC. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
|
||
#include <dxfg_api.h> | ||
|
||
#include <dxfeed_graal_c_api/api.h> | ||
#include <dxfeed_graal_cpp_api/api.hpp> | ||
|
||
namespace dxfcpp { | ||
|
||
const WildcardSymbol WildcardSymbol::ALL{"*"}; | ||
|
||
void *WildcardSymbol::toGraal() const noexcept { | ||
static const dxfg_wildcard_symbol_t wildcardGraalSymbol{{WILDCARD}}; | ||
|
||
return bit_cast<void *>(&wildcardGraalSymbol); | ||
} | ||
|
||
const std::string &WildcardSymbol::getSymbol() const noexcept { return symbol; } | ||
|
||
} // namespace dxfcpp |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.