Skip to content

Commit

Permalink
[MDAPI-26] Update Graal SDK to v1.1.21
Browse files Browse the repository at this point in the history
internal::IsolatedTools
  • Loading branch information
AnatolyKalin committed Jul 2, 2024
1 parent f2b6469 commit 5e7b718
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 34 deletions.
2 changes: 1 addition & 1 deletion DEPENDENCIES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Compile-time

- [dxFeed Graal Native SDK](https://github.com/dxFeed/dxfeed-graal-native-sdk) v1.1.16
- [dxFeed Graal Native SDK](https://github.com/dxFeed/dxfeed-graal-native-sdk) v1.1.21
- [Boost](https://github.com/boostorg/boost) v1.84.0
- Boost.Stacktrace 1.0
- [utfcpp](https://github.com/nemtrif/utfcpp) v3.2.3
Expand Down
1 change: 1 addition & 0 deletions include/dxfeed_graal_cpp_api/api/DXFeed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ struct DXFCPP_EXPORT DXFeed : SharedEntity {

/**
* Requests time series of events for the specified event type, symbol, and a range of time.
*
* @tparam E The type of event.
* @param symbol The symbol.
* @param fromTime The time, inclusive, to request events from (see TimeSeriesEvent::getTime()).
Expand Down
6 changes: 0 additions & 6 deletions include/dxfeed_graal_cpp_api/isolated/Isolated.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ DXFCPP_BEGIN_NAMESPACE

namespace isolated {

struct Tools {
static std::unordered_set<std::string> /* dxfg_string_list* */ parseSymbols(std::string_view symbolList);

static void /* int32_t */ runTool(/* dxfg_string_list* */ const std::vector<std::string>& args);
};

namespace ipf {
struct InstrumentProfileReader {
static /* dxfg_instrument_profile_reader_t* */ JavaObjectHandle<dxfcpp::InstrumentProfileReader> create();
Expand Down
20 changes: 17 additions & 3 deletions include/dxfeed_graal_cpp_api/isolated/internal/IsolatedTools.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,26 @@ DXFCPP_BEGIN_NAMESPACE

namespace isolated::internal::IsolatedTools {

/**
* Calls the Graal SDK function `dxfg_Tools_parseSymbols` in isolation.
*
* @param symbolList The symbol list
* @return parsed symbols.
* @throws JavaException if something happened with the dxFeed API backend.
* @throws GraalException if something happened with the GraalVM.
*/
std::unordered_set<std::string> /* dxfg_string_list* */ parseSymbols(std::string_view symbolList);

void /* int32_t */ runTool(/* dxfg_string_list* */ const std::vector<std::string>& args);

}
/**
* Calls the Graal SDK function `dxfg_Tools_main` in isolation.
*
* @param args The tool's arguments
* @throws JavaException if something happened with the dxFeed API backend.
* @throws GraalException if something happened with the GraalVM.
*/
void /* int32_t */ runTool(/* dxfg_string_list* */ const std::vector<std::string> &args);

} // namespace isolated::internal::IsolatedTools

DXFCPP_END_NAMESPACE

Expand Down
21 changes: 0 additions & 21 deletions src/internal/Isolate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,29 +154,8 @@ constexpr auto runGraalFunction(auto resultCheckerConverter, auto graalFunction,
defaultValue, resultCheckerConverter, graalFunction, params...);
}

std::unordered_set<std::string> /* dxfg_string_list* */
Tools::parseSymbols(std::string_view symbolList) {
std::unordered_set<std::string> result{};

auto graalStringList = runGraalFunctionAndThrowIfNullptr(dxfg_Tools_parseSymbols, symbolList.data());

for (auto i = 0; i < graalStringList->size; i++) {
result.emplace(dxfcpp::toString(graalStringList->elements[i]));
}

isolated::internal::IsolatedStringList::release(graalStringList);

return result;
}

using NativeStringList = typename isolated::internal::NativeStringListWrapper<dxfg_string_list>;

void /* int32_t */ Tools::runTool(/* dxfg_string_list* */ const std::vector<std::string> &args) {
NativeStringList l{args};

runGraalFunctionAndThrowIfLessThanZero(dxfg_Tools_main, l.list);
}

namespace ipf {

/* dxfg_instrument_profile_reader_t* */ dxfcpp::JavaObjectHandle<dxfcpp::InstrumentProfileReader>
Expand Down
4 changes: 2 additions & 2 deletions src/internal/utils/CmdArgsUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ std::unordered_set<SymbolWrapper> CmdArgsUtils::parseSymbols(const std::string &
return {};
}

auto parsed = isolated::Tools::parseSymbols(trimmedSymbols);
auto parsed = isolated::internal::IsolatedTools::parseSymbols(trimmedSymbols);

if (parsed.contains("*") || parsed.contains("all") || parsed.contains("All") || parsed.contains("ALL")) {
return {WildcardSymbol::ALL};
Expand All @@ -155,7 +155,7 @@ std::unordered_set<CandleSymbol> CmdArgsUtils::parseCandleSymbols(const std::str
return {};
}

auto parsed = isolated::Tools::parseSymbols(trimmedSymbols);
auto parsed = isolated::internal::IsolatedTools::parseSymbols(trimmedSymbols);

return parsed | ranges::views::transform([](auto &&s) {
return CandleSymbol::valueOf(s);
Expand Down
23 changes: 23 additions & 0 deletions src/isolated/internal/IsolatedTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,34 @@
#include <dxfg_api.h>

#include <dxfeed_graal_cpp_api/isolated/IsolatedCommon.hpp>
#include <dxfeed_graal_cpp_api/isolated/internal/IsolatedString.hpp>
#include <dxfeed_graal_cpp_api/isolated/internal/IsolatedTools.hpp>

DXFCPP_BEGIN_NAMESPACE

namespace isolated::internal::IsolatedTools {
std::unordered_set<std::string> /* dxfg_string_list* */
parseSymbols(std::string_view symbolList) {
std::unordered_set<std::string> result{};

auto graalStringList = runGraalFunctionAndThrowIfNullptr(dxfg_Tools_parseSymbols, symbolList.data());

for (auto i = 0; i < graalStringList->size; i++) {
result.emplace(dxfcpp::toString(graalStringList->elements[i]));
}

IsolatedStringList::release(graalStringList);

return result;
}

using NativeStringList = NativeStringListWrapper<dxfg_string_list>;

void /* int32_t */ runTool(/* dxfg_string_list* */ const std::vector<std::string> &args) {
NativeStringList l{args};

runGraalFunctionAndThrowIfLessThanZero(dxfg_Tools_main, l.list);
}
} // namespace isolated::internal::IsolatedTools

DXFCPP_END_NAMESPACE
2 changes: 1 addition & 1 deletion tools/Tools/src/Qds/QdsTool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct QdsTool {
auto parsedProperties = CmdArgsUtils::parseProperties(args.properties);

System::setProperties(parsedProperties);
dxfcpp::isolated::Tools::runTool(qdsArgs);
dxfcpp::isolated::internal::IsolatedTools::runTool(qdsArgs);
}
};

Expand Down

0 comments on commit 5e7b718

Please sign in to comment.