dxFeed Graal CXX API v9.0.0
Loading...
Searching...
No Matches
EventSourceWrapper Struct Referencefinal

A helper wrapper class needed to pass heterogeneous event sources using a container and convert them to internal Graal representation. More...

#include <EventSourceWrapper.hpp>

Public Member Functions

 EventSourceWrapper (const IndexedEventSource &data) noexcept
 Constructs a wrapper from IndexedEventSource.
 EventSourceWrapper (const OrderSource &data) noexcept
 Constructs a wrapper from OrderSource.
void * toGraal () const
 Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
std::unique_ptr< void, decltype(&EventSourceWrapper::freeGraal)> toGraalUnique () const
 Allocates memory for the dxFeed Graal SDK structure (recursively if necessary).
std::string toString () const
 Returns a string representation of the current object.
std::string toStringUnderlying () const
 Returns a string representation of the underlying object.
bool isIndexedEventSource () const noexcept
bool isOrderSource () const noexcept
std::optional< IndexedEventSource > asIndexedEventSource () const noexcept
std::optional< OrderSource > asOrderSource () const noexcept
const DataType & getData () const noexcept

Static Public Member Functions

static void freeGraal (void *graalNative)
 Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).
static EventSourceWrapper fromGraal (void *graalNative)
 Creates an object of the current type and fills it with data from the dxFeed Graal SDK structure.

Detailed Description

A helper wrapper class needed to pass heterogeneous event sources using a container and convert them to internal Graal representation.

Constructor & Destructor Documentation

◆ EventSourceWrapper() [1/2]

EventSourceWrapper::EventSourceWrapper ( const IndexedEventSource & data)
noexcept

Constructs a wrapper from IndexedEventSource.

Parameters
dataThe IndexedEventSource.

◆ EventSourceWrapper() [2/2]

EventSourceWrapper::EventSourceWrapper ( const OrderSource & data)
noexcept

Constructs a wrapper from OrderSource.

Parameters
dataThe OrderSource.

Member Function Documentation

◆ asIndexedEventSource()

std::optional< IndexedEventSource > EventSourceWrapper::asIndexedEventSource ( ) const
noexcept
Returns
IndexedEventSource (optional) or std::nullopt if the current EventSourceWrapper doesn't hold IndexedEventSource.

◆ asOrderSource()

std::optional< OrderSource > EventSourceWrapper::asOrderSource ( ) const
noexcept
Returns
OrderSource (optional) or std::nullopt if the current EventSourceWrapper doesn't hold OrderSource.

◆ freeGraal()

void EventSourceWrapper::freeGraal ( void * graalNative)
static

Releases the memory occupied by the dxFeed Graal SDK structure (recursively if necessary).

Parameters
graalNativeThe pointer to the dxFeed Graal SDK structure.
Exceptions
InvalidArgumentException

References IndexedEventSource::freeGraal().

Referenced by toGraalUnique().

◆ fromGraal()

EventSourceWrapper EventSourceWrapper::fromGraal ( void * graalNative)
static

Creates an object of the current type and fills it with data from the dxFeed Graal SDK structure.

Parameters
graalNativeThe pointer to the dxFeed Graal SDK structure.
Returns
The object of the current type.
Exceptions
InvalidArgumentException
RuntimeExceptionif an event source type is unknown

References IndexedEventSource::fromGraal().

◆ getData()

const EventSourceWrapper::DataType & EventSourceWrapper::getData ( ) const
noexcept
Returns
The internal data.

◆ isIndexedEventSource()

bool EventSourceWrapper::isIndexedEventSource ( ) const
noexcept
Returns
true if current EventSourceWrapper holds a IndexedEventSource.

◆ isOrderSource()

bool EventSourceWrapper::isOrderSource ( ) const
noexcept
Returns
true if current EventSourceWrapper holds a OrderSource.

◆ toGraal()

void * EventSourceWrapper::toGraal ( ) const
nodiscard

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.

Returns
The pointer to the filled dxFeed Graal SDK structure
Exceptions
InvalidArgumentExceptionif the name of the source is not valid UTF-8.

Referenced by toGraalUnique().

◆ toGraalUnique()

std::unique_ptr< void, decltype(&EventSourceWrapper::freeGraal)> EventSourceWrapper::toGraalUnique ( ) const

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.

Returns
The smart unique pointer to the filled dxFeed Graal SDK structure
Exceptions
InvalidArgumentExceptionif the name of the source is not valid UTF-8.

References freeGraal(), and toGraal().

◆ toString()

std::string EventSourceWrapper::toString ( ) const

Returns a string representation of the current object.

Returns
a string representation

◆ toStringUnderlying()

std::string EventSourceWrapper::toStringUnderlying ( ) const

Returns a string representation of the underlying object.

Returns
a string representation of the underlying object.