Skip to content

Commit

Permalink
Use range instead of iterators for parallelTransform in thread pool, …
Browse files Browse the repository at this point in the history
…fix clang-tidy warnings
  • Loading branch information
sjanel committed Jun 14, 2024
1 parent b9708a7 commit 9749a14
Show file tree
Hide file tree
Showing 18 changed files with 208 additions and 188 deletions.
3 changes: 3 additions & 0 deletions .clang-tidy-ignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
**/json.hpp

# Ignore all protobuf/gRPC generated source files
*.pb.cc

*/_deps/*
2 changes: 2 additions & 0 deletions src/api-objects/include/exchangeprivateapitypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "withdraw.hpp"

namespace cct {

using Deposits = vector<Deposit>;
using DepositsSet = FlatSet<Deposit>;

Expand All @@ -27,4 +28,5 @@ struct TradedAmountsVectorWithFinalAmount {
TradedAmountsVector tradedAmountsVector;
MonetaryAmount finalAmount;
};

} // namespace cct
4 changes: 0 additions & 4 deletions src/api-objects/test/recentdeposit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@

namespace cct::api {

inline bool operator==(const RecentDeposit &lhs, const RecentDeposit &rhs) {
return lhs.amount() == rhs.amount() && lhs.timePoint() == rhs.timePoint();
}

class RecentDepositTest : public ::testing::Test {
protected:
void expectNotFound(MonetaryAmount ma) {
Expand Down
19 changes: 10 additions & 9 deletions src/api/common/test/exchangeprivateapi_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,32 @@
#include "withdrawordeposit.hpp"

namespace cct {
inline bool operator==(const DeliveredWithdrawInfo &lhs, const DeliveredWithdrawInfo &rhs) {
return lhs.withdrawId() == rhs.withdrawId();
}

inline BalancePortfolio operator+(const BalancePortfolio &balancePortfolio, const TradedAmounts &tradedAmounts) {
static inline BalancePortfolio operator+(const BalancePortfolio &balancePortfolio, const TradedAmounts &tradedAmounts) {
BalancePortfolio ret = balancePortfolio;
ret += tradedAmounts.to;
ret += -tradedAmounts.from;
return ret;
}

inline bool operator==(const TradedAmountsVectorWithFinalAmount &lhs, const TradedAmountsVectorWithFinalAmount &rhs) {
static inline bool operator==(const TradedAmountsVectorWithFinalAmount &lhs,
const TradedAmountsVectorWithFinalAmount &rhs) {
return lhs.finalAmount == rhs.finalAmount && lhs.tradedAmountsVector == rhs.tradedAmountsVector;
}

static inline bool operator==(const DeliveredWithdrawInfo &lhs, const DeliveredWithdrawInfo &rhs) {
return lhs.withdrawId() == rhs.withdrawId();
}
} // namespace cct

namespace cct::api {

inline bool operator==(const TradeContext &lhs, const TradeContext &rhs) {
static inline bool operator==(const TradeContext &lhs, const TradeContext &rhs) {
// We don't compare on value userRef which is set from a timestamp
return lhs.mk == rhs.mk && lhs.side == rhs.side;
}

inline bool operator==(const TradeInfo &lhs, const TradeInfo &rhs) {
static inline bool operator==(const TradeInfo &lhs, const TradeInfo &rhs) {
return lhs.tradeContext == rhs.tradeContext && lhs.options == rhs.options;
}

Expand Down Expand Up @@ -442,11 +443,11 @@ TEST_F(ExchangePrivateTest, MakerTradeQuoteToBaseTimeout) {
EXPECT_EQ(exchangePrivate.trade(from, market.base(), tradeOptions), partialMatchedTradedAmounts);
}

inline bool operator==(const InitiatedWithdrawInfo &lhs, const InitiatedWithdrawInfo &rhs) {
static inline bool operator==(const InitiatedWithdrawInfo &lhs, const InitiatedWithdrawInfo &rhs) {
return lhs.withdrawId() == rhs.withdrawId();
}

inline bool operator==(const SentWithdrawInfo &lhs, const SentWithdrawInfo &rhs) {
static inline bool operator==(const SentWithdrawInfo &lhs, const SentWithdrawInfo &rhs) {
return lhs.withdrawStatus() == rhs.withdrawStatus() && lhs.netEmittedAmount() == rhs.netEmittedAmount();
}

Expand Down
1 change: 0 additions & 1 deletion src/api/exchanges/src/binancepublicapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "curlpostdata.hpp"
#include "currencycode.hpp"
#include "currencycodeset.hpp"
#include "currencyexchange.hpp"
#include "currencyexchangeflatset.hpp"
#include "exchangepublicapi.hpp"
#include "exchangepublicapitypes.hpp"
Expand Down
1 change: 0 additions & 1 deletion src/api/exchanges/src/bithumbprivateapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include "exchangepublicapitypes.hpp"
#include "file.hpp"
#include "httprequesttype.hpp"
#include "ipow.hpp"
#include "market.hpp"
#include "monetaryamount.hpp"
#include "ndigits.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/api/exchanges/src/bithumbpublicapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#include <chrono>
#include <cstdint>
#include <ctime>
#include <iomanip>
#include <iterator>
#include <memory>
#include <optional>
#include <ranges>
#include <sstream>
#include <string>
#include <string_view>
Expand Down
4 changes: 2 additions & 2 deletions src/engine/src/coincenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ void FillConversionTransferableCommandResults(const MonetaryAmountPerExchange &m
}
}

} // namespace

volatile sig_atomic_t g_signalStatus = 0;

} // namespace

// According to the standard, 'SignalHandler' function should have C linkage:
// https://en.cppreference.com/w/cpp/utility/program/signal
// Thus it's not possible to use a lambda and pass some
Expand Down
1 change: 0 additions & 1 deletion src/engine/src/coincentercommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "monetaryamount.hpp"
#include "ordersconstraints.hpp"
#include "replay-options.hpp"
#include "timedef.hpp"
#include "tradeoptions.hpp"
#include "withdrawoptions.hpp"
#include "withdrawsconstraints.hpp"
Expand Down
Loading

0 comments on commit 9749a14

Please sign in to comment.