OpenTTD Source 20250908-master-g16cd420e4c
history_type.hpp File Reference

Types for storing historical data. More...

Go to the source code of this file.

Data Structures

struct  HistoryRange
 

Typedefs

template<typename T >
using HistoryData = std::array< T, HISTORY_RECORDS >
 Container type for storing history data.
 
using ValidHistoryMask = uint64_t
 Mask of valid history records.
 

Variables

static constexpr uint8_t HISTORY_PERIODS = 24
 
static constexpr HistoryRange HISTORY_MONTH {HISTORY_PERIODS}
 
static constexpr HistoryRange HISTORY_QUARTER {HISTORY_MONTH, 3, HISTORY_PERIODS}
 
static constexpr HistoryRange HISTORY_YEAR {HISTORY_QUARTER, 4, HISTORY_PERIODS}
 
static constexpr uint8_t HISTORY_MAX_DIVISION = std::max({HISTORY_MONTH.division, HISTORY_QUARTER.division, HISTORY_YEAR.division})
 Maximum number of divisions from previous history range.
 
static constexpr uint8_t HISTORY_RECORDS = HISTORY_YEAR.last
 Total number of records require for all history data.
 
static constexpr uint8_t THIS_MONTH = 0
 
static constexpr uint8_t LAST_MONTH = 1
 

Detailed Description

Types for storing historical data.

Definition in file history_type.hpp.

Typedef Documentation

◆ HistoryData

template<typename T >
using HistoryData = std::array<T, HISTORY_RECORDS>

Container type for storing history data.

Template Parameters
Ttype of history data.

Definition at line 53 of file history_type.hpp.

◆ ValidHistoryMask

using ValidHistoryMask = uint64_t

Mask of valid history records.

Definition at line 56 of file history_type.hpp.

Variable Documentation

◆ HISTORY_MAX_DIVISION

constexpr uint8_t HISTORY_MAX_DIVISION = std::max({HISTORY_MONTH.division, HISTORY_QUARTER.division, HISTORY_YEAR.division})
staticconstexpr

Maximum number of divisions from previous history range.

Definition at line 40 of file history_type.hpp.

◆ HISTORY_MONTH

constexpr HistoryRange HISTORY_MONTH {HISTORY_PERIODS}
staticconstexpr

Definition at line 35 of file history_type.hpp.

◆ HISTORY_PERIODS

constexpr uint8_t HISTORY_PERIODS = 24
staticconstexpr

Definition at line 34 of file history_type.hpp.

◆ HISTORY_QUARTER

constexpr HistoryRange HISTORY_QUARTER {HISTORY_MONTH, 3, HISTORY_PERIODS}
staticconstexpr

Definition at line 36 of file history_type.hpp.

◆ HISTORY_RECORDS

constexpr uint8_t HISTORY_RECORDS = HISTORY_YEAR.last
staticconstexpr

Total number of records require for all history data.

Definition at line 43 of file history_type.hpp.

◆ HISTORY_YEAR

constexpr HistoryRange HISTORY_YEAR {HISTORY_QUARTER, 4, HISTORY_PERIODS}
staticconstexpr

Definition at line 37 of file history_type.hpp.

◆ LAST_MONTH

constexpr uint8_t LAST_MONTH = 1
staticconstexpr

Definition at line 46 of file history_type.hpp.

◆ THIS_MONTH

constexpr uint8_t THIS_MONTH = 0
staticconstexpr

Definition at line 45 of file history_type.hpp.