dxFeed Graal CXX API v9.0.0
Loading...
Searching...
No Matches
TimePeriodInfo Struct Reference

Immutable value class for a range of time periods: the minimum and the maximum period in milliseconds. More...

#include <TimePeriodInfo.hpp>

Public Member Functions

constexpr std::int64_t getMin () const noexcept
 Returns the minimum period in milliseconds.
constexpr std::int64_t getMax () const noexcept
 Returns the maximum period in milliseconds.
constexpr bool isUnknown () const noexcept
std::string toString () const
 Returns the info as JSON with the periods in seconds, as Java does: {"min":1.5,"max":2}.

Static Public Member Functions

static TimePeriodInfo valueOf (std::int64_t min, std::int64_t max)
 Returns TimePeriodInfo with the given bounds.

Static Public Attributes

static const TimePeriodInfo UNKNOWN {-1000, -1000}
 The value meaning "not set / unknown". It has negative minimum and maximum.
static const TimePeriodInfo EMPTY {0, 0}
 The value meaning "known to be zero". It has zero minimum and maximum.

Detailed Description

Immutable value class for a range of time periods: the minimum and the maximum period in milliseconds.

It describes the aggregation periods that a server applies (DXEndpoint::getAggregationPeriodInfo()) or that were applied to the delivered events (DXFeedSubscription::getAggregationPeriodInfo()). TimePeriodInfo::UNKNOWN means that no info is available.

Javadoc.

Member Function Documentation

◆ getMax()

std::int64_t TimePeriodInfo::getMax ( ) const
inlineconstexprnoexcept

Returns the maximum period in milliseconds.

It is negative for TimePeriodInfo::UNKNOWN: check isUnknown() before using the value arithmetically.

Returns
The maximum period in milliseconds.

◆ getMin()

std::int64_t TimePeriodInfo::getMin ( ) const
inlineconstexprnoexcept

Returns the minimum period in milliseconds.

It is negative for TimePeriodInfo::UNKNOWN: check isUnknown() before using the value arithmetically.

Returns
The minimum period in milliseconds.

◆ isUnknown()

bool TimePeriodInfo::isUnknown ( ) const
inlineconstexprnoexcept
Returns
true if this is TimePeriodInfo::UNKNOWN.

◆ toString()

std::string TimePeriodInfo::toString ( ) const

Returns the info as JSON with the periods in seconds, as Java does: {"min":1.5,"max":2}.

TimePeriodInfo::UNKNOWN is {"min":-1,"max":-1}.

Returns
The string representation.

◆ valueOf()

TimePeriodInfo TimePeriodInfo::valueOf ( std::int64_t min,
std::int64_t max )
static

Returns TimePeriodInfo with the given bounds.

Parameters
minThe minimum period in milliseconds (non-negative).
maxThe maximum period in milliseconds (non-negative, not less than min).
Returns
TimePeriodInfo with the given bounds; TimePeriodInfo::EMPTY for (0, 0).
Exceptions
InvalidArgumentExceptionif min or max is negative or min is greater than max.