Skip to content

Commit

Permalink
[EN-8236] Implement Message event
Browse files Browse the repository at this point in the history
  • Loading branch information
ttldtor authored Apr 5, 2024
2 parents 5bb30d1 + 0a377f4 commit 9b71b9f
Show file tree
Hide file tree
Showing 33 changed files with 877 additions and 269 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ set(dxFeedGraalCxxApi_EventOption_Sources
src/event/option/Series.cpp
)

set(dxFeedGraalCxxApi_EventMisc_Sources
src/event/misc/Message.cpp
)

set(dxFeedGraalCxxApi_Schedule_Sources
src/schedule/SessionFilter.cpp
src/schedule/SessionType.cpp
Expand All @@ -311,7 +315,7 @@ set(dxFeedGraalCxxApi_Sources
${dxFeedGraalCxxApi_EventCandle_Sources}
${dxFeedGraalCxxApi_EventMarket_Sources}
${dxFeedGraalCxxApi_EventOption_Sources}
${dxFeedGraalCxxApi_EventOption_Sources}
${dxFeedGraalCxxApi_EventMisc_Sources}
${dxFeedGraalCxxApi_Schedule_Sources}
)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ versions):
- [Message](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/event/misc/Message.html) is an event with an
application-specific attachment
- [ ] dxFeed Graal C API
- [ ] dxFeed Graal C++ API
- [x] dxFeed Graal C++ API
- [OptionSale](https://docs.dxfeed.com/dxfeed/api/com/dxfeed/event/market/OptionSale.html) is an event that represents
a trade or another market event with the price (for example, market open/close price, etc.) for each option symbol
listed under the specified Underlying
Expand Down
7 changes: 7 additions & 0 deletions include/dxfeed_graal_cpp_api/api/osub/WildcardSymbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ struct DXFCPP_EXPORT WildcardSymbol final {
*/
static void freeGraal(void *graalNative);

/**
* Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
*
* @param graalNative The pointer to the dxFeed Graal SDK structure.
* @return The object of current type.
* @throws std::invalid_argument
*/
static const WildcardSymbol &fromGraal(void *graalNative);

/**
Expand Down
44 changes: 26 additions & 18 deletions include/dxfeed_graal_cpp_api/event/IndexedEventSource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,32 @@ class DXFCPP_EXPORT IndexedEventSource {
*/
static const IndexedEventSource DEFAULT;


/**
* Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
* Fills the dxFeed Graal SDK structure's fields by the data of the current entity (recursively if necessary).
* Returns the pointer to the filled structure.
*
* @return The pointer to the filled dxFeed Graal SDK structure
*/
virtual void *toGraal() const;

/**
* Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
*
* @param graalNative The pointer to the dxFeed Graal SDK structure.
*/
static void freeGraal(void *graalNative);

/**
* Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
*
* @param graalNative The pointer to the dxFeed Graal SDK structure.
* @return The object of current type.
* @throws std::invalid_argument
*/
static IndexedEventSource fromGraal(void *graalNative);

IndexedEventSource() noexcept = default;
virtual ~IndexedEventSource() noexcept = default;

Expand Down Expand Up @@ -73,24 +99,6 @@ class DXFCPP_EXPORT IndexedEventSource {
auto operator<(const IndexedEventSource &indexedEventSource) const {
return id_ < indexedEventSource.id_;
}

/**
* Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
* Fills the dxFeed Graal SDK structure's fields by the data of the current entity (recursively if necessary).
* Returns the pointer to the filled structure.
*
* @return The pointer to the filled dxFeed Graal SDK structure
*/
virtual void *toGraal() const;

/**
* Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
*
* @param graalNative The pointer to the dxFeed Graal SDK structure.
*/
static void freeGraal(void *graalNative);

static IndexedEventSource fromGraal(void *graalNative);
};

DXFCPP_END_NAMESPACE
Expand Down
41 changes: 24 additions & 17 deletions include/dxfeed_graal_cpp_api/event/candle/Candle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,30 @@ class DXFCPP_EXPORT Candle final : public EventTypeWithSymbol<CandleSymbol>,
static void freeGraalData(void *graalNative) noexcept;

public:
static std::shared_ptr<Candle> fromGraal(void *graalNative);
/// The alias to a type of shared pointer to the Candle object
using Ptr = std::shared_ptr<Candle>;

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

/// Type identifier and additional information about the current event class.
static const EventTypeEnum &TYPE;

/**
* Maximum allowed sequence value.
*
* @see Candle::setSequence()
*/
static constexpr std::uint32_t MAX_SEQUENCE = (1U << 22U) - 1U;

/**
* Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
*
* @param graalNative The pointer to the dxFeed Graal SDK structure.
* @return The object of current type.
* @throws std::invalid_argument
*/
static Ptr fromGraal(void *graalNative);

/**
* Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Expand All @@ -123,22 +146,6 @@ class DXFCPP_EXPORT Candle final : public EventTypeWithSymbol<CandleSymbol>,
*/
static void freeGraal(void *graalNative);

/**
* Maximum allowed sequence value.
*
* @see Candle::setSequence()
*/
static constexpr std::uint32_t MAX_SEQUENCE = (1U << 22U) - 1U;

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

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

/// Type identifier and additional information about the current event class.
static const EventTypeEnum &TYPE;

/**
* Creates new candle with default values.
*/
Expand Down
7 changes: 7 additions & 0 deletions include/dxfeed_graal_cpp_api/event/candle/CandleSymbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,13 @@ struct DXFCPP_EXPORT CandleSymbol {
*/
static void freeGraal(void *graalNative);

/**
* Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
*
* @param graalNative The pointer to the dxFeed Graal SDK structure.
* @return The object of current type.
* @throws std::invalid_argument
*/
static CandleSymbol fromGraal(void *graalNative);

/**
Expand Down
28 changes: 17 additions & 11 deletions include/dxfeed_graal_cpp_api/event/market/AnalyticOrder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,23 @@ class DXFCPP_EXPORT AnalyticOrder final : public Order {
void fillGraalData(void *graalNative) const noexcept override;

public:
static std::shared_ptr<AnalyticOrder> fromGraal(void *graalNative);
/// The alias to a type of shared pointer to the AnalyticOrder object
using Ptr = std::shared_ptr<AnalyticOrder>;

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

/// Type identifier and additional information about the current event class.
static const EventTypeEnum &TYPE;

/**
* Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
*
* @param graalNative The pointer to the dxFeed Graal SDK structure.
* @return The object of current type.
* @throws std::invalid_argument
*/
static Ptr fromGraal(void *graalNative);

/**
* Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Expand All @@ -93,16 +109,6 @@ class DXFCPP_EXPORT AnalyticOrder final : public Order {
*/
static void freeGraal(void *graalNative);

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

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

/// Type identifier and additional information about the current event class.
static const EventTypeEnum &TYPE;

/// Creates new analytic order event with default values.
AnalyticOrder() noexcept = default;

Expand Down
42 changes: 24 additions & 18 deletions include/dxfeed_graal_cpp_api/event/market/OptionSale.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,30 @@ class DXFCPP_EXPORT OptionSale final : public MarketEvent, public IndexedEvent {
static void freeGraalData(void *graalNative) noexcept;

public:
static std::shared_ptr<OptionSale> fromGraal(void *graalNative);
/// The alias to a type of shared pointer to the OptionSale object
using Ptr = std::shared_ptr<OptionSale>;

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

/// Type identifier and additional information about the current event class.
static const EventTypeEnum &TYPE;

/**
* Maximum allowed sequence value.
*
* @see OptionSale::setSequence()
*/
static constexpr std::uint32_t MAX_SEQUENCE = (1U << 22U) - 1U;

/**
* Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
*
* @param graalNative The pointer to the dxFeed Graal SDK structure.
* @return The object of current type.
* @throws std::invalid_argument
*/
static Ptr fromGraal(void *graalNative);

/**
* Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Expand All @@ -104,23 +127,6 @@ class DXFCPP_EXPORT OptionSale final : public MarketEvent, public IndexedEvent {
*/
static void freeGraal(void *graalNative);

public:
/**
* Maximum allowed sequence value.
*
* @see OptionSale::setSequence()
*/
static constexpr std::uint32_t MAX_SEQUENCE = (1U << 22U) - 1U;

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

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

/// Type identifier and additional information about the current event class.
static const EventTypeEnum &TYPE;

/// Creates new option sale event with default values.
OptionSale() noexcept = default;

Expand Down
30 changes: 18 additions & 12 deletions include/dxfeed_graal_cpp_api/event/market/Order.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ DXFCXX_DISABLE_MSC_WARNINGS_PUSH(4251)
#include <cassert>
#include <cstdint>
#include <memory>
#include <string>
#include <optional>
#include <string>

#include "../../internal/Common.hpp"
#include "../EventTypeEnum.hpp"
Expand Down Expand Up @@ -107,7 +107,23 @@ class DXFCPP_EXPORT Order : public OrderBase {
static void freeGraalData(void *graalNative) noexcept;

public:
static std::shared_ptr<Order> fromGraal(void *graalNative);
/// The alias to a type of shared pointer to the Order object
using Ptr = std::shared_ptr<Order>;

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

/// Type identifier and additional information about the current event class.
static const EventTypeEnum &TYPE;

/**
* Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
*
* @param graalNative The pointer to the dxFeed Graal SDK structure.
* @return The object of current type.
* @throws std::invalid_argument
*/
static Ptr fromGraal(void *graalNative);

/**
* Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Expand All @@ -125,16 +141,6 @@ class DXFCPP_EXPORT Order : public OrderBase {
*/
static void freeGraal(void *graalNative);

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

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

/// Type identifier and additional information about the current event class.
static const EventTypeEnum &TYPE;

/// Creates new order event with default values.
Order() noexcept = default;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,14 @@ class DXFCPP_EXPORT OtcMarketsOrder final : public Order {
/// Type identifier and additional information about the current event class.
static const EventTypeEnum &TYPE;

static OtcMarketsOrder::Ptr fromGraal(void *graalNative);
/**
* Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
*
* @param graalNative The pointer to the dxFeed Graal SDK structure.
* @return The object of current type.
* @throws std::invalid_argument
*/
static Ptr fromGraal(void *graalNative);

/**
* Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Expand Down
30 changes: 18 additions & 12 deletions include/dxfeed_graal_cpp_api/event/market/Profile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ DXFCXX_DISABLE_MSC_WARNINGS_PUSH(4251)

#include <cstdint>
#include <memory>
#include <string>
#include <optional>
#include <string>

#include "../../internal/Common.hpp"
#include "../EventTypeEnum.hpp"
Expand Down Expand Up @@ -73,7 +73,23 @@ class DXFCPP_EXPORT Profile final : public MarketEvent, public LastingEvent {
static void freeGraalData(void *graalNative) noexcept;

public:
static std::shared_ptr<Profile> fromGraal(void *graalNative);
/// The alias to a type of shared pointer to the Profile object
using Ptr = std::shared_ptr<Profile>;

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

/// Type identifier and additional information about the current event class.
static const EventTypeEnum &TYPE;

/**
* Creates an object of the current type and fills it with data from the the dxFeed Graal SDK structure.
*
* @param graalNative The pointer to the dxFeed Graal SDK structure.
* @return The object of current type.
* @throws std::invalid_argument
*/
static Ptr fromGraal(void *graalNative);

/**
* Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
Expand All @@ -91,16 +107,6 @@ class DXFCPP_EXPORT Profile final : public MarketEvent, public LastingEvent {
*/
static void freeGraal(void *graalNative);

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

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

/// Type identifier and additional information about the current event class.
static const EventTypeEnum &TYPE;

/// Creates new profile event with default values.
Profile() noexcept = default;

Expand Down
Loading

0 comments on commit 9b71b9f

Please sign in to comment.