diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 426d4945..2040b34a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -44,7 +44,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -57,4 +57,4 @@ jobs: make all - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/github-ci-pull-req.yml b/.github/workflows/github-ci-pull-req.yml index 898b4537..affe7fd9 100644 --- a/.github/workflows/github-ci-pull-req.yml +++ b/.github/workflows/github-ci-pull-req.yml @@ -24,7 +24,7 @@ jobs: cd build-test cmake -DCMAKE_BUILD_TYPE=Release -DDISABLE_TLS=ON -DTARGET_PLATFORM=x64 -DDXFC_BUILD_UNIT_TESTS=ON .. cmake --build . --config Release - ctest -C Release + ctest -VV -C Release env: CTEST_OUTPUT_ON_FAILURE: True diff --git a/.gitignore b/.gitignore index d01d6ee9..de441688 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,6 @@ cmake-build-release*/** /**/*.*~ /docs/dxfeed*/ **/*.swp +CMakeSettings.json +linux-build/** diff --git a/DXFeed.vcxproj b/DXFeed.vcxproj index 7c1824f7..73acc832 100644 --- a/DXFeed.vcxproj +++ b/DXFeed.vcxproj @@ -143,7 +143,7 @@ Disabled - $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;%(AdditionalIncludeDirectories) + $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL;DXFEED_EXPORTS;%(PreprocessorDefinitions) @@ -174,7 +174,7 @@ Disabled - $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;%(AdditionalIncludeDirectories) + $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL;DXFEED_EXPORTS;DXFEED_CODEC_TLS_ENABLED;%(PreprocessorDefinitions) @@ -208,7 +208,7 @@ Disabled - $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;%(AdditionalIncludeDirectories) + $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL;DXFEED_EXPORTS;%(PreprocessorDefinitions) @@ -238,7 +238,7 @@ Disabled - $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;%(AdditionalIncludeDirectories) + $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL;DXFEED_EXPORTS;DXFEED_CODEC_TLS_ENABLED;%(PreprocessorDefinitions) @@ -271,7 +271,7 @@ MaxSpeed - $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;%(AdditionalIncludeDirectories) + $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL;DXFEED_EXPORTS;%(PreprocessorDefinitions) @@ -296,7 +296,7 @@ MaxSpeed - $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;%(AdditionalIncludeDirectories) + $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL;DXFEED_EXPORTS;DXFEED_CODEC_TLS_ENABLED;%(PreprocessorDefinitions) @@ -324,7 +324,7 @@ MaxSpeed - $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;%(AdditionalIncludeDirectories) + $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL;DXFEED_EXPORTS;%(PreprocessorDefinitions) @@ -348,7 +348,7 @@ MaxSpeed - $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;%(AdditionalIncludeDirectories) + $(SolutionDir)include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL;DXFEED_EXPORTS;DXFEED_CODEC_TLS_ENABLED;%(PreprocessorDefinitions) diff --git a/README.md b/README.md index 322ec119..f58e9dd0 100644 --- a/README.md +++ b/README.md @@ -59,16 +59,19 @@ Find useful information in self-service dxFeed Knowledge Base, or C API framewor ## Dependencies - API - - Boost.Locale.EncodingUtf (1.75) + - Boost.Locale.EncodingUtf (1.79) + - Boost.MultiIndex (1.79) - [TOML11](https://github.com/ToruNiina/toml11) (3.6.0) + - [optional-lite](https://github.com/martinmoene/optional-lite) (3.5.0) + - [variant-lite](https://github.com/martinmoene/variant-lite) (2.0.0) - Tests - [Catch2](https://github.com/catchorg/Catch2) (2.13.8) - C++ Wrappers - - [Args](https://github.com/Taywee/args) (6.2.2) - - [fmt](https://github.com/fmtlib/fmt) (8.0.0) - - [optional-lite](https://github.com/martinmoene/optional-lite) (3.1.1) - - [string-view-lite](https://github.com/martinmoene/string-view-lite) (1.1.0) - - [variant-lite](https://github.com/martinmoene/variant-lite) (1.1.0) + - [Args](https://github.com/Taywee/args) (6.3.0) + - [fmt](https://github.com/fmtlib/fmt) (8.1.1) + - [optional-lite](https://github.com/martinmoene/optional-lite) (3.5.0) + - [string-view-lite](https://github.com/martinmoene/string-view-lite) (1.6.0) + - [variant-lite](https://github.com/martinmoene/variant-lite) (2.0.0) diff --git a/include/DXErrorCodes.h b/include/DXErrorCodes.h index 738d4173..164a110c 100644 --- a/include/DXErrorCodes.h +++ b/include/DXErrorCodes.h @@ -27,11 +27,9 @@ * @brief dxFeed C API errors declarations */ -/* -------------------------------------------------------------------------- */ /* * Error codes */ -/* -------------------------------------------------------------------------- */ /// Error level typedef enum dx_log_level_t { @@ -217,7 +215,6 @@ typedef enum { dx_ec_count } dx_error_code_t; -/* -------------------------------------------------------------------------- */ /** * @ingroup c-api-common * @@ -228,10 +225,8 @@ typedef enum { * @returns Error description string * */ -/* -------------------------------------------------------------------------- */ dxf_const_string_t dx_get_error_description(dx_error_code_t code); -/* -------------------------------------------------------------------------- */ /** * @ingroup c-api-common * @@ -242,7 +237,6 @@ dxf_const_string_t dx_get_error_description(dx_error_code_t code); * @returns Error level * */ -/* -------------------------------------------------------------------------- */ dx_log_level_t dx_get_log_level(dx_error_code_t code); #endif /* DX_ERROR_CODES_H_INCLUDED */ diff --git a/include/DXFeed.h b/include/DXFeed.h index 6b566adc..c7dbf439 100644 --- a/include/DXFeed.h +++ b/include/DXFeed.h @@ -98,11 +98,9 @@ #include "DXTypes.h" #include "EventData.h" -/* -------------------------------------------------------------------------- */ /* * DXFeed API function return value codes */ -/* -------------------------------------------------------------------------- */ /** * @ingroup functions-macros @@ -117,11 +115,9 @@ */ #define DXF_FAILURE 0 -/* -------------------------------------------------------------------------- */ /* * DXFeed API generic types */ -/* -------------------------------------------------------------------------- */ /** * @ingroup callback-types @@ -193,7 +189,6 @@ typedef int (*dxf_socket_thread_creation_notifier_t)(dxf_connection_t connection */ typedef void (*dxf_socket_thread_destruction_notifier_t)(dxf_connection_t connection, void* user_data); -/* -------------------------------------------------------------------------- */ /* * DXFeed C API functions @@ -201,7 +196,6 @@ typedef void (*dxf_socket_thread_destruction_notifier_t)(dxf_connection_t connec * has occurred. Use 'dxf_get_last_error' to retrieve the error code * and description. */ -/* -------------------------------------------------------------------------- */ /** * @ingroup c-api-connection-functions diff --git a/include/DXTypes.h b/include/DXTypes.h index d035c730..a55dc32e 100644 --- a/include/DXTypes.h +++ b/include/DXTypes.h @@ -76,6 +76,7 @@ typedef void* dxf_candle_attributes_t; /// Snapshot typedef void* dxf_snapshot_t; +typedef long long dxf_snapshot_v2_t; /// Price level book typedef void* dxf_price_level_book_t; diff --git a/include/EventData.h b/include/EventData.h index 4d8ba564..b284cf10 100644 --- a/include/EventData.h +++ b/include/EventData.h @@ -115,7 +115,6 @@ * @brief Event Subscription Stuff */ - #ifndef EVENT_DATA_H_INCLUDED #define EVENT_DATA_H_INCLUDED @@ -222,7 +221,8 @@ typedef enum dxf_order_action_t { * - \ref dxf_order_t.order_id - always present * - \ref dxf_order_t.aux_order_id - aggressor order ID, if available * - \ref dxf_order_t.trade_id - if available - * - \ref dxf_order_t.trade_size and \ref dxf_order_t.trade_price - contain size and price of this execution - always present + * - \ref dxf_order_t.trade_size and \ref dxf_order_t.trade_price - contain size and price of this execution - + * always present * * Integer value = 6 */ @@ -235,7 +235,8 @@ typedef enum dxf_order_action_t { * Full Order Book fields: * - \ref dxf_order_t.order_id - always empty * - \ref dxf_order_t.trade_id - if available - * - \ref dxf_order_t.trade_size and \ref dxf_order_t.trade_price - contain size and price of this trade - always present + * - \ref dxf_order_t.trade_size and \ref dxf_order_t.trade_price - contain size and price of this trade - always + * present * * Integer value = 7 */ @@ -306,15 +307,17 @@ typedef struct dxf_order_t { /// Microseconds and nanoseconds part of time of this order. dxf_int_t time_nanos; - /// Order action if available, otherwise - dxf_oa_undefined. This field is a part of the FOB ("Full Order Book") support. + /// Order action if available, otherwise - dxf_oa_undefined. This field is a part of the FOB ("Full Order Book") + /// support. dxf_order_action_t action; - /// Time of the last \ref dxf_order.action if available, otherwise - 0. This field is a part of the FOB ("Full Order Book") support. + /// Time of the last \ref dxf_order.action if available, otherwise - 0. This field is a part of the FOB ("Full Order + /// Book") support. dxf_long_t action_time; /** - * Contains order ID if available, otherwise - 0. Some actions dxf_oa_trade, dxf_oa_bust have no order since they are not related - * to any order in Order book. + * Contains order ID if available, otherwise - 0. Some actions dxf_oa_trade, dxf_oa_bust have no order since they + * are not related to any order in Order book. * * This field is a part of the FOB ("Full Order Book") support. */ @@ -437,8 +440,8 @@ typedef struct dxf_trade_t { * Value equals price minus dxf_summary_t#prev_day_close_price */ dxf_double_t change; - /// Identifier of the day that this `trade` or `trade_eth` represents. Identifier of the day is the number of days passed since - /// January 1, 1970. + /// Identifier of the day that this `trade` or `trade_eth` represents. Identifier of the day is the number of days + /// passed since January 1, 1970. dxf_dayid_t day_id; /// Total volume traded for a day dxf_double_t day_volume; @@ -446,10 +449,10 @@ typedef struct dxf_trade_t { dxf_double_t day_turnover; /** * This field contains several individual flags encoded as an integer number the following way: - * - * - * - *
31...43210
DirectionETH
+ * + * + * + *
31...43210
DirectionETH
* * 1. Tick Direction (#dxf_direction_t) * 2. ETH (extendedTradingHours) - flag that determines current trading session: extended or regular (0 - regular @@ -564,10 +567,10 @@ typedef struct dxf_summary { dxf_double_t open_interest; /** * This field contains several individual flags encoded as an integer number the following way: - * - * - * - *
31...43210
ClosePrevClose
+ * + * + * + *
31...43210
ClosePrevClose
* * 1. Close (dayClosePriceType) - parameter that shows if the closing price is final #dxf_price_type_t * 2. PrevClose (prevDayClosePriceType) - parameter that shows if the closing price of the previous day is final @@ -622,9 +625,11 @@ typedef enum dxf_short_sale_restriction { * information that is available about the traded security on the market at any given moment of time. */ typedef struct dxf_profile { - /// The correlation coefficient of the instrument to the S&P500 index (calculated, or received from other data providers) + /// The correlation coefficient of the instrument to the S&P500 index (calculated, or received from other data + /// providers) dxf_double_t beta; - /// Earnings per share (the company’s profits divided by the number of shares). The value comes directly from the annual quarterly accounting reports of companies. Available generally for stocks + /// Earnings per share (the company’s profits divided by the number of shares). The value comes directly from the + /// annual quarterly accounting reports of companies. Available generally for stocks dxf_double_t eps; /// Frequency of cash dividends payments per year (calculated) dxf_double_t div_freq; @@ -705,14 +710,16 @@ typedef struct dxf_time_and_sale { dxf_double_t bid_price; /// The current ask price on the market when this time and sale event had occurred dxf_double_t ask_price; - /// Sale conditions provided for this event by data feed. [TimeAndSale Sale Conditions](https://kb.dxfeed.com/display/DS/TimeAndSale+Sale+Conditions) + /// Sale conditions provided for this event by data feed. [TimeAndSale Sale + /// Conditions](https://kb.dxfeed.com/display/DS/TimeAndSale+Sale+Conditions) dxf_const_string_t exchange_sale_conditions; /** * This field contains several individual flags encoded as an integer number the following way: - * - * - * - *
31...1615...876543210
TTESideSLETHVTType
+ * + * + * + *
31...1615...876543210
TTESideSLETHVTType
* * 1. TradeThroughExempt (TTE) - is a transaction concluded by exempting from compliance with some rule. The value * is encoded by the letter. @@ -940,20 +947,18 @@ typedef struct dxf_configuration { * @{ */ -/* -------------------------------------------------------------------------- */ /* * Event candle attributes */ -/* -------------------------------------------------------------------------- */ /// Composite "exchange code" of a candle, i.e. empty string #define DXF_CANDLE_EXCHANGE_CODE_COMPOSITE_ATTRIBUTE L'\0' /// Default exchange code of a candle, i.e. empty string -#define DXF_CANDLE_EXCHANGE_CODE_ATTRIBUTE_DEFAULT DXF_CANDLE_EXCHANGE_CODE_COMPOSITE_ATTRIBUTE +#define DXF_CANDLE_EXCHANGE_CODE_ATTRIBUTE_DEFAULT DXF_CANDLE_EXCHANGE_CODE_COMPOSITE_ATTRIBUTE /// Default period attribute value of a candle (1.0) -#define DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT 1.0 +#define DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT 1.0 /// Default price level attribute value of a candle (NaN) -#define DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT (NAN) +#define DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT (NAN) /// Candle price attribute. Defines price that is used to build the candles. `price=` typedef enum dxf_candle_price_attribute { @@ -1021,7 +1026,7 @@ typedef enum dxf_candle_type_period_attribute { * * `=p` */ - dxf_ctpa_price, + dxf_ctpa_price, /** * Certain price change, calculated according to the following rules: @@ -1074,23 +1079,25 @@ typedef enum dxf_candle_alignment_attribute { * @{ */ -/* -------------------------------------------------------------------------- */ // Event subscription stuff -/* -------------------------------------------------------------------------- */ -/// Event flag. [EventFlags description](https://kb.dxfeed.com/display/DS/QD+Model+of+Market+Events#QDModelofMarketEvents-EventFlagsfield) +/// Event flag. [EventFlags +/// description](https://kb.dxfeed.com/display/DS/QD+Model+of+Market+Events#QDModelofMarketEvents-EventFlagsfield) typedef enum dxf_event_flag_t { - /// (0x01) TX_PENDING indicates a pending transactional update. When TX_PENDING is 1, it means that an ongoing transaction + /// (0x01) TX_PENDING indicates a pending transactional update. When TX_PENDING is 1, it means that an ongoing + /// transaction /// update, that spans multiple events, is in process dxf_ef_tx_pending = 0x01, /// (0x02) REMOVE_EVENT indicates that the event with the corresponding index has to be removed dxf_ef_remove_event = 0x02, - /// (0x04) SNAPSHOT_BEGIN indicates when the loading of a snapshot starts. Snapshot load starts on new subscription and + /// (0x04) SNAPSHOT_BEGIN indicates when the loading of a snapshot starts. Snapshot load starts on new subscription + /// and /// the first indexed event that arrives for each exchange code (in the case of a regional record) on a new /// subscription may have SNAPSHOT_BEGIN set to true. It means that an ongoing snapshot consisting of multiple /// events is incoming dxf_ef_snapshot_begin = 0x04, - /// (0x08) SNAPSHOT_END or (0x10) SNAPSHOT_SNIP indicates the end of a snapshot. The difference between SNAPSHOT_END and + /// (0x08) SNAPSHOT_END or (0x10) SNAPSHOT_SNIP indicates the end of a snapshot. The difference between SNAPSHOT_END + /// and /// SNAPSHOT_SNIP is the following: SNAPSHOT_END indicates that the data source sent all the data pertaining to /// the subscription for the corresponding indexed event, while SNAPSHOT_SNIP indicates that some limit on the /// amount of data was reached and while there still might be more data available, it will not be provided @@ -1115,22 +1122,22 @@ typedef struct dxf_event_params { dxf_ulong_t snapshot_key; } dxf_event_params_t; -/* -------------------------------------------------------------------------- */ /* * Event listener prototype * event type here is a one-bit mask, not an integer * from dx_eid_begin to dx_eid_count */ -/* -------------------------------------------------------------------------- */ /** * Event listener prototype * * Parameters: - * - event_type - Event type bit mask constructed from dx_event_id_t enum fields. See macro: \ref DXF_ET_TRADE, \ref DXF_ET_QUOTE ... \ref DXF_ET_CONFIGURATION + * - event_type - Event type bit mask constructed from dx_event_id_t enum fields. See macro: \ref DXF_ET_TRADE, \ref + * DXF_ET_QUOTE ... \ref DXF_ET_CONFIGURATION * - symbol_name - Event symbol (AAPL, IBM, etc) - * - data - Pointer to event data (should be casted to some specific event data structure, i.e. dxf_order_t, dxf_trade_t ...) + * - data - Pointer to event data (should be casted to some specific event data structure, i.e. dxf_order_t, dxf_trade_t + * ...) * - data_count **[deprecated]** - The number of events. Always equals to 1. **[Will be removed in 8.0.0 version]** * - user_data - The user data passed to \ref dxf_attach_event_listener * @@ -1175,9 +1182,11 @@ typedef void (*dxf_event_listener_t)(int event_type, dxf_const_string_t symbol_n * Event listener prototype v. 2 * * Parameters: - * - event_type - Event type bit mask constructed from dx_event_id_t enum fields. See macro: \ref DXF_ET_TRADE, \ref DXF_ET_QUOTE ... \ref DXF_ET_CONFIGURATION + * - event_type - Event type bit mask constructed from dx_event_id_t enum fields. See macro: \ref DXF_ET_TRADE, \ref + * DXF_ET_QUOTE ... \ref DXF_ET_CONFIGURATION * - symbol_name - Event symbol (AAPL, IBM, etc) - * - data - Pointer to event data (should be casted to some specific event data structure, i.e. dxf_order_t, dxf_trade_t ...) + * - data - Pointer to event data (should be casted to some specific event data structure, i.e. dxf_order_t, dxf_trade_t + * ...) * - data_count **[deprecated]** - The number of events. Always equals to 1. **[Will be removed in 8.0.0 version]** * - event_params - Some event parameters: event flags, snapshot key and time stored in 4 high or low bytes * - user_data - The user data passed to \ref dxf_attach_event_listener_v2 @@ -1369,11 +1378,9 @@ size_t dx_get_event_subscription_params(dxf_connection_t connection, dx_order_so dx_event_id_t event_id, dx_event_subscr_flag subscr_flags, OUT dx_event_subscription_param_list_t* params); -/* -------------------------------------------------------------------------- */ /* * Snapshot data structs */ -/* -------------------------------------------------------------------------- */ /// Snapshot typedef struct dxf_snapshot_data { @@ -1384,7 +1391,18 @@ typedef struct dxf_snapshot_data { const dxf_event_data_t* records; } dxf_snapshot_data_t, *dxf_snapshot_data_ptr_t; -/* -------------------------------------------------------------------------- */ +typedef struct dxf_snapshot_data_v2 { + int event_type; + dxf_const_string_t symbol; + dxf_const_string_t source; + dxf_long_t from_time; + + size_t records_count; + const dxf_event_data_t* records; +} dxf_snapshot_data_v2_t, *dxf_snapshot_data_v2_ptr_t; + +typedef const dxf_snapshot_data_v2_t* dxf_const_snapshot_data_v2_ptr_t; + /** * @ingroup c-api-snapshots * @@ -1393,13 +1411,19 @@ typedef struct dxf_snapshot_data { * @param[in] snapshot_data Pointer to the received snapshot data * @param[in] user_data Pointer to user struct, use NULL by default */ -/* -------------------------------------------------------------------------- */ typedef void (*dxf_snapshot_listener_t)(const dxf_snapshot_data_ptr_t snapshot_data, void* user_data); -/* -------------------------------------------------------------------------- */ -#define DXF_IS_CANDLE_REMOVAL(c) (((c)->event_flags & dxf_ef_remove_event) != 0) -#define DXF_IS_ORDER_REMOVAL(o) ((((o)->event_flags & dxf_ef_remove_event) != 0) || ((o)->size == 0) || (isnan((o)->size))) -#define DXF_IS_SPREAD_ORDER_REMOVAL(o) ((((o)->event_flags & dxf_ef_remove_event) != 0) || ((o)->size == 0) || (isnan((o)->size))) +typedef void (*dxf_snapshot_listener_v2_t)(dxf_const_snapshot_data_v2_ptr_t snapshot_data, void* user_data); + +typedef void (*dxf_snapshot_inc_listener_v2_t)(dxf_const_snapshot_data_v2_ptr_t removals, + dxf_const_snapshot_data_v2_ptr_t additions, + dxf_const_snapshot_data_v2_ptr_t updates, void* user_data); + +#define DXF_IS_CANDLE_REMOVAL(c) (((c)->event_flags & dxf_ef_remove_event) != 0) +#define DXF_IS_ORDER_REMOVAL(o) \ + ((((o)->event_flags & dxf_ef_remove_event) != 0) || ((o)->size == 0) || (isnan((o)->size))) +#define DXF_IS_SPREAD_ORDER_REMOVAL(o) \ + ((((o)->event_flags & dxf_ef_remove_event) != 0) || ((o)->size == 0) || (isnan((o)->size))) #define DXF_IS_TIME_AND_SALE_REMOVAL(t) (((t)->event_flags & dxf_ef_remove_event) != 0) #define DXF_IS_GREEKS_REMOVAL(g) (((g)->event_flags & dxf_ef_remove_event) != 0) #define DXF_IS_SERIES_REMOVAL(s) (((s)->event_flags & dxf_ef_remove_event) != 0) @@ -1413,11 +1437,9 @@ typedef void (*dxf_snapshot_listener_t)(const dxf_snapshot_data_ptr_t snapshot_d typedef void (*dxf_snapshot_inc_listener_t)(const dxf_snapshot_data_ptr_t snapshot_data, int new_snapshot, void* user_data); -/* -------------------------------------------------------------------------- */ /* * Price Level data structs */ -/* -------------------------------------------------------------------------- */ /// Price level element typedef struct dxf_price_level_element { dxf_double_t price; @@ -1486,9 +1508,7 @@ typedef void (*dxf_price_level_book_inc_listener_t)(dxf_price_level_book_const_d typedef void (*dxf_regional_quote_listener_t)(dxf_const_string_t symbol, const dxf_quote_t* quotes, int count, void* user_data); -/* -------------------------------------------------------------------------- */ // Event data navigation functions -/* -------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" @@ -1506,9 +1526,7 @@ extern "C" dxf_const_event_data_t dx_get_event_data_item(int event_mask, dxf_const_event_data_t data, size_t index); -/* -------------------------------------------------------------------------- */ // Various event functions -/* -------------------------------------------------------------------------- */ /** * @ingroup c-api-event-listener-functions diff --git a/include/RecordData.h b/include/RecordData.h index ed8afc7e..6f02cb9e 100644 --- a/include/RecordData.h +++ b/include/RecordData.h @@ -31,11 +31,9 @@ * @brief dxFeed C API domain types declarations */ -/* -------------------------------------------------------------------------- */ /* * Record type constants */ -/* -------------------------------------------------------------------------- */ /// Record info ID typedef enum { @@ -68,11 +66,9 @@ typedef dxf_int_t dx_record_id_t; /* Invalid or empty record id */ static const dx_record_id_t DX_RECORD_ID_INVALID = -1; -/* -------------------------------------------------------------------------- */ /* * Record structures */ -/* -------------------------------------------------------------------------- */ /// Trade typedef struct dx_trade { diff --git a/samples/CandleSample/CandleSample.c b/samples/CandleSample/CandleSample.c index bf8c97ed..ecf87208 100644 --- a/samples/CandleSample/CandleSample.c +++ b/samples/CandleSample/CandleSample.c @@ -18,10 +18,14 @@ */ #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #else # include # include @@ -37,7 +41,7 @@ #include "DXErrorCodes.h" #include "DXFeed.h" -#define true 1 +#define true 1 #define false 0 // plus the name of the executable @@ -52,7 +56,6 @@ int _CRT_glob = 0; #endif -/* -------------------------------------------------------------------------- */ #ifdef _WIN32 static int is_listener_thread_terminated = false; CRITICAL_SECTION listener_thread_guard; @@ -74,8 +77,6 @@ int is_thread_terminate() { } #endif -/* -------------------------------------------------------------------------- */ - #ifdef _WIN32 void on_reader_thread_terminate(dxf_connection_t connection, void* user_data) { EnterCriticalSection(&listener_thread_guard); @@ -101,8 +102,6 @@ void print_timestamp(dxf_long_t timestamp) { wprintf(L"%ls", timefmt); } -/* -------------------------------------------------------------------------- */ - void listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { dxf_int_t i = 0; @@ -124,7 +123,6 @@ void listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_da candles[i].open_interest); } } -/* -------------------------------------------------------------------------- */ void process_last_error() { int error_code = dx_ec_success; @@ -149,7 +147,6 @@ void process_last_error() { wprintf(L"An error occurred but the error subsystem failed to initialize\n"); } -/* -------------------------------------------------------------------------- */ dxf_string_t ansi_to_unicode(const char* ansi_str) { #ifdef _WIN32 size_t len = strlen(ansi_str); diff --git a/samples/CommandLineSample/CommandLineSample.c b/samples/CommandLineSample/CommandLineSample.c index 5397861a..04dab912 100644 --- a/samples/CommandLineSample/CommandLineSample.c +++ b/samples/CommandLineSample/CommandLineSample.c @@ -24,10 +24,14 @@ #endif #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #else # include # include @@ -83,23 +87,17 @@ int dxs_mutex_create(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_destroy(dxs_mutex_t* mutex) { DeleteCriticalSection(*mutex); free(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_lock(dxs_mutex_t* mutex) { EnterCriticalSection(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_unlock(dxs_mutex_t* mutex) { LeaveCriticalSection(*mutex); return true; @@ -130,8 +128,6 @@ int dxs_mutex_create(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_destroy(dxs_mutex_t* mutex) { if (pthread_mutex_destroy(&mutex->mutex) != 0) { return false; @@ -144,8 +140,6 @@ int dxs_mutex_destroy(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_lock(dxs_mutex_t* mutex) { if (pthread_mutex_lock(&mutex->mutex) != 0) { return false; @@ -154,8 +148,6 @@ int dxs_mutex_lock(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_unlock(dxs_mutex_t* mutex) { if (pthread_mutex_unlock(&mutex->mutex) != 0) { return false; @@ -178,7 +170,7 @@ int dxs_mutex_unlock(dxs_mutex_t* mutex) { #define LOG_DATA_TRANSFER_TAG "-p" #define TIMEOUT_TAG "-o" #define LOG_HEARTBEAT_TAG "-b" -#define RECONNECT_TAG "-r" +#define RECONNECT_TAG "-r" // Prevents file names globbing (converting * to all files in the current dir) #ifdef __MINGW64_VERSION_MAJOR @@ -264,7 +256,6 @@ void print_timestamp(dxf_long_t timestamp) { wcsftime(timefmt, 80, L"%Y%m%d-%H%M%S", timeinfo); wprintf(L"%ls", timefmt); } -/* -------------------------------------------------------------------------- */ void listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { @@ -419,7 +410,6 @@ void listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_da wprintf(L"object=%ls}\n", cnf->object); } } -/* -------------------------------------------------------------------------- */ dxf_string_t ansi_to_unicode(const char* ansi_str, size_t len) { #ifdef _WIN32 @@ -447,8 +437,6 @@ dxf_string_t ansi_to_unicode(const char* ansi_str, size_t len) { #endif /* _WIN32 */ } -/* -------------------------------------------------------------------------- */ - typedef struct { int type; const char* name; @@ -620,8 +608,6 @@ void on_server_heartbeat_notifier(dxf_connection_t connection, dxf_long_t server server_millis, server_lag_mark, connection_rtt); } -/* -------------------------------------------------------------------------- */ - int main(int argc, char* argv[]) { dxf_connection_t connection; dxf_subscription_t subscription; @@ -637,8 +623,8 @@ int main(int argc, char* argv[]) { "[" DUMP_PARAM_LONG_TAG " | " DUMP_PARAM_SHORT_TAG " ] [" TOKEN_PARAM_SHORT_TAG " ] " "[" SUBSCRIPTION_DATA_PARAM_TAG " ] [" LOG_DATA_TRANSFER_TAG "] [" TIMEOUT_TAG - " ] [" LOG_HEARTBEAT_TAG - "] [" RECONNECT_TAG "]\n" + " ] [" LOG_HEARTBEAT_TAG "] [" RECONNECT_TAG + "]\n" " - The DXFeed server address, e.g. demo.dxfeed.com:7300\n" " If you want to use file instead of server data just\n" " write there path to file e.g. path\\to\\raw.bin\n" @@ -748,7 +734,7 @@ int main(int argc, char* argv[]) { } dxf_initialize_logger_v2("command-line-api.log", true, true, true, log_data_transfer_flag); - //dxf_load_config_from_string("network.heartbeatTimeout = 11\n"); + // dxf_load_config_from_string("network.heartbeatTimeout = 11\n"); wprintf(L"Command line sample started.\n"); wprintf(L"Connecting to host %hs...\n", dxfeed_host); diff --git a/samples/FullOrderBookSample/FullOrderBookSample.c b/samples/FullOrderBookSample/FullOrderBookSample.c index 182e5345..de13a22c 100644 --- a/samples/FullOrderBookSample/FullOrderBookSample.c +++ b/samples/FullOrderBookSample/FullOrderBookSample.c @@ -18,10 +18,14 @@ */ #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #else # include @@ -65,7 +69,7 @@ typedef LPCRITICAL_SECTION dxs_mutex_t; #define LS2(s) L##s #ifndef true -# define true 1 +# define true 1 # define false 0 #endif @@ -81,23 +85,17 @@ int dxs_mutex_create(dxs_mutex_t *mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_destroy(dxs_mutex_t *mutex) { DeleteCriticalSection(*mutex); free(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_lock(dxs_mutex_t *mutex) { EnterCriticalSection(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_unlock(dxs_mutex_t *mutex) { LeaveCriticalSection(*mutex); return true; @@ -128,8 +126,6 @@ int dxs_mutex_create(dxs_mutex_t *mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_destroy(dxs_mutex_t *mutex) { if (pthread_mutex_destroy(&mutex->mutex) != 0) { return false; @@ -142,8 +138,6 @@ int dxs_mutex_destroy(dxs_mutex_t *mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_lock(dxs_mutex_t *mutex) { if (pthread_mutex_lock(&mutex->mutex) != 0) { return false; @@ -152,8 +146,6 @@ int dxs_mutex_lock(dxs_mutex_t *mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_unlock(dxs_mutex_t *mutex) { if (pthread_mutex_unlock(&mutex->mutex) != 0) { return false; @@ -209,8 +201,6 @@ void print_timestamp(dxf_long_t timestamp) { wprintf(L"%ls", timefmt); } -/* -------------------------------------------------------------------------- */ - void process_last_error() { int error_code = dx_ec_success; dxf_const_string_t error_descr = NULL; @@ -234,8 +224,6 @@ void process_last_error() { wprintf(L"An error occurred but the error subsystem failed to initialize\n"); } -/* -------------------------------------------------------------------------- */ - dxf_string_t ansi_to_unicode(const char *ansi_str) { #ifdef _WIN32 size_t len = strlen(ansi_str); @@ -263,8 +251,6 @@ dxf_string_t ansi_to_unicode(const char *ansi_str) { #endif /* _WIN32 */ } -/* -------------------------------------------------------------------------- */ - void listener(const dxf_snapshot_data_ptr_t snapshot_data, void *user_data) { size_t i; size_t records_count = snapshot_data->records_count; @@ -279,10 +265,10 @@ void listener(const dxf_snapshot_data_ptr_t snapshot_data, void *user_data) { dxf_order_t *order_records = (dxf_order_t *)snapshot_data->records; - for (i = 0; i < records_count; ++i) { + for (i = 0; i < (size_t)records_count; ++i) { dxf_order_t order = order_records[i]; - if (records_print_limit > 0 && i >= records_print_limit) { + if (records_print_limit > 0 && i >= (size_t)records_print_limit) { wprintf(L" { ... %zu records left ...}\n", records_count - i); break; } @@ -327,8 +313,6 @@ void listener(const dxf_snapshot_data_ptr_t snapshot_data, void *user_data) { } } -/* -------------------------------------------------------------------------- */ - int atoi2(char *str, int *result) { if (str == NULL || str[0] == '\0' || result == NULL) { return false; @@ -351,8 +335,6 @@ int atoi2(char *str, int *result) { return true; } -/* -------------------------------------------------------------------------- */ - int main(int argc, char *argv[]) { if (argc < STATIC_PARAMS_COUNT) { printf("DXFeed command line sample.\n" diff --git a/samples/IncSnapshotConsoleSample/IncSnapshotConsoleSample.c b/samples/IncSnapshotConsoleSample/IncSnapshotConsoleSample.c index 55aa9aa9..8faad9e4 100644 --- a/samples/IncSnapshotConsoleSample/IncSnapshotConsoleSample.c +++ b/samples/IncSnapshotConsoleSample/IncSnapshotConsoleSample.c @@ -18,10 +18,14 @@ */ #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #else # include # include @@ -46,7 +50,7 @@ #ifndef true -# define true 1 +# define true 1 # define false 0 #endif @@ -64,7 +68,6 @@ int _CRT_glob = 0; #endif -/* -------------------------------------------------------------------------- */ #ifdef _WIN32 static int is_listener_thread_terminated = false; CRITICAL_SECTION listener_thread_guard; @@ -86,8 +89,6 @@ int is_thread_terminate() { } #endif -/* -------------------------------------------------------------------------- */ - #ifdef _WIN32 void on_reader_thread_terminate(dxf_connection_t connection, void* user_data) { EnterCriticalSection(&listener_thread_guard); @@ -113,8 +114,6 @@ void print_timestamp(dxf_long_t timestamp) { wprintf(L"%ls", timefmt); } -/* -------------------------------------------------------------------------- */ - void process_last_error() { int error_code = dx_ec_success; dxf_const_string_t error_descr = NULL; @@ -138,8 +137,6 @@ void process_last_error() { wprintf(L"An error occurred but the error subsystem failed to initialize\n"); } -/* -------------------------------------------------------------------------- */ - dxf_string_t ansi_to_unicode(const char* ansi_str) { #ifdef _WIN32 size_t len = strlen(ansi_str); @@ -167,8 +164,6 @@ dxf_string_t ansi_to_unicode(const char* ansi_str) { #endif /* _WIN32 */ } -/* -------------------------------------------------------------------------- */ - void listener(const dxf_snapshot_data_ptr_t snapshot_data, int new_snapshot, void* user_data) { size_t i; size_t records_count = snapshot_data->records_count; @@ -187,7 +182,7 @@ void listener(const dxf_snapshot_data_ptr_t snapshot_data, int new_snapshot, voi for (i = 0; i < records_count; ++i) { dxf_order_t order = order_records[i]; - if (records_print_limit > 0 && i >= records_print_limit) { + if (records_print_limit > 0 && i >= (size_t)records_print_limit) { wprintf(L" { ... %zu records left ...}\n", records_count - i); break; } @@ -208,7 +203,7 @@ void listener(const dxf_snapshot_data_ptr_t snapshot_data, int new_snapshot, voi for (i = 0; i < snapshot_data->records_count; ++i) { dxf_candle_t candle = candle_records[i]; - if (records_print_limit > 0 && i >= records_print_limit) { + if (records_print_limit > 0 && i >= (size_t)records_print_limit) { wprintf(L" { ... %zu records left ...}\n", records_count - i); break; } @@ -232,7 +227,7 @@ void listener(const dxf_snapshot_data_ptr_t snapshot_data, int new_snapshot, voi for (i = 0; i < records_count; ++i) { dxf_order_t order = order_records[i]; - if (records_print_limit > 0 && i >= records_print_limit) { + if (records_print_limit > 0 && i >= (size_t)records_print_limit) { wprintf(L" { ... %zu records left ...}\n", records_count - i); break; } @@ -255,7 +250,7 @@ void listener(const dxf_snapshot_data_ptr_t snapshot_data, int new_snapshot, voi for (i = 0; i < snapshot_data->records_count; ++i) { dxf_time_and_sale_t tns = time_and_sale_records[i]; - if (records_print_limit > 0 && i >= records_print_limit) { + if (records_print_limit > 0 && i >= (size_t)records_print_limit) { wprintf(L" { ... %zu records left ...}\n", records_count - i); break; } @@ -279,7 +274,7 @@ void listener(const dxf_snapshot_data_ptr_t snapshot_data, int new_snapshot, voi for (i = 0; i < snapshot_data->records_count; ++i) { dxf_greeks_t grks = greeks_records[i]; - if (records_print_limit > 0 && i >= records_print_limit) { + if (records_print_limit > 0 && i >= (size_t)records_print_limit) { wprintf(L" { ... %zu records left ...}\n", records_count - i); break; } @@ -302,7 +297,7 @@ void listener(const dxf_snapshot_data_ptr_t snapshot_data, int new_snapshot, voi for (i = 0; i < snapshot_data->records_count; ++i) { dxf_series_t srs = series_records[i]; - if (records_print_limit > 0 && i >= records_print_limit) { + if (records_print_limit > 0 && i >= (size_t)records_print_limit) { wprintf(L" { ... %zu records left ...}\n", records_count - i); break; } @@ -340,8 +335,6 @@ int atoi2(char* str, int* result) { return true; } -/* -------------------------------------------------------------------------- */ - int main(int argc, char* argv[]) { dxf_connection_t connection; dxf_snapshot_t snapshot; diff --git a/samples/PriceLevelBookSample/PriceLevelBookSample.c b/samples/PriceLevelBookSample/PriceLevelBookSample.c index cfa4ce12..c03e8e15 100644 --- a/samples/PriceLevelBookSample/PriceLevelBookSample.c +++ b/samples/PriceLevelBookSample/PriceLevelBookSample.c @@ -18,10 +18,14 @@ */ #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #else # include # include @@ -55,7 +59,6 @@ int _CRT_glob = 0; #endif -/* -------------------------------------------------------------------------- */ #ifdef _WIN32 static int is_listener_thread_terminated = false; CRITICAL_SECTION listener_thread_guard; @@ -77,8 +80,6 @@ int is_thread_terminate() { } #endif -/* -------------------------------------------------------------------------- */ - #ifdef _WIN32 void on_reader_thread_terminate(dxf_connection_t connection, void* user_data) { EnterCriticalSection(&listener_thread_guard); @@ -104,8 +105,6 @@ void print_timestamp(dxf_long_t timestamp) { wprintf(L"%ls", timefmt); } -/* -------------------------------------------------------------------------- */ - void process_last_error() { int error_code = dx_ec_success; dxf_const_string_t error_descr = NULL; @@ -129,8 +128,6 @@ void process_last_error() { wprintf(L"An error occurred but the error subsystem failed to initialize\n"); } -/* -------------------------------------------------------------------------- */ - dxf_string_t ansi_to_unicode(const char* ansi_str) { #ifdef _WIN32 size_t len = strlen(ansi_str); @@ -158,8 +155,6 @@ dxf_string_t ansi_to_unicode(const char* ansi_str) { #endif /* _WIN32 */ } -/* -------------------------------------------------------------------------- */ - void listener(const dxf_price_level_book_data_ptr_t book_data, void* user_data) { size_t i = 0; wprintf(L"New Price Level Order Book for %ls:\n", book_data->symbol); @@ -203,12 +198,8 @@ int atoi2(char* str, int* result) { return true; } -/* -------------------------------------------------------------------------- */ - static const char* default_sources[] = {"BZX", "DEX", NULL}; -/* -------------------------------------------------------------------------- */ - int main(int argc, char* argv[]) { dxf_connection_t connection; dxf_price_level_book_t book; diff --git a/samples/PriceLevelBookSample2/PriceLevelBookSample2.c b/samples/PriceLevelBookSample2/PriceLevelBookSample2.c index f39f5922..b52de33f 100644 --- a/samples/PriceLevelBookSample2/PriceLevelBookSample2.c +++ b/samples/PriceLevelBookSample2/PriceLevelBookSample2.c @@ -18,10 +18,14 @@ */ #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #else # include # include @@ -55,7 +59,6 @@ int _CRT_glob = 0; #endif -/* -------------------------------------------------------------------------- */ #ifdef _WIN32 static int is_listener_thread_terminated = false; CRITICAL_SECTION listener_thread_guard; @@ -77,8 +80,6 @@ int is_thread_terminate() { } #endif -/* -------------------------------------------------------------------------- */ - #ifdef _WIN32 void on_reader_thread_terminate(dxf_connection_t connection, void* user_data) { EnterCriticalSection(&listener_thread_guard); @@ -104,8 +105,6 @@ void print_timestamp(dxf_long_t timestamp) { wprintf(L"%ls", timefmt); } -/* -------------------------------------------------------------------------- */ - void process_last_error() { int error_code = dx_ec_success; dxf_const_string_t error_descr = NULL; @@ -129,8 +128,6 @@ void process_last_error() { wprintf(L"An error occurred but the error subsystem failed to initialize\n"); } -/* -------------------------------------------------------------------------- */ - dxf_string_t ansi_to_unicode(const char* ansi_str) { #ifdef _WIN32 size_t len = strlen(ansi_str); @@ -158,8 +155,6 @@ dxf_string_t ansi_to_unicode(const char* ansi_str) { #endif /* _WIN32 */ } -/* -------------------------------------------------------------------------- */ - void listener(const dxf_price_level_book_data_ptr_t book_data, void* user_data) { size_t i = 0; wprintf(L"\nNew Price Level Order Book for %ls#%hs:\n", book_data->symbol, user_data == NULL ? "" : (char*)user_data); @@ -290,12 +285,8 @@ int atoi2(char* str, int* result) { return true; } -/* -------------------------------------------------------------------------- */ - static const char* default_source = "AGGREGATE_ASK"; -/* -------------------------------------------------------------------------- */ - int main(int argc, char* argv[]) { if (argc < STATIC_PARAMS_COUNT) { printf( diff --git a/samples/RegionalBookSample/RegionalBookSample.c b/samples/RegionalBookSample/RegionalBookSample.c index 3d52297c..cfde9d34 100644 --- a/samples/RegionalBookSample/RegionalBookSample.c +++ b/samples/RegionalBookSample/RegionalBookSample.c @@ -18,10 +18,14 @@ */ #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #else # include # include @@ -53,7 +57,6 @@ int _CRT_glob = 0; #endif -/* -------------------------------------------------------------------------- */ #ifdef _WIN32 static int is_listener_thread_terminated = false; CRITICAL_SECTION listener_thread_guard; @@ -75,8 +78,6 @@ int is_thread_terminate() { } #endif -/* -------------------------------------------------------------------------- */ - #ifdef _WIN32 void on_reader_thread_terminate(dxf_connection_t connection, void* user_data) { EnterCriticalSection(&listener_thread_guard); @@ -102,8 +103,6 @@ void print_timestamp(dxf_long_t timestamp) { wprintf(L"%ls", timefmt); } -/* -------------------------------------------------------------------------- */ - void process_last_error() { int error_code = dx_ec_success; dxf_const_string_t error_descr = NULL; @@ -127,8 +126,6 @@ void process_last_error() { wprintf(L"An error occurred but the error subsystem failed to initialize\n"); } -/* -------------------------------------------------------------------------- */ - dxf_string_t ansi_to_unicode(const char* ansi_str) { #ifdef _WIN32 size_t len = strlen(ansi_str); @@ -156,8 +153,6 @@ dxf_string_t ansi_to_unicode(const char* ansi_str) { #endif /* _WIN32 */ } -/* -------------------------------------------------------------------------- */ - void listener(const dxf_price_level_book_data_ptr_t book_data, void* user_data) { size_t i = 0; wprintf(L"\nNew Regional Order Book for %ls:\n", book_data->symbol); @@ -217,8 +212,6 @@ int atoi2(char* str, int* result) { return true; } -/* -------------------------------------------------------------------------- */ - int main(int argc, char* argv[]) { dxf_connection_t connection; dxf_regional_book_t book; diff --git a/samples/SnapshotConsoleSample/SnapshotConsoleSample.c b/samples/SnapshotConsoleSample/SnapshotConsoleSample.c index db5085bb..b01a4da2 100644 --- a/samples/SnapshotConsoleSample/SnapshotConsoleSample.c +++ b/samples/SnapshotConsoleSample/SnapshotConsoleSample.c @@ -55,10 +55,14 @@ typedef struct { pthread_mutexattr_t attr; } dxs_mutex_t; #else /* !defined(_WIN32) || defined(USE_PTHREADS) */ -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif # define USE_WIN32_THREADS typedef HANDLE dxs_thread_t; typedef DWORD dxs_key_t; @@ -216,8 +220,6 @@ typedef struct { dxf_snapshot_t snapshot; } listener_arg_t; -/* -------------------------------------------------------------------------- */ - void process_last_error() { int error_code = dx_ec_success; dxf_const_string_t error_descr = NULL; @@ -241,8 +243,6 @@ void process_last_error() { wprintf(L"An error occurred but the error subsystem failed to initialize\n"); } -/* -------------------------------------------------------------------------- */ - dxf_string_t ansi_to_unicode(const char *ansi_str) { #ifdef _WIN32 size_t len = strlen(ansi_str); @@ -270,8 +270,6 @@ dxf_string_t ansi_to_unicode(const char *ansi_str) { #endif /* _WIN32 */ } -/* -------------------------------------------------------------------------- */ - void print_order_snapshot(dxf_snapshot_data_ptr_t snapshot_data, dxf_int_t records_print_limit) { size_t i = 0; size_t records_count = snapshot_data->records_count; @@ -375,8 +373,8 @@ void print_greeks_snapshot(dxf_snapshot_data_ptr_t snapshot_data, dxf_int_t reco wprintf(L" { ... %zu records left ...}\n", records_count - i); break; } - - wprintf(L" {time="); + + wprintf(L" {time="); print_timestamp(grks.time); wprintf(L", index=0x%"LS(PRIX64)L", greeks price=%.15g, volatility=%.15g, " L"delta=%.15g, gamma=%.15g, theta=%.15g, rho=%.15g, vega=%.15g, flags=0x%X}\n", @@ -419,8 +417,8 @@ void listener(const dxf_snapshot_data_ptr_t snapshot_data, void *user_data) { records_print_limit = listener_args->records_print_limit; snapshot = listener_args->snapshot; } - - dxf_snapshot_data_t filtered_records = { + + dxf_snapshot_data_t filtered_records = { .event_type = snapshot_data->event_type, .symbol = snapshot_data->symbol, .records = NULL, @@ -490,8 +488,6 @@ void listener(const dxf_snapshot_data_ptr_t snapshot_data, void *user_data) { } } -/* -------------------------------------------------------------------------- */ - int atoi2(char *str, int *result) { if (str == NULL || str[0] == '\0' || result == NULL) { return false; @@ -568,7 +564,7 @@ int main(int argc, char *argv[]) { "of events and a full order book.\n" "-------------------------------------------------------------------------------\n" "Usage: SnapshotConsoleSample \n" - " [order_source] [" FROM_TIME_PARAM_SHORT_TAG " ] [" TO_TIME_PARAM_SHORT_TAG " ]" + " [order_source] [" FROM_TIME_PARAM_SHORT_TAG " ] [" TO_TIME_PARAM_SHORT_TAG " ]" " [" RECORDS_PRINT_LIMIT_SHORT_PARAM " ] [" TOKEN_PARAM_SHORT_TAG " ]\n" " [" LOG_DATA_TRANSFER_TAG "] [" TIMEOUT_TAG " ]\n\n" " - The dxFeed server address, e.g. demo.dxfeed.com:7300\n" @@ -579,7 +575,7 @@ int main(int argc, char *argv[]) { " BZX, DEA, ISE, DEX, IST, ...\n" " b) source for MarketMaker, one of following: AGGREGATE_BID\n" " or AGGREGATE_ASK\n" - " " FROM_TIME_PARAM_SHORT_TAG " - Time from which to receive data (default: current date and time)\n" + " " FROM_TIME_PARAM_SHORT_TAG " - Time from which to receive data (default: current date and time)\n" " " TO_TIME_PARAM_SHORT_TAG " - Time to which to receive data (default: infinity, exist only for CANDLE, TIME_AND_SALE and GREEKS)\n" " " RECORDS_PRINT_LIMIT_SHORT_PARAM " - The number of displayed records " "(0 - unlimited, default: " STRINGIFY(DEFAULT_RECORDS_PRINT_LIMIT)")\n" diff --git a/src/BufferedIOCommon.c b/src/BufferedIOCommon.c index 36b18b9a..69a01bc0 100644 --- a/src/BufferedIOCommon.c +++ b/src/BufferedIOCommon.c @@ -21,11 +21,9 @@ #include "DXErrorHandling.h" #include "DXMemory.h" -/* -------------------------------------------------------------------------- */ /* * Common Unicode data */ -/* -------------------------------------------------------------------------- */ /* * The minimum value of a Unicode high-surrogate code unit in the @@ -65,11 +63,9 @@ static const dxf_int_t MIN_SUPPLEMENTARY_CODE_POINT = 0x010000; */ static dxf_int_t MAX_CODE_POINT = 0x10ffff; -/* -------------------------------------------------------------------------- */ /* * Auxiliary Unicode functions */ -/* -------------------------------------------------------------------------- */ void dx_code_point_to_surrogates (dxf_int_t code_point, dxf_string_t dest_buffer, int dest_buffer_pos) { dxf_int_t offset = code_point - MIN_SUPPLEMENTARY_CODE_POINT; @@ -78,30 +74,22 @@ void dx_code_point_to_surrogates (dxf_int_t code_point, dxf_string_t dest_buffer dest_buffer[dest_buffer_pos] = (dxf_char_t)((offset >> 10) + MIN_HIGH_SURROGATE); } -/* -------------------------------------------------------------------------- */ /* * Common Unicode functions implementation */ -/* -------------------------------------------------------------------------- */ int dx_is_high_surrogate (dxf_char_t value) { return value >= MIN_HIGH_SURROGATE && value <= MAX_HIGH_SURROGATE; } -/* -------------------------------------------------------------------------- */ - int dx_is_low_surrogate (dxf_char_t value) { return value >= MIN_LOW_SURROGATE && value <= MAX_LOW_SURROGATE; } -/* -------------------------------------------------------------------------- */ - dxf_int_t dx_surrogates_to_code_point (dxf_char_t high, dxf_char_t low) { return ((high - MIN_HIGH_SURROGATE) << 10) + (low - MIN_LOW_SURROGATE) + MIN_SUPPLEMENTARY_CODE_POINT; } -/* -------------------------------------------------------------------------- */ - int dx_code_point_to_utf16_chars (dxf_int_t code_point, dxf_string_t dest_buffer, int dest_buffer_pos, int dest_buffer_length, OUT int* result) { if (code_point < 0 || code_point > MAX_CODE_POINT || dest_buffer == NULL || result == NULL) { return dx_set_error_code(dx_ec_invalid_func_param_internal); @@ -128,11 +116,9 @@ int dx_code_point_to_utf16_chars (dxf_int_t code_point, dxf_string_t dest_buffer return true; } -/* -------------------------------------------------------------------------- */ /* * Common compact API functions implementation */ -/* -------------------------------------------------------------------------- */ int dx_get_compact_size (dxf_long_t value) { if (value >= 0) { diff --git a/src/BufferedIOCommon.h b/src/BufferedIOCommon.h index 35f843cd..9fc0678b 100644 --- a/src/BufferedIOCommon.h +++ b/src/BufferedIOCommon.h @@ -23,11 +23,9 @@ #include "PrimitiveTypes.h" #include "DXTypes.h" -/* -------------------------------------------------------------------------- */ /* * Common Unicode functions */ -/* -------------------------------------------------------------------------- */ /* * Determines if the given dx_char_t value is a @@ -102,11 +100,9 @@ dxf_int_t dx_surrogates_to_code_point (dxf_char_t high, dxf_char_t low); */ int dx_code_point_to_utf16_chars (dxf_int_t code_point, dxf_string_t dest_buffer, int dest_buffer_pos, int dest_buffer_length, OUT int* result); -/* -------------------------------------------------------------------------- */ /* * Common compact API functions */ -/* -------------------------------------------------------------------------- */ /* * Returns number of bytes that are needed to write specified number in a compact format. diff --git a/src/BufferedInput.c b/src/BufferedInput.c index 62fc0ecf..419583e1 100644 --- a/src/BufferedInput.c +++ b/src/BufferedInput.c @@ -17,21 +17,20 @@ * */ -#include +#include "BufferedInput.h" -#include "DXFeed.h" +#include +#include -#include "BufferedInput.h" +#include "ConnectionContextData.h" +#include "DXAlgorithms.h" #include "DXErrorHandling.h" +#include "DXFeed.h" #include "DXMemory.h" -#include "DXAlgorithms.h" -#include "ConnectionContextData.h" -/* -------------------------------------------------------------------------- */ /* * Buffered input connection context */ -/* -------------------------------------------------------------------------- */ typedef struct dx_buffered_input_connection_context_t { dxf_byte_t* in_buffer; @@ -40,14 +39,11 @@ typedef struct dx_buffered_input_connection_context_t { int current_in_buffer_position; } dx_buffered_input_connection_context_t; -#define CTX(context) \ - ((dx_buffered_input_connection_context_t*)context) +#define CTX(context) ((dx_buffered_input_connection_context_t*)(context)) #define IS_BUF_CAPACITY_ENOUGH(context, bytes_to_read) \ (CTX(context)->current_in_buffer_position + bytes_to_read <= CTX(context)->in_buffer_length) -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_buffered_input) { dx_buffered_input_connection_context_t* context = dx_calloc(1, sizeof(dx_buffered_input_connection_context_t)); @@ -64,8 +60,6 @@ DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_buffered_input) { return true; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_buffered_input) { int res = true; dx_buffered_input_connection_context_t* context = dx_get_subsystem_data(connection, dx_ccs_buffered_input, &res); @@ -79,87 +73,54 @@ DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_buffered_input) { return true; } -/* -------------------------------------------------------------------------- */ +DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_buffered_input) { return true; } -DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_buffered_input) { - return true; -} - -/* -------------------------------------------------------------------------- */ /* * Connection context functions */ -/* -------------------------------------------------------------------------- */ -void* dx_get_buffered_input_connection_context (dxf_connection_t connection) { +void* dx_get_buffered_input_connection_context(dxf_connection_t connection) { return dx_get_subsystem_data(connection, dx_ccs_buffered_input, NULL); } -/* -------------------------------------------------------------------------- */ /* * Buffer manipulators implementation */ -/* -------------------------------------------------------------------------- */ - -dxf_byte_t* dx_get_in_buffer (void* context) { - return CTX(context)->in_buffer; -} - -/* -------------------------------------------------------------------------- */ -int dx_get_in_buffer_length (void* context) { - return CTX(context)->in_buffer_length; -} +dxf_byte_t* dx_get_in_buffer(void* context) { return CTX(context)->in_buffer; } -/* -------------------------------------------------------------------------- */ +int dx_get_in_buffer_length(void* context) { return CTX(context)->in_buffer_length; } -void dx_set_in_buffer (void* context, dxf_byte_t* new_buffer, int new_length) { +void dx_set_in_buffer(void* context, dxf_byte_t* new_buffer, int new_length) { CTX(context)->in_buffer = new_buffer; CTX(context)->in_buffer_length = new_length; } -/* -------------------------------------------------------------------------- */ +int dx_get_in_buffer_position(void* context) { return CTX(context)->current_in_buffer_position; } -int dx_get_in_buffer_position (void* context) { - return CTX(context)->current_in_buffer_position; -} - -/* -------------------------------------------------------------------------- */ - -void dx_set_in_buffer_position (void* context, int new_position) { +void dx_set_in_buffer_position(void* context, int new_position) { CTX(context)->current_in_buffer_position = new_position; } -/* -------------------------------------------------------------------------- */ +int dx_get_in_buffer_limit(void* context) { return CTX(context)->in_buffer_limit; } -int dx_get_in_buffer_limit (void* context) { - return CTX(context)->in_buffer_limit; -} - -/* -------------------------------------------------------------------------- */ +void dx_set_in_buffer_limit(void* context, int new_limit) { CTX(context)->in_buffer_limit = new_limit; } -void dx_set_in_buffer_limit (void* context, int new_limit) { - CTX(context)->in_buffer_limit = new_limit; -} - -/* -------------------------------------------------------------------------- */ /* * Read operation helpers */ -/* -------------------------------------------------------------------------- */ -static int dx_move_buffer_pos (void* context, int offset) { - int actual_offset = (offset > 0 ? MIN(offset, (CTX(context)->in_buffer_length - CTX(context)->current_in_buffer_position)) - : MAX(offset, -(CTX(context)->current_in_buffer_position))); +static int dx_move_buffer_pos(void* context, int offset) { + int actual_offset = + (offset > 0 ? MIN(offset, (CTX(context)->in_buffer_length - CTX(context)->current_in_buffer_position)) + : MAX(offset, -(CTX(context)->current_in_buffer_position))); CTX(context)->current_in_buffer_position += actual_offset; return offset - actual_offset; } -/* -------------------------------------------------------------------------- */ - -int dx_validate_buffer_and_value (void* context, void* value, int value_size) { +int dx_validate_buffer_and_value(void* context, void* value, int value_size) { if (CTX(context)->in_buffer == NULL) { return dx_set_error_code(dx_bioec_buffer_not_initialized); } @@ -175,9 +136,7 @@ int dx_validate_buffer_and_value (void* context, void* value, int value_size) { return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_utf2 (void* context, int first, OUT dxf_int_t* value) { +int dx_read_utf2(void* context, int first, OUT dxf_int_t* value) { dxf_byte_t second; if (value == NULL) { @@ -195,9 +154,7 @@ int dx_read_utf2 (void* context, int first, OUT dxf_int_t* value) { return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_utf3 (void* context, int first, OUT dxf_int_t* value) { +int dx_read_utf3(void* context, int first, OUT dxf_int_t* value) { dxf_short_t tail; if (value == NULL) { @@ -215,9 +172,7 @@ int dx_read_utf3 (void* context, int first, OUT dxf_int_t* value) { return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_utf4 (void* context, int first, OUT dxf_int_t* res) { +int dx_read_utf4(void* context, int first, OUT dxf_int_t* res) { dxf_byte_t second; dxf_short_t tail; @@ -241,9 +196,7 @@ int dx_read_utf4 (void* context, int first, OUT dxf_int_t* res) { return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_utf_sequence (void* context, int utflen, int lenInChars, OUT dxf_string_t* value) { +int dx_read_utf_sequence(void* context, int utflen, int lenInChars, OUT dxf_string_t* value) { dxf_string_t buffer; int count = 0; dxf_int_t tmpCh; @@ -274,13 +227,13 @@ int dx_read_utf_sequence (void* context, int utflen, int lenInChars, OUT dxf_str --utflen; buffer[count++] = (dxf_char_t)c; } else if ((c & 0xE0) == 0xC0) { - utflen -= lenInChars?1:2; + utflen -= lenInChars ? 1 : 2; CHECKED_CALL_3(dx_read_utf2, context, c, &tmpCh); buffer[count++] = tmpCh; } else if ((c & 0xF0) == 0xE0) { - utflen -= lenInChars?1:3; + utflen -= lenInChars ? 1 : 3; CHECKED_CALL_3(dx_read_utf3, context, c, &tmpCh); @@ -288,7 +241,7 @@ int dx_read_utf_sequence (void* context, int utflen, int lenInChars, OUT dxf_str } else if ((c & 0xF8) == 0xF0) { dxf_int_t tmpInt; int res; - utflen -= lenInChars?1:4; + utflen -= lenInChars ? 1 : 4; CHECKED_CALL_3(dx_read_utf4, context, c, &tmpInt); CHECKED_CALL_5(dx_code_point_to_utf16_chars, tmpInt, buffer, count, utflen, &res); @@ -310,12 +263,10 @@ int dx_read_utf_sequence (void* context, int utflen, int lenInChars, OUT dxf_str return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_byte_buffer_segment (void* context, dxf_byte_t* buffer, int buffer_length, - int segment_offset, int segment_length) { +int dx_read_byte_buffer_segment(void* context, dxf_byte_t* buffer, int buffer_length, int segment_offset, + int segment_length) { if ((segment_offset | segment_length | (segment_offset + segment_length) | - (buffer_length - (segment_offset + segment_length))) < 0) { + (buffer_length - (segment_offset + segment_length))) < 0) { /* a fast way to check if any of the values above are negative */ return dx_set_error_code(dx_bioec_index_out_of_bounds); @@ -325,20 +276,19 @@ int dx_read_byte_buffer_segment (void* context, dxf_byte_t* buffer, int buffer_l return dx_set_error_code(dx_bioec_buffer_underflow); } - dx_memcpy(buffer + segment_offset, CTX(context)->in_buffer + CTX(context)->current_in_buffer_position, segment_length); + dx_memcpy(buffer + segment_offset, CTX(context)->in_buffer + CTX(context)->current_in_buffer_position, + segment_length); CTX(context)->current_in_buffer_position += segment_length; return true; } -/* -------------------------------------------------------------------------- */ /* * Read operations implementation */ -/* -------------------------------------------------------------------------- */ -int dx_read_boolean (void* context, OUT dxf_bool_t* value) { +int dx_read_boolean(void* context, OUT dxf_bool_t* value) { CHECKED_CALL_3(dx_validate_buffer_and_value, context, value, 1); *value = CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++]; @@ -346,9 +296,7 @@ int dx_read_boolean (void* context, OUT dxf_bool_t* value) { return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_byte (void* context, OUT dxf_byte_t* value) { +int dx_read_byte(void* context, OUT dxf_byte_t* value) { CHECKED_CALL_3(dx_validate_buffer_and_value, context, value, 1); *value = CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++]; @@ -356,9 +304,7 @@ int dx_read_byte (void* context, OUT dxf_byte_t* value) { return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_unsigned_byte (void* context, OUT dxf_uint_t* value) { +int dx_read_unsigned_byte(void* context, OUT dxf_uint_t* value) { CHECKED_CALL_3(dx_validate_buffer_and_value, context, value, 1); *value = ((dxf_uint_t)CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++]) & 0xFF; @@ -366,20 +312,17 @@ int dx_read_unsigned_byte (void* context, OUT dxf_uint_t* value) { return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_short (void* context, OUT dxf_short_t* value) { +int dx_read_short(void* context, OUT dxf_short_t* value) { CHECKED_CALL_3(dx_validate_buffer_and_value, context, value, 2); - *value = ((dxf_short_t)CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++] << 8); - *value = *value | ((dxf_short_t)CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++] & 0xFF); + *value = (dxf_short_t)((dxf_short_t)(CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++]) << 8u); + *value = (dxf_short_t)((dxf_short_t)(*value) | + ((dxf_short_t)CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++] & 0xFF)); return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_unsigned_short (void* context, OUT dxf_uint_t* value) { +int dx_read_unsigned_short(void* context, OUT dxf_uint_t* value) { CHECKED_CALL_3(dx_validate_buffer_and_value, context, value, 2); *value = ((dxf_uint_t)(CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++] & 0xFF) << 8); @@ -388,22 +331,18 @@ int dx_read_unsigned_short (void* context, OUT dxf_uint_t* value) { return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_int (void* context, OUT dxf_int_t* value) { +int dx_read_int(void* context, OUT dxf_int_t* value) { CHECKED_CALL_3(dx_validate_buffer_and_value, context, value, 4); *value = ((dxf_int_t)(CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++] & 0xFF) << 24); *value = *value | ((dxf_int_t)(CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++] & 0xFF) << 16); - *value = *value | ((dxf_int_t)(CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++] & 0xFF) << 8); + *value = *value | ((dxf_int_t)(CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++] & 0xFF) << 8); *value = *value | ((dxf_int_t)CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++] & 0xFF); return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_long (void* context, OUT dxf_long_t* value) { +int dx_read_long(void* context, OUT dxf_long_t* value) { CHECKED_CALL_3(dx_validate_buffer_and_value, context, value, 8); *value = ((dxf_long_t)CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++] << 56); @@ -418,33 +357,25 @@ int dx_read_long (void* context, OUT dxf_long_t* value) { return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_float (void* context, OUT dxf_float_t* value) { +int dx_read_float(void* context, OUT dxf_float_t* value) { dxf_int_t int_val; CHECKED_CALL_2(dx_read_int, context, &int_val); - - *value = *((dxf_float_t*)(&int_val)); + memcpy(value, &int_val, sizeof(dxf_float_t)); return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_double (void* context, OUT dxf_double_t* value) { +int dx_read_double(void* context, OUT dxf_double_t* value) { dxf_long_t long_val; CHECKED_CALL_2(dx_read_long, context, &long_val); - - *value = *((dxf_double_t*)(&long_val)); + memcpy(value, &long_val, sizeof(dxf_double_t)); return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_line (void* context, OUT dxf_string_t* value) { +int dx_read_line(void* context, OUT dxf_string_t* value) { static const int tmp_buf_size = 128; dxf_string_t tmp_buffer = NULL; @@ -461,10 +392,10 @@ int dx_read_line (void* context, OUT dxf_string_t* value) { while (CTX(context)->current_in_buffer_position < CTX(context)->in_buffer_length) { dxf_char_t c = CTX(context)->in_buffer[CTX(context)->current_in_buffer_position++] & 0xFF; - if (c == '\n') - break; + if (c == '\n') break; if (c == '\r') { - if ((CTX(context)->current_in_buffer_position < CTX(context)->in_buffer_length) && CTX(context)->in_buffer[CTX(context)->current_in_buffer_position] == '\n') { + if ((CTX(context)->current_in_buffer_position < CTX(context)->in_buffer_length) && + CTX(context)->in_buffer[CTX(context)->current_in_buffer_position] == '\n') { ++CTX(context)->current_in_buffer_position; } @@ -495,9 +426,7 @@ int dx_read_line (void* context, OUT dxf_string_t* value) { return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_utf (void* context, OUT dxf_string_t* value) { +int dx_read_utf(void* context, OUT dxf_string_t* value) { dxf_uint_t utflen; CHECKED_CALL_2(dx_read_unsigned_short, context, &utflen); @@ -505,13 +434,11 @@ int dx_read_utf (void* context, OUT dxf_string_t* value) { return dx_read_utf_sequence(context, (int)utflen, false, OUT value); } -/* -------------------------------------------------------------------------- */ /* * Compact read operations implementation */ -/* -------------------------------------------------------------------------- */ -int dx_read_compact_int (void* context, OUT dxf_int_t* value) { +int dx_read_compact_int(void* context, OUT dxf_int_t* value) { dxf_int_t n; if (value == NULL) { @@ -568,7 +495,6 @@ int dx_read_compact_int (void* context, OUT dxf_int_t* value) { return true; } - /* The encoded number is possibly out of range, some bytes have to be skipped. */ while (((n <<= 1) & 0x10) != 0) { @@ -582,9 +508,7 @@ int dx_read_compact_int (void* context, OUT dxf_int_t* value) { return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_compact_long (void* context, OUT dxf_long_t* value) { +int dx_read_compact_long(void* context, OUT dxf_long_t* value) { dxf_int_t n; dxf_int_t tmp_int; @@ -676,9 +600,7 @@ int dx_read_compact_long (void* context, OUT dxf_long_t* value) { return true; } -/* -------------------------------------------------------------------------- */ - -int dx_read_byte_array (void* context, OUT dxf_byte_array_t* value) { +int dx_read_byte_array(void* context, OUT dxf_byte_array_t* value) { dxf_byte_array_t buffer = DX_EMPTY_ARRAY; dxf_long_t buffer_length; int failed = false; @@ -719,13 +641,11 @@ int dx_read_byte_array (void* context, OUT dxf_byte_array_t* value) { return true; } -/* -------------------------------------------------------------------------- */ /* * UTF read operations implementation */ -/* -------------------------------------------------------------------------- */ -int dx_read_utf_char (void* context, OUT dxf_int_t* value) { +int dx_read_utf_char(void* context, OUT dxf_int_t* value) { dxf_byte_t c; if (value == NULL) { @@ -755,9 +675,7 @@ int dx_read_utf_char (void* context, OUT dxf_int_t* value) { return dx_set_error_code(dx_utfec_bad_utf_data_format_server); } -/* -------------------------------------------------------------------------- */ - -int dx_read_utf_char_array (void* context, OUT dxf_string_t* value) { +int dx_read_utf_char_array(void* context, OUT dxf_string_t* value) { dxf_long_t utflen; CHECKED_CALL_2(dx_read_compact_long, context, &utflen); @@ -775,7 +693,7 @@ int dx_read_utf_char_array (void* context, OUT dxf_string_t* value) { return dx_read_utf_sequence(context, (int)utflen, true, value); } -int dx_read_utf_string (void* context, OUT dxf_string_t* value) { +int dx_read_utf_string(void* context, OUT dxf_string_t* value) { dxf_long_t utflen; CHECKED_CALL_2(dx_read_compact_long, context, &utflen); diff --git a/src/BufferedInput.h b/src/BufferedInput.h index 120daedf..625d09c3 100644 --- a/src/BufferedInput.h +++ b/src/BufferedInput.h @@ -22,19 +22,15 @@ #include "BufferedIOCommon.h" -/* -------------------------------------------------------------------------- */ /* * Connection context functions */ -/* -------------------------------------------------------------------------- */ void* dx_get_buffered_input_connection_context (dxf_connection_t connection); -/* -------------------------------------------------------------------------- */ /* * Buffer manipulators */ -/* -------------------------------------------------------------------------- */ dxf_byte_t* dx_get_in_buffer (void* context); int dx_get_in_buffer_length (void* context); @@ -44,11 +40,9 @@ void dx_set_in_buffer_position (void* context, int new_position); int dx_get_in_buffer_limit (void* context); void dx_set_in_buffer_limit (void* context, int new_limit); -/* -------------------------------------------------------------------------- */ /* * Read operations */ -/* -------------------------------------------------------------------------- */ int dx_read_boolean (void* context, OUT dxf_bool_t* value); int dx_read_byte (void* context, OUT dxf_byte_t* value); @@ -65,11 +59,9 @@ int dx_read_line (void* context, OUT dxf_string_t* value); int dx_read_utf (void* context, OUT dxf_string_t* value); */ -/* -------------------------------------------------------------------------- */ /* * Compact read operations */ -/* -------------------------------------------------------------------------- */ /* * Reads an dx_int_t value in a compact format. @@ -98,11 +90,9 @@ int dx_read_compact_long (void* context, OUT dxf_long_t* value); */ int dx_read_byte_array (void* context, OUT dxf_byte_array_t* value); -/* -------------------------------------------------------------------------- */ /* * UTF read operations */ -/* -------------------------------------------------------------------------- */ /* * Reads Unicode code point in a UTF-8 format. diff --git a/src/BufferedOutput.c b/src/BufferedOutput.c index cbb8af41..f2d76620 100644 --- a/src/BufferedOutput.c +++ b/src/BufferedOutput.c @@ -36,8 +36,6 @@ #define IS_CUR_CAPACITY_ENOUGH(context, bytes_to_write) \ (CTX(context)->current_out_buffer_position + bytes_to_write <= CTX(context)->out_buffer_length) -/* -------------------------------------------------------------------------- */ - static void dx_clear_buffered_output_context_data (dx_buffered_output_connection_context_t* context); DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_buffered_output) { @@ -58,8 +56,6 @@ DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_buffered_output) { return true; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_buffered_output) { int res = true; dx_buffered_output_connection_context_t* context = dx_get_subsystem_data(connection, dx_ccs_buffered_output, &res); @@ -73,17 +69,13 @@ DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_buffered_output) { return true; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_buffered_output) { return true; } -/* -------------------------------------------------------------------------- */ /* * Connection context functions */ -/* -------------------------------------------------------------------------- */ static void dx_clear_buffered_output_context_data (dx_buffered_output_connection_context_t* context) { if (context == NULL) { @@ -97,62 +89,44 @@ static void dx_clear_buffered_output_context_data (dx_buffered_output_connection dx_free(context); } -/* -------------------------------------------------------------------------- */ - void* dx_get_buffered_output_connection_context (dxf_connection_t connection) { return dx_get_subsystem_data(connection, dx_ccs_buffered_output, NULL); } -/* -------------------------------------------------------------------------- */ - int dx_lock_buffered_output (void* context) { return dx_mutex_lock(&(CTX(context)->guard)); } -/* -------------------------------------------------------------------------- */ - int dx_unlock_buffered_output (void* context) { return dx_mutex_unlock(&(CTX(context)->guard)); } -/* -------------------------------------------------------------------------- */ /* * Buffer manipulators implementation */ -/* -------------------------------------------------------------------------- */ dxf_byte_t* dx_get_out_buffer (void* context) { return CTX(context)->out_buffer; } -/* -------------------------------------------------------------------------- */ - int dx_get_out_buffer_length (void* context) { return CTX(context)->out_buffer_length; } -/* -------------------------------------------------------------------------- */ - void dx_set_out_buffer (void* context, dxf_byte_t* new_buffer, int new_length) { CTX(context)->out_buffer = new_buffer; CTX(context)->out_buffer_length = new_length; CTX(context)->current_out_buffer_position = 0; } -/* -------------------------------------------------------------------------- */ - int dx_get_out_buffer_position (void* context) { return CTX(context)->current_out_buffer_position; } -/* -------------------------------------------------------------------------- */ - void dx_set_out_buffer_position (void* context, int new_position) { CTX(context)->current_out_buffer_position = new_position; } -/* -------------------------------------------------------------------------- */ - int dx_ensure_capacity (void* context, int required_capacity) { if (INT_MAX - CTX(context)->current_out_buffer_position < CTX(context)->out_buffer_length) { return dx_set_error_code(dx_bioec_buffer_overflow); @@ -178,11 +152,9 @@ int dx_ensure_capacity (void* context, int required_capacity) { return true; } -/* -------------------------------------------------------------------------- */ /* * Write operation helpers */ -/* -------------------------------------------------------------------------- */ static int dx_check_write_possibility (void* context, int bytes_to_write) { if (CTX(context)->out_buffer == NULL) { @@ -192,23 +164,17 @@ static int dx_check_write_possibility (void* context, int bytes_to_write) { return IS_CUR_CAPACITY_ENOUGH(context, bytes_to_write) || dx_ensure_capacity(context, bytes_to_write); } -/* -------------------------------------------------------------------------- */ - void dx_write_utf2_unchecked (void* context, dxf_int_t code_point) { CTX(context)->out_buffer[CTX(context)->current_out_buffer_position++] = (dxf_byte_t)(0xC0 | code_point >> 6); CTX(context)->out_buffer[CTX(context)->current_out_buffer_position++] = (dxf_byte_t)(0x80 | (code_point & 0x3F)); } -/* -------------------------------------------------------------------------- */ - void dx_write_utf3_unchecked (void* context, dxf_int_t code_point) { CTX(context)->out_buffer[CTX(context)->current_out_buffer_position++] = (dxf_byte_t)(0xE0 | code_point >> 12); CTX(context)->out_buffer[CTX(context)->current_out_buffer_position++] = (dxf_byte_t)(0x80 | (code_point >> 6 & 0x3F)); CTX(context)->out_buffer[CTX(context)->current_out_buffer_position++] = (dxf_byte_t)(0x80 | (code_point & 0x3F)); } -/* -------------------------------------------------------------------------- */ - void dx_write_utf4_unchecked (void* context, dxf_int_t code_point) { CTX(context)->out_buffer[CTX(context)->current_out_buffer_position++] = (dxf_byte_t)(0xF0 | code_point >> 18); CTX(context)->out_buffer[CTX(context)->current_out_buffer_position++] = (dxf_byte_t)(0x80 | (code_point >> 12 & 0x3F)); @@ -216,8 +182,6 @@ void dx_write_utf4_unchecked (void* context, dxf_int_t code_point) { CTX(context)->out_buffer[CTX(context)->current_out_buffer_position++] = (dxf_byte_t)(0x80 | (code_point & 0x3F)); } -/* -------------------------------------------------------------------------- */ - void dx_write_int_unchecked (void* context, dxf_int_t value) { CTX(context)->out_buffer[CTX(context)->current_out_buffer_position++] = (dxf_byte_t)(value >> 24); CTX(context)->out_buffer[CTX(context)->current_out_buffer_position++] = (dxf_byte_t)(value >> 16); @@ -225,8 +189,6 @@ void dx_write_int_unchecked (void* context, dxf_int_t value) { CTX(context)->out_buffer[CTX(context)->current_out_buffer_position++] = (dxf_byte_t)value; } -/* -------------------------------------------------------------------------- */ - int dx_write_byte_buffer_segment (void* context, const dxf_byte_t* buffer, int buffer_length, int segment_offset, int segment_length) { if ((segment_offset | segment_length | (segment_offset + segment_length) | @@ -247,11 +209,9 @@ int dx_write_byte_buffer_segment (void* context, const dxf_byte_t* buffer, int b return true; } -/* -------------------------------------------------------------------------- */ /* * Write operations implementation */ -/* -------------------------------------------------------------------------- */ int dx_write_boolean (void* context, dxf_bool_t value) { CHECKED_CALL_2(dx_check_write_possibility, context, 1); @@ -261,8 +221,6 @@ int dx_write_boolean (void* context, dxf_bool_t value) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_write_byte (void* context, dxf_byte_t value) { CHECKED_CALL_2(dx_check_write_possibility, context, 1); @@ -271,8 +229,6 @@ int dx_write_byte (void* context, dxf_byte_t value) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_write_short (void* context, dxf_short_t value) { CHECKED_CALL_2(dx_check_write_possibility, context, 2); @@ -282,8 +238,6 @@ int dx_write_short (void* context, dxf_short_t value) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_write_char (void* context, dxf_char_t value) { CHECKED_CALL_2(dx_check_write_possibility, context, 2); @@ -293,8 +247,6 @@ int dx_write_char (void* context, dxf_char_t value) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_write_int (void* context, dxf_int_t value) { CHECKED_CALL_2(dx_check_write_possibility, context, 4); @@ -306,8 +258,6 @@ int dx_write_int (void* context, dxf_int_t value) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_write_long (void* context, dxf_long_t value) { CHECKED_CALL_2(dx_check_write_possibility, context, 8); @@ -323,20 +273,14 @@ int dx_write_long (void* context, dxf_long_t value) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_write_float (void* context, dxf_float_t value) { return dx_write_int(context, (dxf_int_t)value); } -/* -------------------------------------------------------------------------- */ - int dx_write_double (void* context, dxf_double_t value) { return dx_write_long(context, (dxf_long_t)value); } -/* -------------------------------------------------------------------------- */ - int dx_write_byte_buffer (void* context, const dxf_char_t* value) { size_t length = dx_string_length(value); size_t i = 0; @@ -348,8 +292,6 @@ int dx_write_byte_buffer (void* context, const dxf_char_t* value) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_write_char_buffer (void* context, const dxf_char_t* value) { size_t length = dx_string_length(value); size_t i = 0; @@ -361,8 +303,6 @@ int dx_write_char_buffer (void* context, const dxf_char_t* value) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_write_utf (void* context, dxf_const_string_t value) { size_t strlen = dx_string_length(value); dxf_int_t utflen = 0; @@ -407,11 +347,9 @@ int dx_write_utf (void* context, dxf_const_string_t value) { return true; } -/* -------------------------------------------------------------------------- */ /* * Compact write operations implementation */ -/* -------------------------------------------------------------------------- */ int dx_write_compact_int (void* context, dxf_int_t value) { CHECKED_CALL_2(dx_check_write_possibility, context, 5); @@ -453,8 +391,6 @@ int dx_write_compact_int (void* context, dxf_int_t value) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_write_compact_long (void* context, dxf_long_t value) { dxf_int_t hi = (dxf_int_t)(value >> 32); @@ -503,8 +439,6 @@ int dx_write_compact_long (void* context, dxf_long_t value) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_write_byte_array (void* context, const dxf_byte_t* buffer, dxf_int_t buffer_size) { if (buffer == NULL) { return dx_write_compact_int(context, -1); @@ -516,11 +450,9 @@ int dx_write_byte_array (void* context, const dxf_byte_t* buffer, dxf_int_t buff return true; } -/* -------------------------------------------------------------------------- */ /* * UTF write operations implementation */ -/* -------------------------------------------------------------------------- */ int dx_write_utf_char (void* context, dxf_int_t code_point) { CHECKED_CALL_2(dx_check_write_possibility, context, 4); @@ -544,8 +476,6 @@ int dx_write_utf_char (void* context, dxf_int_t code_point) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_write_utf_string (void* context, dxf_const_string_t value) { size_t strlen; dxf_int_t utflen; diff --git a/src/BufferedOutput.h b/src/BufferedOutput.h index 8c183ceb..683e0be2 100644 --- a/src/BufferedOutput.h +++ b/src/BufferedOutput.h @@ -33,21 +33,17 @@ typedef struct dx_buffered_output_connection_context_t { int set_field_mask; } dx_buffered_output_connection_context_t; -/* -------------------------------------------------------------------------- */ /* * Connection context functions */ -/* -------------------------------------------------------------------------- */ void* dx_get_buffered_output_connection_context (dxf_connection_t connection); int dx_lock_buffered_output (void* context); int dx_unlock_buffered_output (void* context); -/* -------------------------------------------------------------------------- */ /* * Buffer manipulators */ -/* -------------------------------------------------------------------------- */ dxf_byte_t* dx_get_out_buffer (void* context); int dx_get_out_buffer_length (void* context); @@ -62,11 +58,9 @@ void dx_set_out_buffer_position (void* context, int new_position); */ int dx_ensure_capacity (void* context, int required_capacity); -/* -------------------------------------------------------------------------- */ /* * Write operations */ -/* -------------------------------------------------------------------------- */ int dx_write_boolean (void* context, dxf_bool_t value); int dx_write_byte (void* context, dxf_byte_t value); @@ -80,11 +74,9 @@ int dx_write_byte_buffer (void* context, const dxf_char_t* value); int dx_write_char_buffer (void* context, const dxf_char_t* value); int dx_write_utf (void* context, dxf_const_string_t value); -/* -------------------------------------------------------------------------- */ /* * Compact write operations */ -/* -------------------------------------------------------------------------- */ int dx_write_compact_int (void* context, dxf_int_t value); int dx_write_compact_long (void* context, dxf_long_t value); @@ -98,11 +90,9 @@ int dx_write_compact_long (void* context, dxf_long_t value); */ int dx_write_byte_array (void* context, const dxf_byte_t* buffer, int buffer_size); -/* -------------------------------------------------------------------------- */ /* * UTF write operations */ -/* -------------------------------------------------------------------------- */ /* * Writes a Unicode code point in a UTF-8 format. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d0828487..3c7d9fee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -62,7 +62,7 @@ if (NOT ${APP_VERSION} STREQUAL "") configure_file("${PROJECT_SOURCE_DIR}/${PROJECT}${POSTFIX}.def.in" "${PROJECT_SOURCE_DIR}/${DEF_FILE}") endif () -include_directories(${INCLUDE_DIR} ../thirdparty/toml11 ../thirdparty/boost-1_75) +include_directories(${INCLUDE_DIR} ../thirdparty/toml11 ../thirdparty/boost-1_79 ../thirdparty/optional-lite-3.5.0 ../thirdparty/variant-lite-2.0.0) set(EXPORT_HEADERS ${INCLUDE_DIR}/DXErrorCodes.h @@ -95,6 +95,8 @@ set(HEADER_FILES EventSubscription.h EventSubscription.hpp HeartbeatPayload.hpp + IdGenerator.hpp + Utils/Hash.hpp Logger.h ObjectArray.h PriceLevelBook.h @@ -106,6 +108,10 @@ set(HEADER_FILES RecordTranscoder.h ServerMessageProcessor.h Snapshot.h + Snapshot/Snapshot.h + Snapshot/Snapshot.hpp + Snapshot/SnapshotKey.hpp + Snapshot/SnapshotChanges.hpp StringConverter.hpp TaskQueue.h TimeMarkUtil.hpp @@ -169,6 +175,7 @@ set(SOURCE_FILES RecordTranscoder.c ServerMessageProcessor.c Snapshot.c + Snapshot/Snapshot.cpp TaskQueue.c Version.c WideDecimal.cpp @@ -335,13 +342,15 @@ elseif (MACOSX) endif () if (NOT DISABLE_TLS) + set(DX_CAPI_BINARY_PATH ${CMAKE_BINARY_DIR}) + if (WIN32) ADD_CUSTOM_COMMAND( TARGET ${PROJECT} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/win/${TARGET_PLATFORM}/libtls-15${PLATFORM_POSTFIX}.dll ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/win/${TARGET_PLATFORM}/libssl-43${PLATFORM_POSTFIX}.dll ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/win/${TARGET_PLATFORM}/libcrypto-41${PLATFORM_POSTFIX}.dll ${CMAKE_BINARY_DIR}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/win/${TARGET_PLATFORM}/libtls-15${PLATFORM_POSTFIX}.dll ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/win/${TARGET_PLATFORM}/libssl-43${PLATFORM_POSTFIX}.dll ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/win/${TARGET_PLATFORM}/libcrypto-41${PLATFORM_POSTFIX}.dll ${DX_CAPI_BINARY_PATH} ) elseif (MACOSX) ADD_CUSTOM_COMMAND( @@ -352,18 +361,18 @@ if (NOT DISABLE_TLS) ADD_CUSTOM_COMMAND( TARGET ${PROJECT} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libcrypto.46.0.0.dylib ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libcrypto.46.dylib ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libcrypto.a ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libcrypto.dylib ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libssl.48.0.0.dylib ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libssl.48.dylib ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libssl.a ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libssl.dylib ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libtls.20.0.0.dylib ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libtls.20.dylib ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libtls.a ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libtls.dylib ${CMAKE_BINARY_DIR}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libcrypto.46.0.0.dylib ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libcrypto.46.dylib ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libcrypto.a ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libcrypto.dylib ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libssl.48.0.0.dylib ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libssl.48.dylib ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libssl.a ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libssl.dylib ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libtls.20.0.0.dylib ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libtls.20.dylib ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libtls.a ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/mac/${TARGET_PLATFORM}/libtls.dylib ${DX_CAPI_BINARY_PATH} ) else (WIN32) ADD_CUSTOM_COMMAND( @@ -374,15 +383,15 @@ if (NOT DISABLE_TLS) ADD_CUSTOM_COMMAND( TARGET ${PROJECT} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libcrypto.so.41.1.0 ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libcrypto.so.41 ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libcrypto.so ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libssl.so.43.2.0 ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libssl.so.43 ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libssl.so ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libtls.so.15.4.0 ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libtls.so.15 ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libtls.so ${CMAKE_BINARY_DIR}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libcrypto.so.41.1.0 ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libcrypto.so.41 ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libcrypto.so ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libssl.so.43.2.0 ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libssl.so.43 ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libssl.so ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libtls.so.15.4.0 ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libtls.so.15 ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/nix/${TARGET_PLATFORM}/libtls.so ${DX_CAPI_BINARY_PATH} ) endif (WIN32) endif (NOT DISABLE_TLS) diff --git a/src/ClientMessageProcessor.c b/src/ClientMessageProcessor.c index 22386917..7b92ff62 100644 --- a/src/ClientMessageProcessor.c +++ b/src/ClientMessageProcessor.c @@ -36,11 +36,9 @@ #include "TaskQueue.h" #include "Version.h" -/* -------------------------------------------------------------------------- */ /* * Event subscription auxiliary stuff */ -/* -------------------------------------------------------------------------- */ int dx_to_subscription_message_type(int subscribe, dx_subscription_type_t subscr_type, OUT dx_message_type_t* res) { if (res == NULL) { @@ -63,11 +61,9 @@ int dx_to_subscription_message_type(int subscribe, dx_subscription_type_t subscr return true; } -/* -------------------------------------------------------------------------- */ /* * Event subscription task stuff */ -/* -------------------------------------------------------------------------- */ typedef struct { dxf_connection_t connection; @@ -80,8 +76,6 @@ typedef struct { dxf_long_t time; } dx_event_subscription_task_data_t; -/* -------------------------------------------------------------------------- */ - void* dx_destroy_event_subscription_task_data(dx_event_subscription_task_data_t* data) { if (data == NULL) { return NULL; @@ -117,8 +111,6 @@ size_t dx_count_symbols(dxf_const_string_t* symbols, size_t symbol_count, const return count; } -/* -------------------------------------------------------------------------- */ - void* dx_create_event_subscription_task_data(dxf_connection_t connection, dx_order_source_array_ptr_t order_source, dxf_const_string_t* symbols, size_t symbol_count, int* symbols_indices_to_subscribe, int symbols_indices_count, @@ -179,11 +171,9 @@ void* dx_create_event_subscription_task_data(dxf_connection_t connection, dx_ord return data; } -/* -------------------------------------------------------------------------- */ /* * Common helpers */ -/* -------------------------------------------------------------------------- */ static int dx_compose_message_header(void* bocc, dx_message_type_t message_type) { CHECKED_CALL_2(dx_write_byte, bocc, (dxf_byte_t)0); /* reserve one byte for message length */ @@ -192,8 +182,6 @@ static int dx_compose_message_header(void* bocc, dx_message_type_t message_type) return true; } -/* -------------------------------------------------------------------------- */ - static int dx_move_message_data(void* bocc, int old_offset, int new_offset, int data_length) { CHECKED_CALL_2(dx_ensure_capacity, bocc, new_offset + data_length); @@ -202,8 +190,6 @@ static int dx_move_message_data(void* bocc, int old_offset, int new_offset, int return true; } -/* -------------------------------------------------------------------------- */ - static int dx_finish_composing_message(void* bocc) { int message_length = dx_get_out_buffer_position(bocc) - 1; /* 1 is for the one byte reserved for size */ int length_size = dx_get_compact_size(message_length); @@ -221,11 +207,9 @@ static int dx_finish_composing_message(void* bocc) { return true; } -/* -------------------------------------------------------------------------- */ /* * Symbol subscription helpers */ -/* -------------------------------------------------------------------------- */ static int dx_compose_body(void* bocc, dxf_int_t record_id, dxf_int_t cipher, dxf_const_string_t symbol) { if (cipher == 0 && symbol == NULL) { @@ -238,8 +222,6 @@ static int dx_compose_body(void* bocc, dxf_int_t record_id, dxf_int_t cipher, dx return true; } -/* -------------------------------------------------------------------------- */ - static int dx_subscribe_symbol_to_record(dxf_connection_t connection, dx_message_type_t type, dxf_const_string_t symbol, dxf_int_t cipher, dxf_int_t record_id, dxf_long_t time, OUT dxf_byte_t** buffer, OUT int* buffer_size) { @@ -305,8 +287,6 @@ static int dx_subscribe_symbol_to_record(dxf_connection_t connection, dx_message return true; } -/* -------------------------------------------------------------------------- */ - int dx_subscribe_symbols_to_events_task(void* data, int command) { dx_event_subscription_task_data_t* task_data = data; int res = dx_tes_pop_me; @@ -332,11 +312,9 @@ int dx_subscribe_symbols_to_events_task(void* data, int command) { return res; } -/* -------------------------------------------------------------------------- */ /* * Describe record helpers */ -/* -------------------------------------------------------------------------- */ static int dx_write_record_field(void* bocc, const dx_field_info_t* field) { CHECKED_CALL_2(dx_write_utf_string, bocc, field->field_name); @@ -345,8 +323,6 @@ static int dx_write_record_field(void* bocc, const dx_field_info_t* field) { return true; } -/* -------------------------------------------------------------------------- */ - static int dx_write_event_record(void* bocc, const dx_record_item_t* record, dx_record_id_t record_id) { int field_index = 0; @@ -361,8 +337,6 @@ static int dx_write_event_record(void* bocc, const dx_record_item_t* record, dx_ return true; } -/* -------------------------------------------------------------------------- */ - int dx_write_event_records(void* bocc, void* dscc) { dx_record_id_t record_id = dx_get_next_unsubscribed_record_id(dscc, false); dx_record_id_t count = dx_get_records_list_count(dscc); @@ -375,8 +349,6 @@ int dx_write_event_records(void* bocc, void* dscc) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_describe_records_sender_task(void* data, int command) { int res = dx_tes_pop_me; @@ -391,7 +363,6 @@ int dx_describe_records_sender_task(void* data, int command) { return res; } -/* -------------------------------------------------------------------------- */ int dx_load_events_for_subscription(dxf_connection_t connection, dx_order_source_array_ptr_t order_sources, int event_types, dxf_uint_t subscr_flags) { dx_event_id_t eid = dx_eid_begin; @@ -406,8 +377,6 @@ int dx_load_events_for_subscription(dxf_connection_t connection, dx_order_source return true; } -/* -------------------------------------------------------------------------- */ - int dx_get_event_server_support(dxf_connection_t connection, dx_order_source_array_ptr_t order_source, int event_types, int unsubscribe, dxf_uint_t subscr_flags, OUT dx_message_support_status_t* res) { *res = dx_mss_supported; @@ -459,11 +428,9 @@ int dx_get_event_server_support(dxf_connection_t connection, dx_order_source_arr return success; } -/* -------------------------------------------------------------------------- */ /* * Describe protocol helpers */ -/* -------------------------------------------------------------------------- */ static int dx_write_describe_protocol_magic(void* bocc) { /* hex value is 0x44585033 */ @@ -475,8 +442,6 @@ static int dx_write_describe_protocol_magic(void* bocc) { return true; } -/* -------------------------------------------------------------------------- */ - static int dx_write_describe_protocol_properties(void* bocc, const dx_property_map_t* properties) { size_t i; @@ -492,8 +457,6 @@ static int dx_write_describe_protocol_properties(void* bocc, const dx_property_m return true; } -/* -------------------------------------------------------------------------- */ - static int dx_write_describe_protocol_message_data(void* bocc, const int* msg_roster, int msg_count) { int i = 0; @@ -508,22 +471,16 @@ static int dx_write_describe_protocol_message_data(void* bocc, const int* msg_ro return true; } -/* -------------------------------------------------------------------------- */ - static int dx_write_describe_protocol_sends(void* bocc) { return dx_write_describe_protocol_message_data(bocc, dx_get_send_message_roster(), dx_get_send_message_roster_size()); } -/* -------------------------------------------------------------------------- */ - static int dx_write_describe_protocol_recvs(void* bocc) { return dx_write_describe_protocol_message_data(bocc, dx_get_recv_message_roster(), dx_get_recv_message_roster_size()); } -/* -------------------------------------------------------------------------- */ - int dx_heartbeat_sender_task(void* data, int command) { int res = dx_tes_pop_me; @@ -551,11 +508,9 @@ int dx_describe_protocol_sender_task(void* data, int command) { return res; } -/* -------------------------------------------------------------------------- */ /* * External interface */ -/* -------------------------------------------------------------------------- */ int dx_subscribe_symbols_to_events(dxf_connection_t connection, dx_order_source_array_ptr_t order_source, dxf_const_string_t* symbols, size_t symbol_count, int* symbols_indices_to_subscribe, @@ -665,8 +620,6 @@ int dx_subscribe_symbols_to_events(dxf_connection_t connection, dx_order_source_ return success; } -/* -------------------------------------------------------------------------- */ - int dx_send_record_description(dxf_connection_t connection, int task_mode) { static const int initial_size = 1024; @@ -722,7 +675,6 @@ int dx_send_record_description(dxf_connection_t connection, int task_mode) { return true; } -/* -------------------------------------------------------------------------- */ int dx_send_protocol_description(dxf_connection_t connection, int task_mode) { static const int initial_size = 1024; diff --git a/src/Configuration.hpp b/src/Configuration.hpp index 0473f908..1d71227e 100644 --- a/src/Configuration.hpp +++ b/src/Configuration.hpp @@ -27,7 +27,14 @@ #include #include #include + +#if defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable : 4503) +#endif + #include + #include extern "C" { @@ -315,3 +322,7 @@ struct Configuration : std::enable_shared_from_this { } }; } // namespace dx + +#if defined(_MSC_VER) +# pragma warning(pop) +#endif diff --git a/src/ConnectionContextData.c b/src/ConnectionContextData.c index b5a3c148..f5e63a75 100644 --- a/src/ConnectionContextData.c +++ b/src/ConnectionContextData.c @@ -25,11 +25,9 @@ #include "DXAlgorithms.h" #include "Logger.h" -/* -------------------------------------------------------------------------- */ /* * Various data */ -/* -------------------------------------------------------------------------- */ static const dx_conn_ctx_subsys_manipulator_t g_initializer_queue[dx_ccs_count] = { DX_CONNECTION_SUBSYS_INIT_NAME(dx_ccs_network), @@ -75,21 +73,18 @@ static const dx_conn_ctx_subsys_manipulator_t g_check_queue[dx_ccs_count] = { DX_CONNECTION_SUBSYS_CHECK_NAME(dx_ccs_price_level_book), DX_CONNECTION_SUBSYS_CHECK_NAME(dx_ccs_regional_book) }; -/* -------------------------------------------------------------------------- */ + /* * Various types */ -/* -------------------------------------------------------------------------- */ typedef struct { void* subsystem_data[dx_ccs_count]; } dx_connection_data_collection_t; -/* -------------------------------------------------------------------------- */ /* * Main functions implementation */ -/* -------------------------------------------------------------------------- */ dxf_connection_t dx_init_connection (void) { dx_connection_data_collection_t* res = dx_calloc(1, sizeof(dx_connection_data_collection_t)); @@ -109,8 +104,6 @@ dxf_connection_t dx_init_connection (void) { return (dxf_connection_t)res; } -/* -------------------------------------------------------------------------- */ - int dx_deinit_connection (dxf_connection_t connection) { int i = dx_ccs_begin; int res = true; @@ -124,8 +117,6 @@ int dx_deinit_connection (dxf_connection_t connection) { return res; } -/* -------------------------------------------------------------------------- */ - int dx_can_deinit_connection (dxf_connection_t connection) { int i = dx_ccs_begin; @@ -138,8 +129,6 @@ int dx_can_deinit_connection (dxf_connection_t connection) { return true; } -/* -------------------------------------------------------------------------- */ - void* dx_get_subsystem_data (dxf_connection_t connection, dx_connection_context_subsystem_t subsystem, OUT int* res) { if (connection == NULL) { dx_set_error_code(dx_cec_invalid_connection_handle_internal); @@ -160,8 +149,6 @@ void* dx_get_subsystem_data (dxf_connection_t connection, dx_connection_context_ return ((dx_connection_data_collection_t*)connection)->subsystem_data[subsystem]; } -/* -------------------------------------------------------------------------- */ - int dx_set_subsystem_data (dxf_connection_t connection, dx_connection_context_subsystem_t subsystem, void* data) { if (connection == NULL) { dx_set_last_error(dx_cec_invalid_connection_handle_internal); @@ -180,8 +167,6 @@ int dx_set_subsystem_data (dxf_connection_t connection, dx_connection_context_su return true; } -/* -------------------------------------------------------------------------- */ - int dx_validate_connection_handle (dxf_connection_t connection, int is_internal) { if (connection == NULL) { return dx_set_error_code(is_internal ? dx_cec_invalid_connection_handle_internal : dx_cec_invalid_connection_handle); diff --git a/src/ConnectionContextData.h b/src/ConnectionContextData.h index f2af8f96..03cfc7df 100644 --- a/src/ConnectionContextData.h +++ b/src/ConnectionContextData.h @@ -27,11 +27,9 @@ #include "PrimitiveTypes.h" #include "DXTypes.h" -/* -------------------------------------------------------------------------- */ /* * Various types */ -/* -------------------------------------------------------------------------- */ typedef enum { dx_ccs_begin, @@ -53,11 +51,9 @@ typedef enum { typedef int (*dx_conn_ctx_subsys_manipulator_t) (dxf_connection_t connection); -/* -------------------------------------------------------------------------- */ /* * Subsystem initializer/deinitializer macros */ -/* -------------------------------------------------------------------------- */ #define DX_CONNECTION_SUBSYS_INIT_NAME(subsys_id) \ subsys_id##_init @@ -77,11 +73,9 @@ typedef int (*dx_conn_ctx_subsys_manipulator_t) (dxf_connection_t connection); #define DX_CONNECTION_SUBSYS_CHECK_PROTO(subsys_id) \ int DX_CONNECTION_SUBSYS_CHECK_NAME(subsys_id) (dxf_connection_t connection) -/* -------------------------------------------------------------------------- */ /* * Subsystem initializer/deinitializer prototypes */ -/* -------------------------------------------------------------------------- */ DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_network); DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_event_subscription); @@ -120,11 +114,9 @@ DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_snapshot_subscription); DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_price_level_book); DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_regional_book); -/* -------------------------------------------------------------------------- */ /* * Main functions */ -/* -------------------------------------------------------------------------- */ dxf_connection_t dx_init_connection (void); int dx_deinit_connection (dxf_connection_t connection); diff --git a/src/DXAddressParser.c b/src/DXAddressParser.c index 6d71e81e..d97e1eb9 100644 --- a/src/DXAddressParser.c +++ b/src/DXAddressParser.c @@ -98,8 +98,6 @@ static const char* schemes[] = { }; static const size_t scheme_count = sizeof(schemes) / sizeof(schemes[0]); -/* -------------------------------------------------------------------------- */ - static int dx_is_empty_entry(const char* entry_begin, const char* entry_end) { if (entry_begin >= entry_end) return true; @@ -111,8 +109,6 @@ static int dx_is_empty_entry(const char* entry_begin, const char* entry_end) { return false; } -/* -------------------------------------------------------------------------- */ - static const char* dx_find_first(const char* from, const char* to, int ch) { const char* pos = strchr(from, ch); if (pos > to) @@ -120,8 +116,6 @@ static const char* dx_find_first(const char* from, const char* to, int ch) { return pos; } -/* -------------------------------------------------------------------------- */ - static const char* dx_find_last(const char* from, const char* to, int ch) { char* substr = dx_ansi_create_string_src_len(from, to - from); char* pos = NULL; @@ -138,8 +132,6 @@ static const char* dx_find_last(const char* from, const char* to, int ch) { return from + offset; } -/* -------------------------------------------------------------------------- */ - static const char* dx_find_first_of_values(const char* from, const char* to, int first, int second) { const char* first_pos = dx_find_first(from, to, first); const char* second_pos = dx_find_first(from, to, second); @@ -150,14 +142,10 @@ static const char* dx_find_first_of_values(const char* from, const char* to, int return MIN(first_pos, second_pos); } -/* -------------------------------------------------------------------------- */ - static int dx_has_next(const char* next) { return next != NULL && *next != null_symbol; } -/* -------------------------------------------------------------------------- */ - static int dx_is_numeric(const char* str) { const char* next = str; if (str == NULL || strlen(str) == 0) @@ -169,8 +157,6 @@ static int dx_is_numeric(const char* str) { return true; } -/* -------------------------------------------------------------------------- */ - static int dx_get_next_entry(OUT const char** next, OUT const char** entry, OUT size_t* size) { if (entry == NULL || size == NULL || next == NULL) return dx_set_error_code(dx_ec_invalid_func_param_internal); @@ -206,8 +192,6 @@ static int dx_get_next_entry(OUT const char** next, OUT const char** entry, OUT return true; } -/* -------------------------------------------------------------------------- */ - static int dx_get_next_codec(OUT const char** next, const char* next_end, OUT const char** codec, OUT size_t* size) { if (codec == NULL || size == NULL || next == NULL) return dx_set_error_code(dx_ec_invalid_func_param_internal); @@ -235,8 +219,6 @@ static int dx_get_next_codec(OUT const char** next, const char* next_end, OUT co return true; } -/* -------------------------------------------------------------------------- */ - static int dx_get_codec_name(const char* codec, size_t codec_size, OUT const char** name, OUT size_t* name_size) { char* end = NULL; if (codec == NULL || name == NULL || name_size == NULL) { @@ -258,8 +240,6 @@ static int dx_get_codec_name(const char* codec, size_t codec_size, OUT const cha return true; } -/* -------------------------------------------------------------------------- */ - static int dx_get_codec_properties(const char* codec, size_t codec_size, OUT const char** props, OUT size_t* props_size) { const char* name; size_t name_size; @@ -286,8 +266,6 @@ static int dx_get_codec_properties(const char* codec, size_t codec_size, OUT con return true; } -/* -------------------------------------------------------------------------- */ - static int dx_get_next_property(OUT const char** next, OUT size_t* next_size, OUT const char** prop, OUT size_t* prop_size) { if (next == NULL || next_size == NULL || prop == NULL || prop_size == NULL) { return dx_set_error_code(dx_ec_invalid_func_param_internal); @@ -326,8 +304,6 @@ static int dx_get_next_property(OUT const char** next, OUT size_t* next_size, OU return true; } -/* -------------------------------------------------------------------------- */ - static int dx_get_host_port_string(const char* entry, size_t entry_size, OUT const char** address, OUT size_t* size) { const char* begin; const char* end; @@ -347,8 +323,6 @@ static int dx_get_host_port_string(const char* entry, size_t entry_size, OUT con return true; } -/* -------------------------------------------------------------------------- */ - static int dx_get_properties(const char* entry, size_t entry_size, OUT const char** props, OUT size_t* props_size) { const char* begin; const char* end; @@ -374,8 +348,6 @@ static int dx_get_properties(const char* entry, size_t entry_size, OUT const cha return true; } -/* -------------------------------------------------------------------------- */ - static void dx_free_property(OUT dx_address_property_t* prop) { if (prop == NULL) return; @@ -387,8 +359,6 @@ static void dx_free_property(OUT dx_address_property_t* prop) { prop->value = NULL; } -/* -------------------------------------------------------------------------- */ - //Note: free allocated memory for prop! static int dx_parse_property(const char* str, size_t size, OUT dx_address_property_t* prop) { const char* splitter = dx_find_first(str, str + size, property_value_splitter); @@ -410,8 +380,6 @@ static int dx_parse_property(const char* str, size_t size, OUT dx_address_proper return true; } -/* -------------------------------------------------------------------------- */ - int dx_codec_tls_copy(const dx_codec_tls_t* src, OUT dx_codec_tls_t* dest) { if (src == NULL || dest == NULL) return dx_set_error_code(dx_ec_invalid_func_param_internal); @@ -431,8 +399,6 @@ int dx_codec_tls_copy(const dx_codec_tls_t* src, OUT dx_codec_tls_t* dest) { return true; } -/* -------------------------------------------------------------------------- */ - void dx_codec_tls_free(dx_codec_tls_t* tls) { if (tls->key_store != NULL) dx_free(tls->key_store); @@ -448,8 +414,6 @@ void dx_codec_tls_free(dx_codec_tls_t* tls) { tls->trust_store_password = NULL; } -/* -------------------------------------------------------------------------- */ - static int dx_codec_tls_parser(const char* codec, size_t size, OUT dx_address_t* addr) { const char* next; size_t next_size; @@ -493,8 +457,6 @@ static int dx_codec_tls_parser(const char* codec, size_t size, OUT dx_address_t* return true; } -/* -------------------------------------------------------------------------- */ - int dx_codec_gzip_copy(const dx_codec_gzip_t* src, OUT dx_codec_gzip_t* dest) { if (src == NULL || dest == NULL) return dx_set_error_code(dx_ec_invalid_func_param_internal); @@ -503,15 +465,11 @@ int dx_codec_gzip_copy(const dx_codec_gzip_t* src, OUT dx_codec_gzip_t* dest) { return true; } -/* -------------------------------------------------------------------------- */ - static int dx_codec_gzip_parser(const char* codec, size_t size, OUT dx_address_t* addr) { addr->gzip.enabled = true; return true; } -/* -------------------------------------------------------------------------- */ - static int dx_codec_parse(const char* codec, size_t codec_size, OUT dx_address_t* addr) { const char* codec_name; size_t codec_name_size; @@ -530,8 +488,6 @@ static int dx_codec_parse(const char* codec, size_t codec_size, OUT dx_address_t return dx_set_error_code(dx_nec_unknown_codec); } -/* -------------------------------------------------------------------------- */ - static int dx_parse_host_port(const char* host, size_t size, OUT dx_address_t* addr) { size_t i; const char* host_start = NULL; @@ -579,8 +535,6 @@ static int dx_parse_host_port(const char* host, size_t size, OUT dx_address_t* a return true; } -/* -------------------------------------------------------------------------- */ - static void dx_free_address(OUT dx_address_t* addr) { if (addr == NULL) return; @@ -597,8 +551,6 @@ static void dx_free_address(OUT dx_address_t* addr) { memset((void*)addr, 0, sizeof(dx_address_t)); } -/* -------------------------------------------------------------------------- */ - static int dx_parse_address(const char* entry, size_t entry_size, OUT dx_address_t* addr) { const char* next = entry; const char* next_end = entry + entry_size; @@ -668,8 +620,6 @@ static int dx_parse_address(const char* entry, size_t entry_size, OUT dx_address return true; } -/* -------------------------------------------------------------------------- */ - void dx_clear_address_array(dx_address_array_t* addresses) { size_t i = 0; @@ -685,8 +635,6 @@ void dx_clear_address_array(dx_address_array_t* addresses) { memset((void*)addresses, 0, sizeof(dx_address_array_t)); } -/* -------------------------------------------------------------------------- */ - int dx_get_addresses_from_collection(const char* collection, OUT dx_address_array_t* addresses) { char* collection_copied = NULL; const char* next = collection; diff --git a/src/DXAlgorithms.c b/src/DXAlgorithms.c index 3611401c..f008060e 100644 --- a/src/DXAlgorithms.c +++ b/src/DXAlgorithms.c @@ -18,10 +18,14 @@ */ #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #else # include # include @@ -36,21 +40,17 @@ #include #include -/* -------------------------------------------------------------------------- */ /* * Bit operations implementation */ -/* -------------------------------------------------------------------------- */ int dx_is_only_single_bit_set (int value) { return (value != 0 && (value & (value - 1)) == 0); } -/* -------------------------------------------------------------------------- */ /* * Random number generation functions implementation */ -/* -------------------------------------------------------------------------- */ static dxf_ulong_t dx_seed; @@ -65,24 +65,18 @@ static void dx_init_randomizer (void) { } } -/* -------------------------------------------------------------------------- */ - int dx_random_integer (int max_value) { dx_init_randomizer(); return (int)((long long)max_value * (unsigned int)rand() / RAND_MAX); } -/* -------------------------------------------------------------------------- */ - double dx_random_double (double max_value) { dx_init_randomizer(); return max_value / RAND_MAX * rand(); } -/* -------------------------------------------------------------------------- */ - size_t dx_random_size(size_t max_value) { dx_init_randomizer(); //use 64bit xorshift64star @@ -92,11 +86,9 @@ size_t dx_random_size(size_t max_value) { return (size_t)(max_value * ((double)(dx_seed * UINT64_C(2685821657736338717)) / ULLONG_MAX)); } -/* -------------------------------------------------------------------------- */ /* * Array functions implementation */ -/* -------------------------------------------------------------------------- */ int dx_capacity_manager_halfer (size_t new_size, size_t* capacity) { if (new_size > *capacity) { @@ -114,36 +106,26 @@ int dx_capacity_manager_halfer (size_t new_size, size_t* capacity) { return false; } -/* -------------------------------------------------------------------------- */ /* * String functions implementation */ -/* -------------------------------------------------------------------------- */ dxf_string_t dx_create_string (size_t size) { return (dxf_string_t)dx_calloc(size + 1, sizeof(dxf_char_t)); } -/* -------------------------------------------------------------------------- */ - dxf_string_t dx_create_string_src (dxf_const_string_t src) { return dx_create_string_src_len(src, dx_string_length(src)); } -/* -------------------------------------------------------------------------- */ - char* dx_ansi_create_string(size_t size) { return (char*)dx_calloc(size + 1, sizeof(char)); } -/* -------------------------------------------------------------------------- */ - char* dx_ansi_create_string_src(const char* src) { return dx_ansi_create_string_src_len(src, strlen(src)); } -/* -------------------------------------------------------------------------- */ - char* dx_ansi_create_string_src_len(const char* src, size_t len) { char* res = NULL; if (len == 0) { @@ -167,8 +149,6 @@ size_t dx_ansi_string_length(const char* str) { return strlen(str); } -/* -------------------------------------------------------------------------- */ - dxf_string_t dx_create_string_src_len(dxf_const_string_t src, size_t len) { dxf_string_t res = dx_create_string(len); @@ -179,20 +159,14 @@ dxf_string_t dx_create_string_src_len(dxf_const_string_t src, size_t len) { return dx_copy_string_len(res, src, len); } -/* -------------------------------------------------------------------------- */ - dxf_string_t dx_copy_string (dxf_string_t dest, dxf_const_string_t src) { return wcscpy(dest, src); } -/* -------------------------------------------------------------------------- */ - dxf_string_t dx_copy_string_len (dxf_string_t dest, dxf_const_string_t src, size_t len) { return wcsncpy(dest, src, len); } -/* -------------------------------------------------------------------------- */ - size_t dx_string_length (dxf_const_string_t str) { return wcslen(str); } @@ -201,8 +175,6 @@ int dx_string_null_or_empty(dxf_const_string_t str) { return str == NULL || dx_string_length(str) == 0; } -/* -------------------------------------------------------------------------- */ - int dx_compare_strings (dxf_const_string_t s1, dxf_const_string_t s2) { return wcscmp(s1, s2); } @@ -211,14 +183,10 @@ int dx_compare_strings_num(dxf_const_string_t s1, dxf_const_string_t s2, size_t return wcsncmp(s1, s2, num); } -/* -------------------------------------------------------------------------- */ - dxf_char_t dx_toupper (dxf_char_t c) { return towupper(c); } -/* -------------------------------------------------------------------------- */ - dxf_string_t dx_ansi_to_unicode (const char* ansi_str) { #ifdef _WIN32 size_t len = strlen(ansi_str); @@ -254,8 +222,6 @@ dxf_string_t dx_ansi_to_unicode (const char* ansi_str) { #endif /* _WIN32 */ } -/* -------------------------------------------------------------------------- */ - dxf_string_t dx_decode_from_integer (dxf_long_t code) { dxf_char_t decoded[8] = { 0 }; int offset = 0; @@ -277,11 +243,9 @@ dxf_string_t dx_concatenate_strings(dxf_string_t dest, dxf_const_string_t src) { return wcscat(dest, src); } -/* -------------------------------------------------------------------------- */ /* * Time functions implementation */ -/* -------------------------------------------------------------------------- */ int dx_millisecond_timestamp (void) { @@ -294,8 +258,6 @@ int dx_millisecond_timestamp (void) { #endif } -/* -------------------------------------------------------------------------- */ - int dx_millisecond_timestamp_diff (int newer, int older) { long long res = 0; @@ -365,8 +327,6 @@ dxf_ulong_t dx_microsecond_timestamp_diff(int newer_sample, void* newer, int old #endif } -/* -------------------------------------------------------------------------- */ - /** * Returns correct number of seconds with proper handling negative values and overflows. * Idea is that number of milliseconds shall be within [0..999] @@ -378,8 +338,6 @@ dxf_int_t dx_get_seconds_from_time(dxf_long_t millis) { (dxf_int_t)MAX((millis + 1) / DX_TIME_SECOND - 1, INT_MIN); } -/* -------------------------------------------------------------------------- */ - /** * Returns correct number of milliseconds with proper handling negative values. * Idea is that number of milliseconds shall be within [0..999] @@ -391,11 +349,9 @@ dxf_int_t dx_get_millis_from_time(dxf_long_t millis) { return r >= 0 ? r : r + (dxf_int_t)DX_TIME_SECOND; } -/* -------------------------------------------------------------------------- */ /* * Base64 encoding operations implementation */ -/* -------------------------------------------------------------------------- */ #define WHITESPACE 64 #define EQUALS 65 diff --git a/src/DXAlgorithms.h b/src/DXAlgorithms.h index aec47aca..e8cb0b69 100644 --- a/src/DXAlgorithms.h +++ b/src/DXAlgorithms.h @@ -28,19 +28,15 @@ #include "PrimitiveTypes.h" #include "DXMemory.h" -/* -------------------------------------------------------------------------- */ /* * Generic values */ -/* -------------------------------------------------------------------------- */ #define INVALID_INDEX (-1) -/* -------------------------------------------------------------------------- */ /* * Generic operations */ -/* -------------------------------------------------------------------------- */ #define DX_SWAP(type, e1, e2) \ do { \ @@ -109,11 +105,9 @@ } \ } while (false) -/* -------------------------------------------------------------------------- */ /* * Memory operations */ -/* -------------------------------------------------------------------------- */ #define CHECKED_FREE(ptr) \ do { \ @@ -139,11 +133,9 @@ dx_free((void*)array_ptr); \ } while (false) -/* -------------------------------------------------------------------------- */ /* * Bit operations */ -/* -------------------------------------------------------------------------- */ #define INDEX_BITMASK(index) \ (1 << (index)) @@ -165,21 +157,17 @@ int dx_is_only_single_bit_set (int value); -/* -------------------------------------------------------------------------- */ /* * Random number generation functions */ -/* -------------------------------------------------------------------------- */ int dx_random_integer (int max_value); double dx_random_double (double max_value); size_t dx_random_size(size_t max_value); -/* -------------------------------------------------------------------------- */ /* * Array constats */ -/* -------------------------------------------------------------------------- */ /* * Sets the empty array value. @@ -191,14 +179,12 @@ size_t dx_random_size(size_t max_value); */ #define DX_EMPTY_ARRAY { NULL, 0, 0 } -/* -------------------------------------------------------------------------- */ /* * Array operations and functions * A set of operations implementing various array algorithms: search, * insertion, deletion etc */ -/* -------------------------------------------------------------------------- */ /* * Binary search @@ -244,7 +230,6 @@ size_t dx_random_size(size_t max_value); } \ } while (false) -/* -------------------------------------------------------------------------- */ /* * Search @@ -284,7 +269,6 @@ size_t dx_random_size(size_t max_value); } \ } while (false) -/* -------------------------------------------------------------------------- */ /* * Insertion @@ -345,7 +329,6 @@ size_t dx_random_size(size_t max_value); ++((array_obj).size); \ } while (false) -/* -------------------------------------------------------------------------- */ /* * Deletion @@ -404,7 +387,6 @@ size_t dx_random_size(size_t max_value); --((array_obj).size); \ } while (false) -/* -------------------------------------------------------------------------- */ /* * Shuffle * Shuffles the array elements in a random order. @@ -425,7 +407,6 @@ size_t dx_random_size(size_t max_value); } \ } while (false) -/* -------------------------------------------------------------------------- */ /* * Reservation @@ -465,7 +446,6 @@ size_t dx_random_size(size_t max_value); (array_obj).size = reserve_size; \ } while (false) -/* -------------------------------------------------------------------------- */ /* * Functions and predicates used in array operations */ @@ -473,15 +453,11 @@ size_t dx_random_size(size_t max_value); #define DX_FORCED_NUMERIC_COMPARATOR(l, r) (((dxf_ulong_t)(l)>(dxf_ulong_t)(r)?1:((dxf_ulong_t)(l)<(dxf_ulong_t)(r)?-1:0))) -/* -------------------------------------------------------------------------- */ - int dx_capacity_manager_halfer (size_t new_size, size_t* capacity); -/* -------------------------------------------------------------------------- */ /* * String functions */ -/* -------------------------------------------------------------------------- */ dxf_string_t dx_create_string (size_t size); dxf_string_t dx_create_string_src (dxf_const_string_t src); @@ -504,22 +480,18 @@ dxf_string_t dx_ansi_to_unicode (const char* ansi_str); dxf_string_t dx_decode_from_integer (dxf_long_t code); dxf_string_t dx_concatenate_strings(dxf_string_t dest, dxf_const_string_t src); -/* -------------------------------------------------------------------------- */ /* * Time constants */ -/* -------------------------------------------------------------------------- */ /** * Number of milliseconds in a second. */ static const dxf_long_t DX_TIME_SECOND = 1000L; -/* -------------------------------------------------------------------------- */ /* * Time functions */ -/* -------------------------------------------------------------------------- */ int dx_millisecond_timestamp (void); int dx_millisecond_timestamp_diff (int newer, int older); @@ -543,11 +515,9 @@ dxf_int_t dx_get_seconds_from_time(dxf_long_t millis); */ dxf_int_t dx_get_millis_from_time(dxf_long_t millis); -/* -------------------------------------------------------------------------- */ /* * Base64 encoding operations implementation */ -/* -------------------------------------------------------------------------- */ int dx_base64_encode(const char* in, size_t in_len, char* out, size_t out_len); int dx_base64_decode(const char* in, size_t in_len, char* out, size_t *out_len); diff --git a/src/DXErrorCodes.c b/src/DXErrorCodes.c index 47b27adb..66a0a0c3 100644 --- a/src/DXErrorCodes.c +++ b/src/DXErrorCodes.c @@ -19,11 +19,9 @@ #include "DXErrorCodes.h" -/* -------------------------------------------------------------------------- */ /* * Message description functions implementation */ -/* -------------------------------------------------------------------------- */ dxf_const_string_t dx_get_error_description (dx_error_code_t code) { switch (code) { diff --git a/src/DXErrorHandling.c b/src/DXErrorHandling.c index c380cc80..40681659 100644 --- a/src/DXErrorHandling.c +++ b/src/DXErrorHandling.c @@ -22,10 +22,14 @@ */ #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #endif /* _WIN32 */ #include "DXErrorHandling.h" @@ -34,19 +38,15 @@ #include "DXThreads.h" #include "DXMemory.h" -/* -------------------------------------------------------------------------- */ /* * Thread-specific stuff */ -/* -------------------------------------------------------------------------- */ static int g_initialization_attempted = false; static dx_key_t g_last_error_data_key; static dx_error_code_t g_master_thread_last_error_code = dx_ec_success; -/* -------------------------------------------------------------------------- */ - static void dx_key_data_destructor (void* data) { if (data != &g_master_thread_last_error_code && data != NULL) { dx_free(data); @@ -60,11 +60,9 @@ static void dx_key_remover(void *data) { } } -/* -------------------------------------------------------------------------- */ /* * Internal error handling helpers */ -/* -------------------------------------------------------------------------- */ dx_error_function_result_t dx_check_error_code (dx_error_code_t error_code) { if (error_code < 0 || error_code >= dx_ec_count) { @@ -74,11 +72,9 @@ dx_error_function_result_t dx_check_error_code (dx_error_code_t error_code) { return dx_efr_success; } -/* -------------------------------------------------------------------------- */ /* * Error manipulation functions implementation */ -/* -------------------------------------------------------------------------- */ dx_error_function_result_t dx_set_last_error(dx_error_code_t error_code) { return dx_set_last_error_impl(error_code, true); @@ -123,8 +119,6 @@ dx_error_function_result_t dx_set_last_error_impl(dx_error_code_t error_code, in return dx_efr_success; } -/* -------------------------------------------------------------------------- */ - dx_error_function_result_t dx_get_last_error (int* error_code) { dx_error_code_t* error_data = NULL; @@ -155,14 +149,10 @@ dx_error_function_result_t dx_get_last_error (int* error_code) { return dx_efr_success; } -/* -------------------------------------------------------------------------- */ - int dx_pop_last_error () { return (dx_set_last_error(dx_ec_success) == dx_efr_success); } -/* -------------------------------------------------------------------------- */ - int dx_init_error_subsystem (void) { dx_error_code_t* error_data = NULL; @@ -209,11 +199,9 @@ int dx_init_error_subsystem (void) { return true; } -/* -------------------------------------------------------------------------- */ /* * Convenient helper functions implementation */ -/* -------------------------------------------------------------------------- */ dx_error_code_t dx_get_error_code (void) { int code; @@ -225,8 +213,6 @@ dx_error_code_t dx_get_error_code (void) { } } -/* -------------------------------------------------------------------------- */ - int dx_set_error_code (dx_error_code_t code) { return dx_set_error_code_impl(code, true); } diff --git a/src/DXErrorHandling.h b/src/DXErrorHandling.h index 105ce3f3..f5308354 100644 --- a/src/DXErrorHandling.h +++ b/src/DXErrorHandling.h @@ -28,11 +28,9 @@ #include "DXErrorCodes.h" #include "DXTypes.h" -/* -------------------------------------------------------------------------- */ /* * Error subsystem function return value roster */ -/* -------------------------------------------------------------------------- */ typedef enum { dx_efr_success, @@ -40,11 +38,10 @@ typedef enum { dx_efr_error_subsys_init_failure } dx_error_function_result_t; -/* -------------------------------------------------------------------------- */ /* * The error manipulation functions */ -/* -------------------------------------------------------------------------- */ + /* * Reports an error. @@ -62,7 +59,6 @@ dx_error_function_result_t dx_set_last_error(dx_error_code_t error_code); dx_error_function_result_t dx_set_last_error_impl(dx_error_code_t error_code, int with_logging); -/* -------------------------------------------------------------------------- */ /* * Retrieves an information about a previously reported error. @@ -79,7 +75,6 @@ dx_error_function_result_t dx_set_last_error_impl(dx_error_code_t error_code, in dx_error_function_result_t dx_get_last_error (int* error_code); -/* -------------------------------------------------------------------------- */ /* * Erases the information about the last reported error, thus making the subsequent successful 'dx_get_last_error' calls return 'dx_ec_success' @@ -96,7 +91,6 @@ dx_error_function_result_t dx_get_last_error (int* error_code); int dx_pop_last_error (); -/* -------------------------------------------------------------------------- */ /* * Explicitly initializes the error subsystem. Should not be called unless you know what you're doing. @@ -111,11 +105,9 @@ int dx_pop_last_error (); int dx_init_error_subsystem (void); -/* -------------------------------------------------------------------------- */ /* * Convenient helper functions */ -/* -------------------------------------------------------------------------- */ /* * Returns the currently stored error code. diff --git a/src/DXFeed.c b/src/DXFeed.c index b1220957..e4510d0f 100644 --- a/src/DXFeed.c +++ b/src/DXFeed.c @@ -50,11 +50,9 @@ static dxf_const_string_t wildcard_symbol = L"*"; -/* -------------------------------------------------------------------------- */ /* * Auxiliary internal functions */ -/* -------------------------------------------------------------------------- */ int dx_subscribe(dxf_connection_t connection, dx_order_source_array_ptr_t order_source, dxf_const_string_t *symbols, size_t symbols_count, int *symbols_indices_to_subscribe, int symbols_indices_count, int event_types, @@ -64,19 +62,15 @@ int dx_subscribe(dxf_connection_t connection, dx_order_source_array_ptr_t order_ false, subscr_flags, time); } -/* -------------------------------------------------------------------------- */ - int dx_unsubscribe(dxf_connection_t connection, dx_order_source_array_ptr_t order_source, dxf_const_string_t *symbols, size_t symbols_count, int event_types, dxf_uint_t subscr_flags, dxf_long_t time) { return dx_subscribe_symbols_to_events(connection, order_source, symbols, symbols_count, NULL, 0, event_types, true, false, subscr_flags, time); } -/* -------------------------------------------------------------------------- */ /* * Delayed tasks data */ -/* -------------------------------------------------------------------------- */ typedef struct { dxf_connection_t *elements; @@ -89,8 +83,6 @@ typedef struct { static dx_connection_array_t g_connection_queue = {0}; -/* -------------------------------------------------------------------------- */ - int dx_queue_connection_for_close(dxf_connection_t connection) { int conn_exists = false; size_t conn_index; @@ -122,8 +114,6 @@ int dx_queue_connection_for_close(dxf_connection_t connection) { return dx_mutex_unlock(&g_connection_queue.guard); } -/* -------------------------------------------------------------------------- */ - void dx_close_queued_connections(void) { size_t i = 0; @@ -149,8 +139,6 @@ void dx_close_queued_connections(void) { dx_mutex_unlock(&g_connection_queue.guard); } -/* -------------------------------------------------------------------------- */ - void dx_init_connection_queue(void) { static int initialized = false; @@ -161,15 +149,11 @@ void dx_init_connection_queue(void) { } } -/* -------------------------------------------------------------------------- */ - void dx_perform_implicit_tasks(void) { dx_init_connection_queue(); dx_close_queued_connections(); } -/* -------------------------------------------------------------------------- */ - ERRORCODE dx_perform_common_actions(int resetError) { dx_perform_implicit_tasks(); @@ -191,8 +175,6 @@ static ERRORCODE dx_init_codec() { return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - ERRORCODE dx_close_subscription(dxf_subscription_t subscription, int resetError) { dxf_connection_t connection; unsigned events; @@ -224,19 +206,15 @@ ERRORCODE dx_close_subscription(dxf_subscription_t subscription, int resetError) return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ /* * DXFeed API constants */ -/* -------------------------------------------------------------------------- */ #define DEFAULT_SUBSCRIPTION_TIME 0 -/* -------------------------------------------------------------------------- */ /* * DXFeed API implementation */ -/* -------------------------------------------------------------------------- */ DXFEED_API ERRORCODE dxf_create_connection_impl(const char *address, const char *authscheme, const char *authdata, dxf_conn_termination_notifier_t notifier, @@ -296,8 +274,6 @@ DXFEED_API ERRORCODE dxf_create_connection_impl(const char *address, const char return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_create_connection(const char *address, dxf_conn_termination_notifier_t notifier, dxf_conn_status_notifier_t conn_status_notifier, dxf_socket_thread_creation_notifier_t stcn, @@ -314,8 +290,6 @@ DXFEED_API ERRORCODE dxf_create_connection(const char *address, dxf_conn_termina return result; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_create_connection_auth_basic(const char *address, const char *user, const char *password, dxf_conn_termination_notifier_t notifier, dxf_conn_status_notifier_t conn_status_notifier, @@ -357,8 +331,6 @@ DXFEED_API ERRORCODE dxf_create_connection_auth_basic(const char *address, const return res; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_create_connection_auth_bearer(const char *address, const char *token, dxf_conn_termination_notifier_t notifier, dxf_conn_status_notifier_t conn_status_notifier, @@ -386,8 +358,6 @@ DXFEED_API ERRORCODE dxf_create_connection_auth_bearer(const char *address, cons return res; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_create_connection_auth_custom(const char *address, const char *authscheme, const char *authdata, dxf_conn_termination_notifier_t notifier, dxf_conn_status_notifier_t conn_status_notifier, @@ -440,8 +410,6 @@ DXFEED_API ERRORCODE dxf_set_on_server_heartbeat_notifier(dxf_connection_t conne return res; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_close_connection(dxf_connection_t connection) { dx_logging_verbose(dx_ll_debug, L"dxf_close_connection(con = %p)", connection); @@ -466,8 +434,6 @@ DXFEED_API ERRORCODE dxf_close_connection(dxf_connection_t connection) { return (res ? DXF_SUCCESS : DXF_FAILURE); } -/* -------------------------------------------------------------------------- */ - ERRORCODE dxf_create_subscription_impl(dxf_connection_t connection, int event_types, dx_event_subscr_flag subscr_flags, dxf_long_t time, OUT dxf_subscription_t *subscription) { dx_perform_common_actions(DX_RESET_ERROR); @@ -485,7 +451,7 @@ ERRORCODE dxf_create_subscription_impl(dxf_connection_t connection, int event_ty return DXF_FAILURE; } - if ((*subscription = dx_create_event_subscription(connection, event_types, subscr_flags, time)) == + if ((*subscription = dx_create_event_subscription(connection, event_types, subscr_flags, time, 0)) == dx_invalid_subscription) { return DXF_FAILURE; } @@ -524,8 +490,6 @@ DXFEED_API ERRORCODE dxf_create_subscription_with_flags(dxf_connection_t connect return res; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_create_subscription_timed(dxf_connection_t connection, int event_types, dxf_long_t time, OUT dxf_subscription_t *subscription) { dx_logging_verbose(dx_ll_debug, @@ -571,8 +535,6 @@ DXFEED_API ERRORCODE dxf_close_subscription(dxf_subscription_t subscription) { return res; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_add_symbol(dxf_subscription_t subscription, dxf_const_string_t symbol) { dx_logging_verbose(dx_ll_debug, L"dxf_add_symbol(sub = %p, symbol = '%ls')", subscription, (symbol == NULL) ? L"NULL" : symbol); @@ -585,12 +547,8 @@ DXFEED_API ERRORCODE dxf_add_symbol(dxf_subscription_t subscription, dxf_const_s return res; } -/* -------------------------------------------------------------------------- */ - #define DX_WILDCARD_COMPARATOR(l, r) (dx_compare_strings_num(l, r, 1)) -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_add_symbols(dxf_subscription_t subscription, dxf_const_string_t *symbols, int symbol_count) { dx_perform_common_actions(DX_RESET_ERROR); @@ -644,7 +602,7 @@ DXFEED_API ERRORCODE dxf_add_symbols(dxf_subscription_t subscription, dxf_const_ size_t index; (void)index; - DX_ARRAY_SEARCH(symbols, 0, symbol_count, wildcard_symbol, DX_WILDCARD_COMPARATOR, false, found_wildcard, index); + DX_ARRAY_SEARCH(symbols, 0, (size_t)symbol_count, wildcard_symbol, DX_WILDCARD_COMPARATOR, false, found_wildcard, index); if (found_wildcard) { subscr_symbols = &wildcard_symbol; @@ -706,8 +664,6 @@ DXFEED_API ERRORCODE dxf_add_symbols(dxf_subscription_t subscription, dxf_const_ return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_remove_symbol(dxf_subscription_t subscription, dxf_const_string_t symbol) { dx_logging_verbose(dx_ll_debug, L"dxf_remove_symbol(sub = %p, symbol = '%ls')", subscription, symbol); @@ -718,8 +674,6 @@ DXFEED_API ERRORCODE dxf_remove_symbol(dxf_subscription_t subscription, dxf_cons return res; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_remove_symbols(dxf_subscription_t subscription, dxf_const_string_t *symbols, int symbol_count) { dx_perform_common_actions(DX_RESET_ERROR); @@ -765,7 +719,7 @@ DXFEED_API ERRORCODE dxf_remove_symbols(dxf_subscription_t subscription, dxf_con size_t index; (void)index; - DX_ARRAY_SEARCH(symbols, 0, symbol_count, wildcard_symbol, DX_WILDCARD_COMPARATOR, false, found_wildcard, index); + DX_ARRAY_SEARCH(symbols, 0, (size_t)symbol_count, wildcard_symbol, DX_WILDCARD_COMPARATOR, false, found_wildcard, index); if (found_wildcard) { dx_logging_verbose( @@ -821,8 +775,6 @@ DXFEED_API ERRORCODE dxf_remove_symbols(dxf_subscription_t subscription, dxf_con return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_get_symbols(dxf_subscription_t subscription, OUT dxf_const_string_t **symbols, OUT int *symbol_count) { dx_perform_common_actions(DX_RESET_ERROR); @@ -860,8 +812,6 @@ DXFEED_API ERRORCODE dxf_get_symbols(dxf_subscription_t subscription, OUT dxf_co return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_set_symbols(dxf_subscription_t subscription, dxf_const_string_t *symbols, int symbol_count) { dx_perform_common_actions(DX_RESET_ERROR); @@ -896,8 +846,6 @@ DXFEED_API ERRORCODE dxf_set_symbols(dxf_subscription_t subscription, dxf_const_ return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_clear_symbols(dxf_subscription_t subscription) { dxf_connection_t connection; unsigned events; @@ -951,8 +899,6 @@ DXFEED_API ERRORCODE dxf_clear_symbols(dxf_subscription_t subscription) { return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_attach_event_listener(dxf_subscription_t subscription, dxf_event_listener_t event_listener, void *user_data) { dx_logging_verbose(dx_ll_debug, L"dxf_attach_event_listener(sub = %p, listener = %p, user_data = %p)", subscription, @@ -986,8 +932,6 @@ DXFEED_API ERRORCODE dxf_attach_event_listener(dxf_subscription_t subscription, return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_detach_event_listener(dxf_subscription_t subscription, dxf_event_listener_t event_listener) { dx_logging_verbose(dx_ll_debug, L"dxf_detach_event_listener(sub = %p, listener = %p)", subscription, event_listener); @@ -1018,8 +962,6 @@ DXFEED_API ERRORCODE dxf_detach_event_listener(dxf_subscription_t subscription, return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_attach_event_listener_v2(dxf_subscription_t subscription, dxf_event_listener_v2_t event_listener, void *user_data) { dx_logging_verbose(dx_ll_debug, L"dxf_attach_event_listener_v2(sub = %p, listener = %p, user_data = %p)", @@ -1052,8 +994,6 @@ DXFEED_API ERRORCODE dxf_attach_event_listener_v2(dxf_subscription_t subscriptio return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_detach_event_listener_v2(dxf_subscription_t subscription, dxf_event_listener_v2_t event_listener) { dx_logging_verbose(dx_ll_debug, L"dxf_detach_event_listener_v2(sub = %p, listener = %p)", subscription, @@ -1085,8 +1025,6 @@ DXFEED_API ERRORCODE dxf_detach_event_listener_v2(dxf_subscription_t subscriptio return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_get_subscription_event_types(dxf_subscription_t subscription, OUT int *event_types) { dx_logging_verbose(dx_ll_debug, L"dxf_get_subscription_event_types(sub = %p, event_types = %p)", subscription, event_types); @@ -1121,8 +1059,6 @@ DXFEED_API ERRORCODE dxf_get_subscription_event_types(dxf_subscription_t subscri return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_get_last_event(dxf_connection_t connection, int event_type, dxf_const_string_t symbol, OUT dxf_event_data_t *data) { dx_logging_verbose(dx_ll_debug, L"dxf_get_last_event(con = %p, event_type = %d, symbol = '%ls', event data = %p)", @@ -1166,8 +1102,6 @@ DXFEED_API ERRORCODE dxf_get_last_event(dxf_connection_t connection, int event_t return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_get_last_error(OUT int *error_code, OUT dxf_const_string_t *error_descr) { dx_logging_verbose(dx_ll_debug, L"dxf_get_last_error(error_code = %p, error_descr = %p)", error_code, error_descr); @@ -1200,8 +1134,6 @@ DXFEED_API ERRORCODE dxf_get_last_error(OUT int *error_code, OUT dxf_const_strin return DXF_FAILURE; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_set_order_source(dxf_subscription_t subscription, const char *source) { dx_logging_verbose(dx_ll_debug, L"dxf_set_order_source(sub = %p, source = '%hs')", subscription, (source == NULL) ? "NULL" : source); @@ -1288,8 +1220,6 @@ DXFEED_API ERRORCODE dxf_set_order_source(dxf_subscription_t subscription, const return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_add_order_source(dxf_subscription_t subscription, const char *source) { dx_logging_verbose(dx_ll_debug, L"dxf_add_order_source(sub = %p, source = '%hs')", subscription, (source == NULL) ? "NULL" : source); @@ -1367,8 +1297,6 @@ DXFEED_API ERRORCODE dxf_add_order_source(dxf_subscription_t subscription, const return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - ERRORCODE dx_create_snapshot_impl(dxf_connection_t connection, dx_event_id_t event_id, dxf_const_string_t symbol, dxf_const_string_t source, dxf_long_t time, OUT dxf_snapshot_t *snapshot) { dxf_subscription_t subscription = NULL; @@ -1450,8 +1378,6 @@ ERRORCODE dx_create_snapshot_impl(dxf_connection_t connection, dx_event_id_t eve return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_create_snapshot(dxf_connection_t connection, dx_event_id_t event_id, dxf_const_string_t symbol, const char *source, dxf_long_t time, OUT dxf_snapshot_t *snapshot) { dx_logging_verbose(dx_ll_debug, @@ -1475,8 +1401,6 @@ DXFEED_API ERRORCODE dxf_create_snapshot(dxf_connection_t connection, dx_event_i return res; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_create_order_snapshot(dxf_connection_t connection, dxf_const_string_t symbol, const char *source, dxf_long_t time, OUT dxf_snapshot_t *snapshot) { dx_logging_verbose( @@ -1495,8 +1419,6 @@ DXFEED_API ERRORCODE dxf_create_order_snapshot(dxf_connection_t connection, dxf_ return res; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_create_candle_snapshot(dxf_connection_t connection, dxf_candle_attributes_t candle_attributes, dxf_long_t time, OUT dxf_snapshot_t *snapshot) { dx_logging_verbose( @@ -1528,8 +1450,6 @@ DXFEED_API ERRORCODE dxf_create_candle_snapshot(dxf_connection_t connection, dxf return res; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_close_snapshot(dxf_snapshot_t snapshot) { dx_logging_verbose(dx_ll_debug, L"dxf_close_snapshot(snapshot = %p)", snapshot); @@ -1559,8 +1479,6 @@ DXFEED_API ERRORCODE dxf_close_snapshot(dxf_snapshot_t snapshot) { return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_attach_snapshot_listener(dxf_snapshot_t snapshot, dxf_snapshot_listener_t snapshot_listener, void *user_data) { dx_logging_verbose(dx_ll_debug, L"dxf_attach_snapshot_listener(snapshot = %p, listener = %p, user data = %p)", @@ -1592,8 +1510,6 @@ DXFEED_API ERRORCODE dxf_attach_snapshot_listener(dxf_snapshot_t snapshot, dxf_s return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_detach_snapshot_listener(dxf_snapshot_t snapshot, dxf_snapshot_listener_t snapshot_listener) { dx_logging_verbose(dx_ll_debug, L"dxf_detach_snapshot_listener(snapshot = %p, listener = %p)", snapshot, snapshot_listener); @@ -1624,8 +1540,6 @@ DXFEED_API ERRORCODE dxf_detach_snapshot_listener(dxf_snapshot_t snapshot, dxf_s return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_attach_snapshot_inc_listener(dxf_snapshot_t snapshot, dxf_snapshot_inc_listener_t snapshot_listener, void *user_data) { dx_logging_verbose(dx_ll_debug, L"dxf_attach_snapshot_inc_listener(snapshot = %p, listener = %p, user data = %p)", @@ -1658,8 +1572,6 @@ DXFEED_API ERRORCODE dxf_attach_snapshot_inc_listener(dxf_snapshot_t snapshot, return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_detach_snapshot_inc_listener(dxf_snapshot_t snapshot, dxf_snapshot_inc_listener_t snapshot_listener) { dx_logging_verbose(dx_ll_debug, L"dxf_detach_snapshot_inc_listener(snapshot = %p, listener = %p)", snapshot, @@ -1691,8 +1603,6 @@ DXFEED_API ERRORCODE dxf_detach_snapshot_inc_listener(dxf_snapshot_t snapshot, return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_get_snapshot_symbol(dxf_snapshot_t snapshot, OUT dxf_string_t *symbol) { dx_logging_verbose(dx_ll_debug, L"dxf_get_snapshot_symbol(snapshot = %p, symbol ptr = %p)", snapshot, symbol); @@ -1802,8 +1712,6 @@ ERRORCODE dx_create_price_level_book_impl(dxf_connection_t connection, dxf_const return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_create_price_level_book(dxf_connection_t connection, dxf_const_string_t symbol, const char **sources, OUT dxf_price_level_book_t *book) { int sources_count = dx_get_sources_count(sources); @@ -1843,8 +1751,6 @@ DXFEED_API ERRORCODE dxf_create_price_level_book_v2(dxf_connection_t connection, return res; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_close_price_level_book(dxf_price_level_book_t book) { dx_logging_verbose(dx_ll_debug, L"dxf_close_price_level_book(book = %p)", book); @@ -1869,8 +1775,6 @@ DXFEED_API ERRORCODE dxf_close_price_level_book(dxf_price_level_book_t book) { return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_attach_price_level_book_listener(dxf_price_level_book_t book, dxf_price_level_book_listener_t book_listener, void *user_data) { @@ -1904,8 +1808,6 @@ DXFEED_API ERRORCODE dxf_attach_price_level_book_listener(dxf_price_level_book_t return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_detach_price_level_book_listener(dxf_price_level_book_t book, dxf_price_level_book_listener_t book_listener) { dx_logging_verbose(dx_ll_debug, L"dxf_detach_price_level_book_listener(book = %p, listener = %p)", book, @@ -2103,8 +2005,6 @@ DXFEED_API ERRORCODE dxf_create_regional_book(dxf_connection_t connection, dxf_c return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_close_regional_book(dxf_regional_book_t book) { dx_logging_verbose(dx_ll_debug, L"dxf_close_regional_book(book = %p)", book); dx_perform_common_actions(DX_RESET_ERROR); @@ -2130,8 +2030,6 @@ DXFEED_API ERRORCODE dxf_close_regional_book(dxf_regional_book_t book) { return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_attach_regional_book_listener(dxf_regional_book_t book, dxf_price_level_book_listener_t book_listener, void *user_data) { dx_logging_verbose(dx_ll_debug, L"dxf_attach_regional_book_listener(book = %p, listener = %p, user data = %p)", @@ -2164,8 +2062,6 @@ DXFEED_API ERRORCODE dxf_attach_regional_book_listener(dxf_regional_book_t book, return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_detach_regional_book_listener(dxf_regional_book_t book, dxf_price_level_book_listener_t book_listener) { dx_logging_verbose(dx_ll_debug, L"dxf_detach_regional_book_listener(book = %p, listener = %p)", book, @@ -2196,8 +2092,6 @@ DXFEED_API ERRORCODE dxf_detach_regional_book_listener(dxf_regional_book_t book, return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_attach_regional_book_listener_v2(dxf_regional_book_t book, dxf_regional_quote_listener_t listener, void *user_data) { dx_logging_verbose(dx_ll_debug, L"dxf_attach_regional_book_listener_v2(book = %p, listener = %p, user data = %p)", @@ -2230,8 +2124,6 @@ DXFEED_API ERRORCODE dxf_attach_regional_book_listener_v2(dxf_regional_book_t bo return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_detach_regional_book_listener_v2(dxf_regional_book_t book, dxf_regional_quote_listener_t listener) { dx_logging_verbose(dx_ll_debug, L"dxf_detach_regional_book_listener_v2(book = %p, listener = %p)", book, listener); @@ -2262,8 +2154,6 @@ DXFEED_API ERRORCODE dxf_detach_regional_book_listener_v2(dxf_regional_book_t bo return DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - DXFEED_API ERRORCODE dxf_write_raw_data(dxf_connection_t connection, const char *raw_file_name) { if (!dx_add_raw_dump_file(connection, raw_file_name)) { return DXF_FAILURE; diff --git a/src/DXMemory.c b/src/DXMemory.c index 3fb6758e..108b4551 100644 --- a/src/DXMemory.c +++ b/src/DXMemory.c @@ -22,27 +22,30 @@ */ #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #endif #include "DXMemory.h" -#include "DXErrorHandling.h" -#include "DXErrorCodes.h" -#include "Logger.h" -#include #include +#include + +#include "DXErrorCodes.h" +#include "DXErrorHandling.h" +#include "Logger.h" -/* -------------------------------------------------------------------------- */ /* * Error related stuff */ -/* -------------------------------------------------------------------------- */ -void* dx_error_processor (void* src) { +void* dx_error_processor(void* src) { if (src == NULL) { dx_set_error_code(dx_mec_insufficient_memory); } @@ -50,91 +53,67 @@ void* dx_error_processor (void* src) { return src; } -/* -------------------------------------------------------------------------- */ /* * Memory function wrappers implementation */ -/* -------------------------------------------------------------------------- */ -void* dx_malloc (size_t size) { +void* dx_malloc(size_t size) { void* r = malloc(size); #ifdef _DEBUG_MEM dx_logging_dbg_lock(); dx_logging_dbg(L"ALLOC %Iu at 0x%016p", size, r); - dx_logging_dbg_stack(); dx_logging_dbg_unlock(); #endif return dx_error_processor(r); } -/* -------------------------------------------------------------------------- */ - -void* dx_calloc (size_t num, size_t size) { +void* dx_calloc(size_t num, size_t size) { void* r = calloc(num, size); #ifdef _DEBUG_MEM dx_logging_dbg_lock(); dx_logging_dbg(L"CALLOC %Iu * %Iu = %Iu at 0x%016p", size, num, size * num, r); - dx_logging_dbg_stack(); dx_logging_dbg_unlock(); #endif return dx_error_processor(r); } -/* -------------------------------------------------------------------------- */ - -void* dx_memcpy (void * destination, const void * source, size_t size) { - +void* dx_memcpy(void* destination, const void* source, size_t size) { return dx_error_processor(memcpy(destination, source, size)); } -/* -------------------------------------------------------------------------- */ - -void* dx_memmove (void * destination, const void * source, size_t size) { +void* dx_memmove(void* destination, const void* source, size_t size) { return dx_error_processor(memmove(destination, source, size)); } -/* -------------------------------------------------------------------------- */ +void* dx_memset(void* destination, int c, size_t size) { return dx_error_processor(memset(destination, c, size)); } -void* dx_memset (void * destination, int c, size_t size) { - return dx_error_processor(memset(destination, c, size)); -} - -/* -------------------------------------------------------------------------- */ - -void dx_free (void* buf) { +void dx_free(void* buf) { #ifdef _DEBUG_MEM dx_logging_dbg_lock(); dx_logging_dbg(L"FREE at 0x%016p", buf); - dx_logging_dbg_stack(); dx_logging_dbg_unlock(); #endif free(buf); } -/* -------------------------------------------------------------------------- */ /* * Implementation of wrappers with no error handling mechanism enabled */ -/* -------------------------------------------------------------------------- */ -void* dx_calloc_no_ehm (size_t num, size_t size) { - void *r = calloc(num, size); +void* dx_calloc_no_ehm(size_t num, size_t size) { + void* r = calloc(num, size); #ifdef _DEBUG_MEM dx_logging_dbg_lock(); dx_logging_dbg(L"CALLOC %Iu * %Iu = %Iu at 0x%016p", size, num, size * num, r); - dx_logging_dbg_stack(); dx_logging_dbg_unlock(); #endif return r; } -/* -------------------------------------------------------------------------- */ - -void dx_free_no_ehm (void* buf) { +void dx_free_no_ehm(void* buf) { #ifdef _DEBUG_MEM dx_logging_dbg_lock(); dx_logging_dbg(L"FREE at 0x%016p", buf); - dx_logging_dbg_stack(); dx_logging_dbg_unlock(); #endif free(buf); diff --git a/src/DXMemory.h b/src/DXMemory.h index 873399c9..26c9f4c3 100644 --- a/src/DXMemory.h +++ b/src/DXMemory.h @@ -30,11 +30,9 @@ extern "C" { #endif -/* -------------------------------------------------------------------------- */ /* * Memory function wrappers */ -/* -------------------------------------------------------------------------- */ void* dx_malloc(size_t size); void* dx_calloc(size_t num, size_t size); @@ -43,14 +41,12 @@ void* dx_memcpy(void* destination, const void* source, size_t size); void* dx_memmove(void* destination, const void* source, size_t size); void* dx_memset(void* destination, int c, size_t size); -/* -------------------------------------------------------------------------- */ /* * Memory function wrappers without error handling mechanism * May be useful when the internal error handling mechanism cannot be relied * upon, e.g. within its initialization. */ -/* -------------------------------------------------------------------------- */ void* dx_calloc_no_ehm(size_t num, size_t size); void dx_free_no_ehm(void* buf); diff --git a/src/DXNetwork.c b/src/DXNetwork.c index 4e10ba0d..1fe2e97a 100644 --- a/src/DXNetwork.c +++ b/src/DXNetwork.c @@ -44,11 +44,9 @@ #include "Logger.h" #include "ServerMessageProcessor.h" -/* -------------------------------------------------------------------------- */ /* * Internal structures and types */ -/* -------------------------------------------------------------------------- */ typedef struct addrinfo* dx_addrinfo_ptr; @@ -92,11 +90,9 @@ typedef struct tls* dx_tls; typedef struct tls_config* dx_tls_config; #endif // DXFEED_CODEC_TLS_ENABLED -/* -------------------------------------------------------------------------- */ /* * Network connection context */ -/* -------------------------------------------------------------------------- */ typedef struct { dxf_connection_t connection; @@ -158,8 +154,6 @@ static int g_tls_init_guard_initialized = false; #define DEFAULT_HEARTBEAT_PERIOD 10 #define DEFAULT_HEARTBEAT_TIMEOUT 120 -/* -------------------------------------------------------------------------- */ - int dx_clear_connection_data(dx_network_connection_context_t* context); DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_network) { @@ -209,8 +203,6 @@ DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_network) { return true; } -/* -------------------------------------------------------------------------- */ - static int dx_close_socket(dx_network_connection_context_t* context); DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_network) { @@ -242,8 +234,6 @@ DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_network) { return res; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_network) { int res = true; dx_network_connection_context_t* context = dx_get_subsystem_data(connection, dx_ccs_network, &res); @@ -277,35 +267,27 @@ int dx_set_on_server_heartbeat_notifier(dxf_connection_t connection, dxf_conn_on return true; } -/* -------------------------------------------------------------------------- */ /* * Common data */ -/* -------------------------------------------------------------------------- */ #define READ_CHUNK_SIZE 1024 #define TRUST_STORE_DEFAULT_NAME "ca_cert.pem" #define DX_PROPERTY_AUTH L"authorization" -/* -------------------------------------------------------------------------- */ /* * Helper functions */ -/* -------------------------------------------------------------------------- */ static void dx_protocol_property_clear(dx_network_connection_context_t* context); static int dx_protocol_property_make_backup(dx_network_connection_context_t* context); static int dx_protocol_property_restore_backup(dx_network_connection_context_t* context); -/* -------------------------------------------------------------------------- */ - #ifdef DXFEED_CODEC_TLS_ENABLED void tls_unload_file(uint8_t* buf, size_t len) { // Note: it is simple stub since current TLS API do not support unloading files } -/* -------------------------------------------------------------------------- */ - static void dx_logging_ansi_error(const char* ansi_error) { if (ansi_error == NULL) return; dxf_string_t w_error = dx_ansi_to_unicode(ansi_error); @@ -314,8 +296,6 @@ static void dx_logging_ansi_error(const char* ansi_error) { } #endif -/* -------------------------------------------------------------------------- */ - static dx_ext_address_t* dx_get_current_address(dx_network_connection_context_t* context) { if (context == NULL || context->addr_context.elements == NULL) { return NULL; @@ -324,8 +304,6 @@ static dx_ext_address_t* dx_get_current_address(dx_network_connection_context_t* return &(context->addr_context.elements[context->addr_context.cur_addr_index]); } -/* -------------------------------------------------------------------------- */ - void dx_clear_addr_context_data(dx_address_resolution_context_t* context_data) { if (context_data->elements_to_free != NULL) { int i = 0; @@ -390,8 +368,6 @@ void dx_clear_addr_context_data(dx_address_resolution_context_t* context_data) { } } -/* -------------------------------------------------------------------------- */ - int dx_clear_connection_data(dx_network_connection_context_t* context) { int set_fields_flags = 0; int success = true; @@ -448,8 +424,6 @@ int dx_clear_connection_data(dx_network_connection_context_t* context) { return success; } -/* -------------------------------------------------------------------------- */ - static int dx_close_socket(dx_network_connection_context_t* context) { int res = true; @@ -478,14 +452,10 @@ static int dx_close_socket(dx_network_connection_context_t* context) { return dx_mutex_unlock(&(context->socket_guard)) && res; } -/* -------------------------------------------------------------------------- */ - static int dx_have_credentials(dx_network_connection_context_t* context) { return dx_property_map_contains(&context->properties, DX_PROPERTY_AUTH); } -/* -------------------------------------------------------------------------- */ - void dx_notify_conn_termination(dx_network_connection_context_t* context, OUT int* idle_thread_flag) { // if connection required login and we have credentials - don't call notifier if (dx_connection_status_get(context->connection) == dxf_cs_login_required) { @@ -509,8 +479,6 @@ void dx_notify_conn_termination(dx_network_connection_context_t* context, OUT in dx_close_socket(context); } -/* -------------------------------------------------------------------------- */ - #if !defined(_WIN32) || defined(USE_PTHREADS) void* dx_queue_executor(void* arg) { #else @@ -544,11 +512,9 @@ unsigned dx_queue_executor(void* arg) { int queue_empty = true; if (context->queue_thread_termination_trigger) { - - break; + break; } - const time_t last_server_heartbeat = atomic_read_time(&context->last_server_heartbeat); if (last_server_heartbeat != 0 && difftime(time(NULL), last_server_heartbeat) >= context->heartbeat_timeout) { dx_logging_info(L"No messages from server for at least %d seconds. Disconnecting...", @@ -598,8 +564,6 @@ unsigned dx_queue_executor(void* arg) { return DX_THREAD_RETVAL_NULL; } -/* -------------------------------------------------------------------------- */ - void dx_socket_reader(dx_network_connection_context_t* context); #if !defined(_WIN32) || defined(USE_PTHREADS) @@ -676,8 +640,6 @@ int dx_read_from_file(dx_network_connection_context_t* context, char* read_buf, return true; } -/* -------------------------------------------------------------------------- */ - int dx_reestablish_connection(dx_network_connection_context_t* context); void dx_socket_reader(dx_network_connection_context_t* context) { @@ -773,8 +735,6 @@ void dx_socket_reader(dx_network_connection_context_t* context) { } } -/* -------------------------------------------------------------------------- */ - void dx_sleep_before_resolve(dx_network_connection_context_t* context) { static int RECONNECT_TIMEOUT = 100; @@ -788,14 +748,10 @@ void dx_sleep_before_resolve(dx_network_connection_context_t* context) { *last_res_timestamp = dx_millisecond_timestamp(); } -/* -------------------------------------------------------------------------- */ - void dx_shuffle_addrs(dx_address_resolution_context_t* addrs) { DX_ARRAY_SHUFFLE(addrs->elements, dx_ext_address_t, addrs->size); } -/* -------------------------------------------------------------------------- */ - static int dx_create_ext_address(const dx_address_t* source, OUT dx_ext_address_t* dest) { if (source == NULL || dest == NULL) return dx_set_error_code(dx_ec_invalid_func_param_internal); dx_memset((void*)dest, 0, sizeof(dx_ext_address_t)); @@ -832,8 +788,6 @@ static int dx_create_ext_address(const dx_address_t* source, OUT dx_ext_address_ return true; } -/* -------------------------------------------------------------------------- */ - int dx_resolve_address(dx_network_connection_context_t* context) { struct addrinfo hints; size_t i = 0; @@ -876,9 +830,9 @@ int dx_resolve_address(dx_network_connection_context_t* context) { } for (i = 0; i < addresses.size; ++i) { - if (context->is_closing) { - break; - } + if (context->is_closing) { + break; + } dx_addrinfo_ptr addr = NULL; dx_addrinfo_ptr cur_addr = NULL; @@ -932,8 +886,6 @@ int dx_resolve_address(dx_network_connection_context_t* context) { return true; } -/* -------------------------------------------------------------------------- */ - static int dx_connect_via_socket(dx_network_connection_context_t* context, dx_ext_address_t* address) { for (; address->cur_info_index < address->size; ++address->cur_info_index) { dx_addrinfo_ptr cur_addr = address->elements[address->cur_info_index]; @@ -960,8 +912,6 @@ static int dx_connect_via_socket(dx_network_connection_context_t* context, dx_ex return false; } -/* -------------------------------------------------------------------------- */ - #ifdef DXFEED_CODEC_TLS_ENABLED static int dx_connect_via_tls(dx_network_connection_context_t* context, dx_ext_address_t* address) { context->tls_config = tls_config_new(); @@ -1047,8 +997,6 @@ static int dx_connect_via_tls(dx_network_connection_context_t* context, dx_ext_a } #endif // DXFEED_CODEC_TLS_ENABLED -/* -------------------------------------------------------------------------- */ - int dx_connect_to_resolved_addresses(dx_network_connection_context_t* context) { dx_address_resolution_context_t* ctx = &(context->addr_context); @@ -1117,8 +1065,6 @@ int dx_connect_to_resolved_addresses(dx_network_connection_context_t* context) { return dx_mutex_unlock(&(context->socket_guard)); } -/* -------------------------------------------------------------------------- */ - static int dx_server_event_subscription_refresher(dxf_connection_t connection, dx_order_source_array_ptr_t order_source, dxf_const_string_t* symbols, size_t symbol_count, unsigned event_types, dxf_uint_t subscr_flags, dxf_long_t time) { @@ -1126,8 +1072,6 @@ static int dx_server_event_subscription_refresher(dxf_connection_t connection, d false, subscr_flags, time); } -/* ---------------------------------- */ - int dx_reestablish_connection(dx_network_connection_context_t* context) { // Cleanup task queue dx_cleanup_task_queue(context->tq); @@ -1166,11 +1110,9 @@ int dx_reestablish_connection(dx_network_connection_context_t* context) { return true; } -/* -------------------------------------------------------------------------- */ /* * Advanced network functions implementation */ -/* -------------------------------------------------------------------------- */ int dx_bind_to_address(dxf_connection_t connection, const char* address, const dx_connection_context_data_t* ccd) { dx_network_connection_context_t* context = NULL; @@ -1228,8 +1170,6 @@ int dx_bind_to_address(dxf_connection_t connection, const char* address, const d return true; } -/* -------------------------------------------------------------------------- */ - int dx_send_data(dxf_connection_t connection, const void* buffer, int buffer_size) { dx_network_connection_context_t* context = NULL; const char* char_buf = (const char*)buffer; @@ -1299,8 +1239,6 @@ int dx_send_data(dxf_connection_t connection, const void* buffer, int buffer_siz return dx_mutex_unlock(&(context->socket_guard)); } -/* -------------------------------------------------------------------------- */ - int dx_add_worker_thread_task(dxf_connection_t connection, dx_task_processor_t processor, void* data) { dx_network_connection_context_t* context = NULL; int res = true; @@ -1322,11 +1260,9 @@ int dx_add_worker_thread_task(dxf_connection_t connection, dx_task_processor_t p return dx_add_task_to_queue(context->tq, processor, data); } -/* -------------------------------------------------------------------------- */ /* * Connection status functions */ -/* -------------------------------------------------------------------------- */ const dxf_char_t* dx_get_connection_status_string(dxf_connection_status_t status) { static dxf_char_t* strings[(size_t)(dxf_cs_authorized + 1)] = {L"Not Connected", L"Connected", L"Login Required", @@ -1357,8 +1293,7 @@ void dx_connection_status_set(dxf_connection_t connection, dxf_connection_status dx_mutex_lock(&(context->status_guard)); old_status = context->status; dx_logging_verbose(dx_ll_info, L"Connection status changed %d (%ls) -> %d (%ls)", old_status, - dx_get_connection_status_string(old_status), status, - dx_get_connection_status_string(status)); + dx_get_connection_status_string(old_status), status, dx_get_connection_status_string(status)); context->status = status; dx_mutex_unlock(&(context->status_guard)); @@ -1372,8 +1307,6 @@ void dx_connection_status_set(dxf_connection_t connection, dxf_connection_status conn_status_notifier(connection, old_status, status, context->context_data.notifier_user_data); } -/* -------------------------------------------------------------------------- */ - dxf_connection_status_t dx_connection_status_get(dxf_connection_t connection) { dx_network_connection_context_t* context = NULL; dxf_connection_status_t status = dxf_cs_not_connected; @@ -1396,11 +1329,9 @@ dxf_connection_status_t dx_connection_status_get(dxf_connection_t connection) { return status; } -/* -------------------------------------------------------------------------- */ /* * Protocol properties functions */ -/* -------------------------------------------------------------------------- */ static void dx_protocol_property_clear(dx_network_connection_context_t* context) { if (context == NULL) return; @@ -1408,24 +1339,18 @@ static void dx_protocol_property_clear(dx_network_connection_context_t* context) dx_property_map_free_collection(&context->prop_backup); } -/* -------------------------------------------------------------------------- */ - static int dx_protocol_property_make_backup(dx_network_connection_context_t* context) { if (context == NULL) return dx_set_error_code(dx_ec_invalid_func_param_internal); return dx_property_map_clone(&context->properties, &context->prop_backup); } -/* -------------------------------------------------------------------------- */ - static int dx_protocol_property_restore_backup(dx_network_connection_context_t* context) { if (context == NULL) return dx_set_error_code(dx_ec_invalid_func_param_internal); dx_property_map_free_collection(&context->properties); return dx_property_map_clone(&context->prop_backup, &context->properties); } -/* -------------------------------------------------------------------------- */ - int dx_protocol_property_get_snapshot(dxf_connection_t connection, OUT dxf_property_item_t** ppProperties, OUT int* pSize) { if (ppProperties == NULL || pSize == NULL) { @@ -1450,7 +1375,7 @@ int dx_protocol_property_get_snapshot(dxf_connection_t connection, OUT dxf_prope dx_mutex_unlock(&pContext->socket_guard); return false; } - for (int i = 0; i < size; i++) { + for (size_t i = 0; i < size; i++) { pProperties[i].key = dx_create_string_src(pElements[i].key); pProperties[i].value = dx_create_string_src(pElements[i].value); } @@ -1479,8 +1404,6 @@ int dx_protocol_property_set(dxf_connection_t connection, dxf_const_string_t key return dx_property_map_set(&context->properties, key, value); } -/* -------------------------------------------------------------------------- */ - int dx_protocol_property_set_many(dxf_connection_t connection, const dx_property_map_t* other) { dx_network_connection_context_t* context = NULL; int res = true; @@ -1497,8 +1420,6 @@ int dx_protocol_property_set_many(dxf_connection_t connection, const dx_property return dx_property_map_set_many(&context->properties, other); } -/* -------------------------------------------------------------------------- */ - const dx_property_map_t* dx_protocol_property_get_all(dxf_connection_t connection) { dx_network_connection_context_t* context = NULL; int res = true; @@ -1515,8 +1436,6 @@ const dx_property_map_t* dx_protocol_property_get_all(dxf_connection_t connectio return (const dx_property_map_t*)&context->properties; } -/* -------------------------------------------------------------------------- */ - int dx_protocol_property_contains(dxf_connection_t connection, dxf_const_string_t key) { dx_network_connection_context_t* context = NULL; int res = true; @@ -1533,8 +1452,6 @@ int dx_protocol_property_contains(dxf_connection_t connection, dxf_const_string_ return dx_property_map_contains(&context->properties, key); } -/* -------------------------------------------------------------------------- */ - char* dx_protocol_get_basic_auth_data(const char* user, const char* password) { size_t credentials_size; size_t base64_size; @@ -1568,8 +1485,6 @@ char* dx_protocol_get_basic_auth_data(const char* user, const char* password) { return base64_buf; } -/* -------------------------------------------------------------------------- */ - int dx_protocol_configure_basic_auth(dxf_connection_t connection, const char* user, const char* password) { int res = true; char* base64_buf = dx_protocol_get_basic_auth_data(user, password); @@ -1581,8 +1496,6 @@ int dx_protocol_configure_basic_auth(dxf_connection_t connection, const char* us return res; } -/* -------------------------------------------------------------------------- */ - int dx_protocol_configure_custom_auth(dxf_connection_t connection, const char* authscheme, const char* authdata) { size_t buf_size; dxf_string_t buf; @@ -1668,19 +1581,19 @@ dx_connection_context_data_t* dx_get_connection_context_data(dxf_connection_t co } int dx_set_is_closing(dxf_connection_t connection) { - int res = true; + int res = true; - dx_network_connection_context_t* context = dx_get_subsystem_data(connection, dx_ccs_network, &res); + dx_network_connection_context_t* context = dx_get_subsystem_data(connection, dx_ccs_network, &res); - if (context == NULL) { - if (res) { - dx_set_error_code(dx_cec_connection_context_not_initialized); - } + if (context == NULL) { + if (res) { + dx_set_error_code(dx_cec_connection_context_not_initialized); + } - return false; - } + return false; + } - context->is_closing = true; + context->is_closing = true; - return res; + return res; } diff --git a/src/DXNetwork.h b/src/DXNetwork.h index e37eb397..2869110b 100644 --- a/src/DXNetwork.h +++ b/src/DXNetwork.h @@ -33,11 +33,9 @@ #define DX_AUTH_BASIC_KEY "Basic" #define DX_AUTH_BEARER_KEY "Bearer" -/* -------------------------------------------------------------------------- */ /* * Auxiliary structures and types */ -/* -------------------------------------------------------------------------- */ typedef int (*dx_socket_data_receiver_t) (dxf_connection_t connection, const void* buffer, int buffer_size); @@ -52,11 +50,10 @@ typedef struct dx_connection_context_data_t { void* on_server_heartbeat_notifier_user_data; } dx_connection_context_data_t; -/* -------------------------------------------------------------------------- */ /* * Advanced network functions */ -/* -------------------------------------------------------------------------- */ + /* * Binds the connection to the specified address with the given context. @@ -77,7 +74,7 @@ typedef struct dx_connection_context_data_t { int dx_bind_to_address (dxf_connection_t connection, const char* address, const dx_connection_context_data_t* ccd); -/* -------------------------------------------------------------------------- */ + /* * Sends a portion data via a previously bound connection. @@ -93,7 +90,6 @@ int dx_bind_to_address (dxf_connection_t connection, const char* address, int dx_send_data (dxf_connection_t connection, const void* buffer, int buffer_size); -/* -------------------------------------------------------------------------- */ /* * Adds a task for a socket reader thread. The task is put into a special queue. * The task queue is executed on each iteration of the internal infinite loop @@ -113,20 +109,16 @@ int dx_send_data (dxf_connection_t connection, const void* buffer, int buffer_si int dx_add_worker_thread_task (dxf_connection_t connection, dx_task_processor_t processor, void* data); -/* -------------------------------------------------------------------------- */ /* * Connection status functions */ -/* -------------------------------------------------------------------------- */ void dx_connection_status_set(dxf_connection_t connection, dxf_connection_status_t status); dxf_connection_status_t dx_connection_status_get(dxf_connection_t connection); -/* -------------------------------------------------------------------------- */ /* * Protocol properties functions */ -/* -------------------------------------------------------------------------- */ int dx_protocol_property_get_snapshot(dxf_connection_t connection, OUT dxf_property_item_t** ppProperties, OUT int* pSize); diff --git a/src/DXPMessageData.c b/src/DXPMessageData.c index 28d6b4b2..11511963 100644 --- a/src/DXPMessageData.c +++ b/src/DXPMessageData.c @@ -22,11 +22,9 @@ #include "DXErrorCodes.h" #include "DXAlgorithms.h" -/* -------------------------------------------------------------------------- */ /* * Message roster structures */ -/* -------------------------------------------------------------------------- */ static const int g_send_msg_roster[] = { /* the messages our application is able and is going to send */ @@ -54,11 +52,9 @@ static const int g_recv_msg_roster[] = { static const int g_send_msg_count = sizeof(g_send_msg_roster) / sizeof(g_send_msg_roster[0]); static const int g_recv_msg_count = sizeof(g_recv_msg_roster) / sizeof(g_recv_msg_roster[0]); -/* -------------------------------------------------------------------------- */ /* * Message type validation functions implementation */ -/* -------------------------------------------------------------------------- */ int dx_is_message_type_valid (int type) { return type == MESSAGE_HEARTBEAT || @@ -79,16 +75,12 @@ int dx_is_message_type_valid (int type) { type == MESSAGE_TEXT_FORMAT; } -/* -------------------------------------------------------------------------- */ - int dx_is_data_message (int type) { return type == MESSAGE_TICKER_DATA || type == MESSAGE_STREAM_DATA || type == MESSAGE_HISTORY_DATA; } -/* -------------------------------------------------------------------------- */ - int dx_is_subscription_message (int type) { return type == MESSAGE_TICKER_ADD_SUBSCRIPTION || type == MESSAGE_TICKER_REMOVE_SUBSCRIPTION || @@ -98,39 +90,29 @@ int dx_is_subscription_message (int type) { type == MESSAGE_HISTORY_REMOVE_SUBSCRIPTION; } -/* -------------------------------------------------------------------------- */ /* * Message roster functions implementation */ -/* -------------------------------------------------------------------------- */ const int* dx_get_send_message_roster (void) { return g_send_msg_roster; } -/* -------------------------------------------------------------------------- */ - int dx_get_send_message_roster_size (void) { return g_send_msg_count; } -/* -------------------------------------------------------------------------- */ - const int* dx_get_recv_message_roster (void) { return g_recv_msg_roster; } -/* -------------------------------------------------------------------------- */ - int dx_get_recv_message_roster_size (void) { return g_recv_msg_count; } -/* -------------------------------------------------------------------------- */ /* * Miscellaneous message functions implementation */ -/* -------------------------------------------------------------------------- */ dxf_const_string_t dx_get_message_type_name (int type) { switch (type){ diff --git a/src/DXPMessageData.h b/src/DXPMessageData.h index bf48f861..3fe598f2 100644 --- a/src/DXPMessageData.h +++ b/src/DXPMessageData.h @@ -23,11 +23,9 @@ #include "DXTypes.h" #include "PrimitiveTypes.h" -/* -------------------------------------------------------------------------- */ /* * Message types */ -/* -------------------------------------------------------------------------- */ typedef enum { /* @@ -103,32 +101,26 @@ typedef enum { MESSAGE_GZIP_COMPRESSION = 0x8b, // 139 decimal, '<' char } dx_message_type_t; -/* -------------------------------------------------------------------------- */ /* * Message type validation functions */ -/* -------------------------------------------------------------------------- */ int dx_is_message_type_valid(int type); int dx_is_data_message(int type); int dx_is_subscription_message(int type); -/* -------------------------------------------------------------------------- */ /* * Message roster functions */ -/* -------------------------------------------------------------------------- */ const int* dx_get_send_message_roster(void); int dx_get_send_message_roster_size(void); const int* dx_get_recv_message_roster(void); int dx_get_recv_message_roster_size(void); -/* -------------------------------------------------------------------------- */ /* * Miscellaneous message functions */ -/* -------------------------------------------------------------------------- */ dxf_const_string_t dx_get_message_type_name(int type); diff --git a/src/DXProperties.c b/src/DXProperties.c index e2505578..62dc6875 100644 --- a/src/DXProperties.c +++ b/src/DXProperties.c @@ -22,11 +22,9 @@ #include "DXErrorHandling.h" #include "DXProperties.h" -/* -------------------------------------------------------------------------- */ /* * Property map functions implementations */ -/* -------------------------------------------------------------------------- */ static void dx_property_map_free_item(void* obj) { if (obj == NULL) @@ -38,8 +36,6 @@ static void dx_property_map_free_item(void* obj) { dx_free(item->value); } -/* -------------------------------------------------------------------------- */ - void dx_property_map_free_collection(dx_property_map_t* props) { dx_property_item_t* item = props->elements; size_t i; @@ -52,14 +48,10 @@ void dx_property_map_free_collection(dx_property_map_t* props) { props->capacity = 0; } -/* -------------------------------------------------------------------------- */ - static inline int dx_property_item_comparator(dx_property_item_t item1, dx_property_item_t item2) { return dx_compare_strings((dxf_const_string_t)item1.key, (dxf_const_string_t)item2.key); } -/* -------------------------------------------------------------------------- */ - int dx_property_map_clone(const dx_property_map_t* src, dx_property_map_t* dest) { size_t i; int failed = false; @@ -80,14 +72,10 @@ int dx_property_map_clone(const dx_property_map_t* src, dx_property_map_t* dest) return true; } -/* -------------------------------------------------------------------------- */ - dxf_string_t dx_create_empty_string() { return (dxf_string_t)dx_calloc(1, sizeof(dxf_char_t)); } -/* -------------------------------------------------------------------------- */ - int dx_property_map_set(dx_property_map_t* props, dxf_const_string_t key, dxf_const_string_t value) { dx_property_item_t item = { (dxf_string_t)key, (dxf_string_t)value }; int found; @@ -125,8 +113,6 @@ int dx_property_map_set(dx_property_map_t* props, dxf_const_string_t key, dxf_co return true; } -/* -------------------------------------------------------------------------- */ - int dx_property_map_set_many(dx_property_map_t* props, const dx_property_map_t* other) { size_t i; dx_property_map_t temp = { 0 }; @@ -153,8 +139,6 @@ int dx_property_map_set_many(dx_property_map_t* props, const dx_property_map_t* return true; } -/* -------------------------------------------------------------------------- */ - int dx_property_map_contains(const dx_property_map_t* props, dxf_const_string_t key) { dx_property_item_t item = { (dxf_string_t)key, NULL }; int found; @@ -171,8 +155,6 @@ int dx_property_map_contains(const dx_property_map_t* props, dxf_const_string_t return found; } -/* -------------------------------------------------------------------------- */ - int dx_property_map_try_get_value(const dx_property_map_t* props, dxf_const_string_t key, OUT dxf_const_string_t* value) { diff --git a/src/DXProperties.h b/src/DXProperties.h index 24670b17..be192833 100644 --- a/src/DXProperties.h +++ b/src/DXProperties.h @@ -27,12 +27,10 @@ #include "PrimitiveTypes.h" #include "DXTypes.h" -/* -------------------------------------------------------------------------- */ /* * Property map functions implementations * Note: not fast map-dictionary realization, but enough for properties */ -/* -------------------------------------------------------------------------- */ typedef struct { dxf_string_t key; diff --git a/src/DXSockets.c b/src/DXSockets.c index 6e9f442f..88f59ec7 100644 --- a/src/DXSockets.c +++ b/src/DXSockets.c @@ -25,11 +25,9 @@ #include "DXThreads.h" #include "Logger.h" -/* -------------------------------------------------------------------------- */ /* * Socket error code functions */ -/* -------------------------------------------------------------------------- */ #ifdef _WIN32 dx_error_code_t dx_wsa_error_code_to_internal(int wsa_code) { @@ -206,11 +204,9 @@ dx_error_code_t dx_eai_code_to_internal(int code) { #endif -/* -------------------------------------------------------------------------- */ /* * Cross-implementation data */ -/* -------------------------------------------------------------------------- */ static const int g_name_resolution_attempt_count = 5; @@ -218,21 +214,17 @@ static int g_connection_count = 0; static dx_mutex_t g_count_guard; static int g_count_guard_initialized = false; -/* -------------------------------------------------------------------------- */ /* * Socket function wrappers * Win32 implementation */ -/* -------------------------------------------------------------------------- */ #ifdef _WIN32 -/* ---------------------------------- */ /* * Auxiliary stuff */ -/* ---------------------------------- */ int dx_init_socket_subsystem(void) { WORD wVersionRequested; @@ -255,8 +247,6 @@ int dx_init_socket_subsystem(void) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_deinit_socket_subsystem(void) { if (WSACleanup() == SOCKET_ERROR) { return dx_set_error_code(dx_wsa_error_code_to_internal(WSAGetLastError())); @@ -265,11 +255,9 @@ int dx_deinit_socket_subsystem(void) { return true; } -/* -------------------------------------------------------------------------- */ /* * Socket subsystem initialization implementation */ -/* -------------------------------------------------------------------------- */ int dx_on_connection_created(void) { if (!g_count_guard_initialized) { @@ -295,8 +283,6 @@ int dx_on_connection_created(void) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_on_connection_destroyed(void) { CHECKED_CALL(dx_mutex_lock, &g_count_guard); @@ -313,11 +299,9 @@ int dx_on_connection_destroyed(void) { return true; } -/* -------------------------------------------------------------------------- */ /* * DX socket API implementation */ -/* -------------------------------------------------------------------------- */ dx_socket_t dx_socket (int family, int type, int protocol) { dx_socket_t s = INVALID_SOCKET; @@ -329,8 +313,6 @@ dx_socket_t dx_socket (int family, int type, int protocol) { return s; } -/* -------------------------------------------------------------------------- */ - int dx_connect(dx_socket_t s, const struct sockaddr* addr, socklen_t addrlen) { if (connect(s, addr, addrlen) == SOCKET_ERROR) { return dx_set_error_code(dx_wsa_error_code_to_internal(WSAGetLastError())); @@ -339,8 +321,6 @@ int dx_connect(dx_socket_t s, const struct sockaddr* addr, socklen_t addrlen) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_send(dx_socket_t s, const void* buffer, int buflen) { int res = send(s, (const char*)buffer, buflen, 0); @@ -353,8 +333,6 @@ int dx_send(dx_socket_t s, const void* buffer, int buflen) { return res; } -/* -------------------------------------------------------------------------- */ - int dx_recv(dx_socket_t s, void* buffer, int buflen) { int res = recv(s, (char*)buffer, buflen, 0); @@ -374,8 +352,6 @@ int dx_recv(dx_socket_t s, void* buffer, int buflen) { return INVALID_DATA_SIZE; } -/* -------------------------------------------------------------------------- */ - int dx_close(dx_socket_t s) { if (shutdown(s, SD_BOTH) == INVALID_SOCKET) { closesocket(s); @@ -390,8 +366,6 @@ int dx_close(dx_socket_t s) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_getaddrinfo (const char* nodename, const char* servname, const struct addrinfo* hints, struct addrinfo** res) { int funres = 0; @@ -414,29 +388,21 @@ int dx_getaddrinfo (const char* nodename, const char* servname, return true; } -/* -------------------------------------------------------------------------- */ - void dx_freeaddrinfo(struct addrinfo* res) { freeaddrinfo(res); } #else -/* ---------------------------------- */ /* * Auxiliary stuff */ -/* ---------------------------------- */ int dx_init_socket_subsystem(void) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_deinit_socket_subsystem(void) { return true; } -/* -------------------------------------------------------------------------- */ /* * Socket subsystem initialization implementation */ -/* -------------------------------------------------------------------------- */ int dx_on_connection_created(void) { if (!g_count_guard_initialized) { @@ -462,8 +428,6 @@ int dx_on_connection_created(void) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_on_connection_destroyed(void) { CHECKED_CALL(dx_mutex_lock, &g_count_guard); @@ -480,11 +444,9 @@ int dx_on_connection_destroyed(void) { return true; } -/* -------------------------------------------------------------------------- */ /* * DX socket API implementation */ -/* -------------------------------------------------------------------------- */ dx_socket_t dx_socket(int family, int type, int protocol) { dx_socket_t s = INVALID_SOCKET; @@ -496,8 +458,6 @@ dx_socket_t dx_socket(int family, int type, int protocol) { return s; } -/* -------------------------------------------------------------------------- */ - int dx_connect(dx_socket_t s, const struct sockaddr* addr, socklen_t addrlen) { if (connect(s, addr, addrlen) == SOCKET_ERROR) { return dx_set_error_code(dx_errno_code_to_internal()); @@ -506,8 +466,6 @@ int dx_connect(dx_socket_t s, const struct sockaddr* addr, socklen_t addrlen) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_send(dx_socket_t s, const void* buffer, int buflen) { int res = send(s, (const char*)buffer, buflen, 0); @@ -520,8 +478,6 @@ int dx_send(dx_socket_t s, const void* buffer, int buflen) { return res; } -/* -------------------------------------------------------------------------- */ - int dx_recv(dx_socket_t s, void* buffer, int buflen) { int res = recv(s, (char*)buffer, buflen, 0); @@ -541,8 +497,6 @@ int dx_recv(dx_socket_t s, void* buffer, int buflen) { return INVALID_DATA_SIZE; } -/* -------------------------------------------------------------------------- */ - int dx_close(dx_socket_t s) { if (shutdown(s, SHUT_RDWR) == INVALID_SOCKET) { close(s); @@ -557,8 +511,6 @@ int dx_close(dx_socket_t s) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_getaddrinfo(const char* nodename, const char* servname, const struct addrinfo* hints, struct addrinfo** res) { int funres = 0; int iter_count = 0; @@ -580,8 +532,6 @@ int dx_getaddrinfo(const char* nodename, const char* servname, const struct addr return true; } -/* -------------------------------------------------------------------------- */ - void dx_freeaddrinfo(struct addrinfo* res) { freeaddrinfo(res); } #endif // _WIN32 diff --git a/src/DXSockets.h b/src/DXSockets.h index 214e4a0e..434f6bfb 100644 --- a/src/DXSockets.h +++ b/src/DXSockets.h @@ -27,11 +27,15 @@ #define DX_SOCKETS_H_INCLUDED #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif typedef SOCKET dx_socket_t; #else @@ -52,20 +56,16 @@ typedef int dx_socket_t; #define INVALID_DATA_SIZE (-1) -/* -------------------------------------------------------------------------- */ /* * Socket subsystem initialization */ -/* -------------------------------------------------------------------------- */ int dx_on_connection_created (void); int dx_on_connection_destroyed (void); -/* -------------------------------------------------------------------------- */ /* * Socket function wrappers */ -/* -------------------------------------------------------------------------- */ dx_socket_t dx_socket (int family, int type, int protocol); int dx_connect (dx_socket_t s, const struct sockaddr* addr, socklen_t addrlen); diff --git a/src/DXThreads.c b/src/DXThreads.c index 08e09536..5cea4bdf 100644 --- a/src/DXThreads.c +++ b/src/DXThreads.c @@ -18,200 +18,165 @@ */ #ifdef _WIN32 -#include +# include #endif #include -#include "DXThreads.h" -#include "DXErrorHandling.h" #include "DXErrorCodes.h" +#include "DXErrorHandling.h" #include "DXMemory.h" +#include "DXThreads.h" #include "Logger.h" -/* -------------------------------------------------------------------------- */ /* * Auxiliary functions implementation */ -/* -------------------------------------------------------------------------- */ #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif -void dx_sleep (int milliseconds) { - Sleep((DWORD)milliseconds); -} +void dx_sleep(int milliseconds) { Sleep((DWORD)milliseconds); } #else # include -void dx_sleep (int milliseconds) { +void dx_sleep(int milliseconds) { struct timespec ts; - ts.tv_sec = milliseconds / 1000; + ts.tv_sec = milliseconds / 1000; ts.tv_nsec = (milliseconds % 1000) * 1000000; nanosleep(&ts, NULL); } #endif /* _WIN32 */ - -/* -------------------------------------------------------------------------- */ - static dx_thread_t g_master_thread_id; -void dx_mark_thread_master (void) { - g_master_thread_id = dx_get_thread_id(); -} +void dx_mark_thread_master(void) { g_master_thread_id = dx_get_thread_id(); } -/* -------------------------------------------------------------------------- */ - -int dx_is_thread_master (void) { - return dx_compare_threads(dx_get_thread_id(), g_master_thread_id); -} +int dx_is_thread_master(void) { return dx_compare_threads(dx_get_thread_id(), g_master_thread_id); } -/* -------------------------------------------------------------------------- */ /* * Wrapper implementation */ -/* -------------------------------------------------------------------------- */ #ifdef USE_PTHREADS -int dx_thread_create (dx_thread_t* thread_id, const pthread_attr_t* attr, - dx_start_routine_t start_routine, void *arg) { +int dx_thread_create(dx_thread_t* thread_id, const pthread_attr_t* attr, dx_start_routine_t start_routine, void* arg) { int res = pthread_create(thread_id, attr, start_routine, arg); switch (res) { - case EAGAIN: - return dx_set_error_code(dx_tec_not_enough_sys_resources); - case EINVAL: - return dx_set_error_code(dx_tec_invalid_resource_id); - case EPERM: - return dx_set_error_code(dx_tec_permission_denied); - default: - return dx_set_error_code(dx_tec_generic_error); - case 0: - return true; + case EAGAIN: + return dx_set_error_code(dx_tec_not_enough_sys_resources); + case EINVAL: + return dx_set_error_code(dx_tec_invalid_resource_id); + case EPERM: + return dx_set_error_code(dx_tec_permission_denied); + default: + return dx_set_error_code(dx_tec_generic_error); + case 0: + return true; } } -/* -------------------------------------------------------------------------- */ - -int dx_wait_for_thread (dx_thread_t thread_id, void **value_ptr) { +int dx_wait_for_thread(dx_thread_t thread_id, void** value_ptr) { int res = pthread_join(thread_id, value_ptr); switch (res) { - case EINVAL: - return dx_set_error_code(dx_tec_invalid_res_operation); - case ESRCH: - return dx_set_error_code(dx_tec_invalid_resource_id); - case EDEADLK: - return dx_set_error_code(dx_tec_deadlock_detected); - default: - return dx_set_error_code(dx_tec_generic_error); - case 0: - return true; + case EINVAL: + return dx_set_error_code(dx_tec_invalid_res_operation); + case ESRCH: + return dx_set_error_code(dx_tec_invalid_resource_id); + case EDEADLK: + return dx_set_error_code(dx_tec_deadlock_detected); + default: + return dx_set_error_code(dx_tec_generic_error); + case 0: + return true; } } -/* -------------------------------------------------------------------------- */ - -int dx_close_thread_handle (dx_thread_t thread_id) { +int dx_close_thread_handle(dx_thread_t thread_id) { int res = pthread_detach(thread_id); switch (res) { - case EINVAL: - return dx_set_error_code(dx_tec_invalid_res_operation); - default: - return dx_set_error_code(dx_tec_generic_error); - case ESRCH: - /* for some reason this return value is given for a valid thread handle */ - - /* return dx_set_error_code(dx_tec_invalid_resource_id); */ - case 0: - return true; + case EINVAL: + return dx_set_error_code(dx_tec_invalid_res_operation); + default: + return dx_set_error_code(dx_tec_generic_error); + case ESRCH: + /* for some reason this return value is given for a valid thread handle */ + + /* return dx_set_error_code(dx_tec_invalid_resource_id); */ + case 0: + return true; } } -/* -------------------------------------------------------------------------- */ - -int dx_thread_data_key_create (dx_key_t* key, void (*destructor)(void*)) { +int dx_thread_data_key_create(dx_key_t* key, void (*destructor)(void*)) { int res = pthread_key_create(key, destructor); switch (res) { - case EAGAIN: - return dx_set_error_code(dx_tec_not_enough_sys_resources); - case ENOMEM: - return dx_set_error_code(dx_tec_not_enough_memory); - default: - return dx_set_error_code(dx_tec_generic_error); - case 0: - return true; + case EAGAIN: + return dx_set_error_code(dx_tec_not_enough_sys_resources); + case ENOMEM: + return dx_set_error_code(dx_tec_not_enough_memory); + default: + return dx_set_error_code(dx_tec_generic_error); + case 0: + return true; } } -/* -------------------------------------------------------------------------- */ - -int dx_thread_data_key_destroy (dx_key_t key) { +int dx_thread_data_key_destroy(dx_key_t key) { int res = pthread_key_delete(key); switch (res) { - case EINVAL: - return dx_set_error_code(dx_tec_invalid_resource_id); - default: - return dx_set_error_code(dx_tec_generic_error); - case 0: - return true; + case EINVAL: + return dx_set_error_code(dx_tec_invalid_resource_id); + default: + return dx_set_error_code(dx_tec_generic_error); + case 0: + return true; } } -/* -------------------------------------------------------------------------- */ - -int dx_set_thread_data (dx_key_t key, const void* data) { +int dx_set_thread_data(dx_key_t key, const void* data) { int res = pthread_setspecific(key, data); switch (res) { - case ENOMEM: - return dx_set_error_code(dx_tec_not_enough_memory); - case EINVAL: - return dx_set_error_code(dx_tec_invalid_resource_id); - default: - return dx_set_error_code(dx_tec_generic_error); - case 0: - return true; + case ENOMEM: + return dx_set_error_code(dx_tec_not_enough_memory); + case EINVAL: + return dx_set_error_code(dx_tec_invalid_resource_id); + default: + return dx_set_error_code(dx_tec_generic_error); + case 0: + return true; } } -/* -------------------------------------------------------------------------- */ - -void* dx_get_thread_data (dx_key_t key) { - return pthread_getspecific(key); -} - -/* -------------------------------------------------------------------------- */ - -dx_thread_t dx_get_thread_id () { - return pthread_self(); -} - -/* -------------------------------------------------------------------------- */ +void* dx_get_thread_data(dx_key_t key) { return pthread_getspecific(key); } -int dx_compare_threads (dx_thread_t t1, dx_thread_t t2) { - return (pthread_equal(t1, t2) != 0); -} +dx_thread_t dx_get_thread_id() { return pthread_self(); } -/* -------------------------------------------------------------------------- */ +int dx_compare_threads(dx_thread_t t1, dx_thread_t t2) { return (pthread_equal(t1, t2) != 0); } -int dx_mutex_create (dx_mutex_t* mutex) { +int dx_mutex_create(dx_mutex_t* mutex) { int res = pthread_mutexattr_init(&mutex->attr); switch (res) { - case ENOMEM: - return dx_set_error_code(dx_tec_not_enough_memory); - case EINVAL: - return dx_set_error_code(dx_tec_invalid_resource_id); - default: break; + case ENOMEM: + return dx_set_error_code(dx_tec_not_enough_memory); + case EINVAL: + return dx_set_error_code(dx_tec_invalid_resource_id); + default: + break; } res = pthread_mutexattr_settype(&mutex->attr, PTHREAD_MUTEX_RECURSIVE); @@ -223,97 +188,87 @@ int dx_mutex_create (dx_mutex_t* mutex) { res = pthread_mutex_init(&mutex->mutex, &mutex->attr); switch (res) { - case EAGAIN: - return dx_set_error_code(dx_tec_not_enough_sys_resources); - case ENOMEM: - return dx_set_error_code(dx_tec_not_enough_memory); - case EPERM: - return dx_set_error_code(dx_tec_permission_denied); - case EBUSY: - return dx_set_error_code(dx_tec_resource_busy); - case EINVAL: - return dx_set_error_code(dx_tec_invalid_resource_id); - default: - return dx_set_error_code(dx_tec_generic_error); - case 0: - return true; + case EAGAIN: + return dx_set_error_code(dx_tec_not_enough_sys_resources); + case ENOMEM: + return dx_set_error_code(dx_tec_not_enough_memory); + case EPERM: + return dx_set_error_code(dx_tec_permission_denied); + case EBUSY: + return dx_set_error_code(dx_tec_resource_busy); + case EINVAL: + return dx_set_error_code(dx_tec_invalid_resource_id); + default: + return dx_set_error_code(dx_tec_generic_error); + case 0: + return true; } } -/* -------------------------------------------------------------------------- */ - -int dx_mutex_destroy (dx_mutex_t* mutex) { +int dx_mutex_destroy(dx_mutex_t* mutex) { int res = pthread_mutex_destroy(&mutex->mutex); switch (res) { - case EBUSY: - return dx_set_error_code(dx_tec_resource_busy); - case EINVAL: - return dx_set_error_code(dx_tec_invalid_resource_id); - case 0: - break; - default: - return dx_set_error_code(dx_tec_generic_error); + case EBUSY: + return dx_set_error_code(dx_tec_resource_busy); + case EINVAL: + return dx_set_error_code(dx_tec_invalid_resource_id); + case 0: + break; + default: + return dx_set_error_code(dx_tec_generic_error); } res = pthread_mutexattr_destroy(&mutex->attr); switch (res) { - case ENOMEM: - return dx_set_error_code(dx_tec_not_enough_memory); - case EINVAL: - return dx_set_error_code(dx_tec_invalid_resource_id); - default: - return true; + case ENOMEM: + return dx_set_error_code(dx_tec_not_enough_memory); + case EINVAL: + return dx_set_error_code(dx_tec_invalid_resource_id); + default: + return true; } } -/* -------------------------------------------------------------------------- */ - -int dx_mutex_lock (dx_mutex_t* mutex) { +int dx_mutex_lock(dx_mutex_t* mutex) { int res = pthread_mutex_lock(&mutex->mutex); switch (res) { - case EINVAL: - return dx_set_error_code(dx_tec_invalid_resource_id); - case EAGAIN: - return dx_set_error_code(dx_tec_invalid_res_operation); - case EDEADLK: - return dx_set_error_code(dx_tec_deadlock_detected); - default: - return dx_set_error_code(dx_tec_generic_error); - case 0: - return true; + case EINVAL: + return dx_set_error_code(dx_tec_invalid_resource_id); + case EAGAIN: + return dx_set_error_code(dx_tec_invalid_res_operation); + case EDEADLK: + return dx_set_error_code(dx_tec_deadlock_detected); + default: + return dx_set_error_code(dx_tec_generic_error); + case 0: + return true; } } -/* -------------------------------------------------------------------------- */ - -int dx_mutex_unlock (dx_mutex_t* mutex) { +int dx_mutex_unlock(dx_mutex_t* mutex) { int res = pthread_mutex_unlock(&mutex->mutex); switch (res) { - case EINVAL: - return dx_set_error_code(dx_tec_invalid_resource_id); - case EAGAIN: - case EPERM: - return dx_set_error_code(dx_tec_invalid_res_operation); - default: - return dx_set_error_code(dx_tec_generic_error); - case 0: - return true; + case EINVAL: + return dx_set_error_code(dx_tec_invalid_resource_id); + case EAGAIN: + case EPERM: + return dx_set_error_code(dx_tec_invalid_res_operation); + default: + return dx_set_error_code(dx_tec_generic_error); + case 0: + return true; } } -/* -------------------------------------------------------------------------- */ /* * Implementation of wrappers without error handling mechanism */ -/* -------------------------------------------------------------------------- */ -int dx_set_thread_data_no_ehm (dx_key_t key, const void* data) { - return (pthread_setspecific(key, data) == 0); -} +int dx_set_thread_data_no_ehm(dx_key_t key, const void* data) { return (pthread_setspecific(key, data) == 0); } -#elif defined (USE_WIN32_THREADS) +#elif defined(USE_WIN32_THREADS) /* Wrapper for thread start function */ typedef struct dx_thread_wrapper_args_tag { @@ -322,7 +277,7 @@ typedef struct dx_thread_wrapper_args_tag { } dx_thread_wrapper_args_t; static unsigned __stdcall dx_thread_start_routine(void *a) { - dx_thread_wrapper_args_t *args = (dx_thread_wrapper_args_t*)a; + dx_thread_wrapper_args_t *args = (dx_thread_wrapper_args_t *)a; unsigned rv; rv = args->start_routine(args->args); dx_free(args); @@ -332,7 +287,7 @@ static unsigned __stdcall dx_thread_start_routine(void *a) { /* Way to process destructors for TLS */ typedef struct dx_data_key_destructor_tag { dx_key_t key; - void (*destructor)(void*); + void (*destructor)(void *); } dx_data_key_destructor_t; typedef struct dx_destructors_queue_tag { @@ -346,10 +301,8 @@ dx_destructors_queue_t g_key_destructors; static void dx_call_keys_destructor(void *arg) { int i; - if (g_key_destructors.count == 0) - return; - if (!dx_mutex_lock(&g_key_destructors.mutex)) - return; + if (g_key_destructors.count == 0) return; + if (!dx_mutex_lock(&g_key_destructors.mutex)) return; for (i = 0; i < g_key_destructors.count; i++) { void *data = dx_get_thread_data(g_key_destructors.destructors[i].key); @@ -359,11 +312,9 @@ static void dx_call_keys_destructor(void *arg) { dx_mutex_unlock(&g_key_destructors.mutex); } -static void dx_add_key_destructor(dx_key_t key, void (*destructor)(void*)) { - if (g_key_destructors.size == 0) - return; - if (!dx_mutex_lock(&g_key_destructors.mutex)) - return; +static void dx_add_key_destructor(dx_key_t key, void (*destructor)(void *)) { + if (g_key_destructors.size == 0) return; + if (!dx_mutex_lock(&g_key_destructors.mutex)) return; if (g_key_destructors.size == g_key_destructors.count) { dx_data_key_destructor_t *ds; g_key_destructors.size *= 2; @@ -380,13 +331,12 @@ static void dx_add_key_destructor(dx_key_t key, void (*destructor)(void*)) { static void dx_remove_key_destructor(dx_key_t key) { int i; - if (g_key_destructors.count == 0) - return; - if (!dx_mutex_lock(&g_key_destructors.mutex)) - return; + if (g_key_destructors.count == 0) return; + if (!dx_mutex_lock(&g_key_destructors.mutex)) return; for (i = 0; i < g_key_destructors.count; i++) { if (g_key_destructors.destructors[i].key == key) { - dx_memmove(&g_key_destructors.destructors[i], &g_key_destructors.destructors[i + 1], sizeof(*g_key_destructors.destructors) * (g_key_destructors.count - i - 1)); + dx_memmove(&g_key_destructors.destructors[i], &g_key_destructors.destructors[i + 1], + sizeof(*g_key_destructors.destructors) * (g_key_destructors.count - i - 1)); g_key_destructors.count--; break; } @@ -412,11 +362,11 @@ void dx_init_threads() { /* Public API */ -#if defined(_WIN32) -int dx_thread_create (dx_thread_t* thread_id, const void* attr, dx_start_routine_t start_routine, void *arg) -#else -int dx_thread_create (dx_thread_t* thread_id, const pthread_attr_t* attr, dx_start_routine_t start_routine, void *arg) -#endif +# if defined(_WIN32) +int dx_thread_create(dx_thread_t *thread_id, const void *attr, dx_start_routine_t start_routine, void *arg) +# else +int dx_thread_create(dx_thread_t *thread_id, const pthread_attr_t *attr, dx_start_routine_t start_routine, void *arg) +# endif { dx_thread_wrapper_args_t *wargs = dx_calloc(1, sizeof(*wargs)); @@ -428,132 +378,96 @@ int dx_thread_create (dx_thread_t* thread_id, const pthread_attr_t* attr, dx_sta return true; } switch (errno) { - case EAGAIN: - return dx_set_error_code(dx_tec_not_enough_sys_resources); - case EINVAL: - return dx_set_error_code(dx_tec_invalid_resource_id); - case EPERM: - return dx_set_error_code(dx_tec_permission_denied); - default: - return dx_set_error_code(dx_tec_generic_error); + case EAGAIN: + return dx_set_error_code(dx_tec_not_enough_sys_resources); + case EINVAL: + return dx_set_error_code(dx_tec_invalid_resource_id); + case EPERM: + return dx_set_error_code(dx_tec_permission_denied); + default: + return dx_set_error_code(dx_tec_generic_error); } } -/* -------------------------------------------------------------------------- */ - -int dx_wait_for_thread (dx_thread_t thread_id, void **value_ptr) { +int dx_wait_for_thread(dx_thread_t thread_id, void **value_ptr) { int res; res = WaitForSingleObject(thread_id, INFINITE); switch (res) { - case WAIT_FAILED: - return dx_set_error_code(dx_tec_invalid_res_operation); - case WAIT_ABANDONED: - return dx_set_error_code(dx_tec_invalid_resource_id); - case WAIT_TIMEOUT: - return dx_set_error_code(dx_tec_deadlock_detected); - default: - return dx_set_error_code(dx_tec_generic_error); - case WAIT_OBJECT_0: - if (value_ptr == NULL) - return true; - return GetExitCodeThread(thread_id, (LPDWORD)value_ptr); + case WAIT_FAILED: + return dx_set_error_code(dx_tec_invalid_res_operation); + case WAIT_ABANDONED: + return dx_set_error_code(dx_tec_invalid_resource_id); + case WAIT_TIMEOUT: + return dx_set_error_code(dx_tec_deadlock_detected); + default: + return dx_set_error_code(dx_tec_generic_error); + case WAIT_OBJECT_0: + if (value_ptr == NULL) return true; + return GetExitCodeThread(thread_id, (LPDWORD)value_ptr); } } -/* -------------------------------------------------------------------------- */ - -int dx_close_thread_handle (dx_thread_t thread_id) { +int dx_close_thread_handle(dx_thread_t thread_id) { if (CloseHandle(thread_id)) { return true; } return dx_set_error_code(dx_tec_generic_error); } -/* -------------------------------------------------------------------------- */ - -int dx_thread_data_key_create (dx_key_t* key, void (*destructor)(void*)) { +int dx_thread_data_key_create(dx_key_t *key, void (*destructor)(void *)) { *key = TlsAlloc(); - if (*key != TLS_OUT_OF_INDEXES) { - if (destructor != NULL) - dx_add_key_destructor(*key, destructor); + if (*key != TLS_OUT_OF_INDEXES) { + if (destructor != NULL) dx_add_key_destructor(*key, destructor); return true; } return dx_set_error_code(dx_tec_not_enough_memory); } -/* -------------------------------------------------------------------------- */ - -int dx_thread_data_key_destroy (dx_key_t key) { +int dx_thread_data_key_destroy(dx_key_t key) { dx_remove_key_destructor(key); TlsFree(key); return true; } -/* -------------------------------------------------------------------------- */ - -int dx_set_thread_data (dx_key_t key, const void* data) { - TlsSetValue(key, (void*)data); +int dx_set_thread_data(dx_key_t key, const void *data) { + TlsSetValue(key, (void *)data); return true; } -/* -------------------------------------------------------------------------- */ +void *dx_get_thread_data(dx_key_t key) { return TlsGetValue(key); } -void* dx_get_thread_data (dx_key_t key) { - return TlsGetValue(key); -} +dx_thread_t dx_get_thread_id() { return GetCurrentThread(); } -/* -------------------------------------------------------------------------- */ +int dx_compare_threads(dx_thread_t t1, dx_thread_t t2) { return t1 == t2; } -dx_thread_t dx_get_thread_id () { - return GetCurrentThread(); -} - -/* -------------------------------------------------------------------------- */ - -int dx_compare_threads (dx_thread_t t1, dx_thread_t t2) { - return t1 == t2; -} - -/* -------------------------------------------------------------------------- */ - -int dx_mutex_create (dx_mutex_t* mutex) { +int dx_mutex_create(dx_mutex_t *mutex) { *mutex = dx_calloc(1, sizeof(CRITICAL_SECTION)); InitializeCriticalSection(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - -int dx_mutex_destroy (dx_mutex_t* mutex) { +int dx_mutex_destroy(dx_mutex_t *mutex) { DeleteCriticalSection(*mutex); free(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - -int dx_mutex_lock (dx_mutex_t* mutex) { +int dx_mutex_lock(dx_mutex_t *mutex) { EnterCriticalSection(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - -int dx_mutex_unlock (dx_mutex_t* mutex) { +int dx_mutex_unlock(dx_mutex_t *mutex) { LeaveCriticalSection(*mutex); return true; } -/* -------------------------------------------------------------------------- */ /* * Implementation of wrappers without error handling mechanism */ -/* -------------------------------------------------------------------------- */ -int dx_set_thread_data_no_ehm (dx_key_t key, const void* data) { - return dx_set_thread_data(key, data); -} +int dx_set_thread_data_no_ehm(dx_key_t key, const void *data) { return dx_set_thread_data(key, data); } #else # error "Please, select threads implementation" diff --git a/src/DXThreads.h b/src/DXThreads.h index add2a3fa..471c4097 100644 --- a/src/DXThreads.h +++ b/src/DXThreads.h @@ -37,43 +37,43 @@ typedef struct { pthread_mutexattr_t attr; } dx_mutex_t; typedef void* (*dx_start_routine_t)(void*); -#define DX_THREAD_RETVAL_NULL NULL +# define DX_THREAD_RETVAL_NULL NULL #else /* !defined(_WIN32) || defined(USE_PTHREADS) */ -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif # define USE_WIN32_THREADS typedef HANDLE dx_thread_t; typedef DWORD dx_key_t; typedef LPCRITICAL_SECTION dx_mutex_t; -//typedef void pthread_attr_t; +// typedef void pthread_attr_t; typedef unsigned (*dx_start_routine_t)(void*); -#define DX_THREAD_RETVAL_NULL 0 +# define DX_THREAD_RETVAL_NULL 0 #endif /* !defined(_WIN32) || defined(USE_PTHREADS) */ #include "PrimitiveTypes.h" -/* -------------------------------------------------------------------------- */ /* * Callbacks management */ -/* -------------------------------------------------------------------------- */ -void dx_register_thread_constructor(void (*constructor)(void*), void *arg); -void dx_register_thread_destructor(void (*destructor)(void*), void *arg); -void dx_register_process_destructor(void (*destructor)(void*), void *arg); -/* -------------------------------------------------------------------------- */ +void dx_register_thread_constructor(void (*constructor)(void*), void* arg); +void dx_register_thread_destructor(void (*destructor)(void*), void* arg); +void dx_register_process_destructor(void (*destructor)(void*), void* arg); + /* * Auxiliary functions */ -/* -------------------------------------------------------------------------- */ -void dx_sleep (int milliseconds); -void dx_mark_thread_master (void); -int dx_is_thread_master (void); +void dx_sleep(int milliseconds); +void dx_mark_thread_master(void); +int dx_is_thread_master(void); -/* -------------------------------------------------------------------------- */ /* * below are the wrappers for the used POSIX thread functions that incorporate * the error handling. @@ -81,37 +81,32 @@ int dx_is_thread_master (void); * some special error codes, in that case the wrapper implementation must be * customized as well. */ -/* -------------------------------------------------------------------------- */ #if !defined(_WIN32) -int dx_thread_create (dx_thread_t* thread_id, const pthread_attr_t* attr, - dx_start_routine_t start_routine, void *arg); +int dx_thread_create(dx_thread_t* thread_id, const pthread_attr_t* attr, dx_start_routine_t start_routine, void* arg); #else -int dx_thread_create (dx_thread_t* thread_id, const void* attr, - dx_start_routine_t start_routine, void *arg); +int dx_thread_create(dx_thread_t* thread_id, const void* attr, dx_start_routine_t start_routine, void* arg); #endif -int dx_wait_for_thread (dx_thread_t thread_id, void **value_ptr); -int dx_close_thread_handle (dx_thread_t thread_id); -int dx_thread_data_key_create (dx_key_t* key, void (*destructor)(void*)); -int dx_thread_data_key_destroy (dx_key_t key); -int dx_set_thread_data (dx_key_t key, const void* data); -void* dx_get_thread_data (dx_key_t key); -dx_thread_t dx_get_thread_id (); -int dx_compare_threads (dx_thread_t t1, dx_thread_t t2); -int dx_mutex_create (dx_mutex_t* mutex); -int dx_mutex_destroy (dx_mutex_t* mutex); -int dx_mutex_lock (dx_mutex_t* mutex); -int dx_mutex_unlock (dx_mutex_t* mutex); +int dx_wait_for_thread(dx_thread_t thread_id, void** value_ptr); +int dx_close_thread_handle(dx_thread_t thread_id); +int dx_thread_data_key_create(dx_key_t* key, void (*destructor)(void*)); +int dx_thread_data_key_destroy(dx_key_t key); +int dx_set_thread_data(dx_key_t key, const void* data); +void* dx_get_thread_data(dx_key_t key); +dx_thread_t dx_get_thread_id(); +int dx_compare_threads(dx_thread_t t1, dx_thread_t t2); +int dx_mutex_create(dx_mutex_t* mutex); +int dx_mutex_destroy(dx_mutex_t* mutex); +int dx_mutex_lock(dx_mutex_t* mutex); +int dx_mutex_unlock(dx_mutex_t* mutex); -/* -------------------------------------------------------------------------- */ /* * The thread function wrappers that do not invoke internal error * handling mechanism. * Such functions are used when the internal error handling mechanism * cannot be trusted, e.g. within the error subsystem initialization routines. */ -/* -------------------------------------------------------------------------- */ -int dx_set_thread_data_no_ehm (dx_key_t key, const void* data); +int dx_set_thread_data_no_ehm(dx_key_t key, const void* data); #endif /* THREADS_H_INCLUDED */ diff --git a/src/DataStructures.c b/src/DataStructures.c index fad94e4a..f8a4978e 100644 --- a/src/DataStructures.c +++ b/src/DataStructures.c @@ -31,11 +31,9 @@ #define DX_RECORD_FIELD_STDOPS(r, f) DX_RECORD_FIELD_SETTER_NAME(r, f), DX_RECORD_FIELD_DEF_VAL_NAME(r, f), DX_RECORD_FIELD_GETTER_NAME(r, f) -/* -------------------------------------------------------------------------- */ /* * Trade data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_trade[] = { { dx_fid_compact_int, L"Last.Time", NULL, NULL, DX_RECORD_FIELD_STDOPS(dx_trade_t, time), dx_ft_common_field }, @@ -52,11 +50,9 @@ static const dx_field_info_t dx_fields_trade[] = { { dx_fid_compact_int, L"Last.Flags", NULL, L"Flags", DX_RECORD_FIELD_STDOPS(dx_trade_t, flags), dx_ft_common_field }, }; -/* -------------------------------------------------------------------------- */ /* * Quote data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_quote[] = { { dx_fid_compact_int, L"Sequence", NULL, NULL, DX_RECORD_FIELD_STDOPS(dx_quote_t, sequence), dx_ft_common_field }, @@ -71,11 +67,9 @@ static const dx_field_info_t dx_fields_quote[] = { { dx_fid_flag_wd_by_ci, L"Ask.Size", NULL, L"AskSize", DX_RECORD_FIELD_STDOPS(dx_quote_t, ask_size), dx_ft_common_field } }; -/* -------------------------------------------------------------------------- */ /* * Summary data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_summary[] = { { dx_fid_flag_date_by_ci, L"DayId", NULL, L"DayId", DX_RECORD_FIELD_STDOPS(dx_summary_t, day_id), dx_ft_common_field }, @@ -90,11 +84,9 @@ static const dx_field_info_t dx_fields_summary[] = { { dx_fid_compact_int, L"Flags", NULL, L"Flags", DX_RECORD_FIELD_STDOPS(dx_summary_t, flags), dx_ft_common_field } }; -/* -------------------------------------------------------------------------- */ /* * Profile data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_profile[] = { { dx_fid_flag_wd_by_ci, L"Beta", NULL, NULL, DX_RECORD_FIELD_STDOPS(dx_profile_t, beta), dx_ft_common_field }, @@ -115,11 +107,9 @@ static const dx_field_info_t dx_fields_profile[] = { { dx_fid_utf_char_array, L"StatusReason", NULL, L"StatusReason", DX_RECORD_FIELD_STDOPS(dx_profile_t, status_reason), dx_ft_common_field } }; -/* -------------------------------------------------------------------------- */ /* * Market maker data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_market_maker[] = { { dx_fid_utf_char, L"MMExchange", NULL, L"ExchangeCode", DX_RECORD_FIELD_STDOPS(dx_market_maker_t, mm_exchange), dx_ft_first_time_int_field }, @@ -134,11 +124,9 @@ static const dx_field_info_t dx_fields_market_maker[] = { { dx_fid_flag_wd_by_ci, L"MMAsk.Count", NULL, L"AskCount", DX_RECORD_FIELD_STDOPS(dx_market_maker_t, mmask_count), dx_ft_common_field } }; -/* -------------------------------------------------------------------------- */ /* * Order data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_order[] = { { dx_fid_compact_int, L"Index", NULL, L"Index", DX_RECORD_FIELD_STDOPS(dx_order_t, index), dx_ft_second_time_int_field }, @@ -159,11 +147,9 @@ static const dx_field_info_t dx_fields_order[] = { { dx_fid_compact_int, L"MMID", NULL, L"MarketMaker", DX_RECORD_FIELD_STDOPS(dx_order_t, mmid), dx_ft_common_field }, }; -/* -------------------------------------------------------------------------- */ /* * Time and Sale data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_time_and_sale[] = { { dx_fid_flag_sec_by_ci, L"Time", NULL, NULL, DX_RECORD_FIELD_STDOPS(dx_time_and_sale_t, time), dx_ft_first_time_int_field }, @@ -180,11 +166,9 @@ static const dx_field_info_t dx_fields_time_and_sale[] = { { dx_fid_utf_char_array, L"Seller", NULL, L"Seller", DX_RECORD_FIELD_STDOPS(dx_time_and_sale_t, seller), dx_ft_common_field } }; -/* -------------------------------------------------------------------------- */ /* * Candle data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_candle[] = { { dx_fid_flag_sec_by_ci, L"Time", NULL, NULL, DX_RECORD_FIELD_STDOPS(dx_candle_t, time), dx_ft_first_time_int_field }, @@ -202,11 +186,9 @@ static const dx_field_info_t dx_fields_candle[] = { { dx_fid_flag_wd_by_ci, L"OpenInterest", NULL, NULL, DX_RECORD_FIELD_STDOPS(dx_candle_t, open_interest), dx_ft_common_field }, }; -/* -------------------------------------------------------------------------- */ /* * TradeETH data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_trade_eth[] = { { dx_fid_compact_int, L"ETHLast.Time", NULL, NULL, DX_RECORD_FIELD_STDOPS(dx_trade_t, time), dx_ft_common_field }, @@ -222,11 +204,9 @@ static const dx_field_info_t dx_fields_trade_eth[] = { { dx_fid_compact_int, L"ETHLast.Flags", NULL, L"Flags", DX_RECORD_FIELD_STDOPS(dx_trade_t, flags), dx_ft_common_field }, }; -/* -------------------------------------------------------------------------- */ /* * Spread Order data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_spread_order[] = { { dx_fid_compact_int, L"Index", NULL, L"Index", DX_RECORD_FIELD_STDOPS(dx_spread_order_t, index), dx_ft_second_time_int_field }, @@ -247,11 +227,9 @@ static const dx_field_info_t dx_fields_spread_order[] = { { dx_fid_utf_char_array, L"SpreadSymbol", NULL, L"SpreadSymbol", DX_RECORD_FIELD_STDOPS(dx_spread_order_t, spread_symbol), dx_ft_common_field } }; -/* -------------------------------------------------------------------------- */ /* * Greeks data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_greeks[] = { { dx_fid_flag_sec_by_ci, L"Time", NULL, NULL, DX_RECORD_FIELD_STDOPS(dx_greeks_t, time), dx_ft_first_time_int_field }, @@ -265,11 +243,9 @@ static const dx_field_info_t dx_fields_greeks[] = { { dx_fid_flag_wd_by_ci, L"Vega", NULL, NULL, DX_RECORD_FIELD_STDOPS(dx_greeks_t, vega), dx_ft_common_field } }; -/* -------------------------------------------------------------------------- */ /* * TheoPrice data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_theo_price[] = { { dx_fid_flag_sec_by_ci, L"Theo.Time", NULL, L"Time", DX_RECORD_FIELD_STDOPS(dx_theo_price_t, time), dx_ft_common_field }, @@ -281,11 +257,9 @@ static const dx_field_info_t dx_fields_theo_price[] = { { dx_fid_flag_wd_by_ci, L"Theo.Interest", NULL, L"Interest", DX_RECORD_FIELD_STDOPS(dx_theo_price_t, interest), dx_ft_common_field } }; -/* -------------------------------------------------------------------------- */ /* * Underlying data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_underlying[] = { { dx_fid_flag_wd_by_ci, L"Volatility", NULL, NULL, DX_RECORD_FIELD_STDOPS(dx_underlying_t, volatility), dx_ft_common_field }, @@ -296,11 +270,9 @@ static const dx_field_info_t dx_fields_underlying[] = { { dx_fid_flag_wd_by_ci, L"PutCallRatio", NULL, NULL, DX_RECORD_FIELD_STDOPS(dx_underlying_t, put_call_ratio), dx_ft_common_field } }; -/* -------------------------------------------------------------------------- */ /* * Series data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_series[] = { { dx_fid_compact_int, L"Index", NULL, NULL, DX_RECORD_FIELD_STDOPS(dx_series_t, index), dx_ft_second_time_int_field }, @@ -316,22 +288,18 @@ static const dx_field_info_t dx_fields_series[] = { { dx_fid_flag_wd_by_ci, L"Interest", NULL, NULL, DX_RECORD_FIELD_STDOPS(dx_series_t, interest), dx_ft_common_field } }; -/* -------------------------------------------------------------------------- */ /* * Configuration data fields */ -/* -------------------------------------------------------------------------- */ static const dx_field_info_t dx_fields_configuration[] = { { dx_fid_compact_int, L"Version", NULL, L"Version", DX_RECORD_FIELD_STDOPS(dx_configuration_t, version), dx_ft_common_field }, { dx_fid_byte_array | dx_fid_flag_serial_object, L"Configuration", L"Configuration", L"MarshalledAttachment", DX_RECORD_FIELD_STDOPS(dx_configuration_t, object), dx_ft_common_field } }; -/* -------------------------------------------------------------------------- */ /* * Records */ -/* -------------------------------------------------------------------------- */ static const dx_record_info_t g_record_info[dx_rid_count] = { { L"Trade", sizeof(dx_fields_trade) / sizeof(dx_fields_trade[0]), dx_fields_trade }, @@ -351,11 +319,9 @@ static const dx_record_info_t g_record_info[dx_rid_count] = { { L"Configuration", sizeof(dx_fields_configuration) / sizeof(dx_fields_configuration[0]), dx_fields_configuration } }; -/* -------------------------------------------------------------------------- */ /* * Data structures connection context */ -/* -------------------------------------------------------------------------- */ #define RECORD_ID_VECTOR_SIZE 1000 @@ -401,8 +367,6 @@ typedef struct { #define CTX(context) \ ((dx_data_structures_connection_context_t*)context) -/* -------------------------------------------------------------------------- */ - void dx_clear_record_server_support_states(dx_data_structures_connection_context_t* context) { dx_record_server_support_state_list_t *states = NULL; if (context == NULL) @@ -483,8 +447,6 @@ DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_data_structures) { return true; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_data_structures) { int res = true; dx_data_structures_connection_context_t* context = dx_get_subsystem_data(connection, dx_ccs_data_structures, &res); @@ -499,27 +461,21 @@ DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_data_structures) { return true; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_data_structures) { return true; } -/* -------------------------------------------------------------------------- */ /* * Connection context functions implementation */ -/* -------------------------------------------------------------------------- */ void* dx_get_data_structures_connection_context (dxf_connection_t connection) { return dx_get_subsystem_data(connection, dx_ccs_data_structures, NULL); } -/* -------------------------------------------------------------------------- */ /* * Record functions implementation */ -/* -------------------------------------------------------------------------- */ #define RECORD_ID_PAIR_COMPARATOR(left, right) \ DX_NUMERIC_COMPARATOR((left).server_record_id, (right).server_record_id) @@ -546,8 +502,6 @@ dx_record_id_t dx_get_record_id(void* context, dxf_int_t server_record_id) { } } -/* -------------------------------------------------------------------------- */ - int dx_assign_server_record_id(void* context, dx_record_id_t record_id, dxf_int_t server_record_id) { dx_server_local_record_id_map_t* record_id_map = &(CTX(context)->record_id_map); @@ -580,8 +534,6 @@ int dx_assign_server_record_id(void* context, dx_record_id_t record_id, dxf_int_ return true; } -/* -------------------------------------------------------------------------- */ - int dx_validate_record_id(void* context, dx_record_id_t record_id) { dx_record_list_t* records_list = &(CTX(context)->records_list); if (record_id < 0 || record_id >= (dx_record_id_t)records_list->size) { @@ -590,8 +542,6 @@ int dx_validate_record_id(void* context, dx_record_id_t record_id) { return true; } -/* -------------------------------------------------------------------------- */ - /* * Returns pointer to record data. * Don't modify any field of struct and don't free this resources. @@ -614,8 +564,6 @@ const dx_record_item_t* dx_get_record_by_id(void* context, dx_record_id_t record return value; } -/* -------------------------------------------------------------------------- */ - dx_record_id_t dx_get_record_id_by_name(void* context, dxf_const_string_t record_name) { dx_record_id_t record_id; dx_data_structures_connection_context_t* dscc = CTX(context); @@ -635,8 +583,6 @@ dx_record_id_t dx_get_record_id_by_name(void* context, dxf_const_string_t record return DX_RECORD_ID_INVALID; } -/* -------------------------------------------------------------------------- */ - dx_record_id_t dx_get_next_unsubscribed_record_id(void* context, int isUpdate) { dx_record_id_t record_id = DX_RECORD_ID_INVALID; dx_data_structures_connection_context_t* dscc = CTX(context); @@ -655,8 +601,6 @@ dx_record_id_t dx_get_next_unsubscribed_record_id(void* context, int isUpdate) { return record_id; } -/* -------------------------------------------------------------------------- */ - void dx_drop_unsubscribe_counter(void* context) { dx_data_structures_connection_context_t* dscc = CTX(context); dx_record_list_t* records_list = &(dscc->records_list); @@ -668,8 +612,6 @@ void dx_drop_unsubscribe_counter(void* context) { dx_mutex_unlock(&dscc->guard_records_list); } -/* -------------------------------------------------------------------------- */ - int dx_find_record_field(const dx_record_item_t* record_info, dxf_const_string_t field_name, dxf_int_t field_type) { int cur_field_index = 0; dx_field_info_t* fields = (dx_field_info_t*)record_info->fields; @@ -688,8 +630,6 @@ int dx_find_record_field(const dx_record_item_t* record_info, dxf_const_string_t return INVALID_INDEX; } -/* -------------------------------------------------------------------------- */ - dxf_char_t dx_get_record_exchange_code(void* context, dx_record_id_t record_id) { dx_data_structures_connection_context_t* dscc = CTX(context); dx_record_list_t* records_list = &(dscc->records_list); @@ -722,8 +662,6 @@ int dx_set_record_exchange_code(void* context, dx_record_id_t record_id, return true; } -/* -------------------------------------------------------------------------- */ - /* * Creates subscription time field according to record model. Function uses * dx_ft_first_time_int_field and dx_ft_second_time_int_field flags of the @@ -780,8 +718,6 @@ int dx_create_subscription_time(void* context, dx_record_id_t record_id, return true; } -/* -------------------------------------------------------------------------- */ - dx_record_server_support_state_list_t* dx_get_record_server_support_states(void* context) { return &(CTX(context)->record_server_support_states); } @@ -795,8 +731,6 @@ int dx_get_record_server_support_state_value(dx_record_server_support_state_list return true; } -/* -------------------------------------------------------------------------- */ - /* Functions for working with records list */ int dx_add_record_to_list(dxf_connection_t connection, const dx_record_item_t* record, dx_record_id_t index) { diff --git a/src/DataStructures.h b/src/DataStructures.h index 21f79ce5..47e4e2d3 100644 --- a/src/DataStructures.h +++ b/src/DataStructures.h @@ -27,19 +27,15 @@ #include "EventData.h" #include "DXThreads.h" -/* -------------------------------------------------------------------------- */ /* * Connection context functions */ -/* -------------------------------------------------------------------------- */ void* dx_get_data_structures_connection_context (dxf_connection_t connection); -/* -------------------------------------------------------------------------- */ /* * Event record types and structures */ -/* -------------------------------------------------------------------------- */ typedef enum { dx_fid_void = 0, @@ -85,16 +81,12 @@ typedef enum { dx_fid_flag_seq_by_ci = dx_fid_flag_sequence_by_compact_int, } dx_field_id_t; -/* -------------------------------------------------------------------------- */ - typedef enum { dx_ft_common_field = 0, dx_ft_first_time_int_field = 1, dx_ft_second_time_int_field = 2 } dx_scheme_field_time_t; -/* -------------------------------------------------------------------------- */ - typedef struct { int type; dxf_const_string_t field_name; @@ -106,8 +98,6 @@ typedef struct { dx_scheme_field_time_t time; } dx_field_info_t; -/* -------------------------------------------------------------------------- */ - typedef struct { dxf_const_string_t default_name; int field_count; @@ -130,11 +120,9 @@ typedef struct { size_t capacity; } dx_record_server_support_state_list_t; -/* -------------------------------------------------------------------------- */ /* * Record functions */ -/* -------------------------------------------------------------------------- */ dx_record_id_t dx_get_record_id(void* context, dxf_int_t server_record_id); int dx_assign_server_record_id(void* context, dx_record_id_t record_id, dxf_int_t server_record_id); diff --git a/src/EventData.c b/src/EventData.c index 9de15303..a99c5d21 100644 --- a/src/EventData.c +++ b/src/EventData.c @@ -24,11 +24,9 @@ #include "EventSubscription.h" #include "DataStructures.h" -/* -------------------------------------------------------------------------- */ /* * Various common data */ -/* -------------------------------------------------------------------------- */ static const int g_event_data_sizes[dx_eid_count] = { sizeof(dxf_trade_t), @@ -62,11 +60,9 @@ static const dxf_char_t g_time_and_sale_tmpl[] = L"TimeAndSale&"; #define TRADE_ETH_TMPL_LEN STRLEN(g_trade_eth_tmpl) #define TIME_AND_SALE_TMPL_LEN STRLEN(g_time_and_sale_tmpl) -/* -------------------------------------------------------------------------- */ /* * Event functions implementation */ -/* -------------------------------------------------------------------------- */ DXFEED_API dxf_const_string_t dx_event_type_to_string (int event_type) { switch (event_type) { @@ -88,14 +84,10 @@ DXFEED_API dxf_const_string_t dx_event_type_to_string (int event_type) { } } -/* -------------------------------------------------------------------------- */ - int dx_get_event_data_struct_size (int event_id) { return g_event_data_sizes[(dx_event_id_t)event_id]; } -/* -------------------------------------------------------------------------- */ - dx_event_id_t dx_get_event_id_by_bitmask (int event_bitmask) { dx_event_id_t event_id = dx_eid_begin; @@ -108,11 +100,9 @@ dx_event_id_t dx_get_event_id_by_bitmask (int event_bitmask) { return event_id; } -/* -------------------------------------------------------------------------- */ /* * Event subscription implementation */ -/* -------------------------------------------------------------------------- */ int dx_add_subscription_param_to_list(dxf_connection_t connection, dx_event_subscription_param_list_t* param_list, dxf_const_string_t record_name, dx_subscription_type_t subscription_type) { @@ -407,11 +397,9 @@ size_t dx_get_event_subscription_params(dxf_connection_t connection, dx_order_so return param_list.size; } -/* -------------------------------------------------------------------------- */ /* * Event data navigation */ -/* -------------------------------------------------------------------------- */ typedef dxf_const_event_data_t (*dx_event_data_navigator) (dxf_const_event_data_t data, size_t index); #define EVENT_DATA_NAVIGATOR_NAME(struct_name) \ @@ -454,8 +442,6 @@ static const dx_event_data_navigator g_event_data_navigators[dx_eid_count] = { EVENT_DATA_NAVIGATOR_NAME(dxf_configuration_t) }; -/* -------------------------------------------------------------------------- */ - dxf_const_event_data_t dx_get_event_data_item (int event_mask, dxf_const_event_data_t data, size_t index) { return g_event_data_navigators[dx_get_event_id_by_bitmask(event_mask)](data, index); } diff --git a/src/EventManager.c b/src/EventManager.c index 20126f78..cc0dda5e 100644 --- a/src/EventManager.c +++ b/src/EventManager.c @@ -22,11 +22,9 @@ #include "DXMemory.h" #include "EventManager.h" -/* -------------------------------------------------------------------------- */ /* * Event objects management functions */ -/* -------------------------------------------------------------------------- */ #define EVENT_COPY_FUNCTION_NAME(struct_name) \ struct_name##_event_copy diff --git a/src/EventManager.h b/src/EventManager.h index c842543d..ac1ad4b5 100644 --- a/src/EventManager.h +++ b/src/EventManager.h @@ -25,11 +25,9 @@ #include "PrimitiveTypes.h" #include "ObjectArray.h" -/* -------------------------------------------------------------------------- */ /* * Event objects management functions */ -/* -------------------------------------------------------------------------- */ typedef dxf_bool_t(*dx_event_copy_function_t) (const dxf_event_data_t source, OUT dx_string_array_ptr_t* string_buffer, diff --git a/src/EventSubscription.cpp b/src/EventSubscription.cpp index 385699ca..d41f220c 100644 --- a/src/EventSubscription.cpp +++ b/src/EventSubscription.cpp @@ -41,11 +41,9 @@ extern "C" { #include "Configuration.hpp" #include "EventSubscription.hpp" -/* -------------------------------------------------------------------------- */ /* * Internal data structures and objects */ -/* -------------------------------------------------------------------------- */ /** * @addtogroup event-data-structures-order-spread-order @@ -64,27 +62,27 @@ const dxf_const_string_t dx_all_order_sources[] = { L"DEA", /// Direct-Edge EDGA Exchange. L"DEX", /// Direct-Edge EDGX Exchange. L"BYX", /// Bats BYX Exchange. - L"BZX", /// Bats BZX Exchange. - L"BATE", /// Bats Europe BXE Exchange. - L"CHIX", /// Bats Europe CXE Exchange. - L"CEUX", /// Bats Europe DXE Exchange. - L"BXTR", /// Bats Europe TRF. - L"IST", /// Borsa Istanbul Exchange. - L"BI20", /// Borsa Istanbul Exchange. Record for particular top 20 order book. - L"ABE", /// ABE (abe.io) exchange. - L"FAIR", /// FAIR (FairX) exchange. - L"GLBX", /// CME Globex. - L"glbx", /// CME Globex. Record for price level book. - L"ERIS", /// Eris Exchange group of companies. - L"XEUR", /// Eurex Exchange. - L"xeur", /// Eurex Exchange. Record for price level book. - L"CFE", /// CBOE Futures Exchange. - L"C2OX", /// CBOE Options C2 Exchange. - L"SMFE", /// Small Exchange. - L"smfe", /// Small Exchange. Record for price level book. - L"iex", /// Investors exchange. Record for price level book. - L"MEMX", /// Members Exchange. - L"memx", /// Members Exchange. Record for price level book. + L"BZX", /// Bats BZX Exchange. + L"BATE", /// Bats Europe BXE Exchange. + L"CHIX", /// Bats Europe CXE Exchange. + L"CEUX", /// Bats Europe DXE Exchange. + L"BXTR", /// Bats Europe TRF. + L"IST", /// Borsa Istanbul Exchange. + L"BI20", /// Borsa Istanbul Exchange. Record for particular top 20 order book. + L"ABE", /// ABE (abe.io) exchange. + L"FAIR", /// FAIR (FairX) exchange. + L"GLBX", /// CME Globex. + L"glbx", /// CME Globex. Record for price level book. + L"ERIS", /// Eris Exchange group of companies. + L"XEUR", /// Eurex Exchange. + L"xeur", /// Eurex Exchange. Record for price level book. + L"CFE", /// CBOE Futures Exchange. + L"C2OX", /// CBOE Options C2 Exchange. + L"SMFE", /// Small Exchange. + L"smfe", /// Small Exchange. Record for price level book. + L"iex", /// Investors exchange. Record for price level book. + L"MEMX", /// Members Exchange. + L"memx", /// Members Exchange. Record for price level book. nullptr}; const dxf_const_string_t dx_all_special_order_sources[] = { @@ -316,7 +314,8 @@ void SubscriptionData::clearRawOrderSources() { } const std::unordered_set EventSubscriptionConnectionContext::specialOrderSources{ - std::begin(dx_all_special_order_sources), std::begin(dx_all_special_order_sources) + dx_all_special_order_sources_count}; + std::begin(dx_all_special_order_sources), + std::begin(dx_all_special_order_sources) + dx_all_special_order_sources_count}; EventSubscriptionConnectionContext::EventSubscriptionConnectionContext(dxf_connection_t connectionHandle) : connectionHandle{connectionHandle}, mutex{}, symbols{}, subscriptions{} {} @@ -417,8 +416,6 @@ bool EventSubscriptionConnectionContext::hasAnySymbol() { } // namespace dx -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_event_subscription) { CHECKED_CALL_2(dx_validate_connection_handle, connection, true); @@ -433,8 +430,6 @@ DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_event_subscription) { return true; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_event_subscription) { int res = true; auto context = static_cast( @@ -449,30 +444,25 @@ DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_event_subscription) { return res; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_event_subscription) { return true; } -/* -------------------------------------------------------------------------- */ /* * Helper functions */ -/* -------------------------------------------------------------------------- */ dxf_ulong_t dx_symbol_name_hasher(dxf_const_string_t symbol_name) { return static_cast(std::hash{}(symbol_name)); } -/* -------------------------------------------------------------------------- */ /* * Subscription functions implementation */ -/* -------------------------------------------------------------------------- */ const dxf_subscription_t dx_invalid_subscription = (dxf_subscription_t) nullptr; dxf_subscription_t dx_create_event_subscription(dxf_connection_t connection, unsigned event_types, - dx_event_subscr_flag subscr_flags, dxf_long_t time) { + dx_event_subscr_flag subscr_flags, dxf_long_t time, + int add_all_sources) { if (!dx_validate_connection_handle(connection, false)) { return dx_invalid_subscription; } @@ -508,7 +498,7 @@ dxf_subscription_t dx_create_event_subscription(dxf_connection_t connection, uns subscr_data->time = time; res = true; - if (event_types & DXF_ET_ORDER) { + if ((event_types & DXF_ET_ORDER) == DXF_ET_ORDER && add_all_sources != 0) { for (int i = 0; dx_all_order_sources[i]; i++) { res = res && dx_add_order_source(subscr_data, dx_all_order_sources[i]); } @@ -587,8 +577,6 @@ int dx_add_symbols(dxf_subscription_t subscr_id, dxf_const_string_t* symbols, in return dx_add_symbols_impl(subscr_id, symbols, symbol_count, nullptr, nullptr); } -/* -------------------------------------------------------------------------- */ - int dx_remove_symbols(dxf_subscription_t subscr_id, dxf_const_string_t* symbols, size_t symbol_count) { auto subscr_data = static_cast(subscr_id); @@ -622,8 +610,6 @@ int dx_remove_symbols(dxf_subscription_t subscr_id, dxf_const_string_t* symbols, }); } -/* -------------------------------------------------------------------------- */ - int dx_add_listener_impl(dxf_subscription_t subscr_id, dx::ListenerContext::ListenerPtr listener, dx::EventListenerVersion version, void* user_data) { if (subscr_id == dx_invalid_subscription) { @@ -647,22 +633,16 @@ int dx_add_listener_impl(dxf_subscription_t subscr_id, dx::ListenerContext::List return true; } -/* -------------------------------------------------------------------------- */ - int dx_add_listener(dxf_subscription_t subscr_id, dxf_event_listener_t listener, void* user_data) { return dx_add_listener_impl(subscr_id, (dx::ListenerContext::ListenerPtr)listener, dx::EventListenerVersion::Default, user_data); } -/* -------------------------------------------------------------------------- */ - int dx_add_listener_v2(dxf_subscription_t subscr_id, dxf_event_listener_v2_t listener, void* user_data) { return dx_add_listener_impl(subscr_id, (dx::ListenerContext::ListenerPtr)listener, dx::EventListenerVersion::V2, user_data); } -/* -------------------------------------------------------------------------- */ - int dx_remove_listener_impl(dxf_subscription_t subscr_id, dx::ListenerContext::ListenerPtr listener) { if (subscr_id == dx_invalid_subscription) { return dx_set_error_code(dx_esec_invalid_subscr_id); @@ -689,14 +669,10 @@ int dx_remove_listener(dxf_subscription_t subscr_id, dxf_event_listener_t listen return dx_remove_listener_impl(subscr_id, (dx::ListenerContext::ListenerPtr)listener); } -/* -------------------------------------------------------------------------- */ - int dx_remove_listener_v2(dxf_subscription_t subscr_id, dxf_event_listener_v2_t listener) { return dx_remove_listener_impl(subscr_id, (dx::ListenerContext::ListenerPtr)listener); } -/* -------------------------------------------------------------------------- */ - int dx_get_subscription_connection(dxf_subscription_t subscr_id, OUT dxf_connection_t* connection) { auto subscr_data = static_cast(subscr_id); @@ -714,8 +690,6 @@ int dx_get_subscription_connection(dxf_subscription_t subscr_id, OUT dxf_connect return true; } -/* -------------------------------------------------------------------------- */ - int dx_get_event_subscription_event_types(dxf_subscription_t subscr_id, OUT unsigned* event_types) { auto subscr_data = static_cast(subscr_id); @@ -773,8 +747,6 @@ int dx_get_event_subscription_symbols(dxf_subscription_t subscr_id, OUT dxf_cons return true; } -/* -------------------------------------------------------------------------- */ - int dx_get_event_subscription_flags(dxf_subscription_t subscr_id, OUT dx_event_subscr_flag* subscr_flags) { auto subscr_data = static_cast(subscr_id); @@ -791,8 +763,6 @@ int dx_get_event_subscription_flags(dxf_subscription_t subscr_id, OUT dx_event_s return true; } -/* -------------------------------------------------------------------------- */ - int dx_set_event_subscription_flags(dxf_subscription_t subscr_id, dx_event_subscr_flag subscr_flags) { auto subscr_data = static_cast(subscr_id); @@ -809,8 +779,6 @@ int dx_set_event_subscription_flags(dxf_subscription_t subscr_id, dx_event_subsc return true; } -/* -------------------------------------------------------------------------- */ - int dx_get_event_subscription_time(dxf_subscription_t subscr_id, OUT dxf_long_t* time) { auto subscr_data = static_cast(subscr_id); @@ -827,8 +795,6 @@ int dx_get_event_subscription_time(dxf_subscription_t subscr_id, OUT dxf_long_t* return true; } -/* -------------------------------------------------------------------------- */ - static void dx_call_subscr_listeners(dx::SubscriptionData* subscr_data, unsigned event_bitmask, dxf_const_string_t symbol_name, dxf_const_event_data_t data, const dxf_event_params_t* event_params) { @@ -880,15 +846,18 @@ void pass_event_data_to_listeners(dx::EventSubscriptionConnectionContext* ctx, d call = subscription_data->orderSources.find(sourceStr) != subscription_data->orderSources.end(); if (!call) { - if (sourceStr == dx_all_special_order_sources[dxf_sos_AGGREGATE_ASK] || sourceStr == dx_all_special_order_sources[dxf_sos_AGGREGATE_BID]) { + if (sourceStr == dx_all_special_order_sources[dxf_sos_AGGREGATE_ASK] || + sourceStr == dx_all_special_order_sources[dxf_sos_AGGREGATE_BID]) { call = subscription_data->orderSources.find(dx_all_special_order_sources[dxf_sos_AGGREGATE]) != - subscription_data->orderSources.end(); - } else if (sourceStr == dx_all_special_order_sources[dxf_sos_COMPOSITE_ASK] || sourceStr == dx_all_special_order_sources[dxf_sos_COMPOSITE_BID]) { + subscription_data->orderSources.end(); + } else if (sourceStr == dx_all_special_order_sources[dxf_sos_COMPOSITE_ASK] || + sourceStr == dx_all_special_order_sources[dxf_sos_COMPOSITE_BID]) { call = subscription_data->orderSources.find(dx_all_special_order_sources[dxf_sos_COMPOSITE]) != - subscription_data->orderSources.end(); - } else if (sourceStr == dx_all_special_order_sources[dxf_sos_REGIONAL_ASK] || sourceStr == dx_all_special_order_sources[dxf_sos_REGIONAL_BID]) { + subscription_data->orderSources.end(); + } else if (sourceStr == dx_all_special_order_sources[dxf_sos_REGIONAL_ASK] || + sourceStr == dx_all_special_order_sources[dxf_sos_REGIONAL_BID]) { call = subscription_data->orderSources.find(dx_all_special_order_sources[dxf_sos_REGIONAL]) != - subscription_data->orderSources.end(); + subscription_data->orderSources.end(); } } } else { @@ -946,7 +915,6 @@ int dx_process_event_data(dxf_connection_t connection, dx_event_id_t event_id, d return true; } -/* -------------------------------------------------------------------------- */ /* * event type is a one-bit mask here */ @@ -993,8 +961,6 @@ int dx_get_last_symbol_event(dxf_connection_t connection, dxf_const_string_t sym }); } -/* -------------------------------------------------------------------------- */ - int dx_process_connection_subscriptions(dxf_connection_t connection, dx_subscription_processor_t processor) { int res; auto context = static_cast( @@ -1032,12 +998,8 @@ int dx_process_connection_subscriptions(dxf_connection_t connection, dx_subscrip }); } -/* -------------------------------------------------------------------------- */ - /* Functions for working with order source */ -/* -------------------------------------------------------------------------- */ - int dx_add_order_source(dxf_subscription_t subscr_id, dxf_const_string_t source) { auto subscriptionData = static_cast(subscr_id); @@ -1046,8 +1008,6 @@ int dx_add_order_source(dxf_subscription_t subscr_id, dxf_const_string_t source) return true; } -/* -------------------------------------------------------------------------- */ - void dx_clear_order_sources(dxf_subscription_t subscr_id) { if (subscr_id == nullptr) { return; diff --git a/src/EventSubscription.h b/src/EventSubscription.h index 4b9443f8..fbc4415e 100644 --- a/src/EventSubscription.h +++ b/src/EventSubscription.h @@ -23,11 +23,9 @@ #include "EventData.h" #include "PrimitiveTypes.h" -/* -------------------------------------------------------------------------- */ /* * Subscription defines */ -/* -------------------------------------------------------------------------- */ extern const dxf_subscription_t dx_invalid_subscription; @@ -51,21 +49,17 @@ typedef enum dxf_special_order_source_t { dxf_sos_AGGREGATE = 10, } dxf_special_order_source_t; -/* -------------------------------------------------------------------------- */ /* * Subscription types */ -/* -------------------------------------------------------------------------- */ typedef int (*dx_subscription_processor_t)(dxf_connection_t connection, dx_order_source_array_ptr_t order_source, dxf_const_string_t* symbols, size_t symbol_count, unsigned event_types, dxf_uint_t subscr_flags, dxf_long_t time); -/* -------------------------------------------------------------------------- */ /* * Subscription functions */ -/* -------------------------------------------------------------------------- */ #ifdef __cplusplus extern "C" { @@ -73,7 +67,8 @@ extern "C" { /* returns dx_invalid_subscription on error */ dxf_subscription_t dx_create_event_subscription(dxf_connection_t connection, unsigned event_types, - dx_event_subscr_flag subscr_flags, dxf_long_t time); + dx_event_subscr_flag subscr_flags, dxf_long_t time, + int add_all_sources); int dx_close_event_subscription(dxf_subscription_t subscr_id); int dx_add_symbols(dxf_subscription_t subscr_id, dxf_const_string_t* symbols, int symbol_count); // Adds symbols to the subscription and counts the number of unique added symbols that will be sent to the server for diff --git a/src/IdGenerator.hpp b/src/IdGenerator.hpp new file mode 100644 index 00000000..c45adb37 --- /dev/null +++ b/src/IdGenerator.hpp @@ -0,0 +1,16 @@ +#pragma once + +namespace dx { +using Id = long long; + +template +class IdGenerator { + static Id id; + +public: + static Id get() { return id++; } +}; + +template +Id IdGenerator::id{0}; +} // namespace dx \ No newline at end of file diff --git a/src/Logger.c b/src/Logger.c index 95b211a2..562a6f96 100644 --- a/src/Logger.c +++ b/src/Logger.c @@ -18,12 +18,13 @@ */ #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) -# ifdef _DEBUG -# include +# if !defined(__MINGW32__) +# pragma warning(pop) # endif #else # include @@ -45,11 +46,9 @@ #include "DXThreads.h" #include "Version.h" -/* -------------------------------------------------------------------------- */ /* * Implementation Details */ -/* -------------------------------------------------------------------------- */ #define CURRENT_TIME_STR_LENGTH 31 #define CURRENT_TIME_STR_TIME_OFFSET 24 @@ -83,11 +82,9 @@ static int g_key_created = false; static dxf_char_t current_time_str[CURRENT_TIME_STR_LENGTH + 1]; -/* -------------------------------------------------------------------------- */ /* * Auxiliary functions */ -/* -------------------------------------------------------------------------- */ dxf_string_t dx_get_current_time_buffer(void); @@ -198,8 +195,6 @@ void dx_vlog_debug_message(const dxf_char_t *format, va_list ap) { #endif // _WIN32 -/* -------------------------------------------------------------------------- */ - static void dx_current_time_buffer_destructor(void *data) { if (data != current_time_str && data != NULL) { dx_free(data); @@ -213,8 +208,6 @@ static void dx_key_remover(void *data) { } } -/* -------------------------------------------------------------------------- */ - dxf_string_t dx_get_current_time_buffer(void) { /* * This function uses the low-level functions without embedded error handling/logging, @@ -247,8 +240,6 @@ dxf_string_t dx_get_current_time_buffer(void) { return buffer; } -/* -------------------------------------------------------------------------- */ - int dx_init_current_time_key(void) { if (g_key_creation_attempted) { return g_key_created; @@ -272,8 +263,6 @@ int dx_init_current_time_key(void) { return true; } -/* -------------------------------------------------------------------------- */ - void dx_flush_log(void) { if (g_log_file == NULL) { return; @@ -324,11 +313,9 @@ static void dx_close_logging(void *arg) { } } -/* -------------------------------------------------------------------------- */ /* * External interface */ -/* -------------------------------------------------------------------------- */ ERRORCODE dx_initialize_logger_impl(const char *file_name, int rewrite_file, int show_timezone_info, int verbose, int log_data_transfer) { @@ -488,8 +475,6 @@ DXFEED_API ERRORCODE dxf_initialize_logger_v2(const char *file_name, int rewrite return dx_initialize_logger_impl(file_name, rewrite_file, show_timezone_info, verbose, log_data_transfer); } -/* -------------------------------------------------------------------------- */ - void dx_logging_error(dxf_const_string_t message) { if (g_log_file == NULL || message == NULL) { return; @@ -567,21 +552,8 @@ void dx_logging_error_by_code(int error_code) { dx_flush_log(); } -/* -------------------------------------------------------------------------- */ - void dx_logging_last_error(void) { dx_logging_error_by_code(dx_get_error_code()); } -/* -------------------------------------------------------------------------- */ - -void dx_logging_last_error_verbose(void) { - if (!g_verbose_logger_mode) { - return; - } - - dx_logging_error_by_code(dx_get_error_code()); - dx_flush_log(); -} - void dx_logging_verbose(dx_log_level_t log_level, const dxf_char_t *format, ...) { if (!g_verbose_logger_mode) { return; @@ -641,74 +613,12 @@ void dx_logging_dbg(const dxf_char_t *format, ...) { #endif } -#ifdef _DEBUG -# ifdef _WIN32 -# define STACK_SIZE 256 -static dxf_ubyte_t SYM_INFO[sizeof(SYM_TYPE) + 255]; -static void *STACK[STACK_SIZE]; -# endif -#endif - -void dx_logging_dbg_stack() { -#ifdef _DEBUG -# ifdef _WIN32 - if (dx_ll_debug < dx_get_minimum_logging_level(g_default_log_level)) return; - - USHORT frames; - SYMBOL_INFO *symbol = (SYMBOL_INFO *)&SYM_INFO[0]; - HANDLE process; - - process = GetCurrentProcess(); - SymInitialize(process, NULL, TRUE); - frames = CaptureStackBackTrace(0, 256, STACK, NULL); - symbol->SizeOfStruct = sizeof(SYMBOL_INFO); - symbol->MaxNameLen = 255; - - for (USHORT i = 1; i < frames; i++) { - SymFromAddr(process, (DWORD64)(STACK[i]), 0, symbol); - dx_logging_dbg(L"* %3hu: %ls - 0x%016p", frames - i - 1, symbol->Name, (void *)symbol->Address); - } - dx_logging_dbg_flush(); -# else - dx_logging_dbg(L"* "); - dx_logging_dbg_flush(); -# endif -#endif -} - -const char *dx_logging_dbg_sym(void *addr) { -#ifdef _DEBUG -# ifdef _WIN32 - SYMBOL_INFO *symbol = (SYMBOL_INFO *)&SYM_INFO[0]; - HANDLE process; - process = GetCurrentProcess(); - SymInitialize(process, NULL, TRUE); - symbol->SizeOfStruct = sizeof(SYMBOL_INFO); - symbol->MaxNameLen = 255; - SymFromAddr(process, (DWORD64)addr, 0, symbol); - return symbol->Name; -# else - return ""; -# endif -#else - return ""; -#endif -} - -void dx_logging_dbg_flush() { -#ifdef _DEBUG - fflush(g_dbg_file); -#endif -} - void dx_logging_dbg_unlock() { #ifdef _DEBUG dx_mutex_unlock(&g_dbg_lock); #endif } -/* -------------------------------------------------------------------------- */ - void dx_logging_info(const dxf_char_t *format, ...) { if (dx_ll_info < dx_get_minimum_logging_level(g_default_log_level)) return; @@ -739,24 +649,6 @@ void dx_logging_info(const dxf_char_t *format, ...) { dx_flush_log(); } -/* -------------------------------------------------------------------------- */ - -void dx_logging_verbose_gap(void) { - if (g_log_file == NULL || !g_verbose_logger_mode) { - return; - } - - if (!dx_mutex_lock(&g_log_file_lock)) { - return; - } - - fwprintf(g_log_file, L"\n"); - - dx_mutex_unlock(&g_log_file_lock); - - dx_flush_log(); -} - void dx_logging_transfer_data(FILE *log_file, const void *buffer, int buffer_size) { if (!g_data_transfer_logger_mode) { return; diff --git a/src/Logger.h b/src/Logger.h index 52ef2556..b68873fe 100644 --- a/src/Logger.h +++ b/src/Logger.h @@ -41,17 +41,12 @@ dxf_const_string_t dx_get_log_level_prefix(dx_log_level_t log_level); void dx_logging_error_by_code(int error_code); void dx_logging_info(const dxf_char_t *format, ...); void dx_logging_verbose(dx_log_level_t log_level, const dxf_char_t *format, ...); -void dx_logging_verbose_gap(void); void dx_flush_log(void); void dx_logging_dbg_lock(); void dx_logging_dbg(const dxf_char_t *format, ...); -void dx_logging_dbg_stack(); -const char *dx_logging_dbg_sym(void *addr); -void dx_logging_dbg_flush(); void dx_logging_dbg_unlock(); void dx_logging_last_error(void); -void dx_logging_last_error_verbose(void); /** * Logs the data that was sent diff --git a/src/PriceLevelBook.c b/src/PriceLevelBook.c index 3f494fe2..7403ad09 100644 --- a/src/PriceLevelBook.c +++ b/src/PriceLevelBook.c @@ -175,8 +175,6 @@ DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_price_level_book) { return true; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_price_level_book) { int res = true; dx_plb_connection_context_t *context = dx_get_subsystem_data(connection, dx_ccs_price_level_book, &res); @@ -187,7 +185,6 @@ DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_price_level_book) { return res; } -/* -------------------------------------------------------------------------- */ static int dx_plb_clear_connection_context(dx_plb_connection_context_t *context) { int res = true; int i = 0; @@ -202,12 +199,8 @@ static int dx_plb_clear_connection_context(dx_plb_connection_context_t *context) return res; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_price_level_book) { return true; } -/* -------------------------------------------------------------------------- */ - /* This function must be called with context guard taken */ static int dx_plb_ctx_grow_sources_hashtable(dx_plb_connection_context_t *context) { dx_plb_source_t **newArray; @@ -236,8 +229,6 @@ static int dx_plb_ctx_grow_sources_hashtable(dx_plb_connection_context_t *contex return true; } -/* -------------------------------------------------------------------------- */ - /* This function must be called with context guard taken */ static dx_plb_source_t *dx_plb_ctx_find_source(dx_plb_connection_context_t *context, dxf_const_string_t symbol, dxf_const_string_t src) { @@ -245,8 +236,6 @@ static dx_plb_source_t *dx_plb_ctx_find_source(dx_plb_connection_context_t *cont return context->sources[pos]; } -/* -------------------------------------------------------------------------- */ - /* This function must be called with context guard taken */ static int dx_plb_ctx_add_source(dx_plb_connection_context_t *context, dx_plb_source_t *source) { /* Resize hash table if it is half-full */ @@ -262,8 +251,6 @@ static int dx_plb_ctx_add_source(dx_plb_connection_context_t *context, dx_plb_so return true; } -/* -------------------------------------------------------------------------- */ - /* This function must be called with context guard taken */ static int dx_plb_ctx_remove_source(dx_plb_connection_context_t *context, dx_plb_source_t *source) { size_t pos = dx_plb_source_find_pos(context, source->symbol, source->source); @@ -292,8 +279,6 @@ static int dx_plb_ctx_remove_source(dx_plb_connection_context_t *context, dx_plb return true; } -/* -------------------------------------------------------------------------- */ - /* This function must be called with context guard taken */ static void dx_plb_ctx_cleanup_sources(dx_plb_connection_context_t *context) { int i = 0; @@ -346,8 +331,6 @@ static void dx_plb_source_free(dx_plb_source_t *source) { CHECKED_FREE(source); } -/* -------------------------------------------------------------------------- */ - /* This function should be called without source guard */ static int dx_plb_source_clear(dx_plb_source_t *source, int force) { ERRORCODE err = DXF_SUCCESS; @@ -379,8 +362,6 @@ static int dx_plb_source_clear(dx_plb_source_t *source, int force) { return res && err == DXF_SUCCESS; } -/* -------------------------------------------------------------------------- */ - /* This function should be called without source guard, but with context guard taken */ static void dx_plb_source_cleanup(dx_plb_connection_context_t *context, dx_plb_source_t *source) { /* Adding of book to source is always under context taken, so we are safe here */ @@ -392,16 +373,12 @@ static void dx_plb_source_cleanup(dx_plb_connection_context_t *context, dx_plb_s dx_plb_source_clear(source, false); } -/* -------------------------------------------------------------------------- */ - static dxf_ulong_t dx_plb_source_hash(dxf_const_string_t symbol, dxf_const_string_t src) { dxf_ulong_t h1 = dx_symbol_name_hasher(symbol); dxf_ulong_t h2 = dx_symbol_name_hasher(src); return ((dxf_ulong_t)h1) << 32u | (dxf_ulong_t)h2; } -/* -------------------------------------------------------------------------- */ - /* This function must be called with context guard taken */ static size_t dx_plb_source_find_pos(dx_plb_connection_context_t *context, dxf_const_string_t symbol, dxf_const_string_t src) { @@ -417,8 +394,6 @@ static size_t dx_plb_source_find_pos(dx_plb_connection_context_t *context, dxf_c return i; } -/* -------------------------------------------------------------------------- */ - static dx_plb_source_t *dx_plb_source_create(dxf_connection_t connection, dxf_const_string_t symbol, dxf_const_string_t src) { const static dx_event_subscr_flag subscription_flags = dx_esf_single_record | dx_esf_time_series; @@ -457,7 +432,7 @@ static dx_plb_source_t *dx_plb_source_create(dxf_connection_t connection, dxf_co source->snapshot_status = dx_status_full; /* Create subscription */ - if ((source->subscription = dx_create_event_subscription(connection, DXF_ET_ORDER, subscription_flags, 0)) == + if ((source->subscription = dx_create_event_subscription(connection, DXF_ET_ORDER, subscription_flags, 0, 0)) == dx_invalid_subscription) { dx_plb_source_free(source); dx_set_error_code(dx_mec_insufficient_memory); @@ -471,7 +446,6 @@ static dx_plb_source_t *dx_plb_source_create(dxf_connection_t connection, dxf_co } /* Set source */ - dx_clear_order_sources(source->subscription); if (!dx_add_order_source(source->subscription, source->source)) { dx_plb_source_free(source); return NULL; @@ -496,7 +470,6 @@ static dx_plb_source_t *dx_plb_source_create(dxf_connection_t connection, dxf_co return source; } -/* -------------------------------------------------------------------------- */ /* This must be called without source guard taken */ static void dx_plb_source_remove_book(dx_plb_source_t *source, dx_price_level_book_t *book, size_t idx) { dx_plb_source_consumer_t *c, **p; @@ -522,7 +495,6 @@ static void dx_plb_source_remove_book(dx_plb_source_t *source, dx_price_level_bo dx_logging_error(L"PLB Internal error: can not find consumer for source\n"); } -/* -------------------------------------------------------------------------- */ /* This must be called without source guard taken but with context guard taken (!) */ static int dx_plb_source_add_book(dx_plb_source_t *source, dx_price_level_book_t *book, int idx) { dx_plb_source_consumer_t *c; @@ -546,8 +518,6 @@ static int dx_plb_source_add_book(dx_plb_source_t *source, dx_price_level_book_t return true; } -/* -------------------------------------------------------------------------- */ - static void dx_plb_source_reset_snapshot(dx_plb_source_t *source) { for (size_t i = 0; i < source->snapshot.size; i++) { dx_free(source->snapshot.elements[i]); @@ -577,8 +547,6 @@ static void dx_plb_source_reset_snapshot(dx_plb_source_t *source) { source->final_asks = source->asks; } -/* -------------------------------------------------------------------------- */ - static void dx_plb_source_remove_order_from_levels(dx_plb_price_level_side_t *ob, const dxf_order_t *order) { size_t pos; int found; @@ -592,8 +560,6 @@ static void dx_plb_source_remove_order_from_levels(dx_plb_price_level_side_t *ob ob->updated = true; } -/* -------------------------------------------------------------------------- */ - static void dx_plb_source_add_order_to_levels(dx_plb_price_level_side_t *ob, const dxf_order_t *order) { size_t pos; int found; @@ -622,8 +588,6 @@ static void dx_plb_source_add_order_to_levels(dx_plb_price_level_side_t *ob, con } } -/* -------------------------------------------------------------------------- */ - static void dx_plb_source_rebuild_levels(dx_plb_records_array_t *snapshot, dx_plb_price_level_side_t *ob, dxf_order_side_t side) { size_t i = 0; @@ -715,8 +679,6 @@ static int dx_plb_book_free(dx_price_level_book_t *book) { return true; } -/* -------------------------------------------------------------------------- */ - /* This functions must be called without guard */ static void dx_plb_book_clear(dx_price_level_book_t *book) { size_t i = 0; @@ -749,8 +711,6 @@ static void dx_plb_book_clear(dx_price_level_book_t *book) { dx_plb_book_free(book); } -/* -------------------------------------------------------------------------- */ - /* This functions must be called with book guard taken */ static int dx_plb_book_update_one_side(dx_plb_price_level_side_t *dst, dx_plb_price_level_side_t **srcs, size_t src_count, double startValue) { @@ -799,8 +759,6 @@ static int dx_plb_book_update_one_side(dx_plb_price_level_side_t *dst, dx_plb_pr return changed; } -/* -------------------------------------------------------------------------- */ - /* This functions must be called without book guard */ static void dx_plb_book_update(dx_price_level_book_t *book, dx_plb_source_t *src) { int changed = false; diff --git a/src/PriceLevelBookNG.hpp b/src/PriceLevelBookNG.hpp index 29e65909..1042c03b 100644 --- a/src/PriceLevelBookNG.hpp +++ b/src/PriceLevelBookNG.hpp @@ -71,7 +71,7 @@ struct PriceLevel { PriceLevel(double newPrice, double newSize, std::int64_t newTime) : price{newPrice}, size{newSize}, time{newTime} {}; - [[nodiscard]] bool isValid() const { return !std::isnan(price); } + bool isValid() const { return !std::isnan(price); } friend bool operator<(const PriceLevel& a, const PriceLevel& b) { if (std::isnan(b.price)) return true; @@ -121,7 +121,7 @@ struct PriceLevelChanges { PriceLevelChanges(std::string newSymbol, std::vector newAsks, std::vector newBids) : symbol{std::move(newSymbol)}, asks{std::move(newAsks)}, bids{std::move(newBids)} {} - [[nodiscard]] bool isEmpty() const { return asks.empty() && bids.empty(); } + bool isEmpty() const { return asks.empty() && bids.empty(); } }; struct PriceLevelChangesSet { @@ -134,7 +134,7 @@ struct PriceLevelChangesSet { PriceLevelChangesSet(PriceLevelChanges newRemovals, PriceLevelChanges newAdditions, PriceLevelChanges newUpdates) : removals{std::move(newRemovals)}, additions{std::move(newAdditions)}, updates{std::move(newUpdates)} {} - [[nodiscard]] bool isEmpty() const { return removals.isEmpty() && additions.isEmpty() && updates.isEmpty(); } + bool isEmpty() const { return removals.isEmpty() && additions.isEmpty() && updates.isEmpty(); } }; class PriceLevelBook final { @@ -496,11 +496,11 @@ class PriceLevelBook final { std::vector{bidUpdates.begin(), bidUpdates.end()}}}; } - [[nodiscard]] std::vector getAsks() const { + std::vector getAsks() const { return {asks_.begin(), lastAsk_ == asks_.end() ? lastAsk_ : std::next(lastAsk_)}; } - [[nodiscard]] std::vector getBids() const { + std::vector getBids() const { return {bids_.begin(), lastBid_ == bids_.end() ? lastBid_ : std::next(lastBid_)}; } diff --git a/src/RecordBuffers.c b/src/RecordBuffers.c index 918c78f9..52bed6b1 100644 --- a/src/RecordBuffers.c +++ b/src/RecordBuffers.c @@ -25,22 +25,18 @@ #include "ConnectionContextData.h" #include "ObjectArray.h" -/* -------------------------------------------------------------------------- */ /* * Internal data structures and types */ -/* -------------------------------------------------------------------------- */ typedef struct { void* buffer; int capacity; } dx_event_record_buffer_t; -/* -------------------------------------------------------------------------- */ /* * Record buffers connection context */ -/* -------------------------------------------------------------------------- */ typedef struct { dx_event_record_buffer_t record_buffer_array[dx_rid_count]; @@ -54,8 +50,6 @@ typedef struct { #define CONTEXT_FIELD(field) \ (((dx_record_buffers_connection_context_t*)dx_get_subsystem_data(connection, dx_ccs_record_buffers))->field) -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_record_buffers) { dx_record_buffers_connection_context_t* context = dx_calloc(1, sizeof(dx_record_buffers_connection_context_t)); @@ -72,8 +66,6 @@ DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_record_buffers) { return true; } -/* -------------------------------------------------------------------------- */ - void dx_clear_record_buffers (dx_event_record_buffer_t* record_buffers); void dx_free_string_buffers_impl (dx_string_array_t* string_buffers); void dx_free_byte_array_buffers_impl(dx_byte_buffer_array_t* byte_array_buffers); @@ -94,27 +86,21 @@ DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_record_buffers) { return true; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_record_buffers) { return true; } -/* -------------------------------------------------------------------------- */ /* * Connection context functions implementation */ -/* -------------------------------------------------------------------------- */ void* dx_get_record_buffers_connection_context (dxf_connection_t connection) { return dx_get_subsystem_data(connection, dx_ccs_record_buffers, NULL); } -/* -------------------------------------------------------------------------- */ /* * Buffer manager prototype and body macros */ -/* -------------------------------------------------------------------------- */ #define GET_RECORD_PTR_NAME(record_id) \ record_id##_get_record_ptr @@ -152,11 +138,9 @@ void* dx_get_record_buffers_connection_context (dxf_connection_t connection) { return CTX(context)->record_buffer_array[record_id].buffer; \ } -/* -------------------------------------------------------------------------- */ /* * Buffer managers implementation */ -/* -------------------------------------------------------------------------- */ GET_RECORD_PTR_BODY(dx_rid_trade, dx_trade_t) GET_RECORD_BUF_PTR_BODY(dx_rid_trade) @@ -189,11 +173,9 @@ GET_RECORD_BUF_PTR_BODY(dx_rid_series) GET_RECORD_PTR_BODY(dx_rid_configuration, dx_configuration_t) GET_RECORD_BUF_PTR_BODY(dx_rid_configuration) -/* -------------------------------------------------------------------------- */ /* * Buffer manager collection */ -/* -------------------------------------------------------------------------- */ const dx_buffer_manager_collection_t g_buffer_managers[dx_rid_count] = { { GET_RECORD_PTR_NAME(dx_rid_trade), GET_RECORD_BUF_PTR_NAME(dx_rid_trade) }, @@ -226,24 +208,18 @@ void dx_clear_record_buffers (dx_event_record_buffer_t* record_buffers) { } } -/* -------------------------------------------------------------------------- */ /* * Auxiliary memory management stuff */ -/* -------------------------------------------------------------------------- */ int dx_store_string_buffer (void* context, dxf_const_string_t buf) { return dx_string_array_add(&(CTX(context)->string_buffers), buf); } -/* -------------------------------------------------------------------------- */ - int dx_store_byte_array_buffer(void* context, dxf_byte_array_t buf) { return dx_byte_buffer_array_add(&(CTX(context)->byte_array_buffers), buf); } -/* -------------------------------------------------------------------------- */ - void dx_free_string_buffers_impl (dx_string_array_t* string_buffers) { dx_string_array_free(string_buffers); } @@ -252,8 +228,6 @@ void dx_free_byte_array_buffers_impl(dx_byte_buffer_array_t* byte_array_buffers) dx_byte_buffer_array_free(byte_array_buffers); } -/* ---------------------------------- */ - void dx_free_buffers(void* context) { dx_free_string_buffers_impl(&(CTX(context)->string_buffers)); dx_free_byte_array_buffers_impl(&(CTX(context)->byte_array_buffers)); diff --git a/src/RecordBuffers.h b/src/RecordBuffers.h index 6607b66c..e8a74abc 100644 --- a/src/RecordBuffers.h +++ b/src/RecordBuffers.h @@ -28,28 +28,22 @@ #include "PrimitiveTypes.h" #include "EventData.h" -/* -------------------------------------------------------------------------- */ /* * Connection context functions */ -/* -------------------------------------------------------------------------- */ void* dx_get_record_buffers_connection_context (dxf_connection_t connection); -/* -------------------------------------------------------------------------- */ /* * Buffer manager functions prototypes */ -/* -------------------------------------------------------------------------- */ typedef void* (*dx_get_record_ptr_t)(void* context, int record_index); typedef void* (*dx_get_record_buffer_ptr_t)(void* context); -/* -------------------------------------------------------------------------- */ /* * Buffer manager collection */ -/* -------------------------------------------------------------------------- */ typedef struct { dx_get_record_ptr_t record_getter; @@ -58,11 +52,9 @@ typedef struct { extern const dx_buffer_manager_collection_t g_buffer_managers[dx_rid_count]; -/* -------------------------------------------------------------------------- */ /* * Auxiliary memory management functions */ -/* -------------------------------------------------------------------------- */ int dx_store_string_buffer (void* context, dxf_const_string_t buf); int dx_store_byte_array_buffer(void* context, dxf_byte_array_t buf); diff --git a/src/RecordFieldSetters.c b/src/RecordFieldSetters.c index 3107aa51..8503760e 100644 --- a/src/RecordFieldSetters.c +++ b/src/RecordFieldSetters.c @@ -27,33 +27,27 @@ #include "DataStructures.h" #include "EventData.h" -/* -------------------------------------------------------------------------- */ /* * Setter body macro */ -/* -------------------------------------------------------------------------- */ #define FIELD_SETTER_BODY(struct_name, field_name, field_type) \ DX_RECORD_FIELD_SETTER_PROTOTYPE(struct_name, field_name) { \ ((struct_name*)object)->field_name = *(field_type*)field; \ } -/* -------------------------------------------------------------------------- */ /* * Getter body macro */ -/* -------------------------------------------------------------------------- */ #define FIELD_GETTER_BODY(struct_name, field_name, field_type) \ DX_RECORD_FIELD_GETTER_PROTOTYPE(struct_name, field_name) { \ *(field_type*)field = ((struct_name*)object)->field_name; \ } -/* -------------------------------------------------------------------------- */ /* * Default value getter functions */ -/* -------------------------------------------------------------------------- */ #define GENERIC_VALUE_GETTER_NAME(field_type) generic_##field_type##_value_getter @@ -67,11 +61,9 @@ return GENERIC_VALUE_GETTER_NAME(field_type)(); \ } -/* -------------------------------------------------------------------------- */ /* * Some less-than-generic value getters macros */ -/* -------------------------------------------------------------------------- */ #define RECORD_EXCHANGE_CODE_GETTER_NAME(record_id) record_id##_exchange_code_getter @@ -88,11 +80,9 @@ return &exchange_code; \ } -/* -------------------------------------------------------------------------- */ /* * Generic value getters implementation */ -/* -------------------------------------------------------------------------- */ GENERIC_VALUE_GETTER_NAME_PROTO(dxf_char_t) { static DX_THREAD_LOCAL dxf_char_t c = 0; @@ -100,69 +90,53 @@ GENERIC_VALUE_GETTER_NAME_PROTO(dxf_char_t) { return &c; } -/* -------------------------------------------------------------------------- */ - GENERIC_VALUE_GETTER_NAME_PROTO(dxf_int_t) { static DX_THREAD_LOCAL dxf_int_t i = 0; return &i; } -/* -------------------------------------------------------------------------- */ - GENERIC_VALUE_GETTER_NAME_PROTO(dxf_long_t) { static DX_THREAD_LOCAL dxf_long_t l = 0; return &l; } -/* -------------------------------------------------------------------------- */ - GENERIC_VALUE_GETTER_NAME_PROTO(dxf_double_t) { static DX_THREAD_LOCAL dxf_double_t d = 0; return &d; } -/* -------------------------------------------------------------------------- */ - GENERIC_VALUE_GETTER_NAME_PROTO(dxf_dayid_t) { static DX_THREAD_LOCAL dxf_dayid_t d_id = 0; return &d_id; } -/* -------------------------------------------------------------------------- */ - GENERIC_VALUE_GETTER_NAME_PROTO(dxf_const_string_t) { static DX_THREAD_LOCAL dxf_const_string_t s = L""; return &s; } -/* -------------------------------------------------------------------------- */ - GENERIC_VALUE_GETTER_NAME_PROTO(dxf_byte_array_t) { static DX_THREAD_LOCAL dxf_byte_array_t cba = {NULL, 0, 0}; return &cba; } -/* -------------------------------------------------------------------------- */ /* * Standard operations macros */ -/* -------------------------------------------------------------------------- */ #define FIELD_STDOPS_BODIES(struct_name, field_name, field_type) \ FIELD_SETTER_BODY(struct_name, field_name, field_type) \ FIELD_DEF_VAL_BODY(struct_name, field_name, field_type) \ FIELD_GETTER_BODY(struct_name, field_name, field_type) -/* -------------------------------------------------------------------------- */ /* * Trade field setters/getters implementation */ -/* -------------------------------------------------------------------------- */ FIELD_STDOPS_BODIES(dx_trade_t, time, dxf_int_t) FIELD_STDOPS_BODIES(dx_trade_t, sequence, dxf_int_t) @@ -177,11 +151,9 @@ FIELD_STDOPS_BODIES(dx_trade_t, day_volume, dxf_double_t) FIELD_STDOPS_BODIES(dx_trade_t, day_turnover, dxf_double_t) FIELD_STDOPS_BODIES(dx_trade_t, flags, dxf_int_t) -/* -------------------------------------------------------------------------- */ /* * Quote field setters/getters implementation */ -/* -------------------------------------------------------------------------- */ FIELD_STDOPS_BODIES(dx_quote_t, sequence, dxf_int_t) FIELD_STDOPS_BODIES(dx_quote_t, time_nanos, dxf_int_t) @@ -194,11 +166,9 @@ FIELD_STDOPS_BODIES(dx_quote_t, ask_exchange_code, dxf_char_t) FIELD_STDOPS_BODIES(dx_quote_t, ask_price, dxf_double_t) FIELD_STDOPS_BODIES(dx_quote_t, ask_size, dxf_double_t) -/* -------------------------------------------------------------------------- */ /* * Summary field setters/getters implementation */ -/* -------------------------------------------------------------------------- */ FIELD_STDOPS_BODIES(dx_summary_t, day_id, dxf_dayid_t) FIELD_STDOPS_BODIES(dx_summary_t, day_open_price, dxf_double_t) @@ -211,11 +181,9 @@ FIELD_STDOPS_BODIES(dx_summary_t, prev_day_volume, dxf_double_t) FIELD_STDOPS_BODIES(dx_summary_t, open_interest, dxf_double_t) FIELD_STDOPS_BODIES(dx_summary_t, flags, dxf_int_t) -/* -------------------------------------------------------------------------- */ /* * Profile field setter implementation */ -/* -------------------------------------------------------------------------- */ FIELD_STDOPS_BODIES(dx_profile_t, beta, dxf_double_t) FIELD_STDOPS_BODIES(dx_profile_t, eps, dxf_double_t) @@ -234,11 +202,9 @@ FIELD_STDOPS_BODIES(dx_profile_t, flags, dxf_int_t) FIELD_STDOPS_BODIES(dx_profile_t, description, dxf_const_string_t) FIELD_STDOPS_BODIES(dx_profile_t, status_reason, dxf_const_string_t) -/* -------------------------------------------------------------------------- */ /* * Market maker field setters/getters implementation */ -/* -------------------------------------------------------------------------- */ FIELD_STDOPS_BODIES(dx_market_maker_t, mm_exchange, dxf_char_t) FIELD_STDOPS_BODIES(dx_market_maker_t, mm_id, dxf_int_t) @@ -251,11 +217,9 @@ FIELD_STDOPS_BODIES(dx_market_maker_t, mmask_price, dxf_double_t) FIELD_STDOPS_BODIES(dx_market_maker_t, mmask_size, dxf_double_t) FIELD_STDOPS_BODIES(dx_market_maker_t, mmask_count, dxf_double_t) -/* -------------------------------------------------------------------------- */ /* * Order field setters/getters implementation */ -/* -------------------------------------------------------------------------- */ FIELD_STDOPS_BODIES(dx_order_t, index, dxf_int_t) FIELD_STDOPS_BODIES(dx_order_t, time, dxf_int_t) @@ -274,11 +238,9 @@ FIELD_STDOPS_BODIES(dx_order_t, trade_price, dxf_double_t) FIELD_STDOPS_BODIES(dx_order_t, trade_size, dxf_double_t) FIELD_STDOPS_BODIES(dx_order_t, mmid, dxf_int_t) -/* -------------------------------------------------------------------------- */ /* * Time and Sale field setters/getters implementation */ -/* -------------------------------------------------------------------------- */ FIELD_STDOPS_BODIES(dx_time_and_sale_t, time, dxf_int_t) FIELD_STDOPS_BODIES(dx_time_and_sale_t, sequence, dxf_int_t) @@ -293,11 +255,9 @@ FIELD_STDOPS_BODIES(dx_time_and_sale_t, flags, dxf_int_t) FIELD_STDOPS_BODIES(dx_time_and_sale_t, buyer, dxf_const_string_t) FIELD_STDOPS_BODIES(dx_time_and_sale_t, seller, dxf_const_string_t) -/* -------------------------------------------------------------------------- */ /* * Candle field setters/getters implementation */ -/* -------------------------------------------------------------------------- */ FIELD_STDOPS_BODIES(dx_candle_t, time, dxf_int_t) FIELD_STDOPS_BODIES(dx_candle_t, sequence, dxf_int_t) @@ -313,11 +273,9 @@ FIELD_STDOPS_BODIES(dx_candle_t, ask_volume, dxf_double_t) FIELD_STDOPS_BODIES(dx_candle_t, imp_volatility, dxf_double_t) FIELD_STDOPS_BODIES(dx_candle_t, open_interest, dxf_double_t) -/* -------------------------------------------------------------------------- */ /* * SpreadOrder field setters/getters implementation */ -/* -------------------------------------------------------------------------- */ FIELD_STDOPS_BODIES(dx_spread_order_t, index, dxf_int_t) FIELD_STDOPS_BODIES(dx_spread_order_t, time, dxf_int_t) @@ -336,11 +294,9 @@ FIELD_STDOPS_BODIES(dx_spread_order_t, trade_price, dxf_double_t) FIELD_STDOPS_BODIES(dx_spread_order_t, trade_size, dxf_double_t) FIELD_STDOPS_BODIES(dx_spread_order_t, spread_symbol, dxf_const_string_t) -/* -------------------------------------------------------------------------- */ /* * Greeks field setters/getters implementation */ -/* -------------------------------------------------------------------------- */ FIELD_STDOPS_BODIES(dx_greeks_t, time, dxf_int_t) FIELD_STDOPS_BODIES(dx_greeks_t, sequence, dxf_int_t) @@ -352,11 +308,9 @@ FIELD_STDOPS_BODIES(dx_greeks_t, theta, dxf_double_t) FIELD_STDOPS_BODIES(dx_greeks_t, rho, dxf_double_t) FIELD_STDOPS_BODIES(dx_greeks_t, vega, dxf_double_t) -/* -------------------------------------------------------------------------- */ /* * TheoPrice field setters/getters implementation */ -/* -------------------------------------------------------------------------- */ FIELD_SETTER_BODY(dx_theo_price_t, time, dxf_int_t) FIELD_DEF_VAL_BODY(dx_theo_price_t, time, dxf_int_t) @@ -368,11 +322,9 @@ FIELD_STDOPS_BODIES(dx_theo_price_t, gamma, dxf_double_t) FIELD_STDOPS_BODIES(dx_theo_price_t, dividend, dxf_double_t) FIELD_STDOPS_BODIES(dx_theo_price_t, interest, dxf_double_t) -/* -------------------------------------------------------------------------- */ /* * Underlying field setters/getters implementation */ -/* -------------------------------------------------------------------------- */ FIELD_STDOPS_BODIES(dx_underlying_t, volatility, dxf_double_t) FIELD_STDOPS_BODIES(dx_underlying_t, front_volatility, dxf_double_t) @@ -381,11 +333,9 @@ FIELD_STDOPS_BODIES(dx_underlying_t, call_volume, dxf_double_t) FIELD_STDOPS_BODIES(dx_underlying_t, put_volume, dxf_double_t) FIELD_STDOPS_BODIES(dx_underlying_t, put_call_ratio, dxf_double_t) -/* -------------------------------------------------------------------------- */ /* * Series field setters/getters implementation */ -/* -------------------------------------------------------------------------- */ FIELD_STDOPS_BODIES(dx_series_t, index, dxf_int_t) FIELD_STDOPS_BODIES(dx_series_t, time, dxf_int_t) @@ -399,17 +349,13 @@ FIELD_STDOPS_BODIES(dx_series_t, forward_price, dxf_double_t) FIELD_STDOPS_BODIES(dx_series_t, dividend, dxf_double_t) FIELD_STDOPS_BODIES(dx_series_t, interest, dxf_double_t) -/* -------------------------------------------------------------------------- */ /* * Configuration field setters/getters implementation */ -/* -------------------------------------------------------------------------- */ FIELD_STDOPS_BODIES(dx_configuration_t, version, dxf_int_t) FIELD_STDOPS_BODIES(dx_configuration_t, object, dxf_byte_array_t) -/* -------------------------------------------------------------------------- */ - RECORD_EXCHANGE_CODE_GETTER_BODY(dx_rid_trade) RECORD_EXCHANGE_CODE_GETTER_BODY(dx_rid_quote) RECORD_EXCHANGE_CODE_GETTER_BODY(dx_rid_summary) diff --git a/src/RecordFieldSetters.h b/src/RecordFieldSetters.h index a628b909..fab1a1b0 100644 --- a/src/RecordFieldSetters.h +++ b/src/RecordFieldSetters.h @@ -27,35 +27,27 @@ #include "DXFeed.h" -/* -------------------------------------------------------------------------- */ /* * Generic setter prototype */ -/* -------------------------------------------------------------------------- */ typedef void (*dx_record_field_setter_t)(void* object, const void* field); -/* -------------------------------------------------------------------------- */ /* * Generic default value getter prototype */ -/* -------------------------------------------------------------------------- */ typedef const void* (*dx_record_field_def_val_getter_t) (void); -/* -------------------------------------------------------------------------- */ /* * Generic setter prototype */ -/* -------------------------------------------------------------------------- */ typedef void(*dx_record_field_getter_t)(void* object, OUT void* field); -/* -------------------------------------------------------------------------- */ /* * Setter macros */ -/* -------------------------------------------------------------------------- */ #define DX_RECORD_FIELD_SETTER_NAME(struct_name, field_name) \ struct_name##_##field_name##_##setter @@ -63,11 +55,9 @@ typedef void(*dx_record_field_getter_t)(void* object, OUT void* field); #define DX_RECORD_FIELD_SETTER_PROTOTYPE(struct_name, field_name) \ void DX_RECORD_FIELD_SETTER_NAME(struct_name, field_name) (void* object, const void* field) -/* -------------------------------------------------------------------------- */ /* * Default value function macros */ -/* -------------------------------------------------------------------------- */ #define DX_RECORD_FIELD_DEF_VAL_NAME(struct_name, field_name) \ struct_name##_##field_name##_##default_value @@ -75,11 +65,9 @@ typedef void(*dx_record_field_getter_t)(void* object, OUT void* field); #define DX_RECORD_FIELD_DEF_VAL_PROTOTYPE(struct_name, field_name) \ const void* DX_RECORD_FIELD_DEF_VAL_NAME(struct_name, field_name) (void) -/* -------------------------------------------------------------------------- */ /* * Setter macros */ -/* -------------------------------------------------------------------------- */ #define DX_RECORD_FIELD_GETTER_NAME(struct_name, field_name) \ struct_name##_##field_name##_##getter @@ -87,21 +75,17 @@ typedef void(*dx_record_field_getter_t)(void* object, OUT void* field); #define DX_RECORD_FIELD_GETTER_PROTOTYPE(struct_name, field_name) \ void DX_RECORD_FIELD_GETTER_NAME(struct_name, field_name) (void* object, OUT void* field) -/* -------------------------------------------------------------------------- */ /* * Standard operations macros */ -/* -------------------------------------------------------------------------- */ #define DX_RECORD_FIELD_STDOPS_PROTOTYPES(struct_name, field_name) \ DX_RECORD_FIELD_SETTER_PROTOTYPE(struct_name, field_name); \ DX_RECORD_FIELD_DEF_VAL_PROTOTYPE(struct_name, field_name); \ DX_RECORD_FIELD_GETTER_PROTOTYPE(struct_name, field_name); -/* -------------------------------------------------------------------------- */ /* * Trade field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_trade_t, time) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_trade_t, sequence) @@ -116,11 +100,9 @@ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_trade_t, day_volume) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_trade_t, day_turnover) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_trade_t, flags) -/* -------------------------------------------------------------------------- */ /* * Quote field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_quote_t, sequence) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_quote_t, time_nanos) @@ -133,11 +115,9 @@ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_quote_t, ask_exchange_code) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_quote_t, ask_price) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_quote_t, ask_size) -/* -------------------------------------------------------------------------- */ /* * Summary field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_summary_t, day_id) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_summary_t, day_open_price) @@ -150,11 +130,9 @@ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_summary_t, prev_day_volume) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_summary_t, open_interest) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_summary_t, flags) -/* -------------------------------------------------------------------------- */ /* * Profile field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_profile_t, beta) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_profile_t, eps) @@ -173,11 +151,9 @@ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_profile_t, flags) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_profile_t, description) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_profile_t, status_reason) -/* -------------------------------------------------------------------------- */ /* * Market maker field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_market_maker_t, mm_exchange) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_market_maker_t, mm_id) @@ -190,11 +166,9 @@ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_market_maker_t, mmask_price) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_market_maker_t, mmask_size) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_market_maker_t, mmask_count) -/* -------------------------------------------------------------------------- */ /* * Order field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_order_t, index) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_order_t, time) @@ -213,11 +187,9 @@ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_order_t, trade_price) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_order_t, trade_size) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_order_t, mmid) -/* -------------------------------------------------------------------------- */ /* * Time and Sale field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_time_and_sale_t, time) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_time_and_sale_t, sequence) @@ -232,11 +204,9 @@ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_time_and_sale_t, flags) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_time_and_sale_t, buyer) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_time_and_sale_t, seller) -/* -------------------------------------------------------------------------- */ /* * Candle field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_candle_t, time) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_candle_t, sequence) @@ -252,11 +222,9 @@ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_candle_t, ask_volume) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_candle_t, imp_volatility) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_candle_t, open_interest) -/* -------------------------------------------------------------------------- */ /* * SpreadOrder field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_spread_order_t, index) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_spread_order_t, time) @@ -275,11 +243,9 @@ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_spread_order_t, trade_price) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_spread_order_t, trade_size) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_spread_order_t, spread_symbol) -/* -------------------------------------------------------------------------- */ /* * Greeks field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_greeks_t, time) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_greeks_t, sequence) @@ -291,11 +257,9 @@ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_greeks_t, theta) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_greeks_t, rho) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_greeks_t, vega) -/* -------------------------------------------------------------------------- */ /* * TheoPrice field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_theo_price_t, time) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_theo_price_t, price) @@ -305,11 +269,9 @@ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_theo_price_t, gamma) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_theo_price_t, dividend) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_theo_price_t, interest) -/* -------------------------------------------------------------------------- */ /* * Underlying field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_underlying_t, volatility) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_underlying_t, front_volatility) @@ -318,11 +280,9 @@ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_underlying_t, call_volume) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_underlying_t, put_volume) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_underlying_t, put_call_ratio) -/* -------------------------------------------------------------------------- */ /* * Series field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_series_t, index) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_series_t, time) @@ -336,11 +296,9 @@ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_series_t, forward_price) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_series_t, dividend) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_series_t, interest) -/* -------------------------------------------------------------------------- */ /* * Configuration field operations */ -/* -------------------------------------------------------------------------- */ DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_configuration_t, version) DX_RECORD_FIELD_STDOPS_PROTOTYPES(dx_configuration_t, object) diff --git a/src/RecordTranscoder.c b/src/RecordTranscoder.c index 1cbaf0ba..79983a07 100644 --- a/src/RecordTranscoder.c +++ b/src/RecordTranscoder.c @@ -32,11 +32,9 @@ #include "DXErrorHandling.h" #include "ConfigurationDeserializer.h" -/* -------------------------------------------------------------------------- */ /* * Common fiddling macros and constants */ -/* -------------------------------------------------------------------------- */ static const dxf_uint_t DX_SEQUENCE_MASK = 0x3FFFFFU; static const dxf_byte_t DX_SEQUENCE_MS_SHIFT = 22; @@ -63,11 +61,9 @@ dxf_ulong_t char_to_bits(dxf_char_t value) return res >> leading_zero_bits; } -/* -------------------------------------------------------------------------- */ /* * Trade flags constants */ -/* -------------------------------------------------------------------------- */ static const dxf_uint_t DX_TRADE_FLAGS_ETH = 1; static const dxf_byte_t DX_TRADE_FLAGS_DIR_SHIFT = 1; static const dxf_uint_t DX_TRADE_FLAGS_DIR_MASK = 0x7; @@ -75,11 +71,9 @@ static const dxf_uint_t DX_TRADE_FLAGS_DIR_MASK = 0x7; #define DX_TRADE_GET_DIR(rec) ((dxf_direction_t)(((rec)->flags >> DX_TRADE_FLAGS_DIR_SHIFT) & DX_TRADE_FLAGS_DIR_MASK)) #define DX_TRADE_GET_ETH(rec) (((rec)->flags & DX_TRADE_FLAGS_ETH) == DX_TRADE_FLAGS_ETH) -/* -------------------------------------------------------------------------- */ /* * Summary flags constants */ -/* -------------------------------------------------------------------------- */ static const dxf_byte_t DX_SUMMARY_FLAGS_DCPT_SHIFT = 2; static const dxf_byte_t DX_SUMMARY_FLAGS_PDCPT_SHIFT = 0; static const dxf_uint_t DX_SUMMARY_FLAGS_CPT_MASK = 0x3; @@ -87,11 +81,9 @@ static const dxf_uint_t DX_SUMMARY_FLAGS_CPT_MASK = 0x3; #define DX_SUMMARY_GET_DCPT(rec) ((dxf_price_type_t)(((rec)->flags >> DX_SUMMARY_FLAGS_DCPT_SHIFT) & DX_SUMMARY_FLAGS_CPT_MASK)) #define DX_SUMMARY_GET_PDCPT(rec) ((dxf_price_type_t)(((rec)->flags >> DX_SUMMARY_FLAGS_PDCPT_SHIFT) & DX_SUMMARY_FLAGS_CPT_MASK)) -/* -------------------------------------------------------------------------- */ /* * Profile flags constants */ -/* -------------------------------------------------------------------------- */ static const dxf_byte_t DX_PROFILE_FLAGS_TS_SHIFT = 0; static const dxf_uint_t DX_PROFILE_FLAGS_TS_MASK = 0x3; static const dxf_byte_t DX_PROFILE_FLAGS_SSR_SHIFT = 2; @@ -100,11 +92,9 @@ static const dxf_uint_t DX_PROFILE_FLAGS_SSR_MASK = 0x3; #define DX_PROFILE_GET_TS(rec) ((dxf_trading_status_t)(((rec)->flags >> DX_PROFILE_FLAGS_TS_SHIFT) & DX_PROFILE_FLAGS_TS_MASK)) #define DX_PROFILE_GET_SSR(rec) ((dxf_short_sale_restriction_t)(((rec)->flags >> DX_PROFILE_FLAGS_SSR_SHIFT) & DX_PROFILE_FLAGS_SSR_MASK)) -/* -------------------------------------------------------------------------- */ /* * Order index calculation constants */ -/* -------------------------------------------------------------------------- */ /* * Index field contains source identifier, optional exchange code and low-end index (virtual id or MMID). @@ -164,11 +154,9 @@ static const dxf_uint_t DX_ORDER_FLAGS_ACTION_MASK = 0x0f; #define DX_ORDER_GET_EXCHANGE(rec) ((dxf_char_t)(((rec)->flags >> DX_ORDER_FLAGS_EXCHANGE_SHIFT) & DX_ORDER_FLAGS_EXCHANGE_MASK)) #define DX_ORDER_GET_ACTION(rec) ((dxf_order_action_t)(((rec)->flags >> DX_ORDER_FLAGS_ACTION_SHIFT) & DX_ORDER_FLAGS_ACTION_MASK)) -/* -------------------------------------------------------------------------- */ /* * TimeAndSale calculation constants */ -/* -------------------------------------------------------------------------- */ static const dxf_byte_t DX_TNS_FLAGS_TYPE_SHIFT = 0; static const dxf_uint_t DX_TNS_FLAGS_TYPE_MASK = 0x3; static const dxf_uint_t DX_TNS_FLAGS_VALID_TICK = 0x4; @@ -188,32 +176,24 @@ static const dxf_byte_t DX_TNS_INDEX_TIME_SHIFT = 32; #define DX_TNS_GET_SIDE(rec) ((dxf_order_side_t)(((rec)->flags >> DX_TNS_FLAGS_SIDE_SHIFT) & DX_TNS_FLAGS_SIDE_MASK)) #define DX_TNS_GET_TTE(rec) ((dxf_char_t)(((rec)->flags >> DX_TNS_FLAGS_TTE_SHIFT) & DX_TNS_FLAGS_TTE_MASK)) -/* -------------------------------------------------------------------------- */ /* * Candle calculation constants */ -/* -------------------------------------------------------------------------- */ static const dxf_byte_t DX_CANDLE_INDEX_TIME_SHIFT = 32; -/* -------------------------------------------------------------------------- */ /* * Candle calculation constants */ -/* -------------------------------------------------------------------------- */ static const dxf_byte_t DX_GREEKS_INDEX_TIME_SHIFT = 32; -/* -------------------------------------------------------------------------- */ /* * Series calculation constants */ -/* -------------------------------------------------------------------------- */ //static const dxf_byte_t DX_SERIES_INDEX_TIME_SHIFT = 32; -/* -------------------------------------------------------------------------- */ /* * Record transcoder connection context */ -/* -------------------------------------------------------------------------- */ /* Must be synchronized with dx_event_id_t */ const size_t dx_event_sizes[] = { @@ -251,8 +231,6 @@ void dx_copy_event_params(const dxf_event_params_t* from, dxf_event_params_t* to #define CTX(context) \ ((dx_record_transcoder_connection_context_t*)context) -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_record_transcoder) { dx_record_transcoder_connection_context_t* context = NULL; @@ -287,8 +265,6 @@ DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_record_transcoder) { return true; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_record_transcoder) { int res = true; dx_record_transcoder_connection_context_t* context = dx_get_subsystem_data(connection, dx_ccs_record_transcoder, &res); @@ -307,20 +283,16 @@ DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_record_transcoder) { return true; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_record_transcoder) { return true; } -/* -------------------------------------------------------------------------- */ /* * Event data buffer functions * some transcoders require separate data structures to be allocated and filled * based on the record data they receive */ -/* -------------------------------------------------------------------------- */ void* dx_initialize_event_data_buffer(int count, size_t struct_size, OUT void** buffer_data, OUT int* buffer_count) { @@ -354,11 +326,9 @@ dxf_event_data_t dx_get_event_data_buffer(dx_record_transcoder_connection_contex (void**)&(context->event_buffers[event_id].buffer), &(context->event_buffers[event_id].count)); } -/* -------------------------------------------------------------------------- */ /* * Record transcoder macros and prototypes */ -/* -------------------------------------------------------------------------- */ #define RECORD_TRANSCODER_NAME(struct_name) \ struct_name##_transcoder @@ -368,11 +338,9 @@ typedef int (*dx_record_transcoder_t) (dx_record_transcoder_connection_context_t const dxf_event_params_t* event_params, void* record_buffer); -/* -------------------------------------------------------------------------- */ /* * Record transcoders implementation */ -/* -------------------------------------------------------------------------- */ static int dx_trade_t_transcoder_impl(dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, @@ -425,8 +393,6 @@ int RECORD_TRANSCODER_NAME(dx_trade_t) (dx_record_transcoder_connection_context_ return dx_trade_t_transcoder_impl(context, record_params, event_params, (dx_trade_t*)record_buffer, dx_eid_trade); } -/* -------------------------------------------------------------------------- */ - int dx_transcode_quote_to_order_bid (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -466,8 +432,6 @@ int dx_transcode_quote_to_order_bid (dx_record_transcoder_connection_context_t* event_params); } -/* ---------------------------------- */ - int dx_transcode_quote_to_order_ask (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -508,8 +472,6 @@ int dx_transcode_quote_to_order_ask (dx_record_transcoder_connection_context_t* event_params); } -/* ---------------------------------- */ - int dx_transcode_quote (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -542,8 +504,6 @@ int dx_transcode_quote (dx_record_transcoder_connection_context_t* context, event_params); } -/* ---------------------------------- */ - int RECORD_TRANSCODER_NAME(dx_quote_t) (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -577,8 +537,6 @@ int RECORD_TRANSCODER_NAME(dx_quote_t) (dx_record_transcoder_connection_context_ return true; } -/* -------------------------------------------------------------------------- */ - int RECORD_TRANSCODER_NAME(dx_summary_t) (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -616,8 +574,6 @@ int RECORD_TRANSCODER_NAME(dx_summary_t) (dx_record_transcoder_connection_contex event_params); } -/* -------------------------------------------------------------------------- */ - int RECORD_TRANSCODER_NAME(dx_profile_t) (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -664,8 +620,6 @@ int RECORD_TRANSCODER_NAME(dx_profile_t) (dx_record_transcoder_connection_contex event_params); } -/* -------------------------------------------------------------------------- */ - int dx_transcode_market_maker_to_order_bid (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -712,8 +666,6 @@ int dx_transcode_market_maker_to_order_bid (dx_record_transcoder_connection_cont event_params); } -/* ---------------------------------- */ - int dx_transcode_market_maker_to_order_ask (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -758,8 +710,6 @@ int dx_transcode_market_maker_to_order_ask (dx_record_transcoder_connection_cont event_params); } -/* ---------------------------------- */ - int RECORD_TRANSCODER_NAME(dx_market_maker_t) (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -789,8 +739,6 @@ int RECORD_TRANSCODER_NAME(dx_market_maker_t) (dx_record_transcoder_connection_c return true; } -/* ---------------------------------- */ - #define MAX_SUFFIX_LEN_FOR_INDEX 4 dxf_long_t suffix_to_long(dxf_const_string_t suffix) @@ -868,8 +816,6 @@ int RECORD_TRANSCODER_NAME(dx_order_t) (dx_record_transcoder_connection_context_ event_params); } -/* -------------------------------------------------------------------------- */ - int RECORD_TRANSCODER_NAME(dx_time_and_sale_t) (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -931,8 +877,6 @@ int RECORD_TRANSCODER_NAME(dx_time_and_sale_t) (dx_record_transcoder_connection_ event_params); } -/* -------------------------------------------------------------------------- */ - int RECORD_TRANSCODER_NAME(dx_candle_t) (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -971,8 +915,6 @@ int RECORD_TRANSCODER_NAME(dx_candle_t) (dx_record_transcoder_connection_context event_params); } -/* -------------------------------------------------------------------------- */ - int RECORD_TRANSCODER_NAME(dx_trade_eth_t) (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -980,8 +922,6 @@ int RECORD_TRANSCODER_NAME(dx_trade_eth_t) (dx_record_transcoder_connection_cont return dx_trade_t_transcoder_impl(context, record_params, event_params, (dx_trade_t*)record_buffer, dx_eid_trade_eth); } -/* -------------------------------------------------------------------------- */ - int RECORD_TRANSCODER_NAME(dx_spread_order_t) (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -1039,8 +979,6 @@ int RECORD_TRANSCODER_NAME(dx_spread_order_t) (dx_record_transcoder_connection_c event_params); } -/* -------------------------------------------------------------------------- */ - int RECORD_TRANSCODER_NAME(dx_greeks_t) (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -1074,8 +1012,6 @@ int RECORD_TRANSCODER_NAME(dx_greeks_t) (dx_record_transcoder_connection_context event_params); } -/* -------------------------------------------------------------------------- */ - int RECORD_TRANSCODER_NAME(dx_theo_price_t) (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -1088,8 +1024,6 @@ int RECORD_TRANSCODER_NAME(dx_theo_price_t) (dx_record_transcoder_connection_con event_params); } -/* -------------------------------------------------------------------------- */ - int RECORD_TRANSCODER_NAME(dx_underlying_t) (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -1116,8 +1050,6 @@ int RECORD_TRANSCODER_NAME(dx_underlying_t) (dx_record_transcoder_connection_con event_params); } -/* -------------------------------------------------------------------------- */ - int RECORD_TRANSCODER_NAME(dx_series_t)(dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, void* record_buff) { @@ -1155,8 +1087,6 @@ int RECORD_TRANSCODER_NAME(dx_series_t)(dx_record_transcoder_connection_context_ event_params); } -/* -------------------------------------------------------------------------- */ - int RECORD_TRANSCODER_NAME(dx_configuration_t) (dx_record_transcoder_connection_context_t* context, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, @@ -1180,11 +1110,9 @@ int RECORD_TRANSCODER_NAME(dx_configuration_t) (dx_record_transcoder_connection_ event_params); } -/* -------------------------------------------------------------------------- */ /* * Interface functions implementation */ -/* -------------------------------------------------------------------------- */ static const dx_record_transcoder_t g_record_transcoders[dx_rid_count] = { RECORD_TRANSCODER_NAME(dx_trade_t), @@ -1204,8 +1132,6 @@ static const dx_record_transcoder_t g_record_transcoders[dx_rid_count] = { RECORD_TRANSCODER_NAME(dx_configuration_t) }; -/* -------------------------------------------------------------------------- */ - int dx_transcode_record_data (dxf_connection_t connection, const dx_record_params_t* record_params, const dxf_event_params_t* event_params, diff --git a/src/RecordTranscoder.h b/src/RecordTranscoder.h index 41137626..31235d8b 100644 --- a/src/RecordTranscoder.h +++ b/src/RecordTranscoder.h @@ -38,11 +38,9 @@ typedef struct { dxf_time_int_field_t time_int_field; } dx_record_params_t; -/* -------------------------------------------------------------------------- */ /* * Interface functions */ -/* -------------------------------------------------------------------------- */ int dx_transcode_record_data (dxf_connection_t connection, const dx_record_params_t* record_params, diff --git a/src/RegionalBook.c b/src/RegionalBook.c index 655a20d9..65740db3 100644 --- a/src/RegionalBook.c +++ b/src/RegionalBook.c @@ -122,8 +122,6 @@ DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_regional_book) { return true; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_regional_book) { int res = true; dx_rb_connection_context_t* context = dx_get_subsystem_data(connection, dx_ccs_regional_book, &res); @@ -134,7 +132,6 @@ DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_regional_book) { return res; } -/* -------------------------------------------------------------------------- */ static int dx_rb_clear_connection_context(dx_rb_connection_context_t* context) { int res = true; res &= dx_mutex_destroy(&(context->guard)); @@ -142,8 +139,6 @@ static int dx_rb_clear_connection_context(dx_rb_connection_context_t* context) { return res; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_regional_book) { return true; } @@ -170,8 +165,6 @@ static int dx_rb_book_free(dx_regional_book_t *book) { return true; } -/* -------------------------------------------------------------------------- */ - /* This functuions must be called without guard */ static void dx_rb_book_clear(dx_regional_book_t *book) { /* Kill subscription */ @@ -182,9 +175,7 @@ static void dx_rb_book_clear(dx_regional_book_t *book) { } -/* -------------------------------------------------------------------------- */ - -/* This functuions must be called with book guard taken */ +/* This functions must be called with book guard taken */ static int dx_rb_book_update_one_side(dxf_price_level_element_t *dst, size_t *dst_count, dx_regional_book_t *book, int isBid, double startValue) { int changed = false; size_t didx = 0; @@ -239,9 +230,7 @@ static int dx_rb_book_update_one_side(dxf_price_level_element_t *dst, size_t *ds return changed; } -/* -------------------------------------------------------------------------- */ - -/* This functuions must be called without book guard */ +/* This functions must be called without book guard */ static void dx_rb_book_update(dx_regional_book_t *book) { int changed = false; size_t i = 0; @@ -385,7 +374,7 @@ dxf_regional_book_t dx_create_regional_book(dxf_connection_t connection, } /* Create subscription which we need, for needed regions */ - if ((book->subscription = dx_create_event_subscription(connection, DXF_ET_QUOTE, dx_esf_quotes_regional, 0)) == dx_invalid_subscription) { + if ((book->subscription = dx_create_event_subscription(connection, DXF_ET_QUOTE, dx_esf_quotes_regional, 0, 0)) == dx_invalid_subscription) { dx_rb_book_free(book); dx_set_error_code(dx_mec_insufficient_memory); return NULL; diff --git a/src/ServerMessageProcessor.c b/src/ServerMessageProcessor.c index 7fe09be4..5eb08d0c 100644 --- a/src/ServerMessageProcessor.c +++ b/src/ServerMessageProcessor.c @@ -39,11 +39,9 @@ #include "Snapshot.h" #include "SymbolCodec.h" -/* -------------------------------------------------------------------------- */ /* * Common data */ -/* -------------------------------------------------------------------------- */ #define SYMBOL_BUFFER_LEN 2048 @@ -59,11 +57,9 @@ #define DX_RECV_PROPERTY_AUTH L"authentication" #define DX_RECV_PROPERTY_LOGIN_REQUIRED L"LOGIN " -/* -------------------------------------------------------------------------- */ /* * Client-server data overlapping structures and stuff */ -/* -------------------------------------------------------------------------- */ typedef struct { int type; @@ -84,11 +80,9 @@ typedef struct { size_t capacity; } dx_record_digest_list_t; -/* -------------------------------------------------------------------------- */ /* * Message support data */ -/* -------------------------------------------------------------------------- */ typedef enum { dx_dps_not_sent, @@ -97,11 +91,9 @@ typedef enum { dx_dps_pending } dx_describe_protocol_status_t; -/* -------------------------------------------------------------------------- */ /* * Server message processor connection context */ -/* -------------------------------------------------------------------------- */ typedef struct { dxf_connection_t connection; @@ -138,8 +130,6 @@ typedef struct { dx_property_map_t recv_props; } dx_server_msg_proc_connection_context_t; -/* -------------------------------------------------------------------------- */ - void dx_init_record_digests_list(dx_record_digest_list_t* record_digests) { if (record_digests == NULL) return; @@ -209,8 +199,6 @@ DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_server_msg_processor) { return true; } -/* -------------------------------------------------------------------------- */ - void dx_clear_record_digests (dx_server_msg_proc_connection_context_t* context); DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_server_msg_processor) { @@ -232,17 +220,13 @@ DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_server_msg_processor) { return true; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_server_msg_processor) { return true; } -/* -------------------------------------------------------------------------- */ /* * Field digest functions */ -/* -------------------------------------------------------------------------- */ dx_record_digest_t* dx_get_record_digest(dx_server_msg_proc_connection_context_t* context, dx_record_id_t record_id) { dx_record_digest_list_t* record_digests = NULL; @@ -306,8 +290,6 @@ int dx_create_field_digest (dx_server_msg_proc_connection_context_t* context, return true; } -/* -------------------------------------------------------------------------- */ - int dx_digest_unsupported_fields (dx_server_msg_proc_connection_context_t* context, dx_record_id_t record_id, const dx_record_item_t* record_info) { dx_record_digest_t* record_digest = NULL; @@ -351,8 +333,6 @@ int dx_digest_unsupported_fields (dx_server_msg_proc_connection_context_t* conte return true; } -/* -------------------------------------------------------------------------- */ - void dx_init_record_digest(dx_record_digest_t* digest) { if (digest == NULL) return; @@ -361,8 +341,6 @@ void dx_init_record_digest(dx_record_digest_t* digest) { digest->in_sync_with_server = false; } -/* -------------------------------------------------------------------------- */ - void dx_clear_record_digest (dx_record_digest_t* digest) { int i = 0; @@ -379,8 +357,6 @@ void dx_clear_record_digest (dx_record_digest_t* digest) { dx_init_record_digest(digest); } -/* -------------------------------------------------------------------------- */ - void dx_clear_record_digests (dx_server_msg_proc_connection_context_t* context) { if (!dx_mutex_lock(&(context->record_digests_guard))) { return; @@ -405,8 +381,6 @@ void dx_clear_record_digests (dx_server_msg_proc_connection_context_t* context) dx_mutex_unlock(&(context->record_digests_guard)); } -/* -------------------------------------------------------------------------- */ - void dx_init_record_digests(dx_server_msg_proc_connection_context_t* context) { dx_record_id_t i; dx_record_id_t count = dx_get_records_list_count(context->dscc); @@ -415,11 +389,9 @@ void dx_init_record_digests(dx_server_msg_proc_connection_context_t* context) { } } -/* -------------------------------------------------------------------------- */ /* * Server synchronization functions implementation */ -/* -------------------------------------------------------------------------- */ int dx_clear_server_info (dxf_connection_t connection) { int res = true; @@ -459,11 +431,9 @@ int dx_clear_server_info (dxf_connection_t connection) { return true; } -/* -------------------------------------------------------------------------- */ /* * Message support functions */ -/* -------------------------------------------------------------------------- */ int dx_lock_describe_protocol_processing (dxf_connection_t connection, int lock) { int res = true; @@ -484,8 +454,6 @@ int dx_lock_describe_protocol_processing (dxf_connection_t connection, int lock) } } -/* -------------------------------------------------------------------------- */ - static int dx_get_msg_support_state (int msg, const int* roster, size_t count, int bitmask) { size_t idx; int found = false; @@ -503,8 +471,6 @@ static int dx_get_msg_support_state (int msg, const int* roster, size_t count, i return false; } -/* ---------------------------------- */ - int dx_is_message_supported_by_server (dxf_connection_t connection, dx_message_type_t msg, int lock_required, OUT dx_message_support_status_t* status) { int res = true; @@ -552,8 +518,6 @@ int dx_is_message_supported_by_server (dxf_connection_t connection, dx_message_t return true; } -/* -------------------------------------------------------------------------- */ - int dx_legacy_send_msg_bitmask (OUT int* bitmask) { static DX_THREAD_LOCAL const int s_legacy_msg_list[] = { MESSAGE_TICKER_ADD_SUBSCRIPTION, @@ -598,8 +562,6 @@ int dx_legacy_send_msg_bitmask (OUT int* bitmask) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_legacy_recv_msg_bitmask (int* bitmask) { static DX_THREAD_LOCAL const int s_legacy_msg_list[] = { MESSAGE_TICKER_DATA, @@ -641,8 +603,6 @@ int dx_legacy_recv_msg_bitmask (int* bitmask) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_describe_protocol_timeout_countdown_task (void* data, int command) { /* * This is a special worker thread task that processes the describe protocol timeout logic @@ -719,8 +679,6 @@ int dx_describe_protocol_timeout_countdown_task (void* data, int command) { return res; } -/* ---------------------------------- */ - int dx_describe_protocol_sent (dxf_connection_t connection) { int res = true; dx_server_msg_proc_connection_context_t* context = dx_get_subsystem_data(connection, dx_ccs_server_msg_processor, &res); @@ -779,11 +737,9 @@ int dx_describe_protocol_sent (dxf_connection_t connection) { return dx_mutex_unlock(&(context->describe_protocol_guard)) && res; } -/* -------------------------------------------------------------------------- */ /* * Server message processor helpers */ -/* -------------------------------------------------------------------------- */ static int dx_read_message_type (dx_server_msg_proc_connection_context_t* context, OUT dx_message_type_t* value) { dxf_long_t type; @@ -805,8 +761,6 @@ static int dx_read_message_type (dx_server_msg_proc_connection_context_t* contex return true; } -/* -------------------------------------------------------------------------- */ - static int dx_read_message_length_and_set_buffer_limit (dx_server_msg_proc_connection_context_t* context) { dxf_long_t message_length; int message_end_offset; @@ -830,8 +784,6 @@ static int dx_read_message_length_and_set_buffer_limit (dx_server_msg_proc_conne return true; } -/* -------------------------------------------------------------------------- */ - static int dx_read_symbol (dx_server_msg_proc_connection_context_t* context) { dxf_int_t r; @@ -871,8 +823,6 @@ static int dx_read_symbol (dx_server_msg_proc_connection_context_t* context) { return true; } -/* -------------------------------------------------------------------------- */ - #define CHECKED_SET_VALUE(setter, buffer, value) \ if (setter != NULL) { \ setter(buffer, value); \ @@ -1076,8 +1026,6 @@ int dx_read_records (dx_server_msg_proc_connection_context_t* context, return true; } -/* -------------------------------------------------------------------------- */ - #define CHECKED_GET_VALUE(getter, buffer, value) \ if (getter != NULL) { \ getter(buffer, value); \ @@ -1105,8 +1053,6 @@ dxf_time_int_field_t dx_get_time_int_field(void* dscc, dx_record_id_t record_id, return (high << 32) | (low & 0xFFFFFFFF); } -/* -------------------------------------------------------------------------- */ - int dx_process_data_message (dx_server_msg_proc_connection_context_t* context) { context->last_cipher = 0; CHECKED_FREE(context->last_symbol); @@ -1170,7 +1116,6 @@ int dx_process_data_message (dx_server_msg_proc_connection_context_t* context) { return false; } - if (!dx_read_records(context, record_id, record_buffer)) { dx_free_buffers(context->rbcc); @@ -1204,8 +1149,6 @@ int dx_process_data_message (dx_server_msg_proc_connection_context_t* context) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_fill_record_digest(dx_server_msg_proc_connection_context_t* context, dx_record_id_t rid, const dx_record_item_t* record_info, dxf_int_t field_count, OUT dx_record_digest_t* record_digest) { int i = 0; @@ -1232,8 +1175,6 @@ int dx_fill_record_digest(dx_server_msg_proc_connection_context_t* context, dx_r return true; } -/* -------------------------------------------------------------------------- */ - int dx_process_describe_records (dx_server_msg_proc_connection_context_t* context) { while (dx_get_in_buffer_position(context->bicc) < dx_get_in_buffer_limit(context->bicc)) { dxf_int_t server_record_id; @@ -1287,11 +1228,9 @@ int dx_process_describe_records (dx_server_msg_proc_connection_context_t* contex return true; } -/* -------------------------------------------------------------------------- */ /* * Describe protocol functions */ -/* -------------------------------------------------------------------------- */ int dx_read_describe_protocol_properties (dx_server_msg_proc_connection_context_t* context) { dxf_string_t key; @@ -1320,12 +1259,8 @@ int dx_read_describe_protocol_properties (dx_server_msg_proc_connection_context_ return true; } -/* -------------------------------------------------------------------------- */ - typedef void (*dx_message_type_processor_t)(dx_server_msg_proc_connection_context_t* context, int message_id, dxf_string_t message_name); -/* ---------------------------------- */ - static void dx_process_server_send_message_type (dx_server_msg_proc_connection_context_t* context, int message_id, dxf_string_t message_name) { size_t msg_index; int found = false; @@ -1350,8 +1285,6 @@ static void dx_process_server_send_message_type (dx_server_msg_proc_connection_c context->recv_msgs_bitmask |= INDEX_BITMASK(msg_index); } -/* ---------------------------------- */ - static void dx_process_server_recv_message_type (dx_server_msg_proc_connection_context_t* context, int message_id, dxf_string_t message_name) { size_t msg_index; int found = false; @@ -1378,8 +1311,6 @@ static void dx_process_server_recv_message_type (dx_server_msg_proc_connection_c context->send_msgs_bitmask |= INDEX_BITMASK(msg_index); } -/* -------------------------------------------------------------------------- */ - int dx_read_describe_protocol_message_list (dx_server_msg_proc_connection_context_t* context, dx_message_type_processor_t processor) { dxf_int_t count; int i = 0; @@ -1408,8 +1339,6 @@ int dx_read_describe_protocol_message_list (dx_server_msg_proc_connection_contex return true; } -/* -------------------------------------------------------------------------- */ - int dx_process_describe_protocol (dx_server_msg_proc_connection_context_t* context) { dxf_int_t magic; int buf_pos; @@ -1498,11 +1427,9 @@ int dx_process_heartbeat_message(dx_server_msg_proc_connection_context_t* contex return dx_connection_process_incoming_heartbeat(connection_impl); } -/* -------------------------------------------------------------------------- */ /* * High level message processor functions */ -/* -------------------------------------------------------------------------- */ int dx_process_message (dx_server_msg_proc_connection_context_t* context, dx_message_type_t message_type) { if (dx_is_data_message(message_type)) { @@ -1561,8 +1488,6 @@ int dx_process_message (dx_server_msg_proc_connection_context_t* context, dx_mes return true; } -/* -------------------------------------------------------------------------- */ - int dx_append_new_data (dx_server_msg_proc_connection_context_t* context, const dxf_byte_t* new_buffer, dxf_int_t new_buffer_size) { if (context->buffer_size != context->buffer_pos) { @@ -1605,11 +1530,9 @@ int dx_append_new_data (dx_server_msg_proc_connection_context_t* context, return true; } -/* -------------------------------------------------------------------------- */ /* * Main functions */ -/* -------------------------------------------------------------------------- */ int dx_process_server_data (dxf_connection_t connection, const dxf_byte_t* data_buffer, int data_buffer_size) { int process_result = true; @@ -1732,11 +1655,9 @@ int dx_process_server_data (dxf_connection_t connection, const dxf_byte_t* data_ return process_result; } -/* -------------------------------------------------------------------------- */ /* * Low level socket data receiver implementation */ -/* -------------------------------------------------------------------------- */ int dx_socket_data_receiver (dxf_connection_t connection, const void* buffer, int buffer_size) { int conn_ctx_res = true; @@ -1754,11 +1675,9 @@ int dx_socket_data_receiver (dxf_connection_t connection, const void* buffer, in return dx_process_server_data(connection, buffer, buffer_size); } -/* -------------------------------------------------------------------------- */ /* * Records digest management */ -/* -------------------------------------------------------------------------- */ int dx_add_record_digest_to_list(dxf_connection_t connection, dx_record_id_t index) { int failed = false; @@ -1786,11 +1705,9 @@ int dx_add_record_digest_to_list(dxf_connection_t connection, dx_record_id_t ind return true; } -/* -------------------------------------------------------------------------- */ /* * Start dumping incoming raw data into specific file */ -/* -------------------------------------------------------------------------- */ int dx_add_raw_dump_file(dxf_connection_t connection, const char * raw_file_name) { diff --git a/src/ServerMessageProcessor.h b/src/ServerMessageProcessor.h index 63915ac7..b749a0b0 100644 --- a/src/ServerMessageProcessor.h +++ b/src/ServerMessageProcessor.h @@ -26,19 +26,15 @@ #include "DXPMessageData.h" #include "RecordData.h" -/* -------------------------------------------------------------------------- */ /* * Server synchronization functions */ -/* -------------------------------------------------------------------------- */ int dx_clear_server_info (dxf_connection_t connection); -/* -------------------------------------------------------------------------- */ /* * Describe protocol and message support functions */ -/* -------------------------------------------------------------------------- */ typedef enum { dx_mss_supported, @@ -52,27 +48,21 @@ int dx_is_message_supported_by_server (dxf_connection_t connection, dx_message_t OUT dx_message_support_status_t* status); int dx_describe_protocol_sent (dxf_connection_t connection); -/* -------------------------------------------------------------------------- */ /* * Low level network data receiver */ -/* -------------------------------------------------------------------------- */ int dx_socket_data_receiver (dxf_connection_t connection, const void* buffer, int buffer_size); -/* -------------------------------------------------------------------------- */ /* * Records digest management */ -/* -------------------------------------------------------------------------- */ int dx_add_record_digest_to_list(dxf_connection_t connection, dx_record_id_t index); -/* -------------------------------------------------------------------------- */ /* * Start dumping incoming raw data into specific file */ -/* -------------------------------------------------------------------------- */ int dx_add_raw_dump_file(dxf_connection_t connection, const char* raw_file_name); #endif /* SERVER_MESSAGE_PROCESSOR_H_INCLUDED */ diff --git a/src/Snapshot.c b/src/Snapshot.c index 1137eb35..78f750ca 100644 --- a/src/Snapshot.c +++ b/src/Snapshot.c @@ -27,11 +27,9 @@ #include "Logger.h" #include "Snapshot.h" -/* -------------------------------------------------------------------------- */ /* * Internal data structures and defines */ -/* -------------------------------------------------------------------------- */ typedef enum { dx_status_unknown = 0, @@ -128,11 +126,9 @@ const dxf_snapshot_t dx_invalid_snapshot = (dxf_snapshot_t)NULL; #define SNAPSHOT_KEY_SOURCE_MASK 0xFFFFFFu -/* -------------------------------------------------------------------------- */ /* * Event subscription connection context */ -/* -------------------------------------------------------------------------- */ typedef struct { dxf_connection_t connection; @@ -146,8 +142,6 @@ typedef struct { #define CTX(context) \ ((dx_snapshot_subscription_connection_context_t*)context) -/* -------------------------------------------------------------------------- */ - int dx_clear_snapshot_subscription_connection_context(dx_snapshot_subscription_connection_context_t* context); int dx_free_snapshot_data(dx_snapshot_data_ptr_t snapshot_data); @@ -181,8 +175,6 @@ DX_CONNECTION_SUBSYS_INIT_PROTO(dx_ccs_snapshot_subscription) { return true; } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_snapshot_subscription) { int res = true; dx_snapshot_subscription_connection_context_t* context = dx_get_subsystem_data(connection, dx_ccs_snapshot_subscription, &res); @@ -194,14 +186,10 @@ DX_CONNECTION_SUBSYS_DEINIT_PROTO(dx_ccs_snapshot_subscription) { return dx_clear_snapshot_subscription_connection_context(context); } -/* -------------------------------------------------------------------------- */ - DX_CONNECTION_SUBSYS_CHECK_PROTO(dx_ccs_snapshot_subscription) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_clear_snapshot_subscription_connection_context(dx_snapshot_subscription_connection_context_t* context) { int res = true; size_t i = 0; @@ -223,11 +211,9 @@ int dx_clear_snapshot_subscription_connection_context(dx_snapshot_subscription_c return res; } -/* -------------------------------------------------------------------------- */ /* * Helpers functions implementation */ -/* -------------------------------------------------------------------------- */ int dx_snapshot_records_comparator(dxf_time_int_field_t t1, dxf_time_int_field_t t2) { return t1 > t2 ? -1 : (t1 < t2 ? 1 : 0); @@ -806,11 +792,9 @@ int dx_free_snapshot_data(dx_snapshot_data_ptr_t snapshot_data) { return true; } -/* -------------------------------------------------------------------------- */ /* * Subscription functions implementation */ -/* -------------------------------------------------------------------------- */ dxf_snapshot_t dx_create_snapshot(dxf_connection_t connection, dxf_subscription_t subscription, diff --git a/src/Snapshot.h b/src/Snapshot.h index 14e2e6f8..7546ce74 100644 --- a/src/Snapshot.h +++ b/src/Snapshot.h @@ -26,17 +26,9 @@ extern const dxf_snapshot_t dx_invalid_snapshot; -/* -------------------------------------------------------------------------- */ -/* - * Subscription types - */ -/* -------------------------------------------------------------------------- */ - -/* -------------------------------------------------------------------------- */ /* * Subscription functions */ -/* -------------------------------------------------------------------------- */ /* returns dx_invalid_snapshot on error */ dxf_snapshot_t dx_create_snapshot(dxf_connection_t connection, diff --git a/src/Snapshot/Snapshot.cpp b/src/Snapshot/Snapshot.cpp new file mode 100644 index 00000000..c12085eb --- /dev/null +++ b/src/Snapshot/Snapshot.cpp @@ -0,0 +1,61 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version + * 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is Devexperts LLC. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + */ + +extern "C" { +#include "Snapshot.h" +} + +#include "../StringConverter.hpp" +#include "Snapshot.hpp" + +extern "C" { +dxf_snapshot_v2_t dx_create_snapshot_v2(dxf_connection_t connection, dx_event_id_t event_id, dxf_const_string_t symbol, + const char* source, dxf_long_t time, void* userData) { + auto m = dx::SnapshotManager::getInstance(connection); + + if (dx::detail::isOnlyIndexedEvent(event_id)) { + if (time > 0) { + return dx::INVALID_SNAPSHOT_REFERENCE_ID; + } + + auto s = m->create( + connection, + dx::SnapshotKey(event_id, dx::StringConverter::wStringToUtf8(symbol), std::string(source), nonstd::nullopt), + userData); + + return s.second; + } else if (dx::detail::isTimeSeriesEvent(event_id)) { // TODO: TimeSeriesEvent + return dx::INVALID_SNAPSHOT_REFERENCE_ID; + } + + return dx::INVALID_SNAPSHOT_REFERENCE_ID; +} + +int dx_set_snapshot_listeners_v2(dxf_connection_t connection, dxf_snapshot_v2_t snapshot, dxf_snapshot_listener_v2_t on_new_snapshot_listener, + dxf_snapshot_listener_v2_t on_snapshot_update_listener, + dxf_snapshot_inc_listener_v2_t on_incremental_change_listener) { + + return true; +} + +void dx_close_snapshot_v2(dxf_connection_t connection, dxf_snapshot_v2_t snapshot) { + dx::SnapshotManager::getInstance(connection)->close(snapshot); +} + +} diff --git a/src/Snapshot/Snapshot.h b/src/Snapshot/Snapshot.h new file mode 100644 index 00000000..ad464423 --- /dev/null +++ b/src/Snapshot/Snapshot.h @@ -0,0 +1,42 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version + * 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is Devexperts LLC. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + */ + +#pragma once + +#include +#include + +#include "../PrimitiveTypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +dxf_snapshot_v2_t dx_create_snapshot_v2(dxf_connection_t connection, dx_event_id_t event_id, dxf_const_string_t symbol, + const char* source, dxf_long_t time, void* userData); + +int dx_set_snapshot_listeners_v2(dxf_connection_t connection, dxf_snapshot_v2_t snapshot, dxf_snapshot_listener_v2_t on_new_snapshot_listener, + dxf_snapshot_listener_v2_t on_snapshot_update_listener, + dxf_snapshot_inc_listener_v2_t on_incremental_change_listener); + +void dx_close_snapshot_v2(dxf_connection_t connection, dxf_snapshot_v2_t snapshot); + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/src/Snapshot/Snapshot.hpp b/src/Snapshot/Snapshot.hpp new file mode 100644 index 00000000..45766828 --- /dev/null +++ b/src/Snapshot/Snapshot.hpp @@ -0,0 +1,716 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version + * 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is Devexperts LLC. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + */ + +#pragma once + +extern "C" { +#include +#include + +#include "../EventSubscription.h" +} + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../IdGenerator.hpp" +#include "../Utils/Hash.hpp" +#include "SnapshotChanges.hpp" +#include "SnapshotKey.hpp" + +namespace dx { + +struct UnknownEventType {}; + +template +struct EventIdToType { + using type = UnknownEventType; +}; + +#define DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(eventId, eventType) \ + template <> \ + struct EventIdToType { \ + using type = eventType; \ + } + +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_trade, dxf_trade_t); +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_quote, dxf_quote_t); +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_summary, dxf_summary_t); +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_profile, dxf_profile_t); +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_order, dxf_order_t); +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_time_and_sale, dxf_time_and_sale_t); +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_candle, dxf_candle_t); +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_trade_eth, dxf_trade_eth_t); +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_spread_order, dxf_order_t); +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_greeks, dxf_greeks_t); +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_theo_price, dxf_theo_price_t); +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_underlying, dxf_underlying_t); +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_series, dxf_series_t); +DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER(dx_eid_configuration, dxf_configuration_t); + +#undef DX_SNAPSHOT_EVENT_ID_TO_TYPE_HELPER + +namespace detail { +inline static constexpr unsigned eventIdToBitmask(dx_event_id_t eventId) { + return 1u << static_cast(eventId); +} + +inline static constexpr bool isOnlyIndexedEvent(dx_event_id_t eventId) { + return dx_eid_order == eventId || dx_eid_spread_order == eventId || dx_eid_series == eventId; +} + +inline static constexpr bool isTimeSeriesEvent(dx_event_id_t eventId) { + return dx_eid_candle == eventId || dx_eid_greeks == eventId || dx_eid_theo_price == eventId || + dx_eid_time_and_sale == eventId || dx_eid_underlying == eventId; +} + +inline static dx_event_id_t bitmaskToEventId(unsigned bitmask) { +#define DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(eventId) \ + case eventIdToBitmask(eventId): \ + return eventId + switch (bitmask) { + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_trade); + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_quote); + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_summary); + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_profile); + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_order); + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_time_and_sale); + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_candle); + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_trade_eth); + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_spread_order); + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_greeks); + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_theo_price); + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_underlying); + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_series); + DX_DETAIL_BITMASK_TO_EVENT_ID_CASE(dx_eid_configuration); + default: + return dx_eid_invalid; + } +#undef DX_DETAIL_BITMASK_TO_EVENT_ID_CASE +} + +inline static bool isOnlyIndexedEvent(unsigned eventIdBitmask) { + return isOnlyIndexedEvent(bitmaskToEventId(eventIdBitmask)); +} + +inline static bool isTimeSeriesEvent(unsigned eventIdBitmask) { + return isTimeSeriesEvent(bitmaskToEventId(eventIdBitmask)); +} + +} // namespace detail + +using SnapshotRefId = Id; +const SnapshotRefId INVALID_SNAPSHOT_REFERENCE_ID = SnapshotRefId{-1}; +using ConnectionKey = dxf_connection_t; + +struct SnapshotSubscriber { + using SnapshotHandler = std::function; + using IncrementalSnapshotHandler = std::function; + +private: + std::atomic referenceId_; + SnapshotKey filter_; + void* userData_; + mutable std::recursive_mutex mutex_; + std::atomic isValid_; + + SnapshotHandler onNewSnapshot_{}; + SnapshotHandler onSnapshotUpdate_{}; + IncrementalSnapshotHandler onIncrementalChange_{}; + +public: + SnapshotSubscriber(SnapshotRefId referenceId, SnapshotKey filter, void* userData) + : referenceId_{referenceId}, filter_(std::move(filter)), userData_{userData}, mutex_(), isValid_(true) {} + + SnapshotSubscriber(SnapshotSubscriber&& sub) noexcept : mutex_() { + referenceId_ = sub.referenceId_.load(); + sub.referenceId_ = INVALID_SNAPSHOT_REFERENCE_ID; + filter_ = std::move(sub.filter_); + userData_ = sub.userData_; + onNewSnapshot_ = std::move(sub.onNewSnapshot_); + onSnapshotUpdate_ = std::move(sub.onSnapshotUpdate_); + onIncrementalChange_ = std::move(sub.onIncrementalChange_); + isValid_ = sub.isValid_.load(); + sub.isValid_ = false; + } + + SnapshotSubscriber& operator=(SnapshotSubscriber&& sub) noexcept { + if (this == &sub) { + return *this; + } + + referenceId_ = sub.referenceId_.load(); + sub.referenceId_ = INVALID_SNAPSHOT_REFERENCE_ID; + filter_ = std::move(sub.filter_); + userData_ = sub.userData_; + onNewSnapshot_ = std::move(sub.onNewSnapshot_); + onSnapshotUpdate_ = std::move(sub.onSnapshotUpdate_); + onIncrementalChange_ = std::move(sub.onIncrementalChange_); + isValid_ = sub.isValid_.load(); + sub.isValid_ = false; + + return *this; + } + + void setOnNewSnapshotHandler(SnapshotHandler onNewSnapshotHandler) { + std::lock_guard guard{mutex_}; + onNewSnapshot_ = std::move(onNewSnapshotHandler); + } + + void setOnSnapshotUpdateHandler(SnapshotHandler onSnapshotUpdateHandler) { + std::lock_guard guard{mutex_}; + onSnapshotUpdate_ = std::move(onSnapshotUpdateHandler); + } + + void setOnIncrementalChangeHandler(IncrementalSnapshotHandler onIncrementalChangeHandler) { + std::lock_guard guard{mutex_}; + onIncrementalChange_ = std::move(onIncrementalChangeHandler); + } + + SnapshotRefId getReferenceId() const { return referenceId_; } + + SnapshotKey getFilter() const { + std::lock_guard guard{mutex_}; + + return filter_; + } + + bool isValid() { return isValid_; } +}; + +struct SnapshotManager; + +struct Snapshot { +protected: + std::unordered_map> subscribers_; + mutable std::mutex subscribersMutex_; + + friend SnapshotManager; + + bool addSubscriber(const std::shared_ptr& subscriber) { + std::lock_guard guard{subscribersMutex_}; + + if (!subscriber || !subscriber->isValid() || subscribers_.count(subscriber->getReferenceId()) > 0) { + return false; + } + + return subscribers_.emplace(subscriber->getReferenceId(), subscriber).second; + } + + bool removeSubscriber(SnapshotRefId snapshotRefId) { + std::lock_guard guard{subscribersMutex_}; + + return subscribers_.erase(snapshotRefId) > 0; + } + +public: + explicit Snapshot() : subscribers_{}, subscribersMutex_{} {} + + bool hasSubscriptions() const { + std::lock_guard guard{subscribersMutex_}; + + return !subscribers_.empty(); + } + + virtual ~Snapshot() = default; +}; + +struct OnlyIndexedEventKey { + dxf_long_t index; + dxf_long_t time; +}; + +} // namespace dx + +namespace std { +template <> +struct hash { + std::size_t operator()(const dx::OnlyIndexedEventKey& key) const noexcept { + return dx::hashCombine(key.index, key.time); + } +}; +} // namespace std + +namespace dx { + +struct OnlyIndexedEventsSnapshot final : public Snapshot, + public std::enable_shared_from_this { + using EventType = nonstd::variant; + +private: + SnapshotKey key_; + std::unordered_map events_; + std::unordered_map transaction_; + dxf_connection_t con_; + dxf_subscription_t sub_; + dxf_event_listener_v2_t listener_; + std::atomic_bool isValid_; + + struct SubscriptionParams { + dx_record_info_id_t recordInfoId; + dx_event_subscr_flag subscriptionFlags; + std::string source; + }; + + inline static SubscriptionParams collectSubscriptionParams(const SnapshotKey& key) { + const auto& eventId = key.getEventId(); + const auto& source = key.getSource().value_or(std::string{}); + const auto& sourceWide = StringConverter::utf8ToWString(source); + + dx_record_info_id_t recordInfoId = dx_rid_invalid; + dx_event_subscr_flag subscriptionFlags = dx_esf_default; + std::string resultSource{}; + + if (eventId == dx_eid_order) { + if (sourceWide == dx_all_special_order_sources[static_cast(dxf_sos_AGGREGATE)] || + sourceWide == dx_all_special_order_sources[static_cast(dxf_sos_AGGREGATE_ASK)] || + sourceWide == dx_all_special_order_sources[static_cast(dxf_sos_AGGREGATE_BID)]) { + recordInfoId = dx_rid_market_maker; + subscriptionFlags = static_cast(subscriptionFlags | dx_esf_sr_market_maker_order); + resultSource = StringConverter::wStringToUtf8( + dx_all_special_order_sources[static_cast(dxf_sos_AGGREGATE)]); + } else { + recordInfoId = dx_rid_order; + resultSource = source; + } + } else if (eventId == dx_eid_spread_order) { + recordInfoId = dx_rid_spread_order; + } else if (eventId == dx_eid_series) { + recordInfoId = dx_rid_series; + } else { + recordInfoId = dx_rid_invalid; + } + + return {recordInfoId, subscriptionFlags, resultSource}; + } + + void handleEventsData(int eventBitMask, dxf_const_string_t symbol, const dxf_event_data_t* data, int dataCount, + const dxf_event_params_t* eventParams) { + if (dataCount < 1) { + return; + } + + auto eventId = detail::bitmaskToEventId(eventBitMask); + + if (eventId == dx_eid_invalid) { + return; + } + + // TODO: Snapshot logic + + if (hasSubscriptions()) { + } + } + + OnlyIndexedEventsSnapshot(dxf_connection_t connection, SnapshotKey key) + : key_(std::move(key)), + events_(), + transaction_(), + con_{connection}, + sub_{nullptr}, + listener_{nullptr}, + isValid_{false} {} + + ~OnlyIndexedEventsSnapshot() override { + if (isValid_) { + if (listener_) { + dxf_detach_event_listener_v2(sub_, listener_); + } + + dxf_close_subscription(sub_); + } + } + +public: + static std::shared_ptr create(dxf_connection_t connection, SnapshotKey key) { + if (connection == nullptr) { + return nullptr; + } + + auto snapshot = new OnlyIndexedEventsSnapshot(connection, std::move(key)); + + auto subscriptionParams = collectSubscriptionParams(snapshot->key_); + + if (subscriptionParams.recordInfoId == dx_rid_invalid) { + return nullptr; + } + + auto eventType = DX_EVENT_BIT_MASK(snapshot->key_.getEventId()); + auto sub = dx_create_event_subscription(connection, eventType, subscriptionParams.subscriptionFlags, 0, 0); + + if (sub == dx_invalid_subscription) { + return nullptr; + } + + if ((subscriptionParams.recordInfoId == dx_rid_order || + subscriptionParams.recordInfoId == dx_rid_market_maker) && + !subscriptionParams.source.empty()) { + auto sourceWideString = StringConverter::utf8ToWString(subscriptionParams.source); + + dx_add_order_source(sub, sourceWideString.c_str()); + } + + auto listener = [](int eventBitMask, dxf_const_string_t symbol, const dxf_event_data_t* data, int dataCount, + const dxf_event_params_t* eventParams, void* userData) { + auto snapshot = reinterpret_cast(userData); + + snapshot->handleEventsData(eventBitMask, symbol, data, dataCount, eventParams); + }; + + dx_add_listener_v2(sub, listener, reinterpret_cast(snapshot)); + + auto symbolWideString = StringConverter::utf8ToWString(key.getSymbol()); + auto addSymbolResult = dxf_add_symbol(sub, symbolWideString.c_str()); + + if (addSymbolResult == DXF_FAILURE) { + dxf_detach_event_listener_v2(sub, listener); + dxf_close_subscription(sub); + } + + snapshot->sub_ = sub; + snapshot->listener_ = listener; + snapshot->isValid_ = true; + + //FIXME: bug. See: https://en.cppreference.com/w/cpp/memory/enable_shared_from_this + return snapshot->shared_from_this(); + } +}; + +struct TimeSeriesEventsSnapshot final : public Snapshot {}; + +struct SnapshotManager { + using CommonSnapshotPtr = nonstd::variant, + std::shared_ptr, nullptr_t>; + +private: + static std::unordered_map> managers_; + // one to one + std::unordered_map> indexedEventsSnapshots_; + // many to one + std::unordered_map> indexedEventsSnapshotsByRefId_; + std::mutex indexedEventsSnapshotsMutex_; + // one to one + std::unordered_map> timeSeriesEventsSnapshots_; + // many to one + std::unordered_map> timeSeriesEventsSnapshotsByRefId_; + std::mutex timeSeriesEventsSnapshotsMutex_; + // one to one + std::unordered_map> subscribers_; + std::mutex subscribersMutex_; + + explicit SnapshotManager() + : indexedEventsSnapshots_{}, + indexedEventsSnapshotsByRefId_{}, + indexedEventsSnapshotsMutex_{}, + timeSeriesEventsSnapshots_{}, + timeSeriesEventsSnapshotsByRefId_{}, + timeSeriesEventsSnapshotsMutex_{}, + subscribers_{}, + subscribersMutex_{} {} + + template + std::shared_ptr getImpl(const SnapshotKey&) { + return nullptr; + } + + template + std::shared_ptr getImpl(SnapshotRefId) { + return nullptr; + } + + bool closeImpl(SnapshotRefId snapshotRefId, CommonSnapshotPtr snapshotPtr) { + // TODO: overloaded "idiom" + generic lambda + struct CloseImplVisitor { + SnapshotRefId snapshotRefId; + + bool operator()(std::shared_ptr indexedEventsSnapshotPtr) const { return false; } + + bool operator()(std::shared_ptr timeSeriesEventsSnapshotPtr) const { + return false; + } + + bool operator()(nullptr_t) const { + // TODO: warning + return true; + } + }; + + return nonstd::visit(CloseImplVisitor{snapshotRefId}, snapshotPtr); + } + +public: + /// Returns the SnapshotManager instance by a connection key or creates the new one and returns it. + /// \param connectionKey The connection key (i.e. the pointer to connection context structure) + /// \return The SnapshotManager instance. + static std::shared_ptr getInstance(const ConnectionKey& connectionKey) { + auto found = managers_.find(connectionKey); + + if (found != managers_.end()) { + return found->second; + } + + auto inserted = managers_.emplace(connectionKey, std::shared_ptr(new SnapshotManager{})); + + if (inserted.second) { + return inserted.first->second; + } + + return managers_[connectionKey]; + } + + /// Returns a pointer to the snapshot instance by the snapshot key (an event id, a symbol, an optional source, an + /// optional `timeFrom`) \tparam T The Snapshot type (IndexedEventsSnapshot or TimeSeriesEventsSnapshot) \return A + /// shared pointer to the snapshot instance or std::shared_ptr{nullptr} + template + std::shared_ptr get(const SnapshotKey&) { + return nullptr; + } + + /// Returns a pointer to the snapshot instance (indexed or time series) by the snapshot reference id (1 to 1 for a + /// SnapshotSubscriber) \param snapshotRefId The snapshot reference id \return A shared pointer to the snapshot + /// instance or nullptr + CommonSnapshotPtr get(SnapshotRefId snapshotRefId); + + /// Creates the new snapshot instance and the new SnapshotSubscriber instance or adds new SnapshotSubscriber + /// instance to the existing snapshot. \tparam T The Snapshot type (IndexedEventsSnapshot or + /// TimeSeriesEventsSnapshot) \return The pair of shared pointer to the snapshot instance and reference id to the + /// snapshot (1 to 1 for a SnapshotSubscriber) + template + std::pair, SnapshotRefId> create(const ConnectionKey&, const SnapshotKey&, void*) { + return {nullptr, INVALID_SNAPSHOT_REFERENCE_ID}; + } + + bool setOnNewSnapshotHandler(SnapshotRefId snapshotRefId, + SnapshotSubscriber::SnapshotHandler onNewSnapshotHandler) { + std::lock_guard guard{subscribersMutex_}; + + auto found = subscribers_.find(snapshotRefId); + + if (found != subscribers_.end()) { + found->second->setOnNewSnapshotHandler(std::move(onNewSnapshotHandler)); + + return true; + } + + return false; + } + + bool setOnSnapshotUpdateHandler(SnapshotRefId snapshotRefId, + SnapshotSubscriber::SnapshotHandler onSnapshotUpdateHandler) { + std::lock_guard guard{subscribersMutex_}; + + auto found = subscribers_.find(snapshotRefId); + + if (found != subscribers_.end()) { + found->second->setOnSnapshotUpdateHandler(std::move(onSnapshotUpdateHandler)); + + return true; + } + + return false; + } + + bool setOnIncrementalChangeHandler(SnapshotRefId snapshotRefId, + SnapshotSubscriber::IncrementalSnapshotHandler onIncrementalChangeHandler) { + std::lock_guard guard{subscribersMutex_}; + + auto found = subscribers_.find(snapshotRefId); + + if (found != subscribers_.end()) { + found->second->setOnIncrementalChangeHandler(std::move(onIncrementalChangeHandler)); + + return true; + } + + return false; + } + + bool close(SnapshotRefId snapshotRefId) { + auto snapshotPtr = get(snapshotRefId); + + return closeImpl(snapshotRefId, snapshotPtr); + } +}; + +std::unordered_map> SnapshotManager::managers_{}; + +template <> +std::shared_ptr SnapshotManager::getImpl(const SnapshotKey& snapshotKey) { + auto found = indexedEventsSnapshots_.find(snapshotKey); + + if (found == indexedEventsSnapshots_.end()) { + return nullptr; + } + + return found->second; +} + +template <> +std::shared_ptr SnapshotManager::getImpl(const SnapshotKey& snapshotKey) { + auto found = timeSeriesEventsSnapshots_.find(snapshotKey); + + if (found == timeSeriesEventsSnapshots_.end()) { + return nullptr; + } + + return found->second; +} + +template <> +std::shared_ptr SnapshotManager::getImpl(SnapshotRefId snapshotRefId) { + auto found = indexedEventsSnapshotsByRefId_.find(snapshotRefId); + + if (found == indexedEventsSnapshotsByRefId_.end()) { + return nullptr; + } + + return found->second; +} + +template <> +std::shared_ptr SnapshotManager::getImpl(SnapshotRefId snapshotRefId) { + auto found = timeSeriesEventsSnapshotsByRefId_.find(snapshotRefId); + + if (found == timeSeriesEventsSnapshotsByRefId_.end()) { + return nullptr; + } + + return found->second; +} + +template <> +std::shared_ptr SnapshotManager::get(const SnapshotKey& snapshotKey) { + std::lock_guard guard(indexedEventsSnapshotsMutex_); + + return getImpl(snapshotKey); +} + +template <> +std::shared_ptr SnapshotManager::get(const SnapshotKey& snapshotKey) { + std::lock_guard guard(timeSeriesEventsSnapshotsMutex_); + + return getImpl(snapshotKey); +} + +SnapshotManager::CommonSnapshotPtr SnapshotManager::get(SnapshotRefId snapshotRefId) { + { + std::lock_guard guard(indexedEventsSnapshotsMutex_); + + auto snapshot = getImpl(snapshotRefId); + + if (snapshot) { + return snapshot; + } + } + { + std::lock_guard guard(timeSeriesEventsSnapshotsMutex_); + + auto snapshot = getImpl(snapshotRefId); + + if (snapshot) { + return snapshot; + } + } + + return nullptr; +} + +template <> +Id IdGenerator::id{0}; + +template <> +std::pair, Id> SnapshotManager::create(const ConnectionKey& connectionKey, + const SnapshotKey& snapshotKey, + void* userData) { + std::lock_guard guard(indexedEventsSnapshotsMutex_); + + auto snapshot = getImpl(snapshotKey); + auto id = IdGenerator::get(); + + if (snapshot) { + std::shared_ptr subscriber(new SnapshotSubscriber(id, snapshotKey, userData)); + + if (snapshot->addSubscriber(subscriber)) { + indexedEventsSnapshotsByRefId_.emplace(id, snapshot); + + std::lock_guard subscribersGuard(subscribersMutex_); + + subscribers_.emplace(id, subscriber); + + return {snapshot, id}; + } else { + return {nullptr, INVALID_SNAPSHOT_REFERENCE_ID}; + } + } + + auto newSnapshot = OnlyIndexedEventsSnapshot::create(connectionKey, snapshotKey); + + if (!newSnapshot) { + return {nullptr, INVALID_SNAPSHOT_REFERENCE_ID}; + } + + auto inserted = indexedEventsSnapshots_.emplace(snapshotKey, newSnapshot); + + return {inserted.first->second, id}; +} + +template <> +std::pair, Id> SnapshotManager::create(const ConnectionKey& connectionKey, + const SnapshotKey& snapshotKey, + void* userData) { + std::lock_guard guard(timeSeriesEventsSnapshotsMutex_); + + auto snapshot = getImpl(snapshotKey); + auto id = IdGenerator::get(); + + if (snapshot) { + std::shared_ptr subscriber(new SnapshotSubscriber(id, snapshotKey, userData)); + + if (snapshot->addSubscriber(subscriber)) { + timeSeriesEventsSnapshotsByRefId_.emplace(id, snapshot); + + std::lock_guard subscribersGuard(subscribersMutex_); + + subscribers_.emplace(id, subscriber); + + return {snapshot, id}; + } else { + return {nullptr, INVALID_SNAPSHOT_REFERENCE_ID}; + } + } + + auto inserted = timeSeriesEventsSnapshots_.emplace( + snapshotKey, std::shared_ptr(new TimeSeriesEventsSnapshot{})); + + return {inserted.first->second, id}; +} + +} // namespace dx diff --git a/src/Snapshot/SnapshotChanges.hpp b/src/Snapshot/SnapshotChanges.hpp new file mode 100644 index 00000000..a24177f0 --- /dev/null +++ b/src/Snapshot/SnapshotChanges.hpp @@ -0,0 +1,49 @@ +/* +* The contents of this file are subject to the Mozilla Public License Version +* 2.0 (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* http://www.mozilla.org/MPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Initial Developer of the Original Code is Devexperts LLC. +* Portions created by the Initial Developer are Copyright (C) 2010 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): +* +*/ + +#pragma once + +#include "SnapshotKey.hpp" + +namespace dx { + +struct SnapshotChanges { + SnapshotKey snapshotKey; + + SnapshotChanges() = default; + + SnapshotChanges(SnapshotKey newSnapshotKey) : snapshotKey{std::move(newSnapshotKey)} {} + + bool isEmpty() const { return true; } +}; + +struct SnapshotChangesSet { + SnapshotChanges removals{}; + SnapshotChanges additions{}; + SnapshotChanges updates{}; + + SnapshotChangesSet() = default; + + SnapshotChangesSet(SnapshotChanges newRemovals, SnapshotChanges newAdditions, SnapshotChanges newUpdates) + : removals{std::move(newRemovals)}, additions{std::move(newAdditions)}, updates{std::move(newUpdates)} {} + + bool isEmpty() const { return removals.isEmpty() && additions.isEmpty() && updates.isEmpty(); } +}; + +} \ No newline at end of file diff --git a/src/Snapshot/SnapshotKey.hpp b/src/Snapshot/SnapshotKey.hpp new file mode 100644 index 00000000..a714a83e --- /dev/null +++ b/src/Snapshot/SnapshotKey.hpp @@ -0,0 +1,106 @@ +/* + * The contents of this file are subject to the Mozilla Public License Version + * 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is Devexperts LLC. + * Portions created by the Initial Developer are Copyright (C) 2010 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + */ + +#pragma once + +extern "C" { +#include +} + +#include +#include +#include +#include + +#include "../Utils/Hash.hpp" + +namespace dx { + +/** + *`The class responsible for identifying snapshots. Also used for filtering. + * Not thread safe. + */ +class SnapshotKey { + dx_event_id_t eventId_; + std::string symbol_; + nonstd::optional source_; + nonstd::optional fromTime_; + +public: + /** + * The default constructor. Creates a snapshot key with non valid state (Event id = -1, empty symbol) + */ + SnapshotKey() : eventId_(static_cast(-1)), symbol_(), source_(), fromTime_() {} + + /** + * Creates an instance of a snapshot key. + * @param eventId The event id + * @param symbol The instrument symbol (AAPL, IBM, etc.) + * @param source The source of events (optional, only for IndexedEvent that are not TimeSeriesEvent)) + * @param fromTime The time from which the snapshot is requested (optional, only for TimeSeriesEvent) + */ + SnapshotKey(dx_event_id_t eventId, std::string symbol, nonstd::optional source, + nonstd::optional fromTime) + : eventId_(eventId), symbol_(std::move(symbol)), source_(std::move(source)), fromTime_(std::move(fromTime)) {} + + /** + * The comparison operator + * @param other The other snapshot key + * @return true if keys match. + */ + bool operator==(const SnapshotKey& other) const { + return eventId_ == other.eventId_ && symbol_ == other.symbol_ && source_ == other.source_ && + fromTime_ == other.fromTime_; + } + + /** + * @return The event ID of the current key. + */ + dx_event_id getEventId() const { return eventId_; } + + /** + * @return The symbol of the current key. + */ + const std::string& getSymbol() const { return symbol_; } + + /** + * @return The source of the current key. + */ + const nonstd::optional& getSource() const { return source_; } + + /** + * @return The time from which the snapshot is requested. + */ + const nonstd::optional& getFromTime() const { return fromTime_; } +}; + +} // namespace dx + +namespace std { +template <> +struct hash { + std::size_t operator()(const dx::SnapshotKey& key) const noexcept { + /* static_cast(key.getEventId()) -- workaround for old + * compilers "error: invalid use of incomplete type 'struct std::hash'" bug + */ + return dx::hashCombine(static_cast(key.getEventId()), key.getSymbol(), key.getSource(), + key.getFromTime()); + } +}; +} // namespace std \ No newline at end of file diff --git a/src/SymbolCodec.c b/src/SymbolCodec.c index effd29c2..7db5e890 100644 --- a/src/SymbolCodec.c +++ b/src/SymbolCodec.c @@ -29,11 +29,9 @@ #include -/* -------------------------------------------------------------------------- */ /* * Penta codec data */ -/* -------------------------------------------------------------------------- */ #define PENTA_LENGTH 128 @@ -54,11 +52,9 @@ static dxf_char_t g_penta_characters[1024]; dxf_int_t g_wildcard_cipher; -/* -------------------------------------------------------------------------- */ /* * Helper functions */ -/* -------------------------------------------------------------------------- */ void dx_init_penta (dxf_int_t c, dxf_int_t penta, dxf_int_t penta_length) { g_penta_characters[penta] = (dxf_char_t)c; @@ -66,7 +62,6 @@ void dx_init_penta (dxf_int_t c, dxf_int_t penta, dxf_int_t penta_length) { g_penta_lengths[c] = penta_length; } -/* -------------------------------------------------------------------------- */ /* * Encodes penta into cipher. Shall return 0 if encoding impossible. * The specified penta must be valid (no more than 35 bits). @@ -88,7 +83,6 @@ dxf_int_t dx_encode_penta (dxf_long_t penta, dxf_int_t penta_length) { return 0; } -/* -------------------------------------------------------------------------- */ /* * Converts penta into string. * The specified penta must be valid (no more than 35 bits). @@ -125,7 +119,6 @@ dxf_const_string_t dx_penta_to_string (dxf_long_t penta) { return buffer; } -/* -------------------------------------------------------------------------- */ /* * Decodes cipher into penta code. The specified cipher must not be 0. * The returning penta code must be valid (no more than 35 bits). @@ -155,11 +148,9 @@ int dx_decode_cipher (dxf_int_t cipher, OUT dxf_long_t* res) { return true; } -/* -------------------------------------------------------------------------- */ /* * Symbol codec functions implementation */ -/* -------------------------------------------------------------------------- */ int dx_init_symbol_codec (void) { dxf_int_t i = PENTA_LENGTH; @@ -196,14 +187,10 @@ int dx_init_symbol_codec (void) { return true; } -/* -------------------------------------------------------------------------- */ - dxf_int_t dx_get_codec_valid_cipher (void) { return 0xC0000000; } -/* -------------------------------------------------------------------------- */ - dxf_int_t dx_encode_symbol_name (dxf_const_string_t symbol) { dxf_long_t penta = 0; dxf_int_t penta_length = 0; @@ -241,8 +228,6 @@ dxf_int_t dx_encode_symbol_name (dxf_const_string_t symbol) { return dx_encode_penta(penta, penta_length); } -/* -------------------------------------------------------------------------- */ - int dx_decode_symbol_name (dxf_int_t cipher, OUT dxf_const_string_t* symbol) { dxf_long_t penta; dxf_const_string_t str; @@ -266,7 +251,6 @@ int dx_decode_symbol_name (dxf_int_t cipher, OUT dxf_const_string_t* symbol) { return true; } -/* -------------------------------------------------------------------------- */ int dx_codec_read_symbol (void* bicc, dxf_char_t* buffer, int buffer_length, OUT dxf_string_t* result, OUT dxf_int_t* cipher_result, OUT dxf_event_flags_t* flags, @@ -440,8 +424,6 @@ int dx_codec_read_symbol (void* bicc, dxf_char_t* buffer, int buffer_length, OUT return false; } -/* -------------------------------------------------------------------------- */ - int dx_codec_write_symbol (void* bocc, dxf_int_t cipher, dxf_const_string_t symbol) { if (cipher != 0) { dxf_long_t penta; diff --git a/src/SymbolCodec.h b/src/SymbolCodec.h index 36adae6a..476f4762 100644 --- a/src/SymbolCodec.h +++ b/src/SymbolCodec.h @@ -70,11 +70,9 @@ extern dxf_int_t g_wildcard_cipher; -/* -------------------------------------------------------------------------- */ /* * Symbol codec functions */ -/* -------------------------------------------------------------------------- */ /* * Initialize of symbol codec @@ -83,27 +81,23 @@ extern dxf_int_t g_wildcard_cipher; */ int dx_init_symbol_codec (void); -/* -------------------------------------------------------------------------- */ /* * valid cipher defines range of valid encoded ciphers. */ dxf_int_t dx_get_codec_valid_cipher (void); -/* -------------------------------------------------------------------------- */ /* * Returns encoded cipher for specified symbol. * Returns 0 if specified symbol is NULL or if encoding is impossible. */ dxf_int_t dx_encode_symbol_name (dxf_const_string_t symbol); -/* -------------------------------------------------------------------------- */ /* * Restores symbol for specified cipher. * Restored symbol is NULL if specified cipher is 0. */ int dx_decode_symbol_name (dxf_int_t cipher, OUT dxf_const_string_t* symbol); -/* -------------------------------------------------------------------------- */ /* * Reads symbol from connection context input buffer and returns it in several ways depending on its encodability and length. * If this method produces: @@ -122,7 +116,6 @@ int dx_codec_read_symbol(void* bicc, dxf_char_t* buffer, int buffer_length, OUT OUT dxf_int_t* cipher_result, OUT dxf_event_flags_t* flags, OUT dxf_event_flags_t* mru_event_flags); -/* -------------------------------------------------------------------------- */ /* * Writes the symbol into the buffered output connection context buffer */ diff --git a/src/TaskQueue.c b/src/TaskQueue.c index f0e0d39b..332da7f8 100644 --- a/src/TaskQueue.c +++ b/src/TaskQueue.c @@ -24,11 +24,9 @@ #include "DXErrorHandling.h" #include "Logger.h" -/* -------------------------------------------------------------------------- */ /* * Task queue data */ -/* -------------------------------------------------------------------------- */ typedef struct { dx_task_processor_t processor; @@ -47,11 +45,9 @@ typedef struct { #define MUTEX_FIELD_FLAG (1 << 0) -/* -------------------------------------------------------------------------- */ /* * Helper functions */ -/* -------------------------------------------------------------------------- */ int dx_clear_task_queue_data (dx_task_queue_data_t* tqd) { int res = true; @@ -70,11 +66,9 @@ int dx_clear_task_queue_data (dx_task_queue_data_t* tqd) { return res; } -/* -------------------------------------------------------------------------- */ /* * Task queue functions implementation */ -/* -------------------------------------------------------------------------- */ int dx_create_task_queue (OUT dx_task_queue_t* tq) { dx_task_queue_data_t* tqd = NULL; @@ -100,8 +94,6 @@ int dx_create_task_queue (OUT dx_task_queue_t* tq) { return true; } -/* -------------------------------------------------------------------------- */ - int dx_cleanup_task_queue (dx_task_queue_t tq) { dx_task_queue_data_t* tqd = tq; size_t i = 0; @@ -121,8 +113,6 @@ int dx_cleanup_task_queue (dx_task_queue_t tq) { return dx_mutex_unlock(&(tqd->guard)) && res; } -/* -------------------------------------------------------------------------- */ - int dx_destroy_task_queue (dx_task_queue_t tq) { int res = true; @@ -136,8 +126,6 @@ int dx_destroy_task_queue (dx_task_queue_t tq) { return res; } -/* -------------------------------------------------------------------------- */ - int dx_add_task_to_queue (dx_task_queue_t tq, dx_task_processor_t processor, void* data) { dx_task_queue_data_t* tqd = tq; dx_task_data_t task; @@ -154,8 +142,6 @@ int dx_add_task_to_queue (dx_task_queue_t tq, dx_task_processor_t processor, voi #ifdef _DEBUG_TQ dx_logging_dbg_lock(); - dx_logging_dbg(L"NEWTASK Submit [0x%016p] %ls(0x%016p) at %u", processor, dx_logging_dbg_sym(processor), data, tqd->size); - dx_logging_dbg_stack(); dx_logging_dbg_unlock(); #endif @@ -164,8 +150,6 @@ int dx_add_task_to_queue (dx_task_queue_t tq, dx_task_processor_t processor, voi return dx_mutex_unlock(&(tqd->guard)) && !failed; } -/* -------------------------------------------------------------------------- */ - int dx_execute_task_queue (dx_task_queue_t tq) { dx_task_queue_data_t* tqd = tq; size_t i = 0; @@ -181,8 +165,6 @@ int dx_execute_task_queue (dx_task_queue_t tq) { dx_task_data_t* task = &(tqd->elements[i]); #ifdef _DEBUG_TQ dx_logging_dbg_lock(); - dx_logging_dbg(L"RUNTASK Execute [0x%016p] %ls(0x%016p) at %u", task->processor, dx_logging_dbg_sym(task->processor), task->data, i); - dx_logging_dbg_stack(); dx_logging_dbg_unlock(); #endif int task_res = task->processor(task->data, 0); @@ -212,8 +194,6 @@ int dx_execute_task_queue (dx_task_queue_t tq) { return dx_mutex_unlock(&(tqd->guard)) && res; } -/* -------------------------------------------------------------------------- */ - int dx_is_queue_empty (dx_task_queue_t tq, OUT int* res) { dx_task_queue_data_t* tqd = tq; diff --git a/src/TaskQueue.h b/src/TaskQueue.h index 27ca2574..7ae9c170 100644 --- a/src/TaskQueue.h +++ b/src/TaskQueue.h @@ -22,11 +22,9 @@ #include "PrimitiveTypes.h" -/* -------------------------------------------------------------------------- */ /* * Task data */ -/* -------------------------------------------------------------------------- */ typedef enum { dx_tes_success = (1 << 0), /* if this flag is not set then some error occurred */ @@ -43,11 +41,9 @@ typedef int (*dx_task_processor_t) (void* data, int command); typedef void* dx_task_queue_t; -/* -------------------------------------------------------------------------- */ /* * Task queue functions */ -/* -------------------------------------------------------------------------- */ int dx_create_task_queue (OUT dx_task_queue_t* tq); int dx_cleanup_task_queue (dx_task_queue_t tq); diff --git a/src/Utils/Hash.hpp b/src/Utils/Hash.hpp new file mode 100644 index 00000000..26bdd60c --- /dev/null +++ b/src/Utils/Hash.hpp @@ -0,0 +1,87 @@ +/* +* The contents of this file are subject to the Mozilla Public License Version +* 2.0 (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* http://www.mozilla.org/MPL/ +* +* Software distributed under the License is distributed on an "AS IS" basis, +* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +* for the specific language governing rights and limitations under the +* License. +* +* The Initial Developer of the Original Code is Devexperts LLC. +* Portions created by the Initial Developer are Copyright (C) 2010 +* the Initial Developer. All Rights Reserved. +* +* Contributor(s): +* +*/ + +#pragma once + +#include +#include +#include +#include + +namespace dx { + +/** + * Combines the passed hash (first parameter) with the calculated hashes for the rest of the parameters and + * substitutes it for the first parameter. Does nothing, since the passed hash has nothing to combine with. + * + * @param[in, out] seed The passed hash with which to combine the computed hashes. + */ +inline void hashCombineInPlace(std::size_t& seed) {} + +/** + * Combines the passed hash (first parameter) with the calculated hashes for the rest of the parameters and + * substitutes it for the first parameter. + * + * @tparam T The type of the second parameter. + * @param[in, out] seed The passed hash with which to combine the computed hashes. + * @param v The parameter whose hash is to be computed and combined with the first hash. + */ +template +inline void hashCombineInPlace(std::size_t& seed, T&& v) { + using DecayedT = typename std::decay::type; + + seed ^= (std::hash{}(std::forward(v)) + 0x9e3779b9 + (seed << 6) + (seed >> 2)); +} + +/** + * Combines the passed hash (first parameter) with the calculated hashes for the rest of the parameters and + * substitutes it for the first parameter. + * + * @tparam T The type of the second parameter. + * @tparam Ts The types of the rest parameters. + * @param seed[in, out] The passed hash with which to combine the computed hashes. + * @param v The second parameter whose hash is to be computed and combined with the first hash. + * @param vs The remaining parameters whose hashes are to be calculated and combined with the first hash. + */ +template +inline void hashCombineInPlace(std::size_t& seed, T&& v, Ts&&... vs) { + hashCombineInPlace(seed, std::forward(v)); + hashCombineInPlace(seed, std::forward(vs)...); +} + +/** + * Calculates the parameter hashes, combines them, and returns them as a result. + * + * @tparam T The type of the first parameter. + * @tparam Ts The types of the rest parameters. + * @param v The value of the first parameter. + * @param vs The values of the rest parameters. + * @return The combined hash of all parameters. + */ +template +inline std::size_t hashCombine(T&& v, Ts&&... vs) { + using DecayedT = typename std::decay::type; + auto seed = std::hash{}(std::forward(v)); + + hashCombineInPlace(seed, std::forward(vs)...); + + return seed; +} + +} // namespace dx \ No newline at end of file diff --git a/src/WideDecimal.cpp b/src/WideDecimal.cpp index 3c204fa8..1693e790 100644 --- a/src/WideDecimal.cpp +++ b/src/WideDecimal.cpp @@ -17,7 +17,9 @@ * */ +extern "C" { #include "WideDecimal.h" +} #include "WideDecimal.hpp" @@ -60,12 +62,19 @@ const std::array WideDecimal::Consts::NF_WIDE = { {WideDecimal::Consts::NaN, WideDecimal::Consts::POSITIVE_INFINITY, WideDecimal::Consts::NaN, WideDecimal::Consts::NEGATIVE_INFINITY}}; -template -const typename RightShift::Consts RightShift::consts{}; - const WideDecimal::Consts WideDecimal::consts{}; + +#if defined(_MSC_VER) && _MSC_VER == 1900 +template <> +const typename RightShift::Consts RightShift::consts{}; + +template <> +const typename RightShift::Consts RightShift::consts{}; +#endif + } // namespace dx +extern "C" { int dx_wide_decimal_long_to_double(dxf_long_t longValue, OUT dxf_double_t* decimal) { *decimal = dx::WideDecimal::toDouble(longValue); @@ -73,5 +82,6 @@ int dx_wide_decimal_long_to_double(dxf_long_t longValue, OUT dxf_double_t* decim } dxf_int_t dx_right_shift_int(dxf_int_t int_value, dxf_int_t shift) { - return dx::rightShift(int_value, shift); + return dx::rightShift(int_value, shift); +} } \ No newline at end of file diff --git a/src/WideDecimal.hpp b/src/WideDecimal.hpp index 0c0629c3..3e829bfc 100644 --- a/src/WideDecimal.hpp +++ b/src/WideDecimal.hpp @@ -21,16 +21,15 @@ #include #include +#include #include #include #include -#include extern "C" { #include "DXTypes.h" #include "PrimitiveTypes.h" - } namespace dx { @@ -187,7 +186,7 @@ struct WideDecimal { static const dxf_long_t NEGATIVE_INFINITY = -0x100; static const dxf_long_t MAX_DOUBLE_SIGNIFICAND = (1LL << 53) - 1; - static const dxf_long_t MAX_DOUBLE_VALUE = 1LL << 51; + static const dxf_long_t MAX_DOUBLE_VALUE = 1LL << 51; static const dxf_long_t MIN_SIGNIFICAND; static const dxf_long_t MAX_SIGNIFICAND; static const dxf_int_t BIAS = 128; @@ -308,11 +307,12 @@ struct WideDecimal { dxf_long_t dotPosition = static_cast(result.length()) - (rank - Consts::BIAS); if (dotPosition > firstDigit) { - return result.insert(dotPosition, "."); + return result.insert(static_cast(dotPosition), "."); } if (firstDigit - dotPosition <= static_cast(Consts::MAX_LEADING_ZEROES)) { - return result.insert(firstDigit, consts.zeroChars, 0, 2 + (firstDigit - dotPosition)); + return result.insert(static_cast(firstDigit), consts.zeroChars, 0, + static_cast(2 + (firstDigit - dotPosition))); } } else { // integer number @@ -324,7 +324,7 @@ struct WideDecimal { dxf_long_t digits = static_cast(result.length()) - firstDigit; if (digits != 1) { - result.insert(firstDigit + 1, "."); + result.insert(static_cast(firstDigit) + 1, "."); } result += Consts::EXPONENT_CHAR; @@ -400,8 +400,7 @@ struct WideDecimal { inline static dxf_long_t composeWide(dxf_long_t significand, dxf_int_t scale) { // check exceedingly large scales to avoid rank overflows - if (scale > 255 + static_cast(Consts::EXACT_LONG_POWERS) - - static_cast(Consts::BIAS)) { + if (scale > 255 + static_cast(Consts::EXACT_LONG_POWERS) - static_cast(Consts::BIAS)) { return static_cast(Consts::BIAS); } @@ -468,9 +467,9 @@ struct WideDecimal { } inline static dxf_long_t composeWide(double value) { - return value >= 0 ? composeNonNegative(value, Consts::BIAS) : - value < 0 ? neg(composeNonNegative(-value, Consts::BIAS)) : - Consts::NaN; + return value >= 0 ? composeNonNegative(value, Consts::BIAS) + : value < 0 ? neg(composeNonNegative(-value, Consts::BIAS)) + : Consts::NaN; } inline static dxf_long_t sum(dxf_long_t w1, dxf_long_t w2) { @@ -622,8 +621,7 @@ struct WideDecimal { assert(value >= 0); dxf_int_t rank = findRank(value); - if (rank <= 0) - return Consts::POSITIVE_INFINITY; + if (rank <= 0) return Consts::POSITIVE_INFINITY; auto significand = static_cast(value * consts.divisors[rank] + 0.5); @@ -631,4 +629,10 @@ struct WideDecimal { } }; +#if defined(_MSC_VER) && _MSC_VER == 1900 +#else +template +const typename RightShift::Consts RightShift::consts{}; +#endif + } // namespace dx \ No newline at end of file diff --git a/src/Win32.c b/src/Win32.c index 36c76d7f..c0723bc9 100644 --- a/src/Win32.c +++ b/src/Win32.c @@ -18,10 +18,14 @@ */ #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif # include "DXMemory.h" # include "Logger.h" @@ -29,7 +33,7 @@ # include "DXThreads.h" typedef struct dx_callback_tag { - void (*callback)(void*); + void (*callback)(void *); void *arg; } dx_callback_t; @@ -56,9 +60,8 @@ static void dx_fini_cb_queue(dx_callback_queue_t *q) { dx_mutex_destroy(&q->mutex); } -static void dx_add_cb_queue(dx_callback_queue_t *q, void (*callback)(void*), void *arg) { - if (!dx_mutex_lock(&q->mutex)) - return; +static void dx_add_cb_queue(dx_callback_queue_t *q, void (*callback)(void *), void *arg) { + if (!dx_mutex_lock(&q->mutex)) return; if (q->size == q->count) { dx_callback_t *cbs; q->size *= 2; @@ -75,48 +78,45 @@ static void dx_add_cb_queue(dx_callback_queue_t *q, void (*callback)(void*), voi static void dx_run_cb_queue(dx_callback_queue_t *q) { int i; - if (!dx_mutex_lock(&q->mutex)) - return; - for (i = 0; i < q->count; i++) - q->callbacks[i].callback(q->callbacks[i].arg); + if (!dx_mutex_lock(&q->mutex)) return; + for (i = 0; i < q->count; i++) q->callbacks[i].callback(q->callbacks[i].arg); dx_mutex_unlock(&q->mutex); } -void dx_register_thread_constructor(void (*constructor)(void*), void *arg) { +void dx_register_thread_constructor(void (*constructor)(void *), void *arg) { dx_add_cb_queue(&g_thread_constructors, constructor, arg); } -void dx_register_thread_destructor(void (*destructor)(void*), void *arg) { +void dx_register_thread_destructor(void (*destructor)(void *), void *arg) { dx_add_cb_queue(&g_thread_destructors, destructor, arg); } -void dx_register_process_destructor(void (*destructor)(void*), void *arg) { +void dx_register_process_destructor(void (*destructor)(void *), void *arg) { dx_add_cb_queue(&g_process_destructors, destructor, arg); } extern void dx_init_threads(); -BOOL APIENTRY DllMain (HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) -{ +BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { - case DLL_PROCESS_ATTACH: - dx_init_cb_queue(&g_thread_constructors); - dx_init_cb_queue(&g_thread_destructors); - dx_init_cb_queue(&g_process_destructors); - dx_init_threads(); - break; - case DLL_THREAD_ATTACH: - dx_run_cb_queue(&g_thread_constructors); - break; - case DLL_THREAD_DETACH: - dx_run_cb_queue(&g_thread_destructors); - break; - case DLL_PROCESS_DETACH: - dx_run_cb_queue(&g_process_destructors); - dx_fini_cb_queue(&g_thread_constructors); - dx_fini_cb_queue(&g_thread_destructors); - dx_fini_cb_queue(&g_process_destructors); - break; + case DLL_PROCESS_ATTACH: + dx_init_cb_queue(&g_thread_constructors); + dx_init_cb_queue(&g_thread_destructors); + dx_init_cb_queue(&g_process_destructors); + dx_init_threads(); + break; + case DLL_THREAD_ATTACH: + dx_run_cb_queue(&g_thread_constructors); + break; + case DLL_THREAD_DETACH: + dx_run_cb_queue(&g_thread_destructors); + break; + case DLL_PROCESS_DETACH: + dx_run_cb_queue(&g_process_destructors); + dx_fini_cb_queue(&g_thread_constructors); + dx_fini_cb_queue(&g_thread_destructors); + dx_fini_cb_queue(&g_process_destructors); + break; } return TRUE; } diff --git a/tests/APITest/APITest.c b/tests/APITest/APITest.c index 74cbdc3e..b191c2e0 100644 --- a/tests/APITest/APITest.c +++ b/tests/APITest/APITest.c @@ -32,10 +32,14 @@ #include "Logger.h" #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif void dxs_sleep(int milliseconds) { Sleep((DWORD)milliseconds); } #else void dxs_sleep(int milliseconds) { @@ -48,8 +52,6 @@ void dxs_sleep(int milliseconds) { const char dxfeed_host[] = "demo.dxfeed.com:7300"; -/* -------------------------------------------------------------------------- */ - void print_timestamp(dxf_long_t timestamp) { wchar_t timefmt[80]; @@ -60,8 +62,6 @@ void print_timestamp(dxf_long_t timestamp) { wprintf(L"%ls", timefmt); } -/* -------------------------------------------------------------------------- */ - void first_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wprintf(L"First listener. Event: %ls Symbol: %ls\n", dx_event_type_to_string(event_type), symbol_name); @@ -130,15 +130,11 @@ void first_listener(int event_type, dxf_const_string_t symbol_name, const dxf_ev } } -/* -------------------------------------------------------------------------- */ - void second_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wprintf(L"Second listener. Event: %ls Symbol: %ls\n", dx_event_type_to_string(event_type), symbol_name); } -/* -------------------------------------------------------------------------- */ - void process_last_error(); void conn_termination_notifier(dxf_connection_t conn, void* user_data) { @@ -147,8 +143,6 @@ void conn_termination_notifier(dxf_connection_t conn, void* user_data) { process_last_error(); } -/* -------------------------------------------------------------------------- */ - void process_last_error() { int error_code = dx_ec_success; dxf_const_string_t error_descr = NULL; @@ -173,8 +167,6 @@ void process_last_error() { wprintf(L"An error occurred but the error subsystem failed to initialize\n"); } -/* -------------------------------------------------------------------------- */ - int main(int argc, char* argv[]) { dxf_connection_t connection; dxf_subscription_t subscription; diff --git a/tests/ConnectionTest/ConnectionTest.c b/tests/ConnectionTest/ConnectionTest.c index 26e342d1..a6f2149e 100644 --- a/tests/ConnectionTest/ConnectionTest.c +++ b/tests/ConnectionTest/ConnectionTest.c @@ -28,10 +28,14 @@ #include "DXFeed.h" #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif void dxs_sleep(int milliseconds) { Sleep((DWORD)milliseconds); } #else # include @@ -45,8 +49,6 @@ void dxs_sleep(int milliseconds) { const char dxfeed_host[] = "demo.dxfeed.com:7300"; -/* -------------------------------------------------------------------------- */ - void process_last_error() { int error_code = dx_ec_success; dxf_const_string_t error_descr = NULL; @@ -71,8 +73,6 @@ void process_last_error() { wprintf(L"An error occurred but the error subsystem failed to initialize\n"); } -/* -------------------------------------------------------------------------- */ - int main(int argc, char* argv[]) { dxf_connection_t connection; diff --git a/tests/FullTest/FullTest.c b/tests/FullTest/FullTest.c index ca6752f0..5df3123e 100644 --- a/tests/FullTest/FullTest.c +++ b/tests/FullTest/FullTest.c @@ -52,10 +52,14 @@ typedef struct { pthread_mutexattr_t attr; } dxs_mutex_t; #else /* !defined(_WIN32) || defined(USE_PTHREADS) */ -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif # define USE_WIN32_THREADS typedef HANDLE dxs_thread_t; typedef DWORD dxs_key_t; @@ -75,23 +79,17 @@ int dxs_mutex_create(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_destroy(dxs_mutex_t* mutex) { DeleteCriticalSection(*mutex); free(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_lock(dxs_mutex_t* mutex) { EnterCriticalSection(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_unlock(dxs_mutex_t* mutex) { LeaveCriticalSection(*mutex); return true; @@ -122,8 +120,6 @@ int dxs_mutex_create(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_destroy(dxs_mutex_t* mutex) { if (pthread_mutex_destroy(&mutex->mutex) != 0) { return false; @@ -136,8 +132,6 @@ int dxs_mutex_destroy(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_lock(dxs_mutex_t* mutex) { if (pthread_mutex_lock(&mutex->mutex) != 0) { return false; @@ -146,8 +140,6 @@ int dxs_mutex_lock(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_unlock(dxs_mutex_t* mutex) { if (pthread_mutex_unlock(&mutex->mutex) != 0) { return false; @@ -165,7 +157,6 @@ static char dxfeed_host_default[] = "demo.dxfeed.com:7300"; static const dxf_const_string_t g_symbols[] = {L"IBM", L"MSFT", L"YHOO", L"C"}; #define MAIN_LOOP_SLEEP_MILLIS 100 -/* -------------------------------------------------------------------------- */ void trade_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data); void quote_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, @@ -194,7 +185,7 @@ void series_listener(int event_type, dxf_const_string_t symbol_name, const dxf_e void* user_data); void configuration_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data); -void snapshot_listener(dxf_snapshot_data_ptr_t snapshot_data, void* user_data); +void snapshot_listener(const dxf_snapshot_data_ptr_t snapshot_data, void* user_data); struct event_info_t { dx_event_id_t id; @@ -234,8 +225,6 @@ struct snapshot_info_t { static struct snapshot_info_t snapshot_info[SNAPSHOT_COUNT] = { {dx_eid_order, DXF_ET_ORDER, "NTV", {0, 42}, snapshot_listener, {0}}}; -/* -------------------------------------------------------------------------- */ - static int is_listener_thread_terminated = false; static dxs_mutex_t listener_thread_guard; @@ -249,8 +238,6 @@ int is_thread_terminate() { return res; } -/* -------------------------------------------------------------------------- */ - #ifdef _WIN32 void print_at(COORD c, wchar_t* str) { DWORD dummy; @@ -273,8 +260,6 @@ void on_reader_thread_terminate(dxf_connection_t connection, void* user_data) { wprintf(L"\nTerminating listener thread, host: %hs\n", dxfeed_host); } -/* -------------------------------------------------------------------------- */ - int get_symbol_index(dxf_const_string_t symbol_name) { int i = 0; for (; i < SYMBOLS_COUNT; ++i) { @@ -286,8 +271,6 @@ int get_symbol_index(dxf_const_string_t symbol_name) { return -1; } -/* -------------------------------------------------------------------------- */ - #define DXT_BUF_LEN 256 void trade_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, @@ -316,8 +299,6 @@ void trade_listener(int event_type, dxf_const_string_t symbol_name, const dxf_ev print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void quote_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wchar_t buf[DXT_BUF_LEN]; @@ -344,8 +325,6 @@ void quote_listener(int event_type, dxf_const_string_t symbol_name, const dxf_ev print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void summary_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wchar_t buf[DXT_BUF_LEN]; @@ -372,8 +351,6 @@ void summary_listener(int event_type, dxf_const_string_t symbol_name, const dxf_ print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void profile_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wchar_t buf[DXT_BUF_LEN]; @@ -400,8 +377,6 @@ void profile_listener(int event_type, dxf_const_string_t symbol_name, const dxf_ print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void order_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wchar_t buf[DXT_BUF_LEN]; @@ -428,8 +403,6 @@ void order_listener(int event_type, dxf_const_string_t symbol_name, const dxf_ev print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void time_and_sale_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wchar_t buf[DXT_BUF_LEN]; @@ -456,8 +429,6 @@ void time_and_sale_listener(int event_type, dxf_const_string_t symbol_name, cons print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void candle_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wchar_t buf[DXT_BUF_LEN]; @@ -484,8 +455,6 @@ void candle_listener(int event_type, dxf_const_string_t symbol_name, const dxf_e print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void trade_eth_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wchar_t buf[DXT_BUF_LEN]; @@ -512,8 +481,6 @@ void trade_eth_listener(int event_type, dxf_const_string_t symbol_name, const dx print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void spread_order_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wchar_t buf[DXT_BUF_LEN]; @@ -540,8 +507,6 @@ void spread_order_listener(int event_type, dxf_const_string_t symbol_name, const print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void greeks_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wchar_t buf[DXT_BUF_LEN]; @@ -568,8 +533,6 @@ void greeks_listener(int event_type, dxf_const_string_t symbol_name, const dxf_e print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void theo_price_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wchar_t buf[DXT_BUF_LEN]; @@ -596,8 +559,6 @@ void theo_price_listener(int event_type, dxf_const_string_t symbol_name, const d print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void underlying_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wchar_t buf[DXT_BUF_LEN]; @@ -624,8 +585,6 @@ void underlying_listener(int event_type, dxf_const_string_t symbol_name, const d print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void series_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wchar_t buf[DXT_BUF_LEN]; @@ -652,8 +611,6 @@ void series_listener(int event_type, dxf_const_string_t symbol_name, const dxf_e print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void configuration_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { wchar_t buf[DXT_BUF_LEN]; @@ -680,8 +637,6 @@ void configuration_listener(int event_type, dxf_const_string_t symbol_name, cons print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void snapshot_listener(const dxf_snapshot_data_ptr_t snapshot_data, void* user_data) { wchar_t buf[DXT_BUF_LEN]; struct snapshot_info_t* info = user_data; @@ -710,8 +665,6 @@ void snapshot_listener(const dxf_snapshot_data_ptr_t snapshot_data, void* user_d print_at(coord, buf); } -/* -------------------------------------------------------------------------- */ - void process_last_error() { int error_code = dx_ec_success; dxf_const_string_t error_descr = NULL; @@ -829,7 +782,7 @@ void* create_snapshot_subscription(dxf_connection_t connection, struct snapshot_ return info; } -/* -------------------------------------------------------------------------- */ + #ifdef _WIN32 int initialize_console() { CONSOLE_SCREEN_BUFFER_INFO info; diff --git a/tests/LastEventTest/LastEventTest.c b/tests/LastEventTest/LastEventTest.c index 4687e903..2292dacc 100644 --- a/tests/LastEventTest/LastEventTest.c +++ b/tests/LastEventTest/LastEventTest.c @@ -32,10 +32,14 @@ #include "Logger.h" #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif void dxs_sleep(int milliseconds) { Sleep((DWORD)milliseconds); } #else # include @@ -54,8 +58,6 @@ static const dxf_int_t g_symbols_size = sizeof(g_symbols) / sizeof(g_symbols[0]) static const int g_event_type = DXF_ET_TRADE; static int g_iteration_count = 10; -/* -------------------------------------------------------------------------- */ - void process_last_error() { int error_code = dx_ec_success; dxf_const_string_t error_descr = NULL; @@ -80,8 +82,6 @@ void process_last_error() { wprintf(L"An error occurred but the error subsystem failed to initialize\n"); } -/* -------------------------------------------------------------------------- */ - void listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { dxf_int_t i = 0; @@ -105,8 +105,6 @@ void listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_da } } -/* -------------------------------------------------------------------------- */ - int main(int argc, char* argv[]) { dxf_connection_t connection; dxf_subscription_t subscription; diff --git a/tests/PerformanceTest/PerformanceTest.c b/tests/PerformanceTest/PerformanceTest.c index 296ecc1e..3b04206a 100644 --- a/tests/PerformanceTest/PerformanceTest.c +++ b/tests/PerformanceTest/PerformanceTest.c @@ -55,10 +55,14 @@ typedef struct { pthread_mutexattr_t attr; } dxs_mutex_t; #else /* !defined(_WIN32) || defined(USE_PTHREADS) */ -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif # define USE_WIN32_THREADS typedef HANDLE dxs_thread_t; typedef DWORD dxs_key_t; @@ -77,23 +81,17 @@ int dxs_mutex_create(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_destroy(dxs_mutex_t* mutex) { DeleteCriticalSection(*mutex); free(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_lock(dxs_mutex_t* mutex) { EnterCriticalSection(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_unlock(dxs_mutex_t* mutex) { LeaveCriticalSection(*mutex); return true; @@ -124,8 +122,6 @@ int dxs_mutex_create(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_destroy(dxs_mutex_t* mutex) { if (pthread_mutex_destroy(&mutex->mutex) != 0) { return false; @@ -138,8 +134,6 @@ int dxs_mutex_destroy(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_lock(dxs_mutex_t* mutex) { if (pthread_mutex_lock(&mutex->mutex) != 0) { return false; @@ -148,8 +142,6 @@ int dxs_mutex_lock(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_unlock(dxs_mutex_t* mutex) { if (pthread_mutex_unlock(&mutex->mutex) != 0) { return false; @@ -189,7 +181,6 @@ void on_reader_thread_terminate(dxf_connection_t connection, void* user_data) { wprintf(L"\nTerminating listener thread, host: %hs\n", host); } -/* -------------------------------------------------------------------------- */ int events_counter = 0; int server_lags_counter = 0; dxf_long_t server_lags_sum = 0; @@ -278,7 +269,6 @@ void listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_da tns->is_eth_trade ? L"True" : L"False", tns->type); } } -/* -------------------------------------------------------------------------- */ void process_last_error() { int error_code = dx_ec_success; @@ -386,8 +376,6 @@ void destroy_unicode_symbols(dxf_string_t* symbols, size_t count) { free(symbols); } -/* -------------------------------------------------------------------------- */ - void print_usage() { wprintf(L"Usage: PerformanceTest [print] [" LS(TIMEOUT_TAG) L" ] [ ... ] [-h|--help|-?]\n" @@ -439,7 +427,7 @@ int main(int argc, char* argv[]) { } } - for (size_t i = arg; i < argc; ++i) { + for (size_t i = arg; i < (size_t)argc; ++i) { FILE* file; file = fopen(argv[i], "rt"); if (file == NULL) { diff --git a/tests/QuoteTableTest/QuoteTableTest.c b/tests/QuoteTableTest/QuoteTableTest.c index 0c4abc71..3875e20f 100644 --- a/tests/QuoteTableTest/QuoteTableTest.c +++ b/tests/QuoteTableTest/QuoteTableTest.c @@ -45,10 +45,14 @@ typedef struct { pthread_mutexattr_t attr; } dxs_mutex_t; #else /* !defined(_WIN32) || defined(USE_PTHREADS) */ -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif # define USE_WIN32_THREADS typedef HANDLE dxs_thread_t; typedef DWORD dxs_key_t; @@ -67,23 +71,17 @@ int dxs_mutex_create(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_destroy(dxs_mutex_t* mutex) { DeleteCriticalSection(*mutex); free(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_lock(dxs_mutex_t* mutex) { EnterCriticalSection(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_unlock(dxs_mutex_t* mutex) { LeaveCriticalSection(*mutex); return true; @@ -114,8 +112,6 @@ int dxs_mutex_create(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_destroy(dxs_mutex_t* mutex) { if (pthread_mutex_destroy(&mutex->mutex) != 0) { return false; @@ -128,8 +124,6 @@ int dxs_mutex_destroy(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_lock(dxs_mutex_t* mutex) { if (pthread_mutex_lock(&mutex->mutex) != 0) { return false; @@ -138,8 +132,6 @@ int dxs_mutex_lock(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_unlock(dxs_mutex_t* mutex) { if (pthread_mutex_unlock(&mutex->mutex) != 0) { return false; @@ -177,7 +169,6 @@ static dxf_quote_t* quotes[SYMBOLS_COUNT] = {0}; static dxf_summary_t* summaries[SYMBOLS_COUNT] = {0}; static dxf_profile_t* profiles[SYMBOLS_COUNT] = {0}; -/* -------------------------------------------------------------------------- */ void trade_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data); void quote_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, @@ -192,8 +183,6 @@ static struct event_info_t event_info[EVENTS_COUNT] = {{DXF_ET_TRADE, trade_list {DXF_ET_SUMMARY, summary_listener}, {DXF_ET_PROFILE, profile_listener}}; -/* -------------------------------------------------------------------------- */ - static int is_listener_thread_terminated = false; static dxs_mutex_t listener_thread_guard; @@ -206,8 +195,6 @@ int is_thread_terminate() { return res; } -/* -------------------------------------------------------------------------- */ - void on_reader_thread_terminate(dxf_connection_t connection, void* user_data) { char* host = (char*)user_data; dxs_mutex_lock(&listener_thread_guard); @@ -217,8 +204,6 @@ void on_reader_thread_terminate(dxf_connection_t connection, void* user_data) { wprintf(L"\nTerminating listener thread, host: %hs\n", host); } -/* -------------------------------------------------------------------------- */ - int get_symbol_index(dxf_const_string_t symbol_name) { int i = 0; for (; i < g_symbols_size; ++i) { @@ -230,8 +215,6 @@ int get_symbol_index(dxf_const_string_t symbol_name) { return -1; } -/* -------------------------------------------------------------------------- */ - void output_data(int i) { dxf_trade_t* trade = trades[i]; dxf_quote_t* quote = quotes[i]; @@ -253,7 +236,6 @@ void output_data(int i) { profile ? profile->description : dummy); } -/* -------------------------------------------------------------------------- */ dxf_event_data_t getData(int event_type, int i) { if (event_type == DXF_ET_TRADE) { if (trades[i] == NULL) { @@ -310,8 +292,6 @@ void trade_listener(int event_type, dxf_const_string_t symbol_name, const dxf_ev } } -/* -------------------------------------------------------------------------- */ - void quote_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { int symb_ind = get_symbol_index(symbol_name); @@ -340,8 +320,6 @@ void quote_listener(int event_type, dxf_const_string_t symbol_name, const dxf_ev } } -/* -------------------------------------------------------------------------- */ - void summary_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { int symb_ind = get_symbol_index(symbol_name); @@ -370,8 +348,6 @@ void summary_listener(int event_type, dxf_const_string_t symbol_name, const dxf_ } } -/* -------------------------------------------------------------------------- */ - void profile_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { int symb_ind = get_symbol_index(symbol_name); @@ -400,8 +376,6 @@ void profile_listener(int event_type, dxf_const_string_t symbol_name, const dxf_ } } -/* -------------------------------------------------------------------------- */ - void process_last_error() { int error_code = dx_ec_success; dxf_const_string_t error_descr = NULL; @@ -448,7 +422,6 @@ dxf_subscription_t create_subscription(dxf_connection_t connection, int event_id return subscription; } -/* -------------------------------------------------------------------------- */ void print_usage() { wprintf( diff --git a/tests/SampleTest/SampleTest.c b/tests/SampleTest/SampleTest.c index 61468020..51b25fc3 100644 --- a/tests/SampleTest/SampleTest.c +++ b/tests/SampleTest/SampleTest.c @@ -45,10 +45,14 @@ typedef struct { pthread_mutexattr_t attr; } dxs_mutex_t; #else /* !defined(_WIN32) || defined(USE_PTHREADS) */ -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif # define USE_WIN32_THREADS typedef HANDLE dxs_thread_t; typedef DWORD dxs_key_t; @@ -67,23 +71,17 @@ int dxs_mutex_create(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_destroy(dxs_mutex_t* mutex) { DeleteCriticalSection(*mutex); free(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_lock(dxs_mutex_t* mutex) { EnterCriticalSection(*mutex); return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_unlock(dxs_mutex_t* mutex) { LeaveCriticalSection(*mutex); return true; @@ -114,8 +112,6 @@ int dxs_mutex_create(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_destroy(dxs_mutex_t* mutex) { if (pthread_mutex_destroy(&mutex->mutex) != 0) { return false; @@ -128,8 +124,6 @@ int dxs_mutex_destroy(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_lock(dxs_mutex_t* mutex) { if (pthread_mutex_lock(&mutex->mutex) != 0) { return false; @@ -138,8 +132,6 @@ int dxs_mutex_lock(dxs_mutex_t* mutex) { return true; } -/* -------------------------------------------------------------------------- */ - int dxs_mutex_unlock(dxs_mutex_t* mutex) { if (pthread_mutex_unlock(&mutex->mutex) != 0) { return false; @@ -162,7 +154,6 @@ int dxs_mutex_unlock(dxs_mutex_t* mutex) { // const char dxfeed_host[] = "mddqa.in.devexperts.com:7400"; const char dxfeed_host[] = "demo.dxfeed.com:7300"; -/* -------------------------------------------------------------------------- */ static int is_listener_thread_terminated = false; static dxs_mutex_t listener_thread_guard; @@ -175,8 +166,6 @@ int is_thread_terminate() { return res; } -/* -------------------------------------------------------------------------- */ - void on_reader_thread_terminate(dxf_connection_t connection, void* user_data) { char* host = (char*)user_data; dxs_mutex_lock(&listener_thread_guard); @@ -186,8 +175,6 @@ void on_reader_thread_terminate(dxf_connection_t connection, void* user_data) { wprintf(L"\nTerminating listener thread, host: %hs\n", host); } -/* -------------------------------------------------------------------------- */ - void print_timestamp(dxf_long_t timestamp) { wchar_t timefmt[80]; @@ -197,7 +184,6 @@ void print_timestamp(dxf_long_t timestamp) { wcsftime(timefmt, 80, L"%Y%m%d-%H%M%S", timeinfo); wprintf(L"%ls", timefmt); } -/* -------------------------------------------------------------------------- */ void listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { @@ -268,7 +254,6 @@ void listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_da tns->is_eth_trade ? L"True" : L"False", tns->type); } } -/* -------------------------------------------------------------------------- */ void process_last_error() { int error_code = dx_ec_success; @@ -294,8 +279,6 @@ void process_last_error() { wprintf(L"An error occurred but the error subsystem failed to initialize\n"); } -/* -------------------------------------------------------------------------- */ - int main(int argc, char* argv[]) { dxf_connection_t connection; dxf_subscription_t subscription; diff --git a/tests/UnitTests/AddressParserTest.c b/tests/UnitTests/AddressParserTest.c index ab1f2951..ba088571 100644 --- a/tests/UnitTests/AddressParserTest.c +++ b/tests/UnitTests/AddressParserTest.c @@ -139,8 +139,6 @@ static dx_test_case_t all_cases[] = { }; static const size_t all_cases_count = SIZE_OF_ARRAY(all_cases); -/* -------------------------------------------------------------------------- */ - static int dx_is_equal_address(const dx_address_t* expected, const dx_address_t* actual) { DX_CHECK(dx_is_equal_ansi(expected->host, actual->host)); DX_CHECK(dx_is_equal_const_ansi(expected->port, actual->port)); @@ -157,8 +155,6 @@ static int dx_is_equal_address(const dx_address_t* expected, const dx_address_t* return true; } -/* -------------------------------------------------------------------------- */ - static int dx_is_equal_address_array(const dx_address_array_t* expected, const dx_address_array_t* actual) { size_t i; DX_CHECK(dx_is_equal_size_t(expected->size, actual->size)); @@ -168,8 +164,6 @@ static int dx_is_equal_address_array(const dx_address_array_t* expected, const d return true; } -/* -------------------------------------------------------------------------- */ - /* * Test * @@ -191,8 +185,6 @@ static int get_addresses_from_collection_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - int address_parser_all_tests(void) { int res = true; diff --git a/tests/UnitTests/AlgorithmsTest.c b/tests/UnitTests/AlgorithmsTest.c index 80677a96..bfb391c4 100644 --- a/tests/UnitTests/AlgorithmsTest.c +++ b/tests/UnitTests/AlgorithmsTest.c @@ -74,8 +74,6 @@ static int algorithms_base64_length_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - static int base64_run_case(const base64_test_case* test_case, base64_test_context* context) { size_t source_size = strlen(test_case->source); int i; @@ -123,8 +121,6 @@ static int algorithms_base64_encode_decode_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - static dx_property_item_t source_props_array[] = { { L"a", L"A" }, { L"b", L"B" }, @@ -133,8 +129,6 @@ static dx_property_item_t source_props_array[] = { static size_t source_props_size = SIZE_OF_ARRAY(source_props_array); static dx_property_map_t source = { source_props_array, SIZE_OF_ARRAY(source_props_array), SIZE_OF_ARRAY(source_props_array) }; -/* -------------------------------------------------------------------------- */ - static int dx_is_equal_property_map(const dx_property_map_t* expected, const dx_property_map_t* actual) { size_t i; @@ -147,8 +141,6 @@ static int dx_is_equal_property_map(const dx_property_map_t* expected, const dx_ return true; } -/* -------------------------------------------------------------------------- */ - /* * Test * @@ -169,8 +161,6 @@ int properties_map_set_null_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - /* * Test * @@ -191,8 +181,6 @@ int properties_map_set_empty_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - /* * Test * @@ -217,8 +205,6 @@ int properties_map_get_all_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - /* * Test * @@ -256,8 +242,6 @@ int properties_map_set_change_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - /* * Test * @@ -298,8 +282,6 @@ int properties_map_set_many_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - /* * Test * @@ -333,8 +315,6 @@ int properties_map_set_many_invalid_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - /* * Test * @@ -370,8 +350,6 @@ int properties_map_contains_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - /* * Test * @@ -410,8 +388,6 @@ int property_map_clone_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - /* * Test * @@ -441,8 +417,6 @@ int property_map_try_get_value_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - int algorithms_all_tests(void) { int res = true; diff --git a/tests/UnitTests/CMakeLists.txt b/tests/UnitTests/CMakeLists.txt index e646a91e..51cd354b 100644 --- a/tests/UnitTests/CMakeLists.txt +++ b/tests/UnitTests/CMakeLists.txt @@ -214,12 +214,14 @@ add_dependencies(${PROJECT} ${LIB_DXFEED_PROJ}) if (MSVC) if (NOT DISABLE_TLS) + set(DX_CAPI_BINARY_PATH ${CMAKE_BINARY_DIR}/${CMAKE_BUILD_TYPE}) + ADD_CUSTOM_COMMAND( TARGET ${PROJECT} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/${TARGET_PLATFORM}/libtls-15${PLATFORM_POSTFIX}.dll ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/${TARGET_PLATFORM}/libssl-43${PLATFORM_POSTFIX}.dll ${CMAKE_BINARY_DIR}/$(Configuration) - COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/${TARGET_PLATFORM}/libcrypto-41${PLATFORM_POSTFIX}.dll ${CMAKE_BINARY_DIR}/$(Configuration) + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/${TARGET_PLATFORM}/libtls-15${PLATFORM_POSTFIX}.dll ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/${TARGET_PLATFORM}/libssl-43${PLATFORM_POSTFIX}.dll ${DX_CAPI_BINARY_PATH} + COMMAND ${CMAKE_COMMAND} -E copy ${LIB_TLS}/${TARGET_PLATFORM}/libcrypto-41${PLATFORM_POSTFIX}.dll ${DX_CAPI_BINARY_PATH} ) endif (NOT DISABLE_TLS) endif (MSVC) diff --git a/tests/UnitTests/CandleTest.c b/tests/UnitTests/CandleTest.c index 44e71dd6..5bb5091e 100644 --- a/tests/UnitTests/CandleTest.c +++ b/tests/UnitTests/CandleTest.c @@ -23,10 +23,14 @@ #include #include -#pragma warning(push) -#pragma warning(disable : 5105) -#include -#pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif +# include +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #include "Candle.h" #include "CandleTest.h" @@ -145,16 +149,12 @@ static event_counter_data_ptr_t g_order_data = &g_order_event_counter_data; static dxf_candle_t g_last_candle = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 }; dxf_listener_thread_data_t g_ct_listener_thread_data = NULL; -/* -------------------------------------------------------------------------- */ - void candle_tests_on_thread_terminate(dxf_connection_t connection, void* user_data) { if (g_ct_listener_thread_data == NULL) return; on_reader_thread_terminate(g_ct_listener_thread_data, connection, user_data); } -/* -------------------------------------------------------------------------- */ - void aapl_candle_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, void* user_data) { dxf_candle_t* candles = NULL; @@ -197,8 +197,6 @@ void common_candle_listener(int event_type, dxf_const_string_t symbol_name, cons } } -/* -------------------------------------------------------------------------- */ - int add_symbol_to_existing_candle(dxf_subscription_t subscription, dxf_const_string_t symbol) { dxf_candle_attributes_t candle_attributes = NULL; @@ -295,8 +293,6 @@ int get_order_event_counter() { return get_event_counter(g_order_data); } -/* -------------------------------------------------------------------------- */ - /*Test*/ int candle_attributes_test(void) { int candle_attribute_cases_size = sizeof(g_candle_attribute_cases) / sizeof(g_candle_attribute_cases[0]); @@ -326,8 +322,6 @@ int candle_attributes_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - /*Test*/ int candle_subscription_test(void) { dxf_connection_t connection = NULL; diff --git a/tests/UnitTests/ConnectionTest.c b/tests/UnitTests/ConnectionTest.c index 75974a45..10489d60 100644 --- a/tests/UnitTests/ConnectionTest.c +++ b/tests/UnitTests/ConnectionTest.c @@ -17,14 +17,18 @@ * */ -#include #include +#include #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #else # include # include @@ -33,23 +37,23 @@ # define stricmp strcasecmp #endif +#include "ClientMessageProcessor.h" #include "ConnectionContextData.h" #include "ConnectionTest.h" #include "DXAlgorithms.h" #include "DXFeed.h" +#include "DXMemory.h" +#include "DXThreads.h" #include "DXTypes.h" #include "EventSubscription.h" #include "SymbolCodec.h" #include "TestHelper.h" -#include "DXThreads.h" -#include "DXMemory.h" -#include "ClientMessageProcessor.h" #define MULTIPLE_CONNECTION_THREAD_COUNT 10 -static dxf_const_string_t g_symbol_list[] = { L"SYMA", L"SYMB", L"SYMC" }; +static dxf_const_string_t g_symbol_list[] = {L"SYMA", L"SYMB", L"SYMC"}; static int g_symbol_size = sizeof(g_symbol_list) / sizeof(g_symbol_list[0]); -static int g_event_case_list[] = { DXF_ET_TRADE, DXF_ET_QUOTE, DXF_ET_SUMMARY, DXF_ET_PROFILE }; +static int g_event_case_list[] = {DXF_ET_TRADE, DXF_ET_QUOTE, DXF_ET_SUMMARY, DXF_ET_PROFILE}; static int g_event_case_size = sizeof(g_event_case_list) / sizeof(g_event_case_list[0]); typedef struct { @@ -68,7 +72,8 @@ unsigned multiple_connection_routine(void* arg) { subscription = dx_create_event_subscription(connection, data->event_types, 0, 0); dx_add_symbols(subscription, g_symbol_list, g_symbol_size); dx_send_record_description(connection, true); - dx_subscribe_symbols_to_events(connection, dx_get_order_sources(subscription), g_symbol_list, g_symbol_size, NULL, 0, data->event_types, false, true, 0, 0); + dx_subscribe_symbols_to_events(connection, dx_get_order_sources(subscription), g_symbol_list, g_symbol_size, NULL, + 0, data->event_types, false, true, 0, 0); #ifdef _WIN32 Sleep(2000); #else @@ -87,7 +92,7 @@ int multiple_connection_test(void) { dx_thread_t thread_list[MULTIPLE_CONNECTION_THREAD_COUNT]; size_t thread_count = MULTIPLE_CONNECTION_THREAD_COUNT; multiple_connection_data_t* connections = dx_calloc(thread_count, sizeof(multiple_connection_data_t)); - dxf_const_string_t symbol_set[] = { L"SYMA", L"SYMB", L"SYMC" }; + dxf_const_string_t symbol_set[] = {L"SYMA", L"SYMB", L"SYMC"}; for (i = 0; i < thread_count; i++) { multiple_connection_data_t* connection_data = connections + i; connection_data->event_types = g_event_case_list[dx_random_integer(g_event_case_size - 1)]; @@ -117,29 +122,30 @@ int invalid_connection_address_test(void) { const char* invalid_address = "demo.dxfeed.com::7300"; dxf_connection_t connection; - //invalid connection handler - DX_CHECK(dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_connection("demo.dxfeed.com:7300", NULL, NULL, NULL, NULL, NULL, NULL))); - //invalid address - DX_CHECK(dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_connection(invalid_address, NULL, NULL, NULL, NULL, NULL, &connection))); + // invalid connection handler + DX_CHECK(dx_is_equal_ERRORCODE(DXF_FAILURE, + dxf_create_connection("demo.dxfeed.com:7300", NULL, NULL, NULL, NULL, NULL, NULL))); + // invalid address + DX_CHECK(dx_is_equal_ERRORCODE(DXF_FAILURE, + dxf_create_connection(invalid_address, NULL, NULL, NULL, NULL, NULL, &connection))); DX_CHECK(dx_is_equal_ptr(NULL, connection)); - DX_CHECK(dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_connection("no-port", NULL, NULL, NULL, NULL, NULL, &connection))); + DX_CHECK(dx_is_equal_ERRORCODE(DXF_FAILURE, + dxf_create_connection("no-port", NULL, NULL, NULL, NULL, NULL, &connection))); DX_CHECK(dx_is_equal_ptr(NULL, connection)); - DX_CHECK(dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_connection(":123", NULL, NULL, NULL, NULL, NULL, &connection))); + DX_CHECK( + dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_connection(":123", NULL, NULL, NULL, NULL, NULL, &connection))); DX_CHECK(dx_is_equal_ptr(NULL, connection)); - DX_CHECK(dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_connection("a:123", NULL, NULL, NULL, NULL, NULL, &connection))); + DX_CHECK( + dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_connection("a:123", NULL, NULL, NULL, NULL, NULL, &connection))); DX_CHECK(dx_is_equal_ptr(NULL, connection)); return true; } -/* -------------------------------------------------------------------------- */ - int connection_all_test(void) { int res = true; - if (!multiple_connection_test() || - !invalid_connection_address_test()) { - + if (!multiple_connection_test() || !invalid_connection_address_test()) { res = false; } return res; diff --git a/tests/UnitTests/DXNetworkTests.c b/tests/UnitTests/DXNetworkTests.c index 5af5bb5f..e373ea36 100644 --- a/tests/UnitTests/DXNetworkTests.c +++ b/tests/UnitTests/DXNetworkTests.c @@ -38,8 +38,6 @@ static int dx_is_equal_property_map(const dx_property_map_t* expected, const dx_ return true; } -/* -------------------------------------------------------------------------- */ - /* * Test * @@ -52,8 +50,6 @@ int protocol_get_basic_auth_data_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - /* * Test * @@ -77,8 +73,6 @@ int protocol_configure_basic_auth_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - /* * Test * @@ -102,8 +96,6 @@ int protocol_configure_custom_auth_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - int network_all_test(void) { int res = true; diff --git a/tests/UnitTests/EventDynamicSubscriptionTest.cpp b/tests/UnitTests/EventDynamicSubscriptionTest.cpp index 8b5d33af..9fa70930 100644 --- a/tests/UnitTests/EventDynamicSubscriptionTest.cpp +++ b/tests/UnitTests/EventDynamicSubscriptionTest.cpp @@ -20,31 +20,33 @@ #include #include -#pragma warning(push) -#pragma warning(disable : 5105) +#if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +#endif #include -#pragma warning(pop) +#if !defined(__MINGW32__) +# pragma warning(pop) +#endif -#include "EventDynamicSubscriptionTest.h" #include "DXAlgorithms.h" -#include "DXFeed.h" #include "DXErrorCodes.h" +#include "DXFeed.h" +#include "EventDynamicSubscriptionTest.h" #include "Logger.h" #include "TestHelper.h" -//Timeout in milliseconds for waiting some events is 2 minutes. -#define EVENTS_TIMEOUT 120000 +// Timeout in milliseconds for waiting some events is 2 minutes. +#define EVENTS_TIMEOUT 120000 #define EVENTS_LOOP_SLEEP_TIME 100 const char dxfeed_host[] = "mddqa.in.devexperts.com:7400"; #define SYMBOLS_COUNT 4 -static dxf_const_string_t g_symbols[] = { { L"IBM" }, { L"AAPL" }, { L"XBT/USD" }, { L"C" } }; +static dxf_const_string_t g_symbols[] = {{L"IBM"}, {L"AAPL"}, {L"XBT/USD"}, {L"C"}}; dxf_listener_thread_data_t g_listener_thread_data; -/* -------------------------------------------------------------------------- */ - static dxf_uint_t g_trade_event_counter = 0; CRITICAL_SECTION g_trade_counter_guard; static dxf_uint_t g_order_event_counter = 0; @@ -70,8 +72,6 @@ void drop_order_counter() { LeaveCriticalSection(&g_order_counter_guard); } -/* -------------------------------------------------------------------------- */ - void inc_trade_counter() { EnterCriticalSection(&g_trade_counter_guard); g_trade_event_counter++; @@ -92,20 +92,17 @@ void drop_trade_counter() { LeaveCriticalSection(&g_trade_counter_guard); } -/* -------------------------------------------------------------------------- */ - -void print_timestamp(dxf_long_t timestamp){ +void print_timestamp(dxf_long_t timestamp) { char timefmt[80]; - struct tm * timeinfo; + struct tm* timeinfo; time_t tmpint = (int)(timestamp / 1000); timeinfo = localtime(&tmpint); strftime(timefmt, 80, "%Y%m%d-%H%M%S", timeinfo); printf("%s", timefmt); } -/* -------------------------------------------------------------------------- */ -static dxf_uint_t buf_hash(const unsigned char *buf, int size) { +static dxf_uint_t buf_hash(const unsigned char* buf, int size) { dxf_uint_t hash = 0; dxf_int_t c; int i; @@ -118,15 +115,13 @@ static dxf_uint_t buf_hash(const unsigned char *buf, int size) { return hash; } -/* -------------------------------------------------------------------------- */ - typedef struct { int event_type; dxf_string_t symbol; dxf_event_params_t* params; dxf_uint_t obj_hash; int data_count; - void *user_data; + void* user_data; int is_received; CRITICAL_SECTION guard; @@ -169,10 +164,9 @@ int is_received_event_listener_data(event_listener_data_t* listener_data) { return is_received; } -void set_event_listener_data(int event_type, dxf_const_string_t symbol_name, - const dxf_event_params_t* params, const dxf_event_data_t* data, - int data_count, void* user_data, int event_size, - event_listener_data_t* listener_data) { +void set_event_listener_data(int event_type, dxf_const_string_t symbol_name, const dxf_event_params_t* params, + const dxf_event_data_t* data, int data_count, void* user_data, int event_size, + event_listener_data_t* listener_data) { EnterCriticalSection(&(listener_data->guard)); reset_event_listener_data(listener_data); listener_data->event_type = event_type; @@ -189,39 +183,32 @@ void set_event_listener_data(int event_type, dxf_const_string_t symbol_name, LeaveCriticalSection(&(listener_data->guard)); } -/* -------------------------------------------------------------------------- */ - -void trade_listener(int event_type, dxf_const_string_t symbol_name, - const dxf_event_data_t* data, int data_count, void* user_data) { +void trade_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, + void* user_data) { inc_trade_counter(); } -void order_listener(int event_type, dxf_const_string_t symbol_name, - const dxf_event_data_t* data, int data_count, void* user_data) { +void order_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, + void* user_data) { inc_order_counter(); } -/* -------------------------------------------------------------------------- */ - -void order_event_copy_listener(int event_type, dxf_const_string_t symbol_name, - const dxf_event_data_t* data, int data_count, void* user_data) { - if (order_data.is_received) - return; - set_event_listener_data(event_type, symbol_name, NULL, data, data_count, user_data, sizeof(dxf_order_t), &order_data); +void order_event_copy_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, + int data_count, void* user_data) { + if (order_data.is_received) return; + set_event_listener_data(event_type, symbol_name, NULL, data, data_count, user_data, sizeof(dxf_order_t), + &order_data); } -void order_event_copy_listener_v2(int event_type, dxf_const_string_t symbol_name, - const dxf_event_data_t* data, int data_count, - const dxf_event_params_t* params, void* user_data) { - if (order_data_v2.is_received) - return; - set_event_listener_data(event_type, symbol_name, params, data, data_count, user_data, sizeof(dxf_order_t), &order_data_v2); +void order_event_copy_listener_v2(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, + int data_count, const dxf_event_params_t* params, void* user_data) { + if (order_data_v2.is_received) return; + set_event_listener_data(event_type, symbol_name, params, data, data_count, user_data, sizeof(dxf_order_t), + &order_data_v2); } -/* -------------------------------------------------------------------------- */ - -int subscribe_to_event(dxf_connection_t connection, dxf_subscription_t* subscription, - int event_type, dxf_event_listener_t event_listener, void* user_data) { +int subscribe_to_event(dxf_connection_t connection, dxf_subscription_t* subscription, int event_type, + dxf_event_listener_t event_listener, void* user_data) { if (!dxf_create_subscription(connection, event_type, subscription)) { process_last_error(); @@ -243,16 +230,11 @@ int subscribe_to_event(dxf_connection_t connection, dxf_subscription_t* subscrip return true; } -/* -------------------------------------------------------------------------- */ - void on_thread_terminate(dxf_connection_t connection, void* user_data) { - if (g_listener_thread_data == NULL) - return; + if (g_listener_thread_data == NULL) return; on_reader_thread_terminate(g_listener_thread_data, connection, user_data); } -/* -------------------------------------------------------------------------- */ - /*Test*/ int event_dynamic_subscription_test(void) { dxf_connection_t connection = NULL; @@ -268,13 +250,13 @@ int event_dynamic_subscription_test(void) { return false; } - //Subscribe on trade events + // Subscribe on trade events if (!subscribe_to_event(connection, &trade_subscription, DXF_ET_TRADE, trade_listener, NULL)) { dxf_close_connection(connection); return false; } - //Wait trade events + // Wait trade events timestamp = dx_millisecond_timestamp(); while (get_trade_counter() == 0) { if (is_thread_terminate(g_listener_thread_data)) { @@ -294,7 +276,7 @@ int event_dynamic_subscription_test(void) { Sleep(EVENTS_LOOP_SLEEP_TIME); } - //Subscribe on order events + // Subscribe on order events if (!subscribe_to_event(connection, &order_subscription, DXF_ET_ORDER, order_listener, NULL)) { dxf_close_subscription(trade_subscription); dxf_close_connection(connection); @@ -305,7 +287,7 @@ int event_dynamic_subscription_test(void) { drop_order_counter(); drop_trade_counter(); - //Check trade and order events + // Check trade and order events timestamp = dx_millisecond_timestamp(); while (get_trade_counter() == 0 || get_order_counter() == 0) { if (is_thread_terminate(g_listener_thread_data)) { @@ -327,12 +309,12 @@ int event_dynamic_subscription_test(void) { Sleep(EVENTS_LOOP_SLEEP_TIME); } - //Unsubscribe trade events + // Unsubscribe trade events dxf_detach_event_listener(trade_subscription, trade_listener); drop_order_counter(); drop_trade_counter(); - //Check order events + // Check order events while (loop_counter--) { if (is_thread_terminate(g_listener_thread_data)) { dxf_close_subscription(trade_subscription); @@ -384,7 +366,7 @@ int listener_v2_test(void) { drop_order_counter(); - //Subscribe on order events + // Subscribe on order events if (!subscribe_to_event(connection, &order_subscription, DXF_ET_ORDER, order_event_copy_listener, &user_data)) { dxf_close_connection(connection); PRINT_TEST_FAILED; @@ -398,7 +380,7 @@ int listener_v2_test(void) { return false; }; - //Wait order events + // Wait order events timestamp = dx_millisecond_timestamp(); while (!is_received_event_listener_data(&order_data) || !is_received_event_listener_data(&order_data_v2)) { if (is_thread_terminate(g_listener_thread_data)) { @@ -422,9 +404,7 @@ int listener_v2_test(void) { !dx_is_equal_dxf_const_string_t(order_data.symbol, order_data_v2.symbol) || !dx_is_equal_dxf_uint_t(order_data.obj_hash, order_data_v2.obj_hash) || !dx_is_equal_int(order_data.data_count, order_data_v2.data_count) || - !dx_is_equal_ptr(order_data.user_data, order_data_v2.user_data) || - !dx_is_not_null(order_data_v2.params)) { - + !dx_is_equal_ptr(order_data.user_data, order_data_v2.user_data) || !dx_is_not_null(order_data_v2.params)) { res = false; } @@ -454,8 +434,7 @@ int event_dynamic_subscription_all_test(void) { init_event_listener_data(&order_data); init_event_listener_data(&order_data_v2); - if (!event_dynamic_subscription_test() || - !listener_v2_test()) { + if (!event_dynamic_subscription_test() || !listener_v2_test()) { res = false; } diff --git a/tests/UnitTests/EventSubscriptionTest.c b/tests/UnitTests/EventSubscriptionTest.c index 96a1da35..48d208d7 100644 --- a/tests/UnitTests/EventSubscriptionTest.c +++ b/tests/UnitTests/EventSubscriptionTest.c @@ -187,8 +187,6 @@ int event_subscription_test (void) { return true; } -/* -------------------------------------------------------------------------- */ - #define NON_HISTORY_RECORD_TIME -1 //UTC2017-03-28T07:28:06.123 #define TIME_STAMP 0x15B13D08BEB @@ -291,8 +289,6 @@ int subscription_time_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - int event_subscription_all_test(void) { int res = true; diff --git a/tests/UnitTests/OrderSourceConfigurationTest.c b/tests/UnitTests/OrderSourceConfigurationTest.c index e135a32a..5d3a276a 100644 --- a/tests/UnitTests/OrderSourceConfigurationTest.c +++ b/tests/UnitTests/OrderSourceConfigurationTest.c @@ -18,32 +18,37 @@ */ #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #endif -#include +#include "OrderSourceConfigurationTest.h" + #include +#include -#include "OrderSourceConfigurationTest.h" -#include "DXTypes.h" -#include "DXFeed.h" +#include "DXAlgorithms.h" #include "DXErrorCodes.h" +#include "DXFeed.h" +#include "DXTypes.h" #include "EventData.h" -#include "DXAlgorithms.h" #include "TestHelper.h" -//Timeout in milliseconds for waiting some events is 3 minutes. -#define EVENTS_TIMEOUT 180000 +// Timeout in milliseconds for waiting some events is 3 minutes. +#define EVENTS_TIMEOUT 180000 #define EVENTS_LOOP_SLEEP_TIME 100 -//The maximum milliseconds interval of expecting between two events +// The maximum milliseconds interval of expecting between two events #define WAIT_EVENTS_INTERVAL 200 #define DXFEED_HOST "mddqa.in.devexperts.com:7400" -typedef int(*get_counter_function_t)(); +typedef int (*get_counter_function_t)(); dxf_listener_thread_data_t g_ost_listener_thread_data = NULL; event_counter_data_t counter_data_ntv; @@ -56,32 +61,21 @@ event_counter_data_ptr_t g_dea_counter = &counter_data_dea; int ost_get_ntv_counter() { return get_event_counter(g_ntv_counter); } int ost_get_dex_counter() { return get_event_counter(g_dex_counter); } int ost_get_dea_counter() { return get_event_counter(g_dea_counter); } -get_counter_function_t g_all_counters[] = { ost_get_ntv_counter, ost_get_dex_counter, ost_get_dea_counter }; +get_counter_function_t g_all_counters[] = {ost_get_ntv_counter, ost_get_dex_counter, ost_get_dea_counter}; -/* -------------------------------------------------------------------------- */ - -static void close_data(dxf_connection_t connection, dxf_subscription_t subscription, - dxf_event_listener_t listener) { - if (!dxf_detach_event_listener(subscription, listener)) - process_last_error(); - if (!dxf_close_subscription(subscription)) - process_last_error(); - if (!dxf_close_connection(connection)) - process_last_error(); +static void close_data(dxf_connection_t connection, dxf_subscription_t subscription, dxf_event_listener_t listener) { + if (!dxf_detach_event_listener(subscription, listener)) process_last_error(); + if (!dxf_close_subscription(subscription)) process_last_error(); + if (!dxf_close_connection(connection)) process_last_error(); } -/* -------------------------------------------------------------------------- */ - void order_source_tests_on_thread_terminate(dxf_connection_t connection, void* user_data) { - if (g_ost_listener_thread_data == NULL) - return; + if (g_ost_listener_thread_data == NULL) return; on_reader_thread_terminate(g_ost_listener_thread_data, connection, user_data); } -/* -------------------------------------------------------------------------- */ - -void listener(int event_type, dxf_const_string_t symbol_name, - const dxf_event_data_t* data, int data_count, void* user_data) { +void listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, + void* user_data) { dxf_int_t i = 0; dxf_order_t* orders = (dxf_order_t*)data; @@ -119,8 +113,7 @@ int ost_wait_multiple_events(get_counter_function_t* counter_functions, int func for (i = 0; i < function_number; i++) { res &= counter_functions[i]() > 0; } - if (res) - return true; + if (res) return true; if (is_thread_terminate(g_ost_listener_thread_data)) { printf("Test failed: thread was terminated!\n"); return false; @@ -135,7 +128,7 @@ int ost_wait_multiple_events(get_counter_function_t* counter_functions, int func } int ost_wait_two_events(get_counter_function_t f1, get_counter_function_t f2) { - get_counter_function_t counters[] = { f1, f2 }; + get_counter_function_t counters[] = {f1, f2}; return ost_wait_multiple_events(counters, SIZE_OF_ARRAY(counters)); } @@ -156,7 +149,8 @@ static int wait_all_events_received(event_counter_data_ptr_t counter_data) { return false; } if (dx_millisecond_timestamp_diff(dx_millisecond_timestamp(), timestamp) > EVENTS_TIMEOUT) { - printf("Test failed: timeout is elapsed! Interval of waiting " + printf( + "Test failed: timeout is elapsed! Interval of waiting " "'%s' events possible too much...", get_event_counter_name(counter_data)); return false; @@ -180,18 +174,18 @@ static int wait_all_events_received(event_counter_data_ptr_t counter_data) { int mixed_order_source_test() { dxf_connection_t connection = NULL; dxf_subscription_t subscription = NULL; - dxf_const_string_t symbols[] = { { L"IBM" }, { L"MSFT" }, { L"YHOO" }, { L"C" }, { L"AAPL" } }; + dxf_const_string_t symbols[] = {{L"IBM"}, {L"MSFT"}, {L"YHOO"}, {L"C"}, {L"AAPL"}}; dxf_int_t symbol_count = sizeof(symbols) / sizeof(symbols[0]); drop_event_counter(g_ntv_counter); drop_event_counter(g_dex_counter); drop_event_counter(g_dea_counter); - if (!dxf_create_connection(DXFEED_HOST, order_source_tests_on_thread_terminate, NULL, NULL, NULL, NULL, &connection) || + if (!dxf_create_connection(DXFEED_HOST, order_source_tests_on_thread_terminate, NULL, NULL, NULL, NULL, + &connection) || !dxf_create_subscription(connection, DXF_ET_ORDER, &subscription) || !dxf_add_symbols(subscription, symbols, symbol_count) || !dxf_attach_event_listener(subscription, listener, NULL)) { - process_last_error(); return false; } @@ -208,10 +202,8 @@ int mixed_order_source_test() { close_data(connection, subscription, listener); return false; } - if (!wait_all_events_received(g_ntv_counter) || - !wait_all_events_received(g_dex_counter) || + if (!wait_all_events_received(g_ntv_counter) || !wait_all_events_received(g_dex_counter) || !wait_all_events_received(g_dea_counter)) { - PRINT_TEST_FAILED; close_data(connection, subscription, listener); return false; @@ -219,15 +211,14 @@ int mixed_order_source_test() { drop_event_counter(g_ntv_counter); drop_event_counter(g_dex_counter); drop_event_counter(g_dea_counter); - if (!ost_wait_events(ost_get_ntv_counter) || - !dx_is_equal_int(0, ost_get_dex_counter()) || + if (!ost_wait_events(ost_get_ntv_counter) || !dx_is_equal_int(0, ost_get_dex_counter()) || !dx_is_equal_int(0, ost_get_dea_counter())) { - - printf("at %s, line: %d\n" - " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" - " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", - __FUNCTION__, __LINE__, ">0", "0", "0", - ost_get_ntv_counter(), ost_get_dex_counter(), ost_get_dea_counter()); + printf( + "at %s, line: %d\n" + " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" + " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", + __FUNCTION__, __LINE__, ">0", "0", "0", ost_get_ntv_counter(), ost_get_dex_counter(), + ost_get_dea_counter()); close_data(connection, subscription, listener); return false; } @@ -238,10 +229,8 @@ int mixed_order_source_test() { close_data(connection, subscription, listener); return false; } - if (!wait_all_events_received(g_ntv_counter) || - !wait_all_events_received(g_dex_counter) || + if (!wait_all_events_received(g_ntv_counter) || !wait_all_events_received(g_dex_counter) || !wait_all_events_received(g_dea_counter)) { - PRINT_TEST_FAILED; close_data(connection, subscription, listener); return false; @@ -249,22 +238,19 @@ int mixed_order_source_test() { drop_event_counter(g_ntv_counter); drop_event_counter(g_dex_counter); drop_event_counter(g_dea_counter); - if (!ost_wait_two_events(ost_get_ntv_counter, ost_get_dex_counter) || - !dx_is_equal_int(0, ost_get_dea_counter())) { - - printf("at %s, line: %d\n" - " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" - " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", - __FUNCTION__, __LINE__, ">0", ">0", "0", - ost_get_ntv_counter(), ost_get_dex_counter(), ost_get_dea_counter()); + if (!ost_wait_two_events(ost_get_ntv_counter, ost_get_dex_counter) || !dx_is_equal_int(0, ost_get_dea_counter())) { + printf( + "at %s, line: %d\n" + " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" + " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", + __FUNCTION__, __LINE__, ">0", ">0", "0", ost_get_ntv_counter(), ost_get_dex_counter(), + ost_get_dea_counter()); close_data(connection, subscription, listener); return false; } - if (!dxf_detach_event_listener(subscription, listener) || - !dxf_close_subscription(subscription) || + if (!dxf_detach_event_listener(subscription, listener) || !dxf_close_subscription(subscription) || !dxf_close_connection(connection)) { - process_last_error(); return false; } @@ -285,18 +271,18 @@ int mixed_order_source_test() { int set_order_source_test() { dxf_connection_t connection = NULL; dxf_subscription_t subscription = NULL; - dxf_const_string_t symbols[] = { { L"IBM" }, { L"MSFT" }, { L"YHOO" }, { L"C" }, { L"AAPL" } }; + dxf_const_string_t symbols[] = {{L"IBM"}, {L"MSFT"}, {L"YHOO"}, {L"C"}, {L"AAPL"}}; dxf_int_t symbol_count = sizeof(symbols) / sizeof(symbols[0]); drop_event_counter(g_ntv_counter); drop_event_counter(g_dex_counter); drop_event_counter(g_dea_counter); - if (!dxf_create_connection(DXFEED_HOST, order_source_tests_on_thread_terminate, NULL, NULL, NULL, NULL, &connection) || + if (!dxf_create_connection(DXFEED_HOST, order_source_tests_on_thread_terminate, NULL, NULL, NULL, NULL, + &connection) || !dxf_create_subscription(connection, DXF_ET_ORDER, &subscription) || !dxf_add_symbols(subscription, symbols, symbol_count) || !dxf_attach_event_listener(subscription, listener, NULL)) { - process_last_error(); return false; } @@ -313,10 +299,8 @@ int set_order_source_test() { close_data(connection, subscription, listener); return false; } - if (!wait_all_events_received(g_ntv_counter) || - !wait_all_events_received(g_dex_counter) || + if (!wait_all_events_received(g_ntv_counter) || !wait_all_events_received(g_dex_counter) || !wait_all_events_received(g_dea_counter)) { - PRINT_TEST_FAILED; close_data(connection, subscription, listener); return false; @@ -324,15 +308,14 @@ int set_order_source_test() { drop_event_counter(g_ntv_counter); drop_event_counter(g_dex_counter); drop_event_counter(g_dea_counter); - if (!ost_wait_events(ost_get_ntv_counter) || - !dx_is_equal_int(0, ost_get_dex_counter()) || + if (!ost_wait_events(ost_get_ntv_counter) || !dx_is_equal_int(0, ost_get_dex_counter()) || !dx_is_equal_int(0, ost_get_dea_counter())) { - - printf("at %s, line: %d\n" - " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" - " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", - __FUNCTION__, __LINE__, ">0", "0", "0", - ost_get_ntv_counter(), ost_get_dex_counter(), ost_get_dea_counter()); + printf( + "at %s, line: %d\n" + " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" + " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", + __FUNCTION__, __LINE__, ">0", "0", "0", ost_get_ntv_counter(), ost_get_dex_counter(), + ost_get_dea_counter()); close_data(connection, subscription, listener); return false; } @@ -343,10 +326,8 @@ int set_order_source_test() { close_data(connection, subscription, listener); return false; } - if (!wait_all_events_received(g_ntv_counter) || - !wait_all_events_received(g_dex_counter) || + if (!wait_all_events_received(g_ntv_counter) || !wait_all_events_received(g_dex_counter) || !wait_all_events_received(g_dea_counter)) { - PRINT_TEST_FAILED; close_data(connection, subscription, listener); return false; @@ -354,23 +335,20 @@ int set_order_source_test() { drop_event_counter(g_ntv_counter); drop_event_counter(g_dex_counter); drop_event_counter(g_dea_counter); - if (!ost_wait_events(ost_get_dex_counter) || - !dx_is_equal_int(0, ost_get_ntv_counter()) || + if (!ost_wait_events(ost_get_dex_counter) || !dx_is_equal_int(0, ost_get_ntv_counter()) || !dx_is_equal_int(0, ost_get_dea_counter())) { - - printf("at %s, line: %d\n" - " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" - " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", - __FUNCTION__, __LINE__, "0", ">0", "0", - ost_get_ntv_counter(), ost_get_dex_counter(), ost_get_dea_counter()); + printf( + "at %s, line: %d\n" + " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" + " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", + __FUNCTION__, __LINE__, "0", ">0", "0", ost_get_ntv_counter(), ost_get_dex_counter(), + ost_get_dea_counter()); close_data(connection, subscription, listener); return false; } - if (!dxf_detach_event_listener(subscription, listener) || - !dxf_close_subscription(subscription) || + if (!dxf_detach_event_listener(subscription, listener) || !dxf_close_subscription(subscription) || !dxf_close_connection(connection)) { - process_last_error(); return false; } @@ -391,32 +369,30 @@ int set_order_source_test() { int add_order_source_test() { dxf_connection_t connection = NULL; dxf_subscription_t subscription = NULL; - dxf_const_string_t symbols[] = { L"IBM", L"MSFT", L"YHOO", L"C", L"AAPL", L"XBT/USD" }; + dxf_const_string_t symbols[] = {L"IBM", L"MSFT", L"YHOO", L"C", L"AAPL", L"XBT/USD"}; dxf_int_t symbol_count = sizeof(symbols) / sizeof(symbols[0]); drop_event_counter(g_ntv_counter); drop_event_counter(g_dex_counter); drop_event_counter(g_dea_counter); - if (!dxf_create_connection(DXFEED_HOST, order_source_tests_on_thread_terminate, NULL, NULL, NULL, NULL, &connection) || + if (!dxf_create_connection(DXFEED_HOST, order_source_tests_on_thread_terminate, NULL, NULL, NULL, NULL, + &connection) || !dxf_create_subscription(connection, DXF_ET_ORDER, &subscription) || - !dxf_set_order_source(subscription, "NTV") || - !dxf_add_symbols(subscription, symbols, symbol_count) || + !dxf_set_order_source(subscription, "NTV") || !dxf_add_symbols(subscription, symbols, symbol_count) || !dxf_attach_event_listener(subscription, listener, NULL)) { - process_last_error(); return false; } - if (!ost_wait_events(ost_get_ntv_counter) || - !dx_is_equal_int(0, ost_get_dex_counter()) || + if (!ost_wait_events(ost_get_ntv_counter) || !dx_is_equal_int(0, ost_get_dex_counter()) || !dx_is_equal_int(0, ost_get_dea_counter())) { - - printf("at %s, line: %d\n" - " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" - " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", - __FUNCTION__, __LINE__, ">0", "0", "0", - ost_get_ntv_counter(), ost_get_dex_counter(), ost_get_dea_counter()); + printf( + "at %s, line: %d\n" + " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" + " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", + __FUNCTION__, __LINE__, ">0", "0", "0", ost_get_ntv_counter(), ost_get_dex_counter(), + ost_get_dea_counter()); close_data(connection, subscription, listener); return false; } @@ -427,10 +403,8 @@ int add_order_source_test() { close_data(connection, subscription, listener); return false; } - if (!wait_all_events_received(g_ntv_counter) || - !wait_all_events_received(g_dex_counter) || + if (!wait_all_events_received(g_ntv_counter) || !wait_all_events_received(g_dex_counter) || !wait_all_events_received(g_dea_counter)) { - PRINT_TEST_FAILED; close_data(connection, subscription, listener); return false; @@ -438,14 +412,13 @@ int add_order_source_test() { drop_event_counter(g_ntv_counter); drop_event_counter(g_dex_counter); drop_event_counter(g_dea_counter); - if (!ost_wait_two_events(ost_get_ntv_counter, ost_get_dex_counter) || - !dx_is_equal_int(0, ost_get_dea_counter())) { - - printf("at %s, line: %d\n" - " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" - " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", - __FUNCTION__, __LINE__, ">0", ">0", "0", - ost_get_ntv_counter(), ost_get_dex_counter(), ost_get_dea_counter()); + if (!ost_wait_two_events(ost_get_ntv_counter, ost_get_dex_counter) || !dx_is_equal_int(0, ost_get_dea_counter())) { + printf( + "at %s, line: %d\n" + " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" + " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", + __FUNCTION__, __LINE__, ">0", ">0", "0", ost_get_ntv_counter(), ost_get_dex_counter(), + ost_get_dea_counter()); close_data(connection, subscription, listener); return false; } @@ -456,10 +429,8 @@ int add_order_source_test() { close_data(connection, subscription, listener); return false; } - if (!wait_all_events_received(g_ntv_counter) || - !wait_all_events_received(g_dex_counter) || + if (!wait_all_events_received(g_ntv_counter) || !wait_all_events_received(g_dex_counter) || !wait_all_events_received(g_dea_counter)) { - PRINT_TEST_FAILED; close_data(connection, subscription, listener); return false; @@ -468,19 +439,18 @@ int add_order_source_test() { drop_event_counter(g_dex_counter); drop_event_counter(g_dea_counter); if (!ost_wait_multiple_events(g_all_counters, SIZE_OF_ARRAY(g_all_counters))) { - printf("at %s, line: %d\n" - " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" - " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", - __FUNCTION__, __LINE__, ">0", ">0", ">0", - ost_get_ntv_counter(), ost_get_dex_counter(), ost_get_dea_counter()); + printf( + "at %s, line: %d\n" + " Expected: ntv=%5s, dex=%5s, dea=%5s; \n" + " But was: ntv=%5d, dex=%5d, dea=%5d.\n\n", + __FUNCTION__, __LINE__, ">0", ">0", ">0", ost_get_ntv_counter(), ost_get_dex_counter(), + ost_get_dea_counter()); close_data(connection, subscription, listener); return false; } - if (!dxf_detach_event_listener(subscription, listener) || - !dxf_close_subscription(subscription) || + if (!dxf_detach_event_listener(subscription, listener) || !dxf_close_subscription(subscription) || !dxf_close_connection(connection)) { - process_last_error(); return false; } @@ -501,43 +471,39 @@ int add_order_source_test() { int input_order_source_test() { dxf_connection_t connection = NULL; dxf_subscription_t subscription = NULL; - dxf_const_string_t symbols[] = { { L"IBM" },{ L"MSFT" },{ L"YHOO" },{ L"C" },{ L"AAPL" } }; + dxf_const_string_t symbols[] = {{L"IBM"}, {L"MSFT"}, {L"YHOO"}, {L"C"}, {L"AAPL"}}; dxf_int_t symbol_count = sizeof(symbols) / sizeof(symbols[0]); - if (!dxf_create_connection(DXFEED_HOST, order_source_tests_on_thread_terminate, NULL, NULL, NULL, NULL, &connection) || + if (!dxf_create_connection(DXFEED_HOST, order_source_tests_on_thread_terminate, NULL, NULL, NULL, NULL, + &connection) || !dxf_create_subscription(connection, DXF_ET_ORDER, &subscription)) { - process_last_error(); return false; } if ( - //Try to add order source with NULL subscription + // Try to add order source with NULL subscription dxf_add_order_source(NULL, "NTV") || - //Try to add NULL order source + // Try to add NULL order source dxf_add_order_source(subscription, NULL) || - //Try to add empty-string order source + // Try to add empty-string order source dxf_add_order_source(subscription, "") || - //Try to add very-long-string order source + // Try to add very-long-string order source dxf_add_order_source(subscription, "abcde") || - //Try to set order source with NULL subscription + // Try to set order source with NULL subscription dxf_set_order_source(NULL, "NTV") || - //Try to set NULL order source + // Try to set NULL order source dxf_set_order_source(subscription, NULL) || - //Try to set empty-string order source + // Try to set empty-string order source dxf_set_order_source(subscription, "") || - //Try to set very-long-string order source - dxf_set_order_source(subscription, "abcde") - ) { - + // Try to set very-long-string order source + dxf_set_order_source(subscription, "abcde")) { PRINT_TEST_FAILED; close_data(connection, subscription, listener); return false; } - if (!dxf_close_subscription(subscription) || - !dxf_close_connection(connection)) { - + if (!dxf_close_subscription(subscription) || !dxf_close_connection(connection)) { process_last_error(); return false; } @@ -554,11 +520,8 @@ int order_source_configuration_test(void) { init_event_counter2(g_dex_counter, "DEX"); init_event_counter2(g_dea_counter, "DEA"); - if (!input_order_source_test() || - !add_order_source_test() || - !set_order_source_test() || + if (!input_order_source_test() || !add_order_source_test() || !set_order_source_test() || !mixed_order_source_test()) { - res &= false; } diff --git a/tests/UnitTests/SnapshotTests.c b/tests/UnitTests/SnapshotTests.c index ef104a6d..a97fb555 100644 --- a/tests/UnitTests/SnapshotTests.c +++ b/tests/UnitTests/SnapshotTests.c @@ -17,14 +17,18 @@ * */ -#include #include +#include #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #else # include # include @@ -33,32 +37,32 @@ # define stricmp strcasecmp #endif -#include "DXFeed.h" -#include "DXErrorCodes.h" #include "DXAlgorithms.h" -#include "TestHelper.h" +#include "DXErrorCodes.h" +#include "DXFeed.h" #include "SnapshotTests.h" +#include "TestHelper.h" -//Timeout in milliseconds for waiting some snapshots is 1 minutes. -#define SNAPSHOT_READ_TIMEOUT 60000 +// Timeout in milliseconds for waiting some snapshots is 1 minutes. +#define SNAPSHOT_READ_TIMEOUT 60000 #define SNAPSHOT_LOOP_SLEEP_TIME 100 -//Timeout in milliseconds for waiting some events is 2 minutes. -#define EVENTS_READ_TIMEOUT 120000 +// Timeout in milliseconds for waiting some events is 2 minutes. +#define EVENTS_READ_TIMEOUT 120000 #define EVENTS_LOOP_SLEEP_TIME 100 -#define CANDLE_DEFAULT_SYMBOL L"XBT/USD" -#define CANDLE_USER_EXCHANGE L'A' -#define CANDLE_USER_PERIOD_VALUE 2 +#define CANDLE_DEFAULT_SYMBOL L"XBT/USD" +#define CANDLE_USER_EXCHANGE L'A' +#define CANDLE_USER_PERIOD_VALUE 2 #define CANDLE_USER_PRICE_LEVEL_VALUE 0.1 #define CANDLE_FULL_SYMBOL CANDLE_DEFAULT_SYMBOL L"{=d}" #define SYMBOL_DEFAULT L"AAPL" -#define SYMBOL_IBM L"IBM" +#define SYMBOL_IBM L"IBM" -#define ORDER_SOURCE_DEFAULT NULL -#define ORDER_SOURCE_NTV "NTV" -#define ORDER_SOURCE_IST "IST" +#define ORDER_SOURCE_DEFAULT NULL +#define ORDER_SOURCE_NTV "NTV" +#define ORDER_SOURCE_IST "IST" #define ORDER_SOURCE_MARKET_MAKER "COMPOSITE_BID" const char* g_dxfeed_host = "mddqa.in.devexperts.com:7400"; @@ -74,16 +78,15 @@ dxf_listener_thread_data_t g_st_listener_thread_data = NULL; const int g_event_subscription_type = DX_EVENT_BIT_MASK(dx_eid_quote); void snapshot_tests_on_thread_terminate(dxf_connection_t connection, void* user_data) { - if (g_st_listener_thread_data == NULL) - return; + if (g_st_listener_thread_data == NULL) return; on_reader_thread_terminate(g_st_listener_thread_data, connection, user_data); } CRITICAL_SECTION g_snap_order_guard; int g_snap_order_is_received = false; -dxf_snapshot_data_t g_snap_order_data = { 0, NULL, 0, NULL }; -dxf_char_t g_snap_order_symbol_buf[100] = { 0 }; -dxf_char_t g_snap_order_source[DXF_RECORD_SUFFIX_SIZE] = { 0 }; +dxf_snapshot_data_t g_snap_order_data = {0, NULL, 0, NULL}; +dxf_char_t g_snap_order_symbol_buf[100] = {0}; +dxf_char_t g_snap_order_source[DXF_RECORD_SUFFIX_SIZE] = {0}; void snapshot_order_listener(const dxf_snapshot_data_ptr_t snapshot_data, void* user_data) { EnterCriticalSection(&g_snap_order_guard); @@ -137,8 +140,8 @@ dxf_const_string_t snapshot_order_data_get_source() { CRITICAL_SECTION g_snap_candle_guard; int g_snap_candle_is_received = false; int g_snap_candle_event_type = dx_eid_invalid; -dxf_snapshot_data_t g_snap_candle_data = { 0, NULL, 0, NULL }; -dxf_char_t g_snap_candle_symbol_buf[100] = { 0 }; +dxf_snapshot_data_t g_snap_candle_data = {0, NULL, 0, NULL}; +dxf_char_t g_snap_candle_symbol_buf[100] = {0}; void snapshot_candle_listener(const dxf_snapshot_data_ptr_t snapshot_data, void* user_data) { EnterCriticalSection(&g_snap_candle_guard); wcscpy(g_snap_candle_symbol_buf, snapshot_data->symbol); @@ -184,21 +187,28 @@ int snapshot_initialization_test(void) { dxf_candle_attributes_t candle_attributes = NULL; int res = true; - if (!dxf_create_connection(g_dxfeed_host, snapshot_tests_on_thread_terminate, NULL, NULL, NULL, NULL, &connection)) { + if (!dxf_create_connection(g_dxfeed_host, snapshot_tests_on_thread_terminate, NULL, NULL, NULL, NULL, + &connection)) { process_last_error(); PRINT_TEST_FAILED; return false; } - //test null connection - res &= dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_order_snapshot(NULL, g_default_symbol, g_default_source, g_default_time, &snapshot)); - //test invalid symbol - res &= dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_order_snapshot(connection, g_invalid_symbol, g_default_source, g_default_time, &snapshot)); - //test empty symbol - res &= dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_order_snapshot(connection, g_empty_symbol, g_default_source, g_default_time, &snapshot)); - //test invalid snapshot - res &= dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_order_snapshot(connection, g_default_symbol, g_default_source, g_default_time, NULL)); - //test null candle data + // test null connection + res &= dx_is_equal_ERRORCODE( + DXF_FAILURE, dxf_create_order_snapshot(NULL, g_default_symbol, g_default_source, g_default_time, &snapshot)); + // test invalid symbol + res &= dx_is_equal_ERRORCODE( + DXF_FAILURE, + dxf_create_order_snapshot(connection, g_invalid_symbol, g_default_source, g_default_time, &snapshot)); + // test empty symbol + res &= dx_is_equal_ERRORCODE( + DXF_FAILURE, + dxf_create_order_snapshot(connection, g_empty_symbol, g_default_source, g_default_time, &snapshot)); + // test invalid snapshot + res &= dx_is_equal_ERRORCODE( + DXF_FAILURE, dxf_create_order_snapshot(connection, g_default_symbol, g_default_source, g_default_time, NULL)); + // test null candle data res &= dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_candle_snapshot(connection, NULL, g_default_time, &snapshot)); if (!res) { dxf_close_connection(connection); @@ -207,8 +217,10 @@ int snapshot_initialization_test(void) { return false; } - //test Order snapshot - res &= dx_is_equal_ERRORCODE(DXF_SUCCESS, dxf_create_order_snapshot(connection, g_default_symbol, g_ntv_order_source, g_default_time, &snapshot)); + // test Order snapshot + res &= dx_is_equal_ERRORCODE( + DXF_SUCCESS, + dxf_create_order_snapshot(connection, g_default_symbol, g_ntv_order_source, g_default_time, &snapshot)); res &= dx_is_equal_ERRORCODE(DXF_SUCCESS, dxf_close_snapshot(snapshot)); if (!res) { dxf_close_connection(connection); @@ -217,18 +229,17 @@ int snapshot_initialization_test(void) { return false; } - //test Candle snapshot - if (!dxf_create_candle_symbol_attributes(g_default_symbol, - DXF_CANDLE_EXCHANGE_CODE_ATTRIBUTE_DEFAULT, - DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_day, dxf_cpa_mark, dxf_csa_default, - dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, &candle_attributes)) { - + // test Candle snapshot + if (!dxf_create_candle_symbol_attributes(g_default_symbol, DXF_CANDLE_EXCHANGE_CODE_ATTRIBUTE_DEFAULT, + DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_day, dxf_cpa_mark, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, + &candle_attributes)) { process_last_error(); PRINT_TEST_FAILED; return false; } - res &= dx_is_equal_ERRORCODE(DXF_SUCCESS, dxf_create_candle_snapshot(connection, candle_attributes, g_default_time, &snapshot)); + res &= dx_is_equal_ERRORCODE(DXF_SUCCESS, + dxf_create_candle_snapshot(connection, candle_attributes, g_default_time, &snapshot)); res &= dx_is_equal_ERRORCODE(DXF_SUCCESS, dxf_close_snapshot(snapshot)); res &= dx_is_equal_ERRORCODE(DXF_SUCCESS, dxf_delete_candle_symbol_attributes(candle_attributes)); if (!res) { @@ -238,8 +249,10 @@ int snapshot_initialization_test(void) { return false; } - //test listener subscription on Order snapshot - res &= dx_is_equal_ERRORCODE(DXF_SUCCESS, dxf_create_order_snapshot(connection, g_default_symbol, g_ntv_order_source, g_default_time, &snapshot)); + // test listener subscription on Order snapshot + res &= dx_is_equal_ERRORCODE( + DXF_SUCCESS, + dxf_create_order_snapshot(connection, g_default_symbol, g_ntv_order_source, g_default_time, &snapshot)); res &= dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_attach_snapshot_listener(snapshot, NULL, NULL)); res &= dx_is_equal_ERRORCODE(DXF_SUCCESS, dxf_attach_snapshot_listener(snapshot, snapshot_order_listener, NULL)); res &= dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_detach_snapshot_listener(snapshot, NULL)); @@ -261,96 +274,106 @@ int snapshot_initialization_test(void) { } const candle_attribute_test_case_t g_candle_cases[] = { - { CANDLE_DEFAULT_SYMBOL, DXF_CANDLE_EXCHANGE_CODE_ATTRIBUTE_DEFAULT, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_default, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, DXF_CANDLE_EXCHANGE_CODE_ATTRIBUTE_DEFAULT, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_default, dxf_cpa_default, dxf_csa_default, dxf_caa_default, CANDLE_USER_PRICE_LEVEL_VALUE, L"AAPL{pl=0.1}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_default, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A", __LINE__ }, - - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_second, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=s}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_minute, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=m}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_minute, dxf_cpa_default, dxf_csa_default, dxf_caa_default, CANDLE_USER_PRICE_LEVEL_VALUE, L"AAPL&A{=m,pl=0.1}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_hour, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=h}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_day, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=d}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_week, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=w}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_month, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=mo}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_optexp, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=o}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_year, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=y}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_volume, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=v}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_price, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=p}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_price_momentum, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=pm}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_price_renko, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=pr}", __LINE__ }, - - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_default, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2t}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_second, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2s}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_minute, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2m}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_hour, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2h}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_day, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_week, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2w}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_month, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2mo}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_optexp, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2o}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_year, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2y}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_volume, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2v}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_price, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2p}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_price_momentum, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2pm}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_price_renko, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2pr}", __LINE__ }, - - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_day, dxf_cpa_bid, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d,price=bid}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_day, dxf_cpa_ask, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d,price=ask}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_day, dxf_cpa_mark, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d,price=mark}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_day, dxf_cpa_settlement, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d,price=s}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_day, dxf_cpa_settlement, dxf_csa_default, dxf_caa_default, CANDLE_USER_PRICE_LEVEL_VALUE, L"AAPL&A{=2d,pl=0.1,price=s}", __LINE__ }, - - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_day, dxf_cpa_mark, dxf_csa_regular, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d,price=mark,tho=true}", __LINE__ }, - - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_day, dxf_cpa_mark, dxf_csa_regular, dxf_caa_session, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d,a=s,price=mark,tho=true}", __LINE__ }, - { CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, - dxf_ctpa_day, dxf_cpa_mark, dxf_csa_regular, dxf_caa_session, CANDLE_USER_PRICE_LEVEL_VALUE, L"AAPL&A{=2d,a=s,pl=0.1,price=mark,tho=true}", __LINE__ } -}; + {CANDLE_DEFAULT_SYMBOL, DXF_CANDLE_EXCHANGE_CODE_ATTRIBUTE_DEFAULT, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, + dxf_ctpa_default, dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, + L"AAPL", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, DXF_CANDLE_EXCHANGE_CODE_ATTRIBUTE_DEFAULT, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, + dxf_ctpa_default, dxf_cpa_default, dxf_csa_default, dxf_caa_default, CANDLE_USER_PRICE_LEVEL_VALUE, + L"AAPL{pl=0.1}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_default, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A", __LINE__}, + + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_second, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=s}", + __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_minute, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=m}", + __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_minute, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, CANDLE_USER_PRICE_LEVEL_VALUE, L"AAPL&A{=m,pl=0.1}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_hour, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=h}", + __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_day, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=d}", + __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_week, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=w}", + __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_month, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=mo}", + __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_optexp, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=o}", + __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_year, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=y}", + __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_volume, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=v}", + __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_price, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=p}", + __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_price_momentum, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=pm}", + __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_price_renko, + dxf_cpa_default, dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=pr}", + __LINE__}, + + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_default, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2t}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_second, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2s}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_minute, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2m}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_hour, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2h}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_day, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_week, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2w}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_month, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2mo}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_optexp, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2o}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_year, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2y}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_volume, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2v}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_price, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2p}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_price_momentum, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2pm}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_price_renko, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2pr}", __LINE__}, + + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_day, dxf_cpa_bid, dxf_csa_default, + dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d,price=bid}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_day, dxf_cpa_ask, dxf_csa_default, + dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d,price=ask}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_day, dxf_cpa_mark, dxf_csa_default, + dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d,price=mark}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_day, dxf_cpa_settlement, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d,price=s}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_day, dxf_cpa_settlement, + dxf_csa_default, dxf_caa_default, CANDLE_USER_PRICE_LEVEL_VALUE, L"AAPL&A{=2d,pl=0.1,price=s}", __LINE__}, + + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_day, dxf_cpa_mark, dxf_csa_regular, + dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d,price=mark,tho=true}", __LINE__}, + + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_day, dxf_cpa_mark, dxf_csa_regular, + dxf_caa_session, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, L"AAPL&A{=2d,a=s,price=mark,tho=true}", __LINE__}, + {CANDLE_DEFAULT_SYMBOL, CANDLE_USER_EXCHANGE, CANDLE_USER_PERIOD_VALUE, dxf_ctpa_day, dxf_cpa_mark, dxf_csa_regular, + dxf_caa_session, CANDLE_USER_PRICE_LEVEL_VALUE, L"AAPL&A{=2d,a=s,pl=0.1,price=mark,tho=true}", __LINE__}}; #define CANDLE_CASES_SIZE sizeof(g_candle_cases) / sizeof(g_candle_cases[0]) -const char* g_order_source_cases[] = { - ORDER_SOURCE_DEFAULT, ORDER_SOURCE_NTV, ORDER_SOURCE_IST, ORDER_SOURCE_MARKET_MAKER, - ORDER_SOURCE_DEFAULT, ORDER_SOURCE_NTV, ORDER_SOURCE_IST, ORDER_SOURCE_MARKET_MAKER -}; -dxf_const_string_t g_order_symbol_cases[] = { - SYMBOL_DEFAULT, SYMBOL_DEFAULT, SYMBOL_DEFAULT, SYMBOL_DEFAULT, - SYMBOL_IBM, SYMBOL_IBM, SYMBOL_IBM, SYMBOL_IBM -}; +const char* g_order_source_cases[] = {ORDER_SOURCE_DEFAULT, ORDER_SOURCE_NTV, ORDER_SOURCE_IST, + ORDER_SOURCE_MARKET_MAKER, ORDER_SOURCE_DEFAULT, ORDER_SOURCE_NTV, + ORDER_SOURCE_IST, ORDER_SOURCE_MARKET_MAKER}; +dxf_const_string_t g_order_symbol_cases[] = {SYMBOL_DEFAULT, SYMBOL_DEFAULT, SYMBOL_DEFAULT, SYMBOL_DEFAULT, + SYMBOL_IBM, SYMBOL_IBM, SYMBOL_IBM, SYMBOL_IBM}; #define ORDER_CASES_SIZE sizeof(g_order_source_cases) / sizeof(g_order_source_cases[0]) /*Test*/ @@ -360,9 +383,10 @@ int snapshot_duplicates_test(void) { int res = true; int i; int num = CANDLE_CASES_SIZE + ORDER_CASES_SIZE; - dxf_snapshot_t *snapshots = NULL; + dxf_snapshot_t* snapshots = NULL; - if (!dxf_create_connection(g_dxfeed_host, snapshot_tests_on_thread_terminate, NULL, NULL, NULL, NULL, &connection)) { + if (!dxf_create_connection(g_dxfeed_host, snapshot_tests_on_thread_terminate, NULL, NULL, NULL, NULL, + &connection)) { process_last_error(); PRINT_TEST_FAILED; return false; @@ -371,35 +395,41 @@ int snapshot_duplicates_test(void) { snapshots = dx_calloc(num, sizeof(dxf_snapshot_t)); for (i = 0; i < ORDER_CASES_SIZE; ++i) { - //original snapshot - res &= dx_is_equal_ERRORCODE(DXF_SUCCESS, dxf_create_order_snapshot(connection, g_order_symbol_cases[i], - g_order_source_cases[i], g_default_time, &snapshots[i])); + // original snapshot + res &= dx_is_equal_ERRORCODE(DXF_SUCCESS, + dxf_create_order_snapshot(connection, g_order_symbol_cases[i], + g_order_source_cases[i], g_default_time, &snapshots[i])); res &= dx_is_not_null(snapshots[i]); - //duplicate snapshot - res &= dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_order_snapshot(connection, g_order_symbol_cases[i], - g_order_source_cases[i], g_default_time, &invalid_snapshot)); + // duplicate snapshot + res &= dx_is_equal_ERRORCODE( + DXF_FAILURE, + dxf_create_order_snapshot(connection, g_order_symbol_cases[i], g_order_source_cases[i], g_default_time, + &invalid_snapshot)); res &= dx_is_null(invalid_snapshot); } for (i = 0; i < CANDLE_CASES_SIZE; ++i) { dxf_candle_attributes_t candle_attributes; candle_attribute_test_case_t attr = g_candle_cases[i]; - res &= dx_is_equal_ERRORCODE(DXF_SUCCESS, dxf_create_candle_symbol_attributes(attr.symbol, - attr.exchange_code, attr.period_value, attr.period_type, attr.price, attr.session, - attr.alignment, attr.price_level, &candle_attributes)); - - //original snapshot - res &= dx_is_equal_ERRORCODE(DXF_SUCCESS, dxf_create_candle_snapshot(connection, candle_attributes, g_default_time, &snapshots[i])); + res &= + dx_is_equal_ERRORCODE(DXF_SUCCESS, + dxf_create_candle_symbol_attributes( + attr.symbol, attr.exchange_code, attr.period_value, attr.period_type, attr.price, + attr.session, attr.alignment, attr.price_level, &candle_attributes)); + + // original snapshot + res &= dx_is_equal_ERRORCODE( + DXF_SUCCESS, dxf_create_candle_snapshot(connection, candle_attributes, g_default_time, &snapshots[i])); res &= dx_is_not_null(snapshots[i]); - //duplicate snapshot - res &= dx_is_equal_ERRORCODE(DXF_FAILURE, dxf_create_candle_snapshot(connection, candle_attributes, g_default_time, &snapshots[i])); + // duplicate snapshot + res &= dx_is_equal_ERRORCODE( + DXF_FAILURE, dxf_create_candle_snapshot(connection, candle_attributes, g_default_time, &snapshots[i])); res &= dx_is_null(invalid_snapshot); res &= dxf_delete_candle_symbol_attributes(candle_attributes); } for (i = 0; i < num; ++i) { - if (snapshots[i] != NULL) - dxf_close_snapshot(snapshots[i]); + if (snapshots[i] != NULL) dxf_close_snapshot(snapshots[i]); } dx_free(snapshots); @@ -413,7 +443,7 @@ int snapshot_duplicates_test(void) { } int wait_snapshot(int (*snapshot_data_is_received_func_ptr)(), - const dxf_snapshot_data_ptr_t (*snapshot_data_get_obj_func_ptr)()) { + const dxf_snapshot_data_ptr_t (*snapshot_data_get_obj_func_ptr)()) { int timestamp = dx_millisecond_timestamp(); while (!snapshot_data_is_received_func_ptr() || snapshot_data_get_obj_func_ptr()->records_count == 0) { if (is_thread_terminate(g_st_listener_thread_data)) { @@ -429,8 +459,7 @@ int wait_snapshot(int (*snapshot_data_is_received_func_ptr)(), return true; } -int create_order_snapshot_no_errors(dxf_connection_t connection, OUT dxf_snapshot_t *res_snapshot, - int is_no_errors) { +int create_order_snapshot_no_errors(dxf_connection_t connection, OUT dxf_snapshot_t* res_snapshot, int is_no_errors) { dxf_snapshot_t snapshot; dxf_string_t w_order_source = NULL; int res = true; @@ -456,7 +485,7 @@ int create_order_snapshot_no_errors(dxf_connection_t connection, OUT dxf_snapsho return true; } -int create_order_snapshot(dxf_connection_t connection, OUT dxf_snapshot_t *res_snapshot) { +int create_order_snapshot(dxf_connection_t connection, OUT dxf_snapshot_t* res_snapshot) { return create_order_snapshot_no_errors(connection, res_snapshot, false); } @@ -485,18 +514,16 @@ int check_order_snapshot_data_test(dxf_connection_t connection, dxf_snapshot_t s return true; } -int create_candle_snapshot(dxf_connection_t connection, OUT dxf_snapshot_t *res_snapshot) { +int create_candle_snapshot(dxf_connection_t connection, OUT dxf_snapshot_t* res_snapshot) { dxf_snapshot_t snapshot; int res = true; dxf_snapshot_data_ptr_t snapshot_candle_data = NULL; dxf_candle_attributes_t candle_attributes; - if (!dxf_create_candle_symbol_attributes(CANDLE_DEFAULT_SYMBOL, - DXF_CANDLE_EXCHANGE_CODE_ATTRIBUTE_DEFAULT, - DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, - dxf_ctpa_day, dxf_cpa_default, dxf_csa_default, - dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, &candle_attributes)) { - + if (!dxf_create_candle_symbol_attributes(CANDLE_DEFAULT_SYMBOL, DXF_CANDLE_EXCHANGE_CODE_ATTRIBUTE_DEFAULT, + DXF_CANDLE_PERIOD_VALUE_ATTRIBUTE_DEFAULT, dxf_ctpa_day, dxf_cpa_default, + dxf_csa_default, dxf_caa_default, DXF_CANDLE_PRICE_LEVEL_ATTRIBUTE_DEFAULT, + &candle_attributes)) { process_last_error(); PRINT_TEST_FAILED; return false; @@ -552,7 +579,8 @@ int snapshot_subscription_test(void) { snapshot_order_data_reset(); reset_thread_terminate(g_st_listener_thread_data); - if (!dxf_create_connection(g_dxfeed_host, snapshot_tests_on_thread_terminate, NULL, NULL, NULL, NULL, &connection)) { + if (!dxf_create_connection(g_dxfeed_host, snapshot_tests_on_thread_terminate, NULL, NULL, NULL, NULL, + &connection)) { process_last_error(); PRINT_TEST_FAILED; return false; @@ -570,7 +598,7 @@ int snapshot_subscription_test(void) { return false; } - //close order subscription + // close order subscription if (!dxf_close_snapshot(snapshot)) { process_last_error(); dxf_close_connection(connection); @@ -579,7 +607,7 @@ int snapshot_subscription_test(void) { } snapshot = NULL; - //open other subscriprion + // open other subscriprion snapshot_candle_data_reset(); reset_thread_terminate(g_st_listener_thread_data); @@ -595,7 +623,7 @@ int snapshot_subscription_test(void) { return false; } - //close candle subscription + // close candle subscription if (!dxf_close_snapshot(snapshot)) { process_last_error(); dxf_close_connection(connection); @@ -620,7 +648,8 @@ int snapshot_multiply_subscription_test(void) { dxf_snapshot_t invalid_snapshot = NULL; int res = true; - if (!dxf_create_connection(g_dxfeed_host, snapshot_tests_on_thread_terminate, NULL, NULL, NULL, NULL, &connection)) { + if (!dxf_create_connection(g_dxfeed_host, snapshot_tests_on_thread_terminate, NULL, NULL, NULL, NULL, + &connection)) { process_last_error(); PRINT_TEST_FAILED; return false; @@ -628,7 +657,7 @@ int snapshot_multiply_subscription_test(void) { reset_thread_terminate(g_st_listener_thread_data); - //create a both snapshot objects + // create a both snapshot objects if (!create_order_snapshot(connection, &order_snapshot)) { dxf_close_connection(connection); PRINT_TEST_FAILED; @@ -642,7 +671,7 @@ int snapshot_multiply_subscription_test(void) { return false; } - //check snapshot data for both snapshots objects + // check snapshot data for both snapshots objects snapshot_order_data_reset(); snapshot_candle_data_reset(); if (!check_order_snapshot_data_test(connection, order_snapshot)) { @@ -660,7 +689,7 @@ int snapshot_multiply_subscription_test(void) { return false; } - //try to close candle snapshot and wait snapshot data for order + // try to close candle snapshot and wait snapshot data for order if (!dxf_close_snapshot(candle_snapshot)) { process_last_error(); dxf_close_snapshot(order_snapshot); @@ -678,7 +707,7 @@ int snapshot_multiply_subscription_test(void) { return false; } - //test complete, close order snapshot and connection + // test complete, close order snapshot and connection if (!dxf_close_snapshot(order_snapshot)) { process_last_error(); dxf_close_connection(connection); @@ -695,8 +724,6 @@ int snapshot_multiply_subscription_test(void) { return true; } -/* -------------------------------------------------------------------------- */ - static dxf_uint_t g_event_subscription_counter = 0; CRITICAL_SECTION g_event_subscription_counter_guard; @@ -705,9 +732,7 @@ void init_event_subscription_counter() { g_event_subscription_counter = 0; } -void free_subscription_event_counter() { - DeleteCriticalSection(&g_event_subscription_counter_guard); -} +void free_subscription_event_counter() { DeleteCriticalSection(&g_event_subscription_counter_guard); } void inc_event_subscription_counter() { EnterCriticalSection(&g_event_subscription_counter_guard); @@ -729,9 +754,8 @@ void drop_event_subscription_counter() { LeaveCriticalSection(&g_event_subscription_counter_guard); } -void events_listener(int event_type, dxf_const_string_t symbol_name, - const dxf_event_data_t* data, int data_count, void* user_data) { - +void events_listener(int event_type, dxf_const_string_t symbol_name, const dxf_event_data_t* data, int data_count, + void* user_data) { if (event_type == g_event_subscription_type) { inc_event_subscription_counter(); } @@ -754,15 +778,14 @@ int check_event_subscription_test() { return dx_ge_dxf_uint_t(get_event_subscription_counter(), 1); } -/* -------------------------------------------------------------------------- */ - /*Test*/ int snapshot_subscription_and_events_test(void) { dxf_connection_t connection; dxf_snapshot_t order_snapshot; dxf_subscription_t event_subscription; - if (!dxf_create_connection(g_dxfeed_host, snapshot_tests_on_thread_terminate, NULL, NULL, NULL, NULL, &connection)) { + if (!dxf_create_connection(g_dxfeed_host, snapshot_tests_on_thread_terminate, NULL, NULL, NULL, NULL, + &connection)) { process_last_error(); PRINT_TEST_FAILED; return false; @@ -772,24 +795,23 @@ int snapshot_subscription_and_events_test(void) { snapshot_order_data_reset(); drop_event_subscription_counter(); - //create snapshot + // create snapshot if (!create_order_snapshot(connection, &order_snapshot)) { dxf_close_connection(connection); PRINT_TEST_FAILED; return false; } - //create event - if (!create_event_subscription(connection, g_event_subscription_type, g_default_symbol, - events_listener, &event_subscription)) { - + // create event + if (!create_event_subscription(connection, g_event_subscription_type, g_default_symbol, events_listener, + &event_subscription)) { dxf_close_snapshot(order_snapshot); dxf_close_connection(connection); PRINT_TEST_FAILED; return false; } - //check snapshot data and events + // check snapshot data and events if (!check_order_snapshot_data_test(connection, order_snapshot)) { dxf_close_subscription(event_subscription); dxf_close_snapshot(order_snapshot); @@ -805,7 +827,7 @@ int snapshot_subscription_and_events_test(void) { return false; } - //close snapshot and check event subscription + // close snapshot and check event subscription if (!dxf_close_snapshot(order_snapshot)) { process_last_error(); dxf_close_connection(connection); @@ -821,7 +843,7 @@ int snapshot_subscription_and_events_test(void) { return false; } - //test complete, close subscription + // test complete, close subscription if (!dxf_close_subscription(event_subscription)) { dxf_close_connection(connection); PRINT_TEST_FAILED; @@ -846,7 +868,8 @@ int snapshot_symbols_test(void) { snapshot_order_data_reset(); reset_thread_terminate(g_st_listener_thread_data); - if (!dxf_create_connection(g_dxfeed_host, snapshot_tests_on_thread_terminate, NULL, NULL, NULL, NULL, &connection)) { + if (!dxf_create_connection(g_dxfeed_host, snapshot_tests_on_thread_terminate, NULL, NULL, NULL, NULL, + &connection)) { process_last_error(); PRINT_TEST_FAILED; return false; @@ -860,14 +883,13 @@ int snapshot_symbols_test(void) { if (!dxf_get_snapshot_symbol(snapshot, &returned_symbol) || !dx_is_equal_dxf_string_t(g_default_symbol, returned_symbol)) { - PRINT_TEST_FAILED; dxf_close_snapshot(snapshot); dxf_close_connection(connection); return false; } - //close order subscription + // close order subscription if (!dxf_close_snapshot(snapshot)) { process_last_error(); dxf_close_connection(connection); @@ -876,7 +898,7 @@ int snapshot_symbols_test(void) { } snapshot = NULL; - //open other subscriprion + // open other subscriprion snapshot_candle_data_reset(); reset_thread_terminate(g_st_listener_thread_data); @@ -888,14 +910,13 @@ int snapshot_symbols_test(void) { if (!dxf_get_snapshot_symbol(snapshot, &returned_symbol) || !dx_is_equal_dxf_string_t(CANDLE_FULL_SYMBOL, returned_symbol)) { - PRINT_TEST_FAILED; dxf_close_snapshot(snapshot); dxf_close_connection(connection); return false; } - //close candle subscription + // close candle subscription if (!dxf_close_snapshot(snapshot)) { process_last_error(); dxf_close_connection(connection); @@ -919,13 +940,9 @@ int snapshot_all_test(void) { snapshot_candle_data_init(); init_event_subscription_counter(); - if (!snapshot_initialization_test() || - !snapshot_duplicates_test() || - !snapshot_subscription_test() || - !snapshot_multiply_subscription_test() || - !snapshot_subscription_and_events_test() || + if (!snapshot_initialization_test() || !snapshot_duplicates_test() || !snapshot_subscription_test() || + !snapshot_multiply_subscription_test() || !snapshot_subscription_and_events_test() || !snapshot_symbols_test()) { - res = false; } diff --git a/tests/UnitTests/SnapshotUnitTests.c b/tests/UnitTests/SnapshotUnitTests.c index 25ea2c2b..3649ca6e 100644 --- a/tests/UnitTests/SnapshotUnitTests.c +++ b/tests/UnitTests/SnapshotUnitTests.c @@ -17,14 +17,18 @@ * */ -#include #include +#include #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #else # include # include @@ -38,20 +42,18 @@ #include "DXFeed.h" #include "DXTypes.h" #include "EventSubscription.h" -#include "SnapshotTests.h" #include "Snapshot.h" +#include "SnapshotTests.h" #include "SymbolCodec.h" #include "TestHelper.h" #define SYMBOL_DEFAULT L"SPY" #define SOURCE_DEFAULT L"NTV" -#define TIME_DEFAULT 0 -#define LEVEL_ORDER 3 -#define dxf_osd_buy 0 -#define dxf_osd_sell 1 -#define dxf_osc_order 3 - -/* -------------------------------------------------------------------------- */ +#define TIME_DEFAULT 0 +#define LEVEL_ORDER 3 +#define dxf_osd_buy 0 +#define dxf_osd_sell 1 +#define dxf_osc_order 3 typedef struct { int listener_call_counter; @@ -60,50 +62,46 @@ typedef struct { int play_events(dxf_connection_t connection, dxf_snapshot_t snapshot, dxf_order_t* events, size_t size) { dxf_const_string_t symbol = dx_get_snapshot_symbol(snapshot); - + for (size_t i = 0; i < size; i++) { dxf_order_t order = events[i]; const dxf_event_data_t event_data = (dxf_event_data_t)ℴ const dxf_ulong_t snapshot_key = dx_new_snapshot_key(dx_rid_order, symbol, order.source); - + // Note: use index as time_int_field for test only - dxf_event_params_t event_params = { order.event_flags, order.index, snapshot_key }; + dxf_event_params_t event_params = {order.event_flags, order.index, snapshot_key}; if (!dx_process_event_data(connection, dx_eid_order, symbol, event_data, &event_params)) { return false; } } - + return true; } -int snapshot_test_runner(dxf_order_t* events, size_t size, dxf_snapshot_listener_t listener, int expected_listener_call_count) { +int snapshot_test_runner(dxf_order_t* events, size_t size, dxf_snapshot_listener_t listener, + int expected_listener_call_count) { const dx_event_subscr_flag subscr_flags = dx_esf_time_series | dx_esf_single_record; dxf_const_string_t symbol = SYMBOL_DEFAULT; - dx_snap_test_state_t state = { 0, true }; + dx_snap_test_state_t state = {0, true}; dxf_connection_t connection = dx_init_connection(); dxf_subscription_t subscription = dx_create_event_subscription(connection, DXF_ET_ORDER, subscr_flags, TIME_DEFAULT); - if (subscription == dx_invalid_subscription || - !dx_init_symbol_codec()) { - + if (subscription == dx_invalid_subscription || !dx_init_symbol_codec()) { return false; } dx_clear_order_sources(subscription); dx_add_order_source(subscription, SOURCE_DEFAULT); - dxf_snapshot_t snapshot = dx_create_snapshot(connection, subscription, dx_eid_order, dx_rid_order, symbol, - SOURCE_DEFAULT, TIME_DEFAULT); + dxf_snapshot_t snapshot = + dx_create_snapshot(connection, subscription, dx_eid_order, dx_rid_order, symbol, SOURCE_DEFAULT, TIME_DEFAULT); - if (snapshot == dx_invalid_snapshot || - !dx_add_symbols(subscription, &symbol, 1) || + if (snapshot == dx_invalid_snapshot || !dx_add_symbols(subscription, &symbol, 1) || !dx_add_snapshot_listener(snapshot, listener, (void*)&state) || !play_events(connection, snapshot, events, size) || - !dx_is_equal_int(expected_listener_call_count, state.listener_call_counter) || - !state.result) { - + !dx_is_equal_int(expected_listener_call_count, state.listener_call_counter) || !state.result) { return false; } @@ -114,8 +112,9 @@ int snapshot_test_runner(dxf_order_t* events, size_t size, dxf_snapshot_listener return true; } -//Compare snapshots by index and size -int dx_compare_snapshots(const dxf_snapshot_data_ptr_t snapshot_data, dxf_order_t* test_snap_data, size_t test_snap_size) { +// Compare snapshots by index and size +int dx_compare_snapshots(const dxf_snapshot_data_ptr_t snapshot_data, dxf_order_t* test_snap_data, + size_t test_snap_size) { size_t i; int res = true; dxf_order_t* order_records = (dxf_order_t*)snapshot_data->records; @@ -130,24 +129,53 @@ int dx_compare_snapshots(const dxf_snapshot_data_ptr_t snapshot_data, dxf_order_ return res; } -/* -------------------------------------------------------------------------- */ - static dxf_order_t simple_test_data[] = { - { L"NTV", dxf_ef_snapshot_begin, 0x4e54560000000006, 0, 0, 0, dxf_oa_undefined, 0, 0, 0, 0.0, 0, 0, 0, 0, 0.0, 0.0, 0, dxf_osd_buy, dxf_osc_order, { 0 } }, - { L"NTV", 0, 0x4e54560000000005, 1488551035000, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.50, 100, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order, { L"NSDQ" } }, - { L"NTV", 0, 0x4e54560000000004, 1488551035010, 0, 0, dxf_oa_undefined, 0, 0, 0, 101.00, 101, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_sell, dxf_osc_order, { L"NSDQ" } }, - { L"NTV", 0, 0x4e54560000000003, 0 , 0, 0, dxf_oa_undefined, 0, 0, 0, 0.0, 0, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order, { 0 } }, - { L"NTV", 0, 0x4e54560000000002, 1488551035020, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.40, 102, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order, { L"NSDQ" } }, - { L"NTV", 0, 0x4e54560000000001, 1488551035030, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.30, 103, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order, { L"NSDQ" } }, - { L"NTV", dxf_ef_snapshot_end, 0x4e54560000000000, 1488551035040, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.20, 104, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order, { L"NSDQ" } }, + {L"NTV", dxf_ef_snapshot_begin, 0x4e54560000000006, 0, 0, 0, dxf_oa_undefined, 0, 0, 0, 0.0, 0, 0, 0, 0, 0.0, 0.0, + 0, dxf_osd_buy, dxf_osc_order, {0}}, + {L"NTV", 0, 0x4e54560000000005, 1488551035000, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.50, 100, 0, 0, 0, 0.0, + 0.0, L'Q', dxf_osd_buy, dxf_osc_order, {L"NSDQ"}}, + {L"NTV", 0, 0x4e54560000000004, 1488551035010, 0, 0, dxf_oa_undefined, 0, 0, 0, 101.00, 101, 0, 0, 0, 0.0, + 0.0, L'Q', dxf_osd_sell, dxf_osc_order, {L"NSDQ"}}, + {L"NTV", 0, 0x4e54560000000003, 0, 0, 0, dxf_oa_undefined, 0, 0, 0, 0.0, 0, 0, 0, 0, 0.0, 0.0, + L'Q', dxf_osd_buy, dxf_osc_order, {0}}, + {L"NTV", 0, 0x4e54560000000002, 1488551035020, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.40, 102, 0, 0, 0, 0.0, + 0.0, L'Q', dxf_osd_buy, dxf_osc_order, {L"NSDQ"}}, + {L"NTV", 0, 0x4e54560000000001, 1488551035030, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.30, 103, 0, 0, 0, 0.0, + 0.0, L'Q', dxf_osd_buy, dxf_osc_order, {L"NSDQ"}}, + {L"NTV", + dxf_ef_snapshot_end, + 0x4e54560000000000, + 1488551035040, + 0, + 0, + dxf_oa_undefined, + 0, + 0, + 0, + 100.20, + 104, + 0, + 0, + 0, + 0.0, + 0.0, + L'Q', + dxf_osd_buy, + dxf_osc_order, + {L"NSDQ"}}, }; static dxf_order_t simple_test_snap_data[] = { - { L"NTV", 0, 0x4e54560000000005, 1488551035000, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.50, 100, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, - { L"NTV", 0, 0x4e54560000000004, 1488551035010, 0, 0, dxf_oa_undefined, 0, 0, 0, 101.00, 101, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_sell, dxf_osc_order,{ L"NSDQ" } }, - { L"NTV", 0, 0x4e54560000000003, 0 , 0, 0, dxf_oa_undefined, 0, 0, 0, 0.0, 0, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ 0 } }, - { L"NTV", 0, 0x4e54560000000002, 1488551035020, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.40, 102, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, - { L"NTV", 0, 0x4e54560000000001, 1488551035030, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.30, 103, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, + {L"NTV", 0, 0x4e54560000000005, 1488551035000, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.50, 100, 0, 0, 0, 0.0, + 0.0, L'Q', dxf_osd_buy, dxf_osc_order, {L"NSDQ"}}, + {L"NTV", 0, 0x4e54560000000004, 1488551035010, 0, 0, dxf_oa_undefined, 0, 0, 0, 101.00, 101, 0, 0, 0, 0.0, + 0.0, L'Q', dxf_osd_sell, dxf_osc_order, {L"NSDQ"}}, + {L"NTV", 0, 0x4e54560000000003, 0, 0, 0, dxf_oa_undefined, 0, 0, 0, 0.0, 0, 0, 0, 0, 0.0, 0.0, + L'Q', dxf_osd_buy, dxf_osc_order, {0}}, + {L"NTV", 0, 0x4e54560000000002, 1488551035020, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.40, 102, 0, 0, 0, 0.0, + 0.0, L'Q', dxf_osd_buy, dxf_osc_order, {L"NSDQ"}}, + {L"NTV", 0, 0x4e54560000000001, 1488551035030, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.30, 103, 0, 0, 0, 0.0, + 0.0, L'Q', dxf_osd_buy, dxf_osc_order, {L"NSDQ"}}, }; static int simple_test_snap_size = SIZE_OF_ARRAY(simple_test_snap_data); @@ -166,10 +194,28 @@ int snapshot_simple_test(void) { return snapshot_test_runner(simple_test_data, SIZE_OF_ARRAY(simple_test_data), simple_test_listener, 1); } -/* -------------------------------------------------------------------------- */ - static dxf_order_t empty_test_data[] = { - { L"NTV", dxf_ef_remove_event | dxf_ef_snapshot_begin | dxf_ef_snapshot_end, 0x4e54560000000000, 1488551035040, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.20, 104, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, + {L"NTV", + dxf_ef_remove_event | dxf_ef_snapshot_begin | dxf_ef_snapshot_end, + 0x4e54560000000000, + 1488551035040, + 0, + 0, + dxf_oa_undefined, + 0, + 0, + 0, + 100.20, + 104, + 0, + 0, + 0, + 0.0, + 0.0, + L'Q', + dxf_osd_buy, + dxf_osc_order, + {L"NSDQ"}}, }; void empty_test_listener(const dxf_snapshot_data_ptr_t snapshot_data, void* user_data) { @@ -186,84 +232,243 @@ int snapshot_empty_test(void) { return snapshot_test_runner(empty_test_data, SIZE_OF_ARRAY(empty_test_data), empty_test_listener, 1); } -/* -------------------------------------------------------------------------- */ - static dxf_order_t update_test_data[] = { // initial data - { L"NTV", dxf_ef_snapshot_begin, 0x4e54560000000004, 1488551035000, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.50, 100, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, - { L"NTV", 0, 0x4e54560000000003, 1488551035010, 0, 0, dxf_oa_undefined, 0, 0, 0, 101.00, 101, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_sell, dxf_osc_order,{ L"NSDQ" } }, - { L"NTV", 0, 0x4e54560000000002, 1488551035020, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.40, 102, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, - { L"NTV", 0, 0x4e54560000000001, 1488551035030, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.30, 103, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, - { L"NTV", dxf_ef_snapshot_end, 0x4e54560000000000, 1488551035040, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.20, 104, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, + {L"NTV", + dxf_ef_snapshot_begin, + 0x4e54560000000004, + 1488551035000, + 0, + 0, + dxf_oa_undefined, + 0, + 0, + 0, + 100.50, + 100, + 0, + 0, + 0, + 0.0, + 0.0, + L'Q', + dxf_osd_buy, + dxf_osc_order, + {L"NSDQ"}}, + {L"NTV", 0, 0x4e54560000000003, 1488551035010, 0, 0, dxf_oa_undefined, 0, 0, 0, 101.00, 101, 0, 0, 0, 0.0, + 0.0, L'Q', dxf_osd_sell, dxf_osc_order, {L"NSDQ"}}, + {L"NTV", 0, 0x4e54560000000002, 1488551035020, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.40, 102, 0, 0, 0, 0.0, + 0.0, L'Q', dxf_osd_buy, dxf_osc_order, {L"NSDQ"}}, + {L"NTV", 0, 0x4e54560000000001, 1488551035030, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.30, 103, 0, 0, 0, 0.0, + 0.0, L'Q', dxf_osd_buy, dxf_osc_order, {L"NSDQ"}}, + {L"NTV", + dxf_ef_snapshot_end, + 0x4e54560000000000, + 1488551035040, + 0, + 0, + dxf_oa_undefined, + 0, + 0, + 0, + 100.20, + 104, + 0, + 0, + 0, + 0.0, + 0.0, + L'Q', + dxf_osd_buy, + dxf_osc_order, + {L"NSDQ"}}, // Update#1: one row update - { L"NTV", 0, 0x4e54560000000002, 1488551035020, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.40, 1000, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, + {L"NTV", + 0, + 0x4e54560000000002, + 1488551035020, + 0, + 0, + dxf_oa_undefined, + 0, + 0, + 0, + 100.40, + 1000, + 0, + 0, + 0, + 0.0, + 0.0, + L'Q', + dxf_osd_buy, + dxf_osc_order, + {L"NSDQ"}}, // Update#2: one row remove via flags - { L"NTV", dxf_ef_remove_event, 0x4e54560000000002, 1488551035020, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.40, 1001, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, + {L"NTV", + dxf_ef_remove_event, + 0x4e54560000000002, + 1488551035020, + 0, + 0, + dxf_oa_undefined, + 0, + 0, + 0, + 100.40, + 1001, + 0, + 0, + 0, + 0.0, + 0.0, + L'Q', + dxf_osd_buy, + dxf_osc_order, + {L"NSDQ"}}, // Update#3: one row remove via zero event - { L"NTV", 0, 0x4e54560000000001, 0 , 0, 0, dxf_oa_undefined, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0, dxf_osd_buy, dxf_osc_order,{ 0 } }, + {L"NTV", 0, 0x4e54560000000001, 0, 0, 0, dxf_oa_undefined, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, + 0, dxf_osd_buy, dxf_osc_order, {0}}, // Update#4: complex update (inserting x 2, updating, removing, inserting) - { L"NTV", dxf_ef_tx_pending, 0x4e54560000000002, 1488551035020, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.41, 1001, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, - { L"NTV", dxf_ef_tx_pending, 0x4e54560000000005, 1488551035020, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.42, 1002, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, - { L"NTV", dxf_ef_tx_pending, 0x4e54560000000000, 1488551035040, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.20, 100500, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, - { L"NTV", dxf_ef_tx_pending | dxf_ef_remove_event, 0x4e54560000000004, 1488551035000, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.50, 100, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, - { L"NTV", 0, 0x4e54560000000010, 1488551035000, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.60, 100, 0, 0, 0, 0.0, 0.0, L'Q', dxf_osd_buy, dxf_osc_order,{ L"NSDQ" } }, + {L"NTV", + dxf_ef_tx_pending, + 0x4e54560000000002, + 1488551035020, + 0, + 0, + dxf_oa_undefined, + 0, + 0, + 0, + 100.41, + 1001, + 0, + 0, + 0, + 0.0, + 0.0, + L'Q', + dxf_osd_buy, + dxf_osc_order, + {L"NSDQ"}}, + {L"NTV", + dxf_ef_tx_pending, + 0x4e54560000000005, + 1488551035020, + 0, + 0, + dxf_oa_undefined, + 0, + 0, + 0, + 100.42, + 1002, + 0, + 0, + 0, + 0.0, + 0.0, + L'Q', + dxf_osd_buy, + dxf_osc_order, + {L"NSDQ"}}, + {L"NTV", + dxf_ef_tx_pending, + 0x4e54560000000000, + 1488551035040, + 0, + 0, + dxf_oa_undefined, + 0, + 0, + 0, + 100.20, + 100500, + 0, + 0, + 0, + 0.0, + 0.0, + L'Q', + dxf_osd_buy, + dxf_osc_order, + {L"NSDQ"}}, + {L"NTV", + dxf_ef_tx_pending | dxf_ef_remove_event, + 0x4e54560000000004, + 1488551035000, + 0, + 0, + dxf_oa_undefined, + 0, + 0, + 0, + 100.50, + 100, + 0, + 0, + 0, + 0.0, + 0.0, + L'Q', + dxf_osd_buy, + dxf_osc_order, + {L"NSDQ"}}, + {L"NTV", 0, 0x4e54560000000010, 1488551035000, 0, 0, dxf_oa_undefined, 0, 0, 0, 100.60, 100, 0, 0, 0, 0.0, + 0.0, L'Q', dxf_osd_buy, dxf_osc_order, {L"NSDQ"}}, }; -static dxf_order_t update_test_snap_1_data[] = { - { 0, 0x4e54560000000004, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000003, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000002, 1488551035020, 0, 0, 100.40, 1000, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" } -}; +static dxf_order_t update_test_snap_1_data[] = { + {0, 0x4e54560000000004, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000003, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000002, 1488551035020, 0, 0, 100.40, 1000, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}}; static int update_test_snap_1_size = SIZE_OF_ARRAY(update_test_snap_1_data); static dxf_order_t update_test_snap_2_data[] = { - { 0, 0x4e54560000000004, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000003, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" } -}; + {0, 0x4e54560000000004, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000003, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}}; static int update_test_snap_2_size = SIZE_OF_ARRAY(update_test_snap_2_data); static dxf_order_t update_test_snap_3_data[] = { - { 0, 0x4e54560000000004, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000003, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" } -}; + {0, 0x4e54560000000004, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000003, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}}; static int update_test_snap_3_size = SIZE_OF_ARRAY(update_test_snap_3_data); static dxf_order_t update_test_snap_4_data[] = { - { 0, 0x4e54560000000010, 1488551035000, 0, 0, 100.60, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000005, 1488551035020, 0, 0, 100.42, 1002, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000003, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000002, 1488551035020, 0, 0, 100.41, 1001, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 100500, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" } -}; + {0, 0x4e54560000000010, 1488551035000, 0, 0, 100.60, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000005, 1488551035020, 0, 0, 100.42, 1002, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000003, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000002, 1488551035020, 0, 0, 100.41, 1001, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 100500, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}}; static int update_test_snap_4_size = SIZE_OF_ARRAY(update_test_snap_4_data); void update_test_listener(const dxf_snapshot_data_ptr_t snapshot_data, void* user_data) { dx_snap_test_state_t* state = (dx_snap_test_state_t*)user_data; state->listener_call_counter++; switch (state->listener_call_counter) { - case 1: - // initial snapshot not tested in this case - break; - case 2: - state->result &= dx_compare_snapshots(snapshot_data, update_test_snap_1_data, update_test_snap_1_size); - break; - case 3: - state->result &= dx_compare_snapshots(snapshot_data, update_test_snap_2_data, update_test_snap_2_size); - break; - case 4: - state->result &= dx_compare_snapshots(snapshot_data, update_test_snap_3_data, update_test_snap_3_size); - break; - case 5: - state->result &= dx_compare_snapshots(snapshot_data, update_test_snap_4_data, update_test_snap_4_size); - break; - default: - state->result = false; - break; + case 1: + // initial snapshot not tested in this case + break; + case 2: + state->result &= dx_compare_snapshots(snapshot_data, update_test_snap_1_data, update_test_snap_1_size); + break; + case 3: + state->result &= dx_compare_snapshots(snapshot_data, update_test_snap_2_data, update_test_snap_2_size); + break; + case 4: + state->result &= dx_compare_snapshots(snapshot_data, update_test_snap_3_data, update_test_snap_3_size); + break; + case 5: + state->result &= dx_compare_snapshots(snapshot_data, update_test_snap_4_data, update_test_snap_4_size); + break; + default: + state->result = false; + break; } } @@ -275,35 +480,32 @@ int snapshot_update_test(void) { return snapshot_test_runner(update_test_data, SIZE_OF_ARRAY(update_test_data), update_test_listener, 5); } -/* -------------------------------------------------------------------------- */ - static dxf_order_t bid_ask_test_data[] = { // initial data - { dxf_ef_snapshot_begin, 0x4e54560000000005, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000004, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000002, 1488551035020, 0, 0, 100.40, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { dxf_ef_snapshot_end, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, + {dxf_ef_snapshot_begin, 0x4e54560000000005, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', + L"NTV", L"NSDQ"}, + {0, 0x4e54560000000004, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000002, 1488551035020, 0, 0, 100.40, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {dxf_ef_snapshot_end, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', + L"NTV", L"NSDQ"}, // Update#1: replace max bid with new min ask - { 0, 0x4e54560000000005, 1488551035000, 0, 0, 100.45, 100, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" } -}; + {0, 0x4e54560000000005, 1488551035000, 0, 0, 100.45, 100, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}}; static dxf_order_t bid_ask_test_snap_0_data[] = { - { 0, 0x4e54560000000005, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000004, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000002, 1488551035020, 0, 0, 100.40, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" } -}; + {0, 0x4e54560000000005, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000004, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000002, 1488551035020, 0, 0, 100.40, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}}; static int bid_ask_test_snap_0_size = SIZE_OF_ARRAY(bid_ask_test_snap_0_data); static dxf_order_t bid_ask_test_snap_1_data[] = { - { 0, 0x4e54560000000005, 1488551035000, 0, 0, 100.45, 100, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000004, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000002, 1488551035020, 0, 0, 100.40, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" } -}; + {0, 0x4e54560000000005, 1488551035000, 0, 0, 100.45, 100, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000004, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000002, 1488551035020, 0, 0, 100.40, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}}; static int bid_ask_test_snap_1_size = SIZE_OF_ARRAY(bid_ask_test_snap_1_data); void bid_ask_test_listener(const dxf_snapshot_data_ptr_t snapshot_data, void* user_data) { @@ -319,29 +521,25 @@ void bid_ask_test_listener(const dxf_snapshot_data_ptr_t snapshot_data, void* us dxf_order_t order = order_records[i]; if (order.side == dxf_osd_buy) { - if (order.price > max_bid) - max_bid = order.price; + if (order.price > max_bid) max_bid = order.price; } else if (order.side == dxf_osd_sell) { - if (order.price < min_ask || min_ask == -1) - min_ask = order.price; + if (order.price < min_ask || min_ask == -1) min_ask = order.price; } } state->result &= min_ask > max_bid; switch (state->listener_call_counter) { - case 1: - state->result &= dx_compare_snapshots(snapshot_data, bid_ask_test_snap_0_data, bid_ask_test_snap_0_size) && - dx_is_equal_double(100.50, max_bid) && - dx_is_equal_double(101.00, min_ask); - break; - case 2: - state->result &= dx_compare_snapshots(snapshot_data, bid_ask_test_snap_1_data, bid_ask_test_snap_1_size) && - dx_is_equal_double(100.40, max_bid) && - dx_is_equal_double(100.45, min_ask); - break; - default: - state->result = false; - break; + case 1: + state->result &= dx_compare_snapshots(snapshot_data, bid_ask_test_snap_0_data, bid_ask_test_snap_0_size) && + dx_is_equal_double(100.50, max_bid) && dx_is_equal_double(101.00, min_ask); + break; + case 2: + state->result &= dx_compare_snapshots(snapshot_data, bid_ask_test_snap_1_data, bid_ask_test_snap_1_size) && + dx_is_equal_double(100.40, max_bid) && dx_is_equal_double(100.45, min_ask); + break; + default: + state->result = false; + break; } } @@ -354,32 +552,31 @@ int snapshot_bid_ask_test(void) { return snapshot_test_runner(bid_ask_test_data, SIZE_OF_ARRAY(bid_ask_test_data), bid_ask_test_listener, 2); } -/* -------------------------------------------------------------------------- */ - static dxf_order_t duplicate_index_test_data[] = { - { dxf_ef_snapshot_begin, 0x4e54560000000005, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000004, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000002, 1488551035020, 0, 0, 100.40, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000004, 1488551035010, 0, 0, 101.50, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { dxf_ef_snapshot_end, 0x4e54560000000002, 1488551035020, 0, 0, 100.60, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" } -}; + {dxf_ef_snapshot_begin, 0x4e54560000000005, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', + L"NTV", L"NSDQ"}, + {0, 0x4e54560000000004, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000002, 1488551035020, 0, 0, 100.40, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000004, 1488551035010, 0, 0, 101.50, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}, + {dxf_ef_snapshot_end, 0x4e54560000000002, 1488551035020, 0, 0, 100.60, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', + L"NTV", L"NSDQ"}}; static dxf_order_t duplicate_index_test_snap_data[] = { - { 0, 0x4e54560000000005, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000004, 1488551035010, 0, 0, 101.50, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000002, 1488551035020, 0, 0, 100.60, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" } -}; + {0, 0x4e54560000000005, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000004, 1488551035010, 0, 0, 101.50, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000002, 1488551035020, 0, 0, 100.60, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}}; static int duplicate_index_test_snap_size = SIZE_OF_ARRAY(duplicate_index_test_snap_data); void duplicate_index_test_listener(const dxf_snapshot_data_ptr_t snapshot_data, void* user_data) { dx_snap_test_state_t* state = (dx_snap_test_state_t*)user_data; state->listener_call_counter++; - state->result &= dx_compare_snapshots(snapshot_data, duplicate_index_test_snap_data, duplicate_index_test_snap_size); + state->result &= + dx_compare_snapshots(snapshot_data, duplicate_index_test_snap_data, duplicate_index_test_snap_size); } /* @@ -387,27 +584,27 @@ void duplicate_index_test_listener(const dxf_snapshot_data_ptr_t snapshot_data, * Simulates duplicated indexes in snapshot transmission. */ int snapshot_duplicate_index_test(void) { - return snapshot_test_runner(duplicate_index_test_data, SIZE_OF_ARRAY(duplicate_index_test_data), duplicate_index_test_listener, 1); + return snapshot_test_runner(duplicate_index_test_data, SIZE_OF_ARRAY(duplicate_index_test_data), + duplicate_index_test_listener, 1); } -/* -------------------------------------------------------------------------- */ - static dxf_order_t buildin_update_test_data[] = { - { dxf_ef_snapshot_begin, 0x4e54560000000005, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000004, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000002, 1488551035020, 0, 0, 100.40, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { dxf_ef_snapshot_end | dxf_ef_tx_pending | dxf_ef_remove_event, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { dxf_ef_tx_pending, 0x4e54560000000004, 1488551035010, 0, 0, 101.50, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000002, 1488551035020, 0, 0, 100.60, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" } -}; + {dxf_ef_snapshot_begin, 0x4e54560000000005, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', + L"NTV", L"NSDQ"}, + {0, 0x4e54560000000004, 1488551035010, 0, 0, 101.00, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000002, 1488551035020, 0, 0, 100.40, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {dxf_ef_snapshot_end | dxf_ef_tx_pending | dxf_ef_remove_event, 0x4e54560000000000, 1488551035040, 0, 0, 100.20, + 104, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {dxf_ef_tx_pending, 0x4e54560000000004, 1488551035010, 0, 0, 101.50, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', + L"NTV", L"NSDQ"}, + {0, 0x4e54560000000002, 1488551035020, 0, 0, 100.60, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}}; static dxf_order_t buildin_update_test_snap_data[] = { - { 0, 0x4e54560000000005, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000004, 1488551035010, 0, 0, 101.50, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000002, 1488551035020, 0, 0, 100.60, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" }, - { 0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ" } -}; + {0, 0x4e54560000000005, 1488551035000, 0, 0, 100.50, 100, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000004, 1488551035010, 0, 0, 101.50, 101, 0, dxf_osc_order, dxf_osd_sell, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000002, 1488551035020, 0, 0, 100.60, 102, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}, + {0, 0x4e54560000000001, 1488551035030, 0, 0, 100.30, 103, 0, dxf_osc_order, dxf_osd_buy, L'Q', L"NTV", L"NSDQ"}}; static int buildin_update_test_snap_size = SIZE_OF_ARRAY(buildin_update_test_snap_data); @@ -422,39 +619,27 @@ void buildin_update_test_listener(const dxf_snapshot_data_ptr_t snapshot_data, v * Simulates start of update before SNAPSHOT_END flag transmitted. */ int snapshot_buildin_update_test(void) { - return snapshot_test_runner(buildin_update_test_data, SIZE_OF_ARRAY(buildin_update_test_data), buildin_update_test_listener, 1); + return snapshot_test_runner(buildin_update_test_data, SIZE_OF_ARRAY(buildin_update_test_data), + buildin_update_test_listener, 1); } -/* -------------------------------------------------------------------------- */ - -static dx_record_info_id_t g_record_info_ids_list[] = { - dx_rid_order, dx_rid_time_and_sale, dx_rid_candle, - dx_rid_spread_order, dx_rid_greeks, dx_rid_series -}; +static dx_record_info_id_t g_record_info_ids_list[] = {dx_rid_order, dx_rid_time_and_sale, dx_rid_candle, + dx_rid_spread_order, dx_rid_greeks, dx_rid_series}; static size_t g_record_info_ids_count = SIZE_OF_ARRAY(g_record_info_ids_list); static dxf_const_string_t g_symbols[] = { - L"AAPL", L"FB", L"QQQ", L"AMZN", L"MSFT", L"GOOGL", L"BAC", L"GOOG", L"NFLX", L"TSLA", L"PFE", - L"AGN", L"BABA", L"VRX", L"GE", L"TLT", L"XOM", L"JPM", L"GILD", L"C", L"WFC", L"T", L"JNJ", - L"DIS", L"PCLN", L"XIV", L"CVX", L"MCD", L"INTC", L"VZ", L"CHTR", L"CSCO", L"HD", L"V", L"BIDU", - L"NKE", L"BA", L"WMT", L"KO", L"IBM", L"PG", L"SLB", L"CMCSA", L"SHPG", L"IBB", L"YHOO", - L"ABBV", L"GS", L"FCX", L"ORCL", L"QCOM", L"CVS", L"MRK", L"SBUX", L"BIIB", L"CMG", L"PEP", - L"BAX", L"DAL", L"TGT", L"CELG", L"MON", L"BRK-B", L"AMGN", L"UNH", L"HAL", L"MDT", L"F", - L"BMY", L"AVGO", L"PM", L"CAT", L"COST", L"NVDA", L"JD", L"UNP", L"ABT", L"UTX", L"COP", - L"AIG", L"MO", L"MS", L"LNKD", L"WBA", L"REGN", L"LOW", L"GM", L"TWTR", L"NXPI", L"AAL", L"DVN", - L"MA", L"TEVA", L"MDLZ", L"ABX", L"VLO", L"DOW", L"MMM", L"UA", L"PXD" }; + L"AAPL", L"FB", L"QQQ", L"AMZN", L"MSFT", L"GOOGL", L"BAC", L"GOOG", L"NFLX", L"TSLA", L"PFE", L"AGN", + L"BABA", L"VRX", L"GE", L"TLT", L"XOM", L"JPM", L"GILD", L"C", L"WFC", L"T", L"JNJ", L"DIS", + L"PCLN", L"XIV", L"CVX", L"MCD", L"INTC", L"VZ", L"CHTR", L"CSCO", L"HD", L"V", L"BIDU", L"NKE", + L"BA", L"WMT", L"KO", L"IBM", L"PG", L"SLB", L"CMCSA", L"SHPG", L"IBB", L"YHOO", L"ABBV", L"GS", + L"FCX", L"ORCL", L"QCOM", L"CVS", L"MRK", L"SBUX", L"BIIB", L"CMG", L"PEP", L"BAX", L"DAL", L"TGT", + L"CELG", L"MON", L"BRK-B", L"AMGN", L"UNH", L"HAL", L"MDT", L"F", L"BMY", L"AVGO", L"PM", L"CAT", + L"COST", L"NVDA", L"JD", L"UNP", L"ABT", L"UTX", L"COP", L"AIG", L"MO", L"MS", L"LNKD", L"WBA", + L"REGN", L"LOW", L"GM", L"TWTR", L"NXPI", L"AAL", L"DVN", L"MA", L"TEVA", L"MDLZ", L"ABX", L"VLO", + L"DOW", L"MMM", L"UA", L"PXD"}; static size_t g_symbols_count = SIZE_OF_ARRAY(g_symbols); -const dxf_const_string_t g_sources_list[] = { - L"NTV", - L"BYX", - L"BZX", - L"DEA", - L"ISE", - L"DEX", - L"IST", - NULL -}; +const dxf_const_string_t g_sources_list[] = {L"NTV", L"BYX", L"BZX", L"DEA", L"ISE", L"DEX", L"IST", NULL}; const size_t g_sources_count = SIZE_OF_ARRAY(g_sources_list); typedef struct { @@ -471,7 +656,7 @@ int snapshot_key_test(void) { int found; int error; size_t position = 0; - + for (size_t record_index = 0; record_index < g_record_info_ids_count; record_index++) { for (size_t symbol_index = 0; symbol_index < g_symbols_count; symbol_index++) { for (size_t source_index = 0; source_index < g_sources_count; source_index++) { @@ -479,18 +664,20 @@ int snapshot_key_test(void) { const dxf_const_string_t symbol = g_symbols[symbol_index]; const dxf_const_string_t source = g_sources_list[source_index]; const dxf_ulong_t key = dx_new_snapshot_key(info_id, symbol, source); - - DX_ARRAY_BINARY_SEARCH(all_keys.elements, 0, all_keys.size, key, DX_NUMERIC_COMPARATOR, found, position); - + + DX_ARRAY_BINARY_SEARCH(all_keys.elements, 0, all_keys.size, key, DX_NUMERIC_COMPARATOR, found, + position); + if (found) { - wprintf(L"Duplicate snapshot keys detected: %llu! Record id: %d, symbol:'%ls', source:'%ls'.\n", key, info_id, symbol, source); + wprintf(L"Duplicate snapshot keys detected: %llu! Record id: %d, symbol:'%ls', source:'%ls'.\n", + key, info_id, symbol, source); PRINT_TEST_FAILED; dx_free(all_keys.elements); return false; } - + DX_ARRAY_INSERT(all_keys, dxf_ulong_t, key, position, dx_capacity_manager_halfer, error); - + if (!dx_is_equal_int(false, error)) { PRINT_TEST_FAILED_MESSAGE("Insert array error!"); dx_free(all_keys.elements); @@ -499,14 +686,12 @@ int snapshot_key_test(void) { } } } - + dx_free(all_keys.elements); - + return true; } -/* -------------------------------------------------------------------------- */ - typedef struct { dxf_int_t* elements; size_t size; @@ -521,48 +706,40 @@ int symbol_name_hasher_test(void) { int found; int error; size_t position = 0; - + for (size_t symbol_index = 0; symbol_index < g_symbols_count; symbol_index++) { const dxf_const_string_t symbol = g_symbols[symbol_index]; const dxf_ulong_t hash = dx_symbol_name_hasher(symbol); - + DX_ARRAY_BINARY_SEARCH(hashes.elements, 0, hashes.size, hash, DX_NUMERIC_COMPARATOR, found, position); - + if (found) { wprintf(L"Duplicate hashes detected: %lu! symbol:'%ls'.\n", hash, symbol); PRINT_TEST_FAILED; dx_free(hashes.elements); return false; } - + DX_ARRAY_INSERT(hashes, dxf_int_t, hash, position, dx_capacity_manager_halfer, error); - + if (!dx_is_equal_int(false, error)) { PRINT_TEST_FAILED_MESSAGE("Insert array error!"); dx_free(hashes.elements); return false; } } - + dx_free(hashes.elements); - + return true; } -/* -------------------------------------------------------------------------- */ - int snapshot_all_unit_test(void) { int res = true; - if (!snapshot_simple_test() || - !snapshot_empty_test() || - !snapshot_update_test() || - !snapshot_bid_ask_test() || - !snapshot_duplicate_index_test() || - !snapshot_buildin_update_test() || - !snapshot_key_test() || + if (!snapshot_simple_test() || !snapshot_empty_test() || !snapshot_update_test() || !snapshot_bid_ask_test() || + !snapshot_duplicate_index_test() || !snapshot_buildin_update_test() || !snapshot_key_test() || !symbol_name_hasher_test()) { - res = false; } return res; diff --git a/tests/UnitTests/TestHelper.c b/tests/UnitTests/TestHelper.c index 2a78f786..40ec3f17 100644 --- a/tests/UnitTests/TestHelper.c +++ b/tests/UnitTests/TestHelper.c @@ -20,10 +20,14 @@ #include #ifdef _WIN32 -# pragma warning(push) -# pragma warning(disable : 5105) +# if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +# endif # include -# pragma warning(pop) +# if !defined(__MINGW32__) +# pragma warning(pop) +# endif #else # include # include @@ -89,9 +93,7 @@ void init_listener_thread_data(OUT dxf_listener_thread_data_t* data) { *data = (dxf_listener_thread_data_t)internal_data; } -void free_listener_thread_data(dxf_listener_thread_data_t data) { - free(data); -} +void free_listener_thread_data(dxf_listener_thread_data_t data) { free(data); } int is_thread_terminate(dxf_listener_thread_data_t data) { int res; @@ -107,8 +109,6 @@ void on_reader_thread_terminate(dxf_connection_t connection, void* user_data) { } #endif -/* -------------------------------------------------------------------------- */ - void process_last_error() { int error_code = dx_ec_success; dxf_const_string_t error_descr = NULL; @@ -122,7 +122,8 @@ void process_last_error() { return; } - wprintf(L"Error occurred and successfully retrieved:\n" + wprintf( + L"Error occurred and successfully retrieved:\n" L"error code = %d, description = \"%ls\"\n", error_code, error_descr); return; @@ -131,12 +132,8 @@ void process_last_error() { wprintf(L"An error occurred but the error subsystem failed to initialize\n"); } -/* -------------------------------------------------------------------------- */ - -int create_event_subscription(dxf_connection_t connection, int event_type, - dxf_const_string_t symbol, - dxf_event_listener_t event_listener, - OUT dxf_subscription_t* res_subscription) { +int create_event_subscription(dxf_connection_t connection, int event_type, dxf_const_string_t symbol, + dxf_event_listener_t event_listener, OUT dxf_subscription_t* res_subscription) { dxf_subscription_t subscription = NULL; if (!dxf_create_subscription(connection, event_type, &subscription)) { @@ -160,8 +157,6 @@ int create_event_subscription(dxf_connection_t connection, int event_type, return true; } -/* -------------------------------------------------------------------------- */ - /* Event counter functions */ void init_event_counter(event_counter_data_ptr_t counter_data) { @@ -170,7 +165,7 @@ void init_event_counter(event_counter_data_ptr_t counter_data) { counter_data->counter_name = NULL; } -void init_event_counter2(event_counter_data_ptr_t counter_data, const char *name) { +void init_event_counter2(event_counter_data_ptr_t counter_data, const char* name) { InitializeCriticalSection(&counter_data->event_counter_guard); counter_data->event_counter = 0; counter_data->counter_name = name; @@ -200,53 +195,51 @@ void drop_event_counter(event_counter_data_ptr_t counter_data) { LeaveCriticalSection(&counter_data->event_counter_guard); } -const char *get_event_counter_name(event_counter_data_ptr_t counter_data) { - const char * value = 0; +const char* get_event_counter_name(event_counter_data_ptr_t counter_data) { + const char* value = 0; EnterCriticalSection(&counter_data->event_counter_guard); value = counter_data->counter_name; LeaveCriticalSection(&counter_data->event_counter_guard); return value; } -/* -------------------------------------------------------------------------- */ - #define DX_TOLLERANCE 0.000001 -#define DX_IS_EQUAL_FUNCTION_DEFINITION(type, tmpl) \ -DX_IS_EQUAL_FUNCTION_DECLARATION(type) { \ - if (expected != actual) { \ - wprintf(L"%ls failed: expected=" tmpl L", but was=" tmpl L"\n", __FUNCTIONW__, expected, actual); \ - return false; \ - } \ - return true; \ -} +#define DX_IS_EQUAL_FUNCTION_DEFINITION(type, tmpl) \ + DX_IS_EQUAL_FUNCTION_DECLARATION(type) { \ + if (expected != actual) { \ + wprintf(L"%ls failed: expected=" tmpl L", but was=" tmpl L"\n", __FUNCTIONW__, expected, actual); \ + return false; \ + } \ + return true; \ + } -#define DX_IS_EQUAL_STRING_FUNCTION_DEFINITION(type, tmpl) \ -DX_IS_EQUAL_FUNCTION_DECLARATION(type) { \ - if (wcscmp(expected, actual) != 0) { \ - wprintf(L"%ls failed: expected=" tmpl L", but was=" tmpl L"\n", __FUNCTIONW__, expected, actual); \ - return false; \ - } \ - return true; \ -} +#define DX_IS_EQUAL_STRING_FUNCTION_DEFINITION(type, tmpl) \ + DX_IS_EQUAL_FUNCTION_DECLARATION(type) { \ + if (wcscmp(expected, actual) != 0) { \ + wprintf(L"%ls failed: expected=" tmpl L", but was=" tmpl L"\n", __FUNCTIONW__, expected, actual); \ + return false; \ + } \ + return true; \ + } -#define DX_IS_EQUAL_ANSI_FUNCTION_DEFINITION(type, tmpl, alias) \ -DX_IS_EQUAL_FUNCTION_DECLARATION_A(type, alias) { \ - if (expected == NULL && actual == NULL) { \ - return true; \ - } else if (expected == NULL) { \ - printf("%s failed: expected=NULL, but was=" tmpl "\n", __FUNCTION__, actual); \ - return false; \ - } else if (actual == NULL) { \ - printf("%s failed: expected=" tmpl ", but was=NULL\n", __FUNCTION__, expected); \ - return false; \ - } \ - if (strcmp(expected, actual) != 0) { \ - printf("%s failed: expected=" tmpl ", but was=" tmpl "\n", __FUNCTION__, expected, actual); \ - return false; \ - } \ - return true; \ -} +#define DX_IS_EQUAL_ANSI_FUNCTION_DEFINITION(type, tmpl, alias) \ + DX_IS_EQUAL_FUNCTION_DECLARATION_A(type, alias) { \ + if (expected == NULL && actual == NULL) { \ + return true; \ + } else if (expected == NULL) { \ + printf("%s failed: expected=NULL, but was=" tmpl "\n", __FUNCTION__, actual); \ + return false; \ + } else if (actual == NULL) { \ + printf("%s failed: expected=" tmpl ", but was=NULL\n", __FUNCTION__, expected); \ + return false; \ + } \ + if (strcmp(expected, actual) != 0) { \ + printf("%s failed: expected=" tmpl ", but was=" tmpl "\n", __FUNCTION__, expected, actual); \ + return false; \ + } \ + return true; \ + } DX_IS_EQUAL_FUNCTION_DEFINITION(int, L"%d") DX_IS_EQUAL_FUNCTION_DEFINITION(ERRORCODE, L"%d") @@ -272,9 +265,7 @@ DX_IS_EQUAL_FUNCTION_DECLARATION(double) { return true; } -DX_IS_EQUAL_FUNCTION_DECLARATION(size_t) { - return dx_is_equal_dxf_ulong_t((dxf_ulong_t)expected, actual); -} +DX_IS_EQUAL_FUNCTION_DECLARATION(size_t) { return dx_is_equal_dxf_ulong_t((dxf_ulong_t)expected, actual); } int dx_is_not_null(void* actual) { if (actual == NULL) { @@ -308,8 +299,7 @@ int dx_is_false(int actual) { return true; } -int dx_is_equal_ptr(void* expected, void* actual) -{ +int dx_is_equal_ptr(void* expected, void* actual) { if (expected != actual) { wprintf(L"%ls failed: expected=%p, but was=%p\n", __FUNCTIONW__, expected, actual); return false; @@ -317,14 +307,15 @@ int dx_is_equal_ptr(void* expected, void* actual) return true; } -#define DX_IS_GREATER_OR_EQUAL_FUNCTION_DEFINITION(type, tmpl) \ -DX_IS_GREATER_OR_EQUAL_FUNCTION_DECLARATION(type) { \ - if (actual < param) { \ - wprintf(L"%ls failed: expected greater or equal to " tmpl L", but was=" tmpl L"\n", __FUNCTIONW__, param, actual); \ - return false; \ - } \ - return true; \ -} +#define DX_IS_GREATER_OR_EQUAL_FUNCTION_DEFINITION(type, tmpl) \ + DX_IS_GREATER_OR_EQUAL_FUNCTION_DECLARATION(type) { \ + if (actual < param) { \ + wprintf(L"%ls failed: expected greater or equal to " tmpl L", but was=" tmpl L"\n", __FUNCTIONW__, param, \ + actual); \ + return false; \ + } \ + return true; \ + } DX_IS_GREATER_OR_EQUAL_FUNCTION_DEFINITION(dxf_uint_t, L"%u") DX_IS_GREATER_OR_EQUAL_FUNCTION_DEFINITION(dxf_long_t, L"%lld") diff --git a/tests/UnitTests/TestHelper.h b/tests/UnitTests/TestHelper.h index faa70eff..106fd8d3 100644 --- a/tests/UnitTests/TestHelper.h +++ b/tests/UnitTests/TestHelper.h @@ -20,21 +20,23 @@ #ifndef TEST_HELPER_H_INCLUDED #define TEST_HELPER_H_INCLUDED -#pragma warning(push) -#pragma warning(disable : 5105) +#if !defined(__MINGW32__) +# pragma warning(push) +# pragma warning(disable : 5105) +#endif #include -#pragma warning(pop) +#if !defined(__MINGW32__) +# pragma warning(pop) +#endif #include -#include "DXFeed.h" #include "DXErrorCodes.h" #include "DXErrorHandling.h" +#include "DXFeed.h" #include "PrimitiveTypes.h" #define SIZE_OF_ARRAY(static_array) sizeof(static_array) / sizeof(static_array[0]) -/* -------------------------------------------------------------------------- */ - typedef struct { dxf_const_string_t symbol; dxf_char_t exchange_code; @@ -49,8 +51,6 @@ typedef struct { int line; } candle_attribute_test_case_t; -/* -------------------------------------------------------------------------- */ - typedef void* dxf_listener_thread_data_t; void init_listener_thread_data(OUT dxf_listener_thread_data_t* data); @@ -58,71 +58,62 @@ void free_listener_thread_data(dxf_listener_thread_data_t data); int is_thread_terminate(dxf_listener_thread_data_t data); void on_reader_thread_terminate(dxf_listener_thread_data_t data, dxf_connection_t connection, void* user_data); void reset_thread_terminate(dxf_listener_thread_data_t data); - -/* -------------------------------------------------------------------------- */ - void process_last_error(); -int create_event_subscription(dxf_connection_t connection, int event_type, - dxf_const_string_t symbol, - dxf_event_listener_t event_listener, - OUT dxf_subscription_t* res_subscription); +int create_event_subscription(dxf_connection_t connection, int event_type, dxf_const_string_t symbol, + dxf_event_listener_t event_listener, OUT dxf_subscription_t* res_subscription); -/* -------------------------------------------------------------------------- */ /* Event counter data */ typedef struct { - const char *counter_name; + const char* counter_name; dxf_uint_t event_counter; - //TODO: hide implementation into c-file; remove Windows.h header from this + // TODO: hide implementation into c-file; remove Windows.h header from this CRITICAL_SECTION event_counter_guard; } event_counter_data_t, *event_counter_data_ptr_t; /* Event counter functions */ void init_event_counter(event_counter_data_ptr_t counter_data); -void init_event_counter2(event_counter_data_ptr_t counter_data, const char *name); +void init_event_counter2(event_counter_data_ptr_t counter_data, const char* name); void free_event_counter(event_counter_data_ptr_t counter_data); void inc_event_counter(event_counter_data_ptr_t counter_data); dxf_uint_t get_event_counter(event_counter_data_ptr_t counter_data); void drop_event_counter(event_counter_data_ptr_t counter_data); -const char *get_event_counter_name(event_counter_data_ptr_t counter_data); - -/* -------------------------------------------------------------------------- */ +const char* get_event_counter_name(event_counter_data_ptr_t counter_data); #define PRINT_TEST_FAILED printf("%s failed! File: %s, line: %d\n", __FUNCTION__, __FILE__, __LINE__); -#define PRINT_TEST_FAILED_MESSAGE(message) printf("%s failed! File: %s, line: %d\nMessage:%s\n", __FUNCTION__, __FILE__, __LINE__, message); - -#define DX_CHECK(predicate) \ - do { \ - if (!(predicate)) { \ - PRINT_TEST_FAILED \ - { \ - int error_code; \ - dxf_const_string_t error_descr = L""; \ - if (dx_get_last_error(&error_code) == dx_efr_success && error_code != dx_ec_success) { \ +#define PRINT_TEST_FAILED_MESSAGE(message) \ + printf("%s failed! File: %s, line: %d\nMessage:%s\n", __FUNCTION__, __FILE__, __LINE__, message); + +#define DX_CHECK(predicate) \ + do { \ + if (!(predicate)) { \ + PRINT_TEST_FAILED { \ + int error_code; \ + dxf_const_string_t error_descr = L""; \ + if (dx_get_last_error(&error_code) == dx_efr_success && error_code != dx_ec_success) { \ wprintf(L"Last error: #%d %ls\n", error_code, dx_get_error_description(error_code)); \ - dx_pop_last_error(); \ - } \ - } \ - return false; \ - } \ + dx_pop_last_error(); \ + } \ + } \ + return false; \ + } \ } while (false) -#define DX_CHECK_MESSAGE(predicate, message) \ - do { \ - if (!(predicate)) { \ - PRINT_TEST_FAILED_MESSAGE(message) \ - { \ - int error_code; \ - dxf_const_string_t error_descr = L""; \ - if (dx_get_last_error(&error_code) == dx_efr_success && error_code != dx_ec_success) { \ +#define DX_CHECK_MESSAGE(predicate, message) \ + do { \ + if (!(predicate)) { \ + PRINT_TEST_FAILED_MESSAGE(message) { \ + int error_code; \ + dxf_const_string_t error_descr = L""; \ + if (dx_get_last_error(&error_code) == dx_efr_success && error_code != dx_ec_success) { \ wprintf(L"Last error: #%d %ls\n", error_code, dx_get_error_description(error_code)); \ - dx_pop_last_error(); \ - } \ - } \ - return false; \ - } \ + dx_pop_last_error(); \ + } \ + } \ + return false; \ + } \ } while (false) -#define DX_IS_EQUAL_FUNCTION_DECLARATION(type) int dx_is_equal_##type##(type expected, type actual) +#define DX_IS_EQUAL_FUNCTION_DECLARATION(type) int dx_is_equal_##type##(type expected, type actual) #define DX_IS_GREATER_OR_EQUAL_FUNCTION_DECLARATION(type) int dx_ge_##type##(type actual, type param) #define DX_IS_EQUAL_FUNCTION_DECLARATION_A(type, alias) int dx_is_equal_##alias##(type expected, type actual) @@ -151,4 +142,4 @@ int dx_is_false(int actual); int dx_is_equal_ptr(void* expected, void* actual); -#endif //TEST_HELPER_H_INCLUDED \ No newline at end of file +#endif // TEST_HELPER_H_INCLUDED \ No newline at end of file diff --git a/tests/UnitTests/UnitTests.vcxproj b/tests/UnitTests/UnitTests.vcxproj index 09abe8d7..b2d37284 100644 --- a/tests/UnitTests/UnitTests.vcxproj +++ b/tests/UnitTests/UnitTests.vcxproj @@ -135,7 +135,7 @@ Disabled - $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) + $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) @@ -164,7 +164,7 @@ Disabled - $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) + $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_CONSOLE;DXFEED_CODEC_TLS_ENABLED;%(PreprocessorDefinitions) @@ -193,7 +193,7 @@ Disabled - $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) + $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_CONSOLE;ADDRESS_CODEC_TLS_ENABLED;ADDRESS_CODEC_GZIP_ENABLED;%(PreprocessorDefinitions) @@ -221,7 +221,7 @@ Disabled - $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) + $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;_DEBUG;_CONSOLE;DXFEED_CODEC_TLS_ENABLED;%(PreprocessorDefinitions) @@ -249,7 +249,7 @@ Full - $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) + $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) @@ -270,7 +270,7 @@ Full - $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) + $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_CONSOLE;DXFEED_CODEC_TLS_ENABLED;%(PreprocessorDefinitions) @@ -291,7 +291,7 @@ Full - $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) + $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) @@ -311,7 +311,7 @@ Full - $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_75;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) + $(SolutionDir)\include;$(SolutionDir)thirdparty\toml11;$(SolutionDir)thirdparty\boost-1_79;$(SolutionDir)src;$(SolutionDir)lib\libressl\include;$(SolutionDir)lib\libressl\include;$(SolutionDir)\src;%(AdditionalIncludeDirectories) _CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;WIN32;NDEBUG;_CONSOLE;DXFEED_CODEC_TLS_ENABLED;%(PreprocessorDefinitions) diff --git a/tests/UnitTests2/CMakeLists.txt b/tests/UnitTests2/CMakeLists.txt index 07a0962c..6d3216f2 100644 --- a/tests/UnitTests2/CMakeLists.txt +++ b/tests/UnitTests2/CMakeLists.txt @@ -8,8 +8,10 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(DXFC_TEST_SOURCES WideDecimalTest.cpp) -set(DXFC_INCLUDE_DIRS ../../include ../../src ../../thirdparty/Catch2-2.13.8/single_include) +set(DXFC_TEST_SOURCES WideDecimalTest.cpp SnapshotTest.cpp) +set(DXFC_INCLUDE_DIRS ../../include ../../src ../../thirdparty/Catch2-2.13.8/single_include + ../../thirdparty/boost-1_79 ../../thirdparty/variant-lite-2.0.0 ../../thirdparty/optional-lite-3.5.0 + ../../thirdparty/fmt-8.1.1/include) string(REPLACE ".cpp" "" DXFC_TEST_BASENAMES "${DXFC_TEST_SOURCES}") set(DXFC_TEST_TARGETS ${DXFC_TEST_BASENAMES}) @@ -17,12 +19,13 @@ set(DXFC_TEST_TARGETS ${DXFC_TEST_BASENAMES}) add_library(DXFeedTests2Main OBJECT Main.cpp) target_include_directories(DXFeedTests2Main PRIVATE ${DXFC_INCLUDE_DIRS}) -add_executable(WideDecimalTest WideDecimalTest.cpp ../../src/WideDecimal.h ../../src/WideDecimal.hpp) +add_executable(WideDecimalTest WideDecimalTest.cpp ../../src/WideDecimal.cpp ../../src/WideDecimal.h ../../src/WideDecimal.hpp) +add_executable(SnapshotTest SnapshotTest.cpp ../../src/Snapshot/Snapshot.cpp ../../src/Snapshot/Snapshot.h ../../src/Snapshot/Snapshot.hpp) -foreach(name ${DXFC_TEST_TARGETS}) +foreach (name ${DXFC_TEST_TARGETS}) target_include_directories(${name} PRIVATE ${DXFC_INCLUDE_DIRS}) target_link_libraries(${name} PRIVATE DXFeedTests2Main) set_property(TARGET ${name} PROPERTY CXX_STANDARD 17) set_property(TARGET ${name} PROPERTY CXX_EXTENSIONS OFF) add_test(NAME ${name} COMMAND ${name}) -endforeach() +endforeach () diff --git a/tests/UnitTests2/SnapshotTest.cpp b/tests/UnitTests2/SnapshotTest.cpp new file mode 100644 index 00000000..f615749e --- /dev/null +++ b/tests/UnitTests2/SnapshotTest.cpp @@ -0,0 +1 @@ +#include diff --git a/tests/UnitTests2/WideDecimalTest.cpp b/tests/UnitTests2/WideDecimalTest.cpp index ece3aeee..be238e10 100644 --- a/tests/UnitTests2/WideDecimalTest.cpp +++ b/tests/UnitTests2/WideDecimalTest.cpp @@ -1,28 +1,27 @@ #include -#include #include - -#include #include -#include -#include +#include +#include +#include namespace WideDecimalTest { -inline static dxf_long_t MAX_SIGNIFICAND = dx::WideDecimal::Consts::MAX_SIGNIFICAND; -inline static dxf_int_t MAX_RANK = 255; +const dxf_int_t MAX_RANK = 255; } // namespace WideDecimalTest TEST_CASE("Test right shifts", "[WideDecimal]") { REQUIRE(dx::rightShift(static_cast(-256LL), 8) == static_cast(-1LL)); REQUIRE(dx::rightShift(static_cast(1LL), 8) == 0LL); - REQUIRE(dx::rightShift(static_cast(0x8000000000000080LL), 8) == static_cast(0xFF80000000000000LL)); + REQUIRE(dx::rightShift(static_cast(0x8000000000000080LL), 8) == + static_cast(0xFF80000000000000LL)); REQUIRE(dx::rightShift(-9223372036854775680LL, 8) == -36028797018963968LL); - REQUIRE(dx::rightShift(static_cast(0x8000000000000000LL), 8) == static_cast(0xFF80000000000000LL)); + REQUIRE(dx::rightShift(static_cast(0x8000000000000000LL), 8) == + static_cast(0xFF80000000000000LL)); REQUIRE(dx::WideDecimal::Consts::MIN_SIGNIFICAND < dx::WideDecimal::Consts::MAX_SIGNIFICAND); } TEST_CASE("Test signs", "[WideDecimal]") { - for (dxf_long_t significand = 0; significand <= WideDecimalTest::MAX_SIGNIFICAND; + for (dxf_long_t significand = 0; significand <= dx::WideDecimal::Consts::MAX_SIGNIFICAND; significand += significand / 2 + 1) { for (dxf_int_t rank = 0; rank <= WideDecimalTest::MAX_RANK; rank += 16) { dxf_long_t rawWide = (significand << 8) | (rank & static_cast(0xFF)); @@ -40,7 +39,8 @@ inline static void checkWide(const std::string& expected, dxf_long_t significand dxf_long_t theWide = dx::WideDecimal::composeWide(significand, -exponent); INFO("Expected = '" << expected << "', significand = " << significand << ", exponent = " << exponent - << ": expectedDouble = " << expectedDouble << ", rawWide = " << rawWide << ", theWide = " << theWide); + << ": expectedDouble = " << expectedDouble << ", rawWide = " << rawWide + << ", theWide = " << theWide); REQUIRE(0 == dx::WideDecimal::compare(rawWide, theWide)); REQUIRE(dx::Double::compare(expectedDouble, dx::WideDecimal::toDouble(rawWide)) == 0); REQUIRE(dx::Double::compare(expectedDouble, dx::WideDecimal::toDouble(theWide)) == 0); @@ -74,18 +74,23 @@ TEST_CASE("Test wide", "[WideDecimal]") { checkWide("1.23456E-10", 123456, -15); } -inline static double generate() { - dxf_long_t pa = static_cast(std::pow(10, std::rand() % 12)); +template +inline static double generate(G&& generator) { + std::uniform_int_distribution<> distrib0to11(0, 11); + std::uniform_real_distribution<> distrib0to1(0.0, 1.0); + + auto power = static_cast(std::pow(10, distrib0to11(std::forward(generator)))); - return std::floor(std::rand() % pa) / pa; + return std::floor(distrib0to1(std::forward(generator)) * power) / power; } TEST_CASE("Test random", "[WideDecimal]") { - std::srand(static_cast(std::time(nullptr))); + std::random_device randomDevice; + std::mt19937 generator(randomDevice()); for (int i = 0; i < 10000; i++) { - double a = generate(); - double b = generate(); + double a = generate(generator); + double b = generate(generator); dxf_long_t wa = dx::WideDecimal::composeWide(a); dxf_long_t wb = dx::WideDecimal::composeWide(b); diff --git a/wrappers/cpp/thirdparty/args/args.hxx b/thirdparty/args-6.3.0/args.hxx similarity index 93% rename from wrappers/cpp/thirdparty/args/args.hxx rename to thirdparty/args-6.3.0/args.hxx index bbc521d0..69ccbf64 100644 --- a/wrappers/cpp/thirdparty/args/args.hxx +++ b/thirdparty/args-6.3.0/args.hxx @@ -1,4 +1,8 @@ -/* Copyright (c) 2016-2017 Taylor C. Richberger and Pavel +/* A simple header-only C++ argument parser library. + * + * https://github.com/Taywee/args + * + * Copyright (c) 2016-2021 Taylor C. Richberger and Pavel * Belikov * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -29,6 +33,11 @@ #ifndef ARGS_HXX #define ARGS_HXX +#define ARGS_VERSION "6.3.0" +#define ARGS_VERSION_MAJOR 6 +#define ARGS_VERSION_MINOR 3 +#define ARGS_VERSION_PATCH 0 + #include #include #include @@ -40,6 +49,13 @@ #include #include #include +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER <= 1800 +#define noexcept +#endif #ifdef ARGS_TESTNAMESPACE namespace argstest @@ -212,9 +228,9 @@ namespace args std::istringstream stream(in); std::string::size_type indent = 0; - for (char c : in) + for (auto c : in) { - if (!isspace(c)) + if (!std::isspace(static_cast(c))) { break; } @@ -448,7 +464,7 @@ namespace args Matcher(std::initializer_list in) : Matcher(EitherFlag::GetShort(in), EitherFlag::GetLong(in)) {} - Matcher(Matcher &&other) : shortFlags(std::move(other.shortFlags)), longFlags(std::move(other.longFlags)) + Matcher(Matcher &&other) noexcept : shortFlags(std::move(other.shortFlags)), longFlags(std::move(other.longFlags)) {} ~Matcher() {} @@ -1002,11 +1018,29 @@ namespace args namespace detail { - template - struct IsConvertableToString : std::false_type {}; + template + using vector = std::vector>; + + template + using unordered_map = std::unordered_map, + std::equal_to, std::allocator > >; + + template + class is_streamable + { + template + static auto test(int) + -> decltype( std::declval() << std::declval(), std::true_type() ); + + template + static auto test(...) -> std::false_type; + + public: + using type = decltype(test(0)); + }; template - struct IsConvertableToString() << std::declval(), int())> : std::true_type {}; + using IsConvertableToString = typename is_streamable::type; template typename std::enable_if::value, std::string>::type @@ -1470,7 +1504,9 @@ namespace args */ std::vector::size_type MatchedChildren() const { - return std::count_if(std::begin(Children()), std::end(Children()), [](const Base *child){return child->Matched();}); + // Cast to avoid warnings from -Wsign-conversion + return static_cast::size_type>( + std::count_if(std::begin(Children()), std::end(Children()), [](const Base *child){return child->Matched();})); } /** Whether or not this group matches validation @@ -1630,11 +1666,11 @@ namespace args public: Subparser(std::vector args_, ArgumentParser &parser_, const Command &command_, const HelpParams &helpParams_) - : args(std::move(args_)), parser(&parser_), helpParams(helpParams_), command(command_) + : Group({}, Validators::AllChildGroups), args(std::move(args_)), parser(&parser_), helpParams(helpParams_), command(command_) { } - Subparser(const Command &command_, const HelpParams &helpParams_) : helpParams(helpParams_), command(command_) + Subparser(const Command &command_, const HelpParams &helpParams_) : Group({}, Validators::AllChildGroups), helpParams(helpParams_), command(command_) { } @@ -1981,9 +2017,9 @@ namespace args if (!ProglinePostfix().empty()) { std::string line; - for (char c : ProglinePostfix()) + for (auto c : ProglinePostfix()) { - if (isspace(c)) + if (std::isspace(static_cast(c))) { if (!line.empty()) { @@ -2125,18 +2161,23 @@ namespace args return; } - for (Base *child: Children()) + auto onValidationError = [&] { - if (child->IsGroup() && !child->Matched()) - { - std::ostringstream problem; - problem << "Group validation failed somewhere!"; + std::ostringstream problem; + problem << "Group validation failed somewhere!"; #ifdef ARGS_NOEXCEPT - error = Error::Validation; - errorMsg = problem.str(); + error = Error::Validation; + errorMsg = problem.str(); #else - throw ValidationError(problem.str()); + throw ValidationError(problem.str()); #endif + }; + + for (Base *child: Children()) + { + if (child->IsGroup() && !child->Matched()) + { + onValidationError(); } child->Validate(shortprefix, longprefix); @@ -2145,6 +2186,10 @@ namespace args if (subparser != nullptr) { subparser->Validate(shortprefix, longprefix); + if (!subparser->Matched()) + { + onValidationError(); + } } if (selectedCommand == nullptr && commandIsRequired && (Group::HasCommand() || subparserHasCommand)) @@ -2308,7 +2353,7 @@ namespace args while (valueIt != end && values.size() < nargs.max && - (nargs.min == nargs.max || ParseOption(*valueIt) == OptionType::Positional)) + (values.size() < nargs.min || ParseOption(*valueIt) == OptionType::Positional)) { if (Complete(flag, valueIt, end)) { @@ -2697,7 +2742,7 @@ namespace args #endif readCompletion = true; ++it; - size_t argsLeft = std::distance(it, end); + const auto argsLeft = static_cast(std::distance(it, end)); if (completion->cword == 0 || argsLeft <= 1 || completion->cword >= argsLeft) { #ifndef ARGS_NOEXCEPT @@ -2716,13 +2761,15 @@ namespace args if (idx > 0 && curArgs[idx] == "=") { curArgs[idx - 1] += "="; + // Avoid warnings from -Wsign-conversion + const auto signedIdx = static_cast(idx); if (idx + 1 < curArgs.size()) { curArgs[idx - 1] += curArgs[idx + 1]; - curArgs.erase(curArgs.begin() + idx, curArgs.begin() + idx + 2); + curArgs.erase(curArgs.begin() + signedIdx, curArgs.begin() + signedIdx + 2); } else { - curArgs.erase(curArgs.begin() + idx); + curArgs.erase(curArgs.begin() + signedIdx); } } else { @@ -3195,6 +3242,14 @@ namespace args return count; } + int &operator *() noexcept { + return count; + } + + const int &operator *() const noexcept { + return count; + } + virtual void Reset() noexcept override { FlagBase::Reset(); @@ -3251,9 +3306,14 @@ namespace args operator ()(const std::string &name, const std::string &value, T &destination) { std::istringstream ss(value); - ss >> destination >> std::ws; + bool failed = !(ss >> destination); + + if (!failed) + { + ss >> std::ws; + } - if (ss.rdbuf()->in_avail() > 0) + if (ss.rdbuf()->in_avail() > 0 || failed) { #ifdef ARGS_NOEXCEPT (void)name; @@ -3342,6 +3402,34 @@ namespace args return value; } + /** Get the value + */ + T &operator *() noexcept + { + return value; + } + + /** Get the value + */ + const T &operator *() const noexcept + { + return value; + } + + /** Get the value + */ + T *operator ->() noexcept + { + return &value; + } + + /** Get the value + */ + const T *operator ->() const noexcept + { + return &value; + } + /** Get the default value */ const T &GetDefault() noexcept @@ -3407,7 +3495,7 @@ namespace args */ template < typename T, - template class List = std::vector, + template class List = detail::vector, typename Reader = ValueReader> class NargsValueFlag : public FlagBase { @@ -3471,6 +3559,34 @@ namespace args return values; } + /** Get the value + */ + List &operator *() noexcept + { + return values; + } + + /** Get the values + */ + const List &operator *() const noexcept + { + return values; + } + + /** Get the values + */ + List *operator ->() noexcept + { + return &values; + } + + /** Get the values + */ + const List *operator ->() const noexcept + { + return &values; + } + iterator begin() noexcept { return values.begin(); @@ -3527,7 +3643,7 @@ namespace args */ template < typename T, - template class List = std::vector, + template class List = detail::vector, typename Reader = ValueReader> class ValueFlagList : public ValueFlagBase { @@ -3583,6 +3699,34 @@ namespace args return values; } + /** Get the value + */ + Container &operator *() noexcept + { + return values; + } + + /** Get the values + */ + const Container &operator *() const noexcept + { + return values; + } + + /** Get the values + */ + Container *operator ->() noexcept + { + return &values; + } + + /** Get the values + */ + const Container *operator ->() const noexcept + { + return &values; + } + virtual std::string Name() const override { return name + std::string("..."); @@ -3647,7 +3791,7 @@ namespace args typename K, typename T, typename Reader = ValueReader, - template class Map = std::unordered_map> + template class Map = detail::unordered_map> class MapFlag : public ValueFlagBase { private: @@ -3716,6 +3860,34 @@ namespace args return value; } + /** Get the value + */ + T &operator *() noexcept + { + return value; + } + + /** Get the value + */ + const T &operator *() const noexcept + { + return value; + } + + /** Get the value + */ + T *operator ->() noexcept + { + return &value; + } + + /** Get the value + */ + const T *operator ->() const noexcept + { + return &value; + } + virtual void Reset() noexcept override { ValueFlagBase::Reset(); @@ -3734,9 +3906,9 @@ namespace args template < typename K, typename T, - template class List = std::vector, + template class List = detail::vector, typename Reader = ValueReader, - template class Map = std::unordered_map> + template class Map = detail::unordered_map> class MapFlagList : public ValueFlagBase { private: @@ -3810,6 +3982,34 @@ namespace args return values; } + /** Get the value + */ + Container &operator *() noexcept + { + return values; + } + + /** Get the values + */ + const Container &operator *() const noexcept + { + return values; + } + + /** Get the values + */ + Container *operator ->() noexcept + { + return &values; + } + + /** Get the values + */ + const Container *operator ->() const noexcept + { + return &values; + } + virtual std::string Name() const override { return name + std::string("..."); @@ -3910,6 +4110,34 @@ namespace args return value; } + /** Get the value + */ + T &operator *() noexcept + { + return value; + } + + /** Get the value + */ + const T &operator *() const noexcept + { + return value; + } + + /** Get the value + */ + T *operator ->() noexcept + { + return &value; + } + + /** Get the value + */ + const T *operator ->() const noexcept + { + return &value; + } + virtual void Reset() noexcept override { PositionalBase::Reset(); @@ -3925,7 +4153,7 @@ namespace args */ template < typename T, - template class List = std::vector, + template class List = detail::vector, typename Reader = ValueReader> class PositionalList : public PositionalBase { @@ -3987,6 +4215,34 @@ namespace args return values; } + /** Get the value + */ + Container &operator *() noexcept + { + return values; + } + + /** Get the values + */ + const Container &operator *() const noexcept + { + return values; + } + + /** Get the values + */ + Container *operator ->() noexcept + { + return &values; + } + + /** Get the values + */ + const Container *operator ->() const noexcept + { + return &values; + } + virtual void Reset() noexcept override { PositionalBase::Reset(); @@ -4046,7 +4302,7 @@ namespace args typename K, typename T, typename Reader = ValueReader, - template class Map = std::unordered_map> + template class Map = detail::unordered_map> class MapPositional : public PositionalBase { private: @@ -4108,6 +4364,34 @@ namespace args return value; } + /** Get the value + */ + T &operator *() noexcept + { + return value; + } + + /** Get the value + */ + const T &operator *() const noexcept + { + return value; + } + + /** Get the value + */ + T *operator ->() noexcept + { + return &value; + } + + /** Get the value + */ + const T *operator ->() const noexcept + { + return &value; + } + virtual void Reset() noexcept override { PositionalBase::Reset(); @@ -4126,9 +4410,9 @@ namespace args template < typename K, typename T, - template class List = std::vector, + template class List = detail::vector, typename Reader = ValueReader, - template class Map = std::unordered_map> + template class Map = detail::unordered_map> class MapPositionalList : public PositionalBase { private: @@ -4203,6 +4487,34 @@ namespace args return values; } + /** Get the value + */ + Container &operator *() noexcept + { + return values; + } + + /** Get the values + */ + const Container &operator *() const noexcept + { + return values; + } + + /** Get the values + */ + Container *operator ->() noexcept + { + return &values; + } + + /** Get the values + */ + const Container *operator ->() const noexcept + { + return &values; + } + virtual std::string Name() const override { return name + std::string("..."); diff --git a/thirdparty/boost-1_79/boost/archive/archive_exception.hpp b/thirdparty/boost-1_79/boost/archive/archive_exception.hpp new file mode 100644 index 00000000..dd9181c3 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/archive_exception.hpp @@ -0,0 +1,100 @@ +#ifndef BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP +#define BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// archive/archive_exception.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +#include +#include + +// note: the only reason this is in here is that windows header +// includes #define exception_code _exception_code (arrrgghhhh!). +// the most expedient way to address this is be sure that this +// header is always included whenever this header file is included. +#if defined(BOOST_WINDOWS) +#include +#endif + +#include // must be the last header + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by archives +// +class BOOST_SYMBOL_VISIBLE archive_exception : + public virtual std::exception +{ +private: + char m_buffer[128]; +protected: + BOOST_ARCHIVE_DECL unsigned int + append(unsigned int l, const char * a); + BOOST_ARCHIVE_DECL + archive_exception() BOOST_NOEXCEPT; +public: + typedef enum { + no_exception, // initialized without code + other_exception, // any exception not listed below + unregistered_class, // attempt to serialize a pointer of + // an unregistered class + invalid_signature, // first line of archive does not contain + // expected string + unsupported_version,// archive created with library version + // subsequent to this one + pointer_conflict, // an attempt has been made to directly + // serialize an object which has + // already been serialized through a pointer. + // Were this permitted, the archive load would result + // in the creation of an extra copy of the object. + incompatible_native_format, // attempt to read native binary format + // on incompatible platform + array_size_too_short,// array being loaded doesn't fit in array allocated + input_stream_error, // error on input stream + invalid_class_name, // class name greater than the maximum permitted. + // most likely a corrupted archive or an attempt + // to insert virus via buffer overrun method. + unregistered_cast, // base - derived relationship not registered with + // void_cast_register + unsupported_class_version, // type saved with a version # greater than the + // one used by the program. This indicates that the program + // needs to be rebuilt. + multiple_code_instantiation, // code for implementing serialization for some + // type has been instantiated in more than one module. + output_stream_error // error on input stream + } exception_code; + exception_code code; + + BOOST_ARCHIVE_DECL archive_exception( + exception_code c, + const char * e1 = NULL, + const char * e2 = NULL + ) BOOST_NOEXCEPT; + BOOST_ARCHIVE_DECL archive_exception(archive_exception const &) BOOST_NOEXCEPT; + BOOST_ARCHIVE_DECL ~archive_exception() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE; + BOOST_ARCHIVE_DECL const char * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE; +}; + +}// namespace archive +}// namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP diff --git a/thirdparty/boost-1_79/boost/archive/basic_archive.hpp b/thirdparty/boost-1_79/boost/archive/basic_archive.hpp new file mode 100644 index 00000000..381a1275 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/basic_archive.hpp @@ -0,0 +1,274 @@ +#ifndef BOOST_ARCHIVE_BASIC_ARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_ARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_archive.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include // count +#include +#include +#include +#include +#include + +#include +#include // must be the last header + +namespace boost { +namespace archive { + +#if defined(_MSC_VER) +#pragma warning( push ) +#pragma warning( disable : 4244 4267 ) +#endif + +BOOST_ARCHIVE_DECL boost::serialization::library_version_type +BOOST_ARCHIVE_VERSION(); + +// create alias in boost::archive for older user code. +typedef boost::serialization::library_version_type library_version_type; + +class version_type { +private: + typedef uint_least32_t base_type; + base_type t; +public: + // should be private - but MPI fails if it's not!!! + version_type(): t(0) {} + explicit version_type(const unsigned int & t_) : t(t_){ + BOOST_ASSERT(t_ <= boost::integer_traits::const_max); + } + version_type(const version_type & t_) : + t(t_.t) + {} + version_type & operator=(const version_type & rhs){ + t = rhs.t; + return *this; + } + // used for text output + operator base_type () const { + return t; + } + // used for text intput + operator base_type & (){ + return t; + } + bool operator==(const version_type & rhs) const { + return t == rhs.t; + } + bool operator<(const version_type & rhs) const { + return t < rhs.t; + } +}; + +class class_id_type { +private: + typedef int_least16_t base_type; + base_type t; +public: + // should be private - but then can't use BOOST_STRONG_TYPE below + class_id_type() : t(0) {} + explicit class_id_type(const int t_) : t(t_){ + BOOST_ASSERT(t_ <= boost::integer_traits::const_max); + } + explicit class_id_type(const std::size_t t_) : t(t_){ + // BOOST_ASSERT(t_ <= boost::integer_traits::const_max); + } + class_id_type(const class_id_type & t_) : + t(t_.t) + {} + class_id_type & operator=(const class_id_type & rhs){ + t = rhs.t; + return *this; + } + + // used for text output + operator base_type () const { + return t; + } + // used for text input + operator base_type &() { + return t; + } + bool operator==(const class_id_type & rhs) const { + return t == rhs.t; + } + bool operator<(const class_id_type & rhs) const { + return t < rhs.t; + } +}; + +#define BOOST_SERIALIZATION_NULL_POINTER_TAG boost::archive::class_id_type(-1) + +class object_id_type { +private: + typedef uint_least32_t base_type; + base_type t; +public: + object_id_type(): t(0) {} + // note: presumes that size_t >= unsigned int. + // use explicit cast to silence useless warning + explicit object_id_type(const std::size_t & t_) : t(static_cast(t_)){ + // make quadruple sure that we haven't lost any real integer + // precision + BOOST_ASSERT(t_ <= boost::integer_traits::const_max); + } + object_id_type(const object_id_type & t_) : + t(t_.t) + {} + object_id_type & operator=(const object_id_type & rhs){ + t = rhs.t; + return *this; + } + // used for text output + operator base_type () const { + return t; + } + // used for text input + operator base_type & () { + return t; + } + bool operator==(const object_id_type & rhs) const { + return t == rhs.t; + } + bool operator<(const object_id_type & rhs) const { + return t < rhs.t; + } +}; + +#if defined(_MSC_VER) +#pragma warning( pop ) +#endif + +struct tracking_type { + bool t; + explicit tracking_type(const bool t_ = false) + : t(t_) + {} + tracking_type(const tracking_type & t_) + : t(t_.t) + {} + operator bool () const { + return t; + } + operator bool & () { + return t; + } + tracking_type & operator=(const bool t_){ + t = t_; + return *this; + } + bool operator==(const tracking_type & rhs) const { + return t == rhs.t; + } + bool operator==(const bool & rhs) const { + return t == rhs; + } + tracking_type & operator=(const tracking_type & rhs){ + t = rhs.t; + return *this; + } +}; + +struct class_name_type : + private boost::noncopyable +{ + char *t; + operator const char * & () const { + return const_cast(t); + } + operator char * () { + return t; + } + std::size_t size() const { + return std::strlen(t); + } + explicit class_name_type(const char *key_) + : t(const_cast(key_)){} + explicit class_name_type(char *key_) + : t(key_){} + class_name_type & operator=(const class_name_type & rhs){ + t = rhs.t; + return *this; + } +}; + +enum archive_flags { + no_header = 1, // suppress archive header info + no_codecvt = 2, // suppress alteration of codecvt facet + no_xml_tag_checking = 4, // suppress checking of xml tags + no_tracking = 8, // suppress ALL tracking + flags_last = 8 +}; + +BOOST_ARCHIVE_DECL const char * +BOOST_ARCHIVE_SIGNATURE(); + +/* NOTE : Warning : Warning : Warning : Warning : Warning + * If any of these are changed to different sized types, + * binary_iarchive won't be able to read older archives + * unless you rev the library version and include conditional + * code based on the library version. There is nothing + * inherently wrong in doing this - but you have to be super + * careful because it's easy to get wrong and start breaking + * old archives !!! + */ + +#define BOOST_ARCHIVE_STRONG_TYPEDEF(T, D) \ + class D : public T { \ + public: \ + explicit D(const T tt) : T(tt){} \ + }; \ +/**/ + +BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_reference_type) +BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_optional_type) +BOOST_ARCHIVE_STRONG_TYPEDEF(object_id_type, object_reference_type) + +}// namespace archive +}// namespace boost + +#include // pops abi_suffix.hpp pragmas + +#include + +// set implementation level to primitive for all types +// used internally by the serialization library + +BOOST_CLASS_IMPLEMENTATION(boost::serialization::library_version_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::version_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_reference_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_optional_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::class_name_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::object_id_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::object_reference_type, primitive_type) +BOOST_CLASS_IMPLEMENTATION(boost::archive::tracking_type, primitive_type) + +#include + +// set types used internally by the serialization library +// to be bitwise serializable + +BOOST_IS_BITWISE_SERIALIZABLE(boost::serialization::library_version_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::version_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_id_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_id_reference_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_id_optional_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_name_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::object_id_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::object_reference_type) +BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::tracking_type) + +#endif //BOOST_ARCHIVE_BASIC_ARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/basic_binary_iarchive.hpp b/thirdparty/boost-1_79/boost/archive/basic_binary_iarchive.hpp new file mode 100644 index 00000000..2ec90ce0 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/basic_binary_iarchive.hpp @@ -0,0 +1,217 @@ +#ifndef BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_iarchive.hpp +// +// archives stored as native binary - this should be the fastest way +// to archive the state of a group of obects. It makes no attempt to +// convert to any canonical form. + +// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE +// ON PLATFORM APART FROM THE ONE THEY ARE CREATED ON + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +#include // must be the last header + +namespace boost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +///////////////////////////////////////////////////////////////////////// +// class basic_binary_iarchive - read serialized objects from a input binary stream +template +class BOOST_SYMBOL_VISIBLE basic_binary_iarchive : + public detail::common_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive; + #else + friend class detail::interface_iarchive; + #endif +#endif + // intermediate level to support override of operators + // fot templates in the absence of partial function + // template ordering. If we get here pass to base class + // note extra nonsense to sneak it pass the borland compiers + typedef detail::common_iarchive detail_common_iarchive; + template + void load_override(T & t){ + this->detail_common_iarchive::load_override(t); + } + + // include these to trap a change in binary format which + // isn't specifically handled + // upto 32K classes + BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t)); + BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t)); + // upto 2G objects + BOOST_STATIC_ASSERT(sizeof(object_id_type) == sizeof(uint_least32_t)); + BOOST_STATIC_ASSERT(sizeof(object_reference_type) == sizeof(uint_least32_t)); + + // binary files don't include the optional information + void load_override(class_id_optional_type & /* t */){} + + void load_override(tracking_type & t, int /*version*/){ + boost::serialization::library_version_type lv = this->get_library_version(); + if(boost::serialization::library_version_type(6) < lv){ + int_least8_t x=0; + * this->This() >> x; + t = boost::archive::tracking_type(x); + } + else{ + bool x=0; + * this->This() >> x; + t = boost::archive::tracking_type(x); + } + } + void load_override(class_id_type & t){ + boost::serialization::library_version_type lv = this->get_library_version(); + /* + * library versions: + * boost 1.39 -> 5 + * boost 1.43 -> 7 + * boost 1.47 -> 9 + * + * + * 1) in boost 1.43 and inferior, class_id_type is always a 16bit value, with no check on the library version + * --> this means all archives with version v <= 7 are written with a 16bit class_id_type + * 2) in boost 1.44 this load_override has disappeared (and thus boost 1.44 is not backward compatible at all !!) + * 3) recent boosts reintroduced load_override with a test on the version : + * - v > 7 : this->detail_common_iarchive::load_override(t, version) + * - v > 6 : 16bit + * - other : 32bit + * --> which is obviously incorrect, see point 1 + * + * the fix here decodes class_id_type on 16bit for all v <= 7, which seems to be the correct behaviour ... + */ + if(boost::serialization::library_version_type (7) < lv){ + this->detail_common_iarchive::load_override(t); + } + else{ + int_least16_t x=0; + * this->This() >> x; + t = boost::archive::class_id_type(x); + } + } + void load_override(class_id_reference_type & t){ + load_override(static_cast(t)); + } + + void load_override(version_type & t){ + boost::serialization::library_version_type lv = this->get_library_version(); + if(boost::serialization::library_version_type(7) < lv){ + this->detail_common_iarchive::load_override(t); + } + else + if(boost::serialization::library_version_type(6) < lv){ + uint_least8_t x=0; + * this->This() >> x; + t = boost::archive::version_type(x); + } + else + if(boost::serialization::library_version_type(5) < lv){ + uint_least16_t x=0; + * this->This() >> x; + t = boost::archive::version_type(x); + } + else + if(boost::serialization::library_version_type(2) < lv){ + // upto 255 versions + unsigned char x=0; + * this->This() >> x; + t = version_type(x); + } + else{ + unsigned int x=0; + * this->This() >> x; + t = boost::archive::version_type(x); + } + } + + void load_override(boost::serialization::item_version_type & t){ + boost::serialization::library_version_type lv = this->get_library_version(); +// if(boost::serialization::library_version_type(7) < lvt){ + if(boost::serialization::library_version_type(6) < lv){ + this->detail_common_iarchive::load_override(t); + } + else + if(boost::serialization::library_version_type(6) < lv){ + uint_least16_t x=0; + * this->This() >> x; + t = boost::serialization::item_version_type(x); + } + else{ + unsigned int x=0; + * this->This() >> x; + t = boost::serialization::item_version_type(x); + } + } + + void load_override(serialization::collection_size_type & t){ + if(boost::serialization::library_version_type(5) < this->get_library_version()){ + this->detail_common_iarchive::load_override(t); + } + else{ + unsigned int x=0; + * this->This() >> x; + t = serialization::collection_size_type(x); + } + } + + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load_override(class_name_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + init(); + + basic_binary_iarchive(unsigned int flags) : + detail::common_iarchive(flags) + {} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/basic_binary_iprimitive.hpp b/thirdparty/boost-1_79/boost/archive/basic_binary_iprimitive.hpp new file mode 100644 index 00000000..a2902407 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/basic_binary_iprimitive.hpp @@ -0,0 +1,197 @@ +#ifndef BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP +#define BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +#if defined(_MSC_VER) +#pragma warning( disable : 4800 ) +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_iprimitive.hpp +// +// archives stored as native binary - this should be the fastest way +// to archive the state of a group of obects. It makes no attempt to +// convert to any canonical form. + +// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE +// ON PLATFORM APART FROM THE ONE THEY ARE CREATED ON + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include +#include // std::memcpy +#include // std::size_t +#include // basic_streambuf +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////////// +// class binary_iarchive - read serialized objects from a input binary stream +template +class BOOST_SYMBOL_VISIBLE basic_binary_iprimitive { +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + friend class load_access; +protected: +#else +public: +#endif + std::basic_streambuf & m_sb; + // return a pointer to the most derived class + Archive * This(){ + return static_cast(this); + } + + #ifndef BOOST_NO_STD_LOCALE + // note order! - if you change this, libstd++ will fail! + // a) create new locale with new codecvt facet + // b) save current locale + // c) change locale to new one + // d) use stream buffer + // e) change locale back to original + // f) destroy new codecvt facet + boost::archive::codecvt_null codecvt_null_facet; + basic_streambuf_locale_saver locale_saver; + std::locale archive_locale; + #endif + + // main template for serilization of primitive types + template + void load(T & t){ + load_binary(& t, sizeof(T)); + } + + ///////////////////////////////////////////////////////// + // fundamental types that need special treatment + + // trap usage of invalid uninitialized boolean + void load(bool & t){ + load_binary(& t, sizeof(t)); + int i = t; + BOOST_ASSERT(0 == i || 1 == i); + (void)i; // warning suppression for release builds. + } + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load(std::wstring &ws); + #endif + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load(char * t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load(wchar_t * t); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + init(); + BOOST_ARCHIVE_OR_WARCHIVE_DECL + basic_binary_iprimitive( + std::basic_streambuf & sb, + bool no_codecvt + ); + BOOST_ARCHIVE_OR_WARCHIVE_DECL + ~basic_binary_iprimitive(); +public: + // we provide an optimized load for all fundamental types + // typedef serialization::is_bitwise_serializable + // use_array_optimization; + struct use_array_optimization { + template + #if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS) + struct apply { + typedef typename boost::serialization::is_bitwise_serializable< T >::type type; + }; + #else + struct apply : public boost::serialization::is_bitwise_serializable< T > {}; + #endif + }; + + // the optimized load_array dispatches to load_binary + template + void load_array(serialization::array_wrapper& a, unsigned int) + { + load_binary(a.address(),a.count()*sizeof(ValueType)); + } + + void + load_binary(void *address, std::size_t count); +}; + +template +inline void +basic_binary_iprimitive::load_binary( + void *address, + std::size_t count +){ + // note: an optimizer should eliminate the following for char files + BOOST_ASSERT( + static_cast(count / sizeof(Elem)) + <= boost::integer_traits::const_max + ); + std::streamsize s = static_cast(count / sizeof(Elem)); + std::streamsize scount = m_sb.sgetn( + static_cast(address), + s + ); + if(scount != s) + boost::serialization::throw_exception( + archive_exception(archive_exception::input_stream_error) + ); + // note: an optimizer should eliminate the following for char files + BOOST_ASSERT(count % sizeof(Elem) <= boost::integer_traits::const_max); + s = static_cast(count % sizeof(Elem)); + if(0 < s){ +// if(is.fail()) +// boost::serialization::throw_exception( +// archive_exception(archive_exception::stream_error) +// ); + Elem t; + scount = m_sb.sgetn(& t, 1); + if(scount != 1) + boost::serialization::throw_exception( + archive_exception(archive_exception::input_stream_error) + ); + std::memcpy(static_cast(address) + (count - s), &t, static_cast(s)); + } +} + +} // namespace archive +} // namespace boost + +#include // pop pragmas + +#endif // BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/basic_binary_oarchive.hpp b/thirdparty/boost-1_79/boost/archive/basic_binary_oarchive.hpp new file mode 100644 index 00000000..61bd8faa --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/basic_binary_oarchive.hpp @@ -0,0 +1,185 @@ +#ifndef BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// archives stored as native binary - this should be the fastest way +// to archive the state of a group of obects. It makes no attempt to +// convert to any canonical form. + +// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE +// ON PLATFORM APART FROM THE ONE THEY ARE CREATE ON + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +////////////////////////////////////////////////////////////////////// +// class basic_binary_oarchive - write serialized objects to a binary output stream +// note: this archive has no pretensions to portability. Archive format +// may vary across machine architectures and compilers. About the only +// guarentee is that an archive created with this code will be readable +// by a program built with the same tools for the same machne. This class +// does have the virtue of buiding the smalles archive in the minimum amount +// of time. So under some circumstances it may be he right choice. +template +class BOOST_SYMBOL_VISIBLE basic_binary_oarchive : + public detail::common_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; + #else + friend class detail::interface_oarchive; + #endif +#endif + // any datatype not specifed below will be handled by base class + typedef detail::common_oarchive detail_common_oarchive; + template + void save_override(const T & t){ + this->detail_common_oarchive::save_override(t); + } + + // include these to trap a change in binary format which + // isn't specifically handled + BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(bool)); + // upto 32K classes + BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t)); + BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t)); + // upto 2G objects + BOOST_STATIC_ASSERT(sizeof(object_id_type) == sizeof(uint_least32_t)); + BOOST_STATIC_ASSERT(sizeof(object_reference_type) == sizeof(uint_least32_t)); + + // binary files don't include the optional information + void save_override(const class_id_optional_type & /* t */){} + + // enable this if we decide to support generation of previous versions + #if 0 + void save_override(const boost::archive::version_type & t){ + library_version_type lvt = this->get_library_version(); + if(boost::serialization::library_version_type(7) < lvt){ + this->detail_common_oarchive::save_override(t); + } + else + if(boost::serialization::library_version_type(6) < lvt){ + const boost::uint_least16_t x = t; + * this->This() << x; + } + else{ + const unsigned int x = t; + * this->This() << x; + } + } + void save_override(const boost::serialization::item_version_type & t){ + library_version_type lvt = this->get_library_version(); + if(boost::serialization::library_version_type(7) < lvt){ + this->detail_common_oarchive::save_override(t); + } + else + if(boost::serialization::library_version_type(6) < lvt){ + const boost::uint_least16_t x = t; + * this->This() << x; + } + else{ + const unsigned int x = t; + * this->This() << x; + } + } + + void save_override(class_id_type & t){ + library_version_type lvt = this->get_library_version(); + if(boost::serialization::library_version_type(7) < lvt){ + this->detail_common_oarchive::save_override(t); + } + else + if(boost::serialization::library_version_type(6) < lvt){ + const boost::int_least16_t x = t; + * this->This() << x; + } + else{ + const int x = t; + * this->This() << x; + } + } + void save_override(class_id_reference_type & t){ + save_override(static_cast(t)); + } + + #endif + + // explicitly convert to char * to avoid compile ambiguities + void save_override(const class_name_type & t){ + const std::string s(t); + * this->This() << s; + } + + #if 0 + void save_override(const serialization::collection_size_type & t){ + if (get_library_version() < boost::serialization::library_version_type(6)){ + unsigned int x=0; + * this->This() >> x; + t = serialization::collection_size_type(x); + } + else{ + * this->This() >> t; + } + } + #endif + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + init(); + + basic_binary_oarchive(unsigned int flags) : + detail::common_oarchive(flags) + {} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/basic_binary_oprimitive.hpp b/thirdparty/boost-1_79/boost/archive/basic_binary_oprimitive.hpp new file mode 100644 index 00000000..6c5e8e5e --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/basic_binary_oprimitive.hpp @@ -0,0 +1,187 @@ +#ifndef BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP +#define BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_oprimitive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// archives stored as native binary - this should be the fastest way +// to archive the state of a group of obects. It makes no attempt to +// convert to any canonical form. + +// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE +// ON PLATFORM APART FROM THE ONE THEY ARE CREATE ON + +#include +#include +#include +#include // basic_streambuf +#include +#include // size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class basic_binary_oprimitive - binary output of prmitives + +template +class BOOST_SYMBOL_VISIBLE basic_binary_oprimitive { +#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS + friend class save_access; +protected: +#else +public: +#endif + std::basic_streambuf & m_sb; + // return a pointer to the most derived class + Archive * This(){ + return static_cast(this); + } + #ifndef BOOST_NO_STD_LOCALE + // note order! - if you change this, libstd++ will fail! + // a) create new locale with new codecvt facet + // b) save current locale + // c) change locale to new one + // d) use stream buffer + // e) change locale back to original + // f) destroy new codecvt facet + boost::archive::codecvt_null codecvt_null_facet; + basic_streambuf_locale_saver locale_saver; + std::locale archive_locale; + #endif + // default saving of primitives. + template + void save(const T & t) + { + save_binary(& t, sizeof(T)); + } + + ///////////////////////////////////////////////////////// + // fundamental types that need special treatment + + // trap usage of invalid uninitialized boolean which would + // otherwise crash on load. + void save(const bool t){ + BOOST_ASSERT(0 == static_cast(t) || 1 == static_cast(t)); + save_binary(& t, sizeof(t)); + } + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save(const std::wstring &ws); + #endif + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save(const char * t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save(const wchar_t * t); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + init(); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL + basic_binary_oprimitive( + std::basic_streambuf & sb, + bool no_codecvt + ); + BOOST_ARCHIVE_OR_WARCHIVE_DECL + ~basic_binary_oprimitive(); +public: + + // we provide an optimized save for all fundamental types + // typedef serialization::is_bitwise_serializable + // use_array_optimization; + // workaround without using mpl lambdas + struct use_array_optimization { + template + #if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS) + struct apply { + typedef typename boost::serialization::is_bitwise_serializable< T >::type type; + }; + #else + struct apply : public boost::serialization::is_bitwise_serializable< T > {}; + #endif + }; + + // the optimized save_array dispatches to save_binary + template + void save_array(boost::serialization::array_wrapper const& a, unsigned int) + { + save_binary(a.address(),a.count()*sizeof(ValueType)); + } + + void save_binary(const void *address, std::size_t count); +}; + +template +inline void +basic_binary_oprimitive::save_binary( + const void *address, + std::size_t count +){ + // BOOST_ASSERT(count <= std::size_t(boost::integer_traits::const_max)); + // note: if the following assertions fail + // a likely cause is that the output stream is set to "text" + // mode where by cr characters recieve special treatment. + // be sure that the output stream is opened with ios::binary + //if(os.fail()) + // boost::serialization::throw_exception( + // archive_exception(archive_exception::output_stream_error) + // ); + // figure number of elements to output - round up + count = ( count + sizeof(Elem) - 1) / sizeof(Elem); + std::streamsize scount = m_sb.sputn( + static_cast(address), + static_cast(count) + ); + if(count != static_cast(scount)) + boost::serialization::throw_exception( + archive_exception(archive_exception::output_stream_error) + ); + //os.write( + // static_cast(address), + // count + //); + //BOOST_ASSERT(os.good()); +} + +} //namespace boost +} //namespace archive + +#include // pop pragmas + +#endif // BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/basic_streambuf_locale_saver.hpp b/thirdparty/boost-1_79/boost/archive/basic_streambuf_locale_saver.hpp new file mode 100644 index 00000000..5cd4b36f --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/basic_streambuf_locale_saver.hpp @@ -0,0 +1,108 @@ +#ifndef BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP +#define BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_streambuf_locale_saver.hpp + +// (C) Copyright 2005 Robert Ramey - http://www.rrsd.com + +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// note derived from boost/io/ios_state.hpp +// Copyright 2002, 2005 Daryle Walker. Use, modification, and distribution +// are subject to the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or a copy at .) + +// See for the library's home page. + +#ifndef BOOST_NO_STD_LOCALE + +#include // for std::locale +#include +#include // for std::basic_streambuf + +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost{ +namespace archive{ + +template < typename Ch, class Tr > +class basic_streambuf_locale_saver : + private boost::noncopyable +{ +public: + explicit basic_streambuf_locale_saver(std::basic_streambuf &s) : + m_streambuf(s), + m_locale(s.getloc()) + {} + ~basic_streambuf_locale_saver(){ + m_streambuf.pubsync(); + m_streambuf.pubimbue(m_locale); + } +private: + std::basic_streambuf & m_streambuf; + std::locale const m_locale; +}; + +template < typename Ch, class Tr > +class basic_istream_locale_saver : + private boost::noncopyable +{ +public: + explicit basic_istream_locale_saver(std::basic_istream &s) : + m_istream(s), + m_locale(s.getloc()) + {} + ~basic_istream_locale_saver(){ + // libstdc++ crashes without this + m_istream.sync(); + m_istream.imbue(m_locale); + } +private: + std::basic_istream & m_istream; + std::locale const m_locale; +}; + +template < typename Ch, class Tr > +class basic_ostream_locale_saver : + private boost::noncopyable +{ +public: + explicit basic_ostream_locale_saver(std::basic_ostream &s) : + m_ostream(s), + m_locale(s.getloc()) + {} + ~basic_ostream_locale_saver(){ + m_ostream.flush(); + m_ostream.imbue(m_locale); + } +private: + std::basic_ostream & m_ostream; + std::locale const m_locale; +}; + + +} // archive +} // boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_NO_STD_LOCALE +#endif // BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP diff --git a/thirdparty/boost-1_79/boost/archive/basic_text_iarchive.hpp b/thirdparty/boost-1_79/boost/archive/basic_text_iarchive.hpp new file mode 100644 index 00000000..d58540d8 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/basic_text_iarchive.hpp @@ -0,0 +1,96 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// archives stored as text - note these ar templated on the basic +// stream templates to accommodate wide (and other?) kind of characters +// +// note the fact that on libraries without wide characters, ostream is +// is not a specialization of basic_ostream which in fact is not defined +// in such cases. So we can't use basic_istream but rather +// use two template parameters + +#include +#include + +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +///////////////////////////////////////////////////////////////////////// +// class basic_text_iarchive - read serialized objects from a input text stream +template +class BOOST_SYMBOL_VISIBLE basic_text_iarchive : + public detail::common_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile error + // on msvc 7.1 + friend detail::interface_iarchive; + #else + friend class detail::interface_iarchive; + #endif +#endif + // intermediate level to support override of operators + // fot templates in the absence of partial function + // template ordering + typedef detail::common_iarchive detail_common_iarchive; + template + void load_override(T & t){ + this->detail_common_iarchive::load_override(t); + } + // text file don't include the optional information + void load_override(class_id_optional_type & /*t*/){} + + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load_override(class_name_type & t); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + init(); + + basic_text_iarchive(unsigned int flags) : + detail::common_iarchive(flags) + {} + ~basic_text_iarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/basic_text_iprimitive.hpp b/thirdparty/boost-1_79/boost/archive/basic_text_iprimitive.hpp new file mode 100644 index 00000000..606f59f5 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/basic_text_iprimitive.hpp @@ -0,0 +1,142 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_iprimitive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// archives stored as text - note these are templated on the basic +// stream templates to accommodate wide (and other?) kind of characters +// +// Note the fact that on libraries without wide characters, ostream is +// not a specialization of basic_ostream which in fact is not defined +// in such cases. So we can't use basic_ostream but rather +// use two template parameters + +#include +#include // size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; + #if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT) + using ::locale; + #endif +} // namespace std +#endif + +#include +#include + +#include +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#endif +#include +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class basic_text_iarchive - load serialized objects from a input text stream +#if defined(_MSC_VER) +#pragma warning( push ) +#pragma warning( disable : 4244 4267 ) +#endif + +template +class BOOST_SYMBOL_VISIBLE basic_text_iprimitive { +protected: + IStream &is; + io::ios_flags_saver flags_saver; + io::ios_precision_saver precision_saver; + + #ifndef BOOST_NO_STD_LOCALE + // note order! - if you change this, libstd++ will fail! + // a) create new locale with new codecvt facet + // b) save current locale + // c) change locale to new one + // d) use stream buffer + // e) change locale back to original + // f) destroy new codecvt facet + boost::archive::codecvt_null codecvt_null_facet; + std::locale archive_locale; + basic_istream_locale_saver< + typename IStream::char_type, + typename IStream::traits_type + > locale_saver; + #endif + + template + void load(T & t) + { + if(is >> t) + return; + boost::serialization::throw_exception( + archive_exception(archive_exception::input_stream_error) + ); + } + + void load(char & t) + { + short int i; + load(i); + t = i; + } + void load(signed char & t) + { + short int i; + load(i); + t = i; + } + void load(unsigned char & t) + { + unsigned short int i; + load(i); + t = i; + } + + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + void load(wchar_t & t) + { + BOOST_STATIC_ASSERT(sizeof(wchar_t) <= sizeof(int)); + int i; + load(i); + t = i; + } + #endif + BOOST_ARCHIVE_OR_WARCHIVE_DECL + basic_text_iprimitive(IStream &is, bool no_codecvt); + BOOST_ARCHIVE_OR_WARCHIVE_DECL + ~basic_text_iprimitive(); +public: + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load_binary(void *address, std::size_t count); +}; + +#if defined(_MSC_VER) +#pragma warning( pop ) +#endif + +} // namespace archive +} // namespace boost + +#include // pop pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/basic_text_oarchive.hpp b/thirdparty/boost-1_79/boost/archive/basic_text_oarchive.hpp new file mode 100644 index 00000000..37ce33d7 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/basic_text_oarchive.hpp @@ -0,0 +1,119 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// archives stored as text - note these ar templated on the basic +// stream templates to accommodate wide (and other?) kind of characters +// +// note the fact that on libraries without wide characters, ostream is +// is not a specialization of basic_ostream which in fact is not defined +// in such cases. So we can't use basic_ostream but rather +// use two template parameters + +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +///////////////////////////////////////////////////////////////////////// +// class basic_text_oarchive +template +class BOOST_SYMBOL_VISIBLE basic_text_oarchive : + public detail::common_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; + #else + friend class detail::interface_oarchive; + #endif +#endif + + enum { + none, + eol, + space + } delimiter; + + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + newtoken(); + + void newline(){ + delimiter = eol; + } + + // default processing - kick back to base class. Note the + // extra stuff to get it passed borland compilers + typedef detail::common_oarchive detail_common_oarchive; + template + void save_override(T & t){ + this->detail_common_oarchive::save_override(t); + } + + // start new objects on a new line + void save_override(const object_id_type & t){ + this->This()->newline(); + this->detail_common_oarchive::save_override(t); + } + + // text file don't include the optional information + void save_override(const class_id_optional_type & /* t */){} + + void save_override(const class_name_type & t){ + const std::string s(t); + * this->This() << s; + } + + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + init(); + + basic_text_oarchive(unsigned int flags) : + detail::common_oarchive(flags), + delimiter(none) + {} + ~basic_text_oarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/basic_text_oprimitive.hpp b/thirdparty/boost-1_79/boost/archive/basic_text_oprimitive.hpp new file mode 100644 index 00000000..adc0e896 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/basic_text_oprimitive.hpp @@ -0,0 +1,210 @@ +#ifndef BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP +#define BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_oprimitive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// archives stored as text - note these ar templated on the basic +// stream templates to accommodate wide (and other?) kind of characters +// +// note the fact that on libraries without wide characters, ostream is +// is not a specialization of basic_ostream which in fact is not defined +// in such cases. So we can't use basic_ostream but rather +// use two template parameters + +#include +#include +#include // size_t + +#include +#include +#include + +#include +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#endif + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; + #if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT) + using ::locale; + #endif +} // namespace std +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace archive { + +///////////////////////////////////////////////////////////////////////// +// class basic_text_oprimitive - output of prmitives to stream +template +class BOOST_SYMBOL_VISIBLE basic_text_oprimitive +{ +protected: + OStream &os; + io::ios_flags_saver flags_saver; + io::ios_precision_saver precision_saver; + + #ifndef BOOST_NO_STD_LOCALE + // note order! - if you change this, libstd++ will fail! + // a) create new locale with new codecvt facet + // b) save current locale + // c) change locale to new one + // d) use stream buffer + // e) change locale back to original + // f) destroy new codecvt facet + boost::archive::codecvt_null codecvt_null_facet; + std::locale archive_locale; + basic_ostream_locale_saver< + typename OStream::char_type, + typename OStream::traits_type + > locale_saver; + #endif + + ///////////////////////////////////////////////////////// + // fundamental types that need special treatment + void save(const bool t){ + // trap usage of invalid uninitialized boolean which would + // otherwise crash on load. + BOOST_ASSERT(0 == static_cast(t) || 1 == static_cast(t)); + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::output_stream_error) + ); + os << t; + } + void save(const signed char t) + { + save(static_cast(t)); + } + void save(const unsigned char t) + { + save(static_cast(t)); + } + void save(const char t) + { + save(static_cast(t)); + } + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + void save(const wchar_t t) + { + BOOST_STATIC_ASSERT(sizeof(wchar_t) <= sizeof(int)); + save(static_cast(t)); + } + #endif + + ///////////////////////////////////////////////////////// + // saving of any types not listed above + + template + void save_impl(const T &t, boost::mpl::bool_ &){ + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::output_stream_error) + ); + os << t; + } + + ///////////////////////////////////////////////////////// + // floating point types need even more special treatment + // the following determines whether the type T is some sort + // of floating point type. Note that we then assume that + // the stream << operator is defined on that type - if not + // we'll get a compile time error. This is meant to automatically + // support synthesized types which support floating point + // operations. Also it should handle compiler dependent types + // such long double. Due to John Maddock. + + template + struct is_float { + typedef typename mpl::bool_< + boost::is_floating_point::value + || (std::numeric_limits::is_specialized + && !std::numeric_limits::is_integer + && !std::numeric_limits::is_exact + && std::numeric_limits::max_exponent) + >::type type; + }; + + template + void save_impl(const T &t, boost::mpl::bool_ &){ + // must be a user mistake - can't serialize un-initialized data + if(os.fail()){ + boost::serialization::throw_exception( + archive_exception(archive_exception::output_stream_error) + ); + } + // The formulae for the number of decimla digits required is given in + // http://www2.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf + // which is derived from Kahan's paper: + // www.eecs.berkeley.edu/~wkahan/ieee754status/ieee754.ps + // const unsigned int digits = (std::numeric_limits::digits * 3010) / 10000; + // note: I've commented out the above because I didn't get good results. e.g. + // in one case I got a difference of 19 units. + #ifndef BOOST_NO_CXX11_NUMERIC_LIMITS + const unsigned int digits = std::numeric_limits::max_digits10; + #else + const unsigned int digits = std::numeric_limits::digits10 + 2; + #endif + os << std::setprecision(digits) << std::scientific << t; + } + + template + void save(const T & t){ + typename is_float::type tf; + save_impl(t, tf); + } + + BOOST_ARCHIVE_OR_WARCHIVE_DECL + basic_text_oprimitive(OStream & os, bool no_codecvt); + BOOST_ARCHIVE_OR_WARCHIVE_DECL + ~basic_text_oprimitive(); +public: + // unformatted append of one character + void put(typename OStream::char_type c){ + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::output_stream_error) + ); + os.put(c); + } + // unformatted append of null terminated string + void put(const char * s){ + while('\0' != *s) + os.put(*s++); + } + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_binary(const void *address, std::size_t count); +}; + +} //namespace boost +} //namespace archive + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/basic_xml_archive.hpp b/thirdparty/boost-1_79/boost/archive/basic_xml_archive.hpp new file mode 100644 index 00000000..546610fa --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/basic_xml_archive.hpp @@ -0,0 +1,67 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_archive.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#include // must be the last header + +namespace boost { +namespace archive { + +// constant strings used in xml i/o + +extern +BOOST_ARCHIVE_DECL const char * +BOOST_ARCHIVE_XML_OBJECT_ID(); + +extern +BOOST_ARCHIVE_DECL const char * +BOOST_ARCHIVE_XML_OBJECT_REFERENCE(); + +extern +BOOST_ARCHIVE_DECL const char * +BOOST_ARCHIVE_XML_CLASS_ID(); + +extern +BOOST_ARCHIVE_DECL const char * +BOOST_ARCHIVE_XML_CLASS_ID_REFERENCE(); + +extern +BOOST_ARCHIVE_DECL const char * +BOOST_ARCHIVE_XML_CLASS_NAME(); + +extern +BOOST_ARCHIVE_DECL const char * +BOOST_ARCHIVE_XML_TRACKING(); + +extern +BOOST_ARCHIVE_DECL const char * +BOOST_ARCHIVE_XML_VERSION(); + +extern +BOOST_ARCHIVE_DECL const char * +BOOST_ARCHIVE_XML_SIGNATURE(); + +}// namespace archive +}// namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP + diff --git a/thirdparty/boost-1_79/boost/archive/basic_xml_iarchive.hpp b/thirdparty/boost-1_79/boost/archive/basic_xml_iarchive.hpp new file mode 100644 index 00000000..84c1532f --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/basic_xml_iarchive.hpp @@ -0,0 +1,119 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include + +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +///////////////////////////////////////////////////////////////////////// +// class basic_xml_iarchive - read serialized objects from a input text stream +template +class BOOST_SYMBOL_VISIBLE basic_xml_iarchive : + public detail::common_iarchive +{ + unsigned int depth; +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + friend class detail::interface_iarchive; +#endif + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load_start(const char *name); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load_end(const char *name); + + // Anything not an attribute and not a name-value pair is an + // should be trapped here. + template + void load_override(T & t) + { + // If your program fails to compile here, its most likely due to + // not specifying an nvp wrapper around the variable to + // be serialized. + BOOST_MPL_ASSERT((serialization::is_wrapper< T >)); + this->detail_common_iarchive::load_override(t); + } + + // Anything not an attribute - see below - should be a name value + // pair and be processed here + typedef detail::common_iarchive detail_common_iarchive; + template + void load_override( + const boost::serialization::nvp< T > & t + ){ + this->This()->load_start(t.name()); + this->detail_common_iarchive::load_override(t.value()); + this->This()->load_end(t.name()); + } + + // specific overrides for attributes - handle as + // primitives. These are not name-value pairs + // so they have to be intercepted here and passed on to load. + // although the class_id is included in the xml text file in order + // to make the file self describing, it isn't used when loading + // an xml archive. So we can skip it here. Note: we MUST override + // it otherwise it will be loaded as a normal primitive w/o tag and + // leaving the archive in an undetermined state + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load_override(class_id_type & t); + void load_override(class_id_optional_type & /* t */){} + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load_override(object_id_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load_override(version_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + load_override(tracking_type & t); + // class_name_type can't be handled here as it depends upon the + // char type used by the stream. So require the derived implementation + // handle this. + // void load_override(class_name_type & t); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL + basic_xml_iarchive(unsigned int flags); + BOOST_ARCHIVE_OR_WARCHIVE_DECL + ~basic_xml_iarchive() BOOST_OVERRIDE; +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/basic_xml_oarchive.hpp b/thirdparty/boost-1_79/boost/archive/basic_xml_oarchive.hpp new file mode 100644 index 00000000..b2b19cad --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/basic_xml_oarchive.hpp @@ -0,0 +1,138 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include + +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +////////////////////////////////////////////////////////////////////// +// class basic_xml_oarchive - write serialized objects to a xml output stream +template +class BOOST_SYMBOL_VISIBLE basic_xml_oarchive : + public detail::common_oarchive +{ + // special stuff for xml output + unsigned int depth; + bool pending_preamble; +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + friend class detail::interface_oarchive; +#endif + bool indent_next; + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + indent(); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + init(); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + windup(); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + write_attribute( + const char *attribute_name, + int t, + const char *conjunction = "=\"" + ); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + write_attribute( + const char *attribute_name, + const char *key + ); + // helpers used below + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_start(const char *name); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_end(const char *name); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + end_preamble(); + + // Anything not an attribute and not a name-value pair is an + // error and should be trapped here. + template + void save_override(T & t) + { + // If your program fails to compile here, its most likely due to + // not specifying an nvp wrapper around the variable to + // be serialized. + BOOST_MPL_ASSERT((serialization::is_wrapper< T >)); + this->detail_common_oarchive::save_override(t); + } + + // special treatment for name-value pairs. + typedef detail::common_oarchive detail_common_oarchive; + template + void save_override( + const ::boost::serialization::nvp< T > & t + ){ + this->This()->save_start(t.name()); + this->detail_common_oarchive::save_override(t.const_value()); + this->This()->save_end(t.name()); + } + + // specific overrides for attributes - not name value pairs so we + // want to trap them before the above "fall through" + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const class_id_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const class_id_optional_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const class_id_reference_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const object_id_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const object_reference_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const version_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const class_name_type & t); + BOOST_ARCHIVE_OR_WARCHIVE_DECL void + save_override(const tracking_type & t); + + BOOST_ARCHIVE_OR_WARCHIVE_DECL + basic_xml_oarchive(unsigned int flags); + BOOST_ARCHIVE_OR_WARCHIVE_DECL + ~basic_xml_oarchive() BOOST_OVERRIDE; +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/binary_iarchive.hpp b/thirdparty/boost-1_79/boost/archive/binary_iarchive.hpp new file mode 100644 index 00000000..5052631a --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/binary_iarchive.hpp @@ -0,0 +1,68 @@ +#ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from binary_iarchive_impl instead. This will +// preserve correct static polymorphism. +class BOOST_SYMBOL_VISIBLE binary_iarchive : + public binary_iarchive_impl< + boost::archive::binary_iarchive, + std::istream::char_type, + std::istream::traits_type + >{ +public: + binary_iarchive(std::istream & is, unsigned int flags = 0) : + binary_iarchive_impl< + binary_iarchive, std::istream::char_type, std::istream::traits_type + >(is, flags) + { + init(flags); + } + binary_iarchive(std::streambuf & bsb, unsigned int flags = 0) : + binary_iarchive_impl< + binary_iarchive, std::istream::char_type, std::istream::traits_type + >(bsb, flags) + { + init(flags); + } +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_iarchive) +BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::archive::binary_iarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/binary_iarchive_impl.hpp b/thirdparty/boost-1_79/boost/archive/binary_iarchive_impl.hpp new file mode 100644 index 00000000..8e97ad12 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/binary_iarchive_impl.hpp @@ -0,0 +1,101 @@ +#ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP +#define BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_iarchive_impl.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +template +class BOOST_SYMBOL_VISIBLE binary_iarchive_impl : + public basic_binary_iprimitive, + public basic_binary_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive; + friend basic_binary_iarchive; + friend load_access; + #else + friend class detail::interface_iarchive; + friend class basic_binary_iarchive; + friend class load_access; + #endif +#endif + template + void load_override(T & t){ + this->basic_binary_iarchive::load_override(t); + } + void init(unsigned int flags){ + if(0 != (flags & no_header)){ + return; + } + #if ! defined(__MWERKS__) + this->basic_binary_iarchive::init(); + this->basic_binary_iprimitive::init(); + #else + basic_binary_iarchive::init(); + basic_binary_iprimitive::init(); + #endif + } + binary_iarchive_impl( + std::basic_streambuf & bsb, + unsigned int flags + ) : + basic_binary_iprimitive( + bsb, + 0 != (flags & no_codecvt) + ), + basic_binary_iarchive(flags) + {} + binary_iarchive_impl( + std::basic_istream & is, + unsigned int flags + ) : + basic_binary_iprimitive( + * is.rdbuf(), + 0 != (flags & no_codecvt) + ), + basic_binary_iarchive(flags) + {} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP diff --git a/thirdparty/boost-1_79/boost/archive/binary_oarchive.hpp b/thirdparty/boost-1_79/boost/archive/binary_oarchive.hpp new file mode 100644 index 00000000..ba775d5c --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/binary_oarchive.hpp @@ -0,0 +1,68 @@ +#ifndef BOOST_ARCHIVE_BINARY_OARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from binary_oarchive_impl instead. This will +// preserve correct static polymorphism. +class BOOST_SYMBOL_VISIBLE binary_oarchive : + public binary_oarchive_impl< + binary_oarchive, std::ostream::char_type, std::ostream::traits_type + > +{ +public: + binary_oarchive(std::ostream & os, unsigned int flags = 0) : + binary_oarchive_impl< + binary_oarchive, std::ostream::char_type, std::ostream::traits_type + >(os, flags) + { + init(flags); + } + binary_oarchive(std::streambuf & bsb, unsigned int flags = 0) : + binary_oarchive_impl< + binary_oarchive, std::ostream::char_type, std::ostream::traits_type + >(bsb, flags) + { + init(flags); + } +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_oarchive) +BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::archive::binary_oarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BINARY_OARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/binary_oarchive_impl.hpp b/thirdparty/boost-1_79/boost/archive/binary_oarchive_impl.hpp new file mode 100644 index 00000000..d8387112 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/binary_oarchive_impl.hpp @@ -0,0 +1,102 @@ +#ifndef BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP +#define BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_oarchive_impl.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +template +class BOOST_SYMBOL_VISIBLE binary_oarchive_impl : + public basic_binary_oprimitive, + public basic_binary_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; + friend basic_binary_oarchive; + friend save_access; + #else + friend class detail::interface_oarchive; + friend class basic_binary_oarchive; + friend class save_access; + #endif +#endif + template + void save_override(T & t){ + this->basic_binary_oarchive::save_override(t); + } + void init(unsigned int flags) { + if(0 != (flags & no_header)){ + return; + } + #if ! defined(__MWERKS__) + this->basic_binary_oarchive::init(); + this->basic_binary_oprimitive::init(); + #else + basic_binary_oarchive::init(); + basic_binary_oprimitive::init(); + #endif + } + binary_oarchive_impl( + std::basic_streambuf & bsb, + unsigned int flags + ) : + basic_binary_oprimitive( + bsb, + 0 != (flags & no_codecvt) + ), + basic_binary_oarchive(flags) + {} + binary_oarchive_impl( + std::basic_ostream & os, + unsigned int flags + ) : + basic_binary_oprimitive( + * os.rdbuf(), + 0 != (flags & no_codecvt) + ), + basic_binary_oarchive(flags) + {} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP diff --git a/thirdparty/boost-1_79/boost/archive/binary_wiarchive.hpp b/thirdparty/boost-1_79/boost/archive/binary_wiarchive.hpp new file mode 100644 index 00000000..45a2af56 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/binary_wiarchive.hpp @@ -0,0 +1,56 @@ +#ifndef BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_wiarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include // wistream +#include +#include + +namespace boost { +namespace archive { + +class binary_wiarchive : + public binary_iarchive_impl< + binary_wiarchive, std::wistream::char_type, std::wistream::traits_type + > +{ +public: + binary_wiarchive(std::wistream & is, unsigned int flags = 0) : + binary_iarchive_impl< + binary_wiarchive, std::wistream::char_type, std::wistream::traits_type + >(is, flags) + {} + binary_wiarchive(std::wstreambuf & bsb, unsigned int flags = 0) : + binary_iarchive_impl< + binary_wiarchive, std::wistream::char_type, std::wistream::traits_type + >(bsb, flags) + {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_wiarchive) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/binary_woarchive.hpp b/thirdparty/boost-1_79/boost/archive/binary_woarchive.hpp new file mode 100644 index 00000000..6735ceba --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/binary_woarchive.hpp @@ -0,0 +1,59 @@ +#ifndef BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP +#define BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_woarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include +#include + +namespace boost { +namespace archive { + +// do not derive from this class. If you want to extend this functionality +// via inhertance, derived from binary_oarchive_impl instead. This will +// preserve correct static polymorphism. +class binary_woarchive : + public binary_oarchive_impl< + binary_woarchive, std::wostream::char_type, std::wostream::traits_type + > +{ +public: + binary_woarchive(std::wostream & os, unsigned int flags = 0) : + binary_oarchive_impl< + binary_woarchive, std::wostream::char_type, std::wostream::traits_type + >(os, flags) + {} + binary_woarchive(std::wstreambuf & bsb, unsigned int flags = 0) : + binary_oarchive_impl< + binary_woarchive, std::wostream::char_type, std::wostream::traits_type + >(bsb, flags) + {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_woarchive) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/codecvt_null.hpp b/thirdparty/boost-1_79/boost/archive/codecvt_null.hpp new file mode 100644 index 00000000..3905d43a --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/codecvt_null.hpp @@ -0,0 +1,116 @@ +#ifndef BOOST_ARCHIVE_CODECVT_NULL_HPP +#define BOOST_ARCHIVE_CODECVT_NULL_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// codecvt_null.hpp: + +// (C) Copyright 2004 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL, size_t +#ifndef BOOST_NO_CWCHAR +#include // for mbstate_t +#endif +#include +#include +#include +//#include // must be the last header + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std { +// For STLport on WinCE, BOOST_NO_STDC_NAMESPACE can get defined if STLport is putting symbols in its own namespace. +// In the case of codecvt, however, this does not mean that codecvt is in the global namespace (it will be in STLport's namespace) +# if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + using ::codecvt; +# endif + using ::mbstate_t; + using ::size_t; +} // namespace +#endif + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +template +class codecvt_null; + +template<> +class codecvt_null : public std::codecvt +{ + bool do_always_noconv() const throw() BOOST_OVERRIDE { + return true; + } +public: + explicit codecvt_null(std::size_t no_locale_manage = 0) : + std::codecvt(no_locale_manage) + {} + ~codecvt_null() BOOST_OVERRIDE {} +}; + +template<> +class BOOST_SYMBOL_VISIBLE codecvt_null : + public std::codecvt +{ + BOOST_SYMBOL_EXPORT std::codecvt_base::result + do_out( + std::mbstate_t & state, + const wchar_t * first1, + const wchar_t * last1, + const wchar_t * & next1, + char * first2, + char * last2, + char * & next2 + ) const BOOST_OVERRIDE; + + BOOST_SYMBOL_EXPORT std::codecvt_base::result + do_in( + std::mbstate_t & state, + const char * first1, + const char * last1, + const char * & next1, + wchar_t * first2, + wchar_t * last2, + wchar_t * & next2 + ) const BOOST_OVERRIDE; + + BOOST_SYMBOL_EXPORT int do_encoding( ) const throw( ) BOOST_OVERRIDE { + return sizeof(wchar_t) / sizeof(char); + } + + BOOST_SYMBOL_EXPORT bool do_always_noconv() const throw() BOOST_OVERRIDE { + return false; + } + + BOOST_SYMBOL_EXPORT int do_max_length( ) const throw( ) BOOST_OVERRIDE { + return do_encoding(); + } +public: + BOOST_SYMBOL_EXPORT explicit codecvt_null(std::size_t no_locale_manage = 0); + + BOOST_SYMBOL_EXPORT ~codecvt_null() BOOST_OVERRIDE ; +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif +//#include // pop pragmas + +#endif //BOOST_ARCHIVE_CODECVT_NULL_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/abi_prefix.hpp b/thirdparty/boost-1_79/boost/archive/detail/abi_prefix.hpp new file mode 100644 index 00000000..b45253b5 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/abi_prefix.hpp @@ -0,0 +1,16 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// abi_prefix.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // must be the last header +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4251 4231 4660 4275) +#endif + diff --git a/thirdparty/boost-1_79/boost/archive/detail/abi_suffix.hpp b/thirdparty/boost-1_79/boost/archive/detail/abi_suffix.hpp new file mode 100644 index 00000000..f3307c92 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/abi_suffix.hpp @@ -0,0 +1,15 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// abi_suffix.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif +#include // pops abi_suffix.hpp pragmas + diff --git a/thirdparty/boost-1_79/boost/archive/detail/archive_serializer_map.hpp b/thirdparty/boost-1_79/boost/archive/detail/archive_serializer_map.hpp new file mode 100644 index 00000000..1e94e258 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/archive_serializer_map.hpp @@ -0,0 +1,54 @@ +#ifndef BOOST_ARCHIVE_SERIALIZER_MAP_HPP +#define BOOST_ARCHIVE_SERIALIZER_MAP_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// archive_serializer_map.hpp: extenstion of type_info required for +// serialization. + +// (C) Copyright 2009 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// note: this is nothing more than the thinest of wrappers around +// basic_serializer_map so we can have a one map / archive type. + +#include +#include +#include // must be the last header + +namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +class basic_serializer; + +template +class BOOST_SYMBOL_VISIBLE archive_serializer_map { +public: + static BOOST_ARCHIVE_OR_WARCHIVE_DECL bool insert(const basic_serializer * bs); + static BOOST_ARCHIVE_OR_WARCHIVE_DECL void erase(const basic_serializer * bs); + static BOOST_ARCHIVE_OR_WARCHIVE_DECL const basic_serializer * find( + const boost::serialization::extended_type_info & type_ + ); +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // must be the last header + +#endif //BOOST_ARCHIVE_SERIALIZER_MAP_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/auto_link_archive.hpp b/thirdparty/boost-1_79/boost/archive/detail/auto_link_archive.hpp new file mode 100644 index 00000000..fefd3ab2 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/auto_link_archive.hpp @@ -0,0 +1,48 @@ +#ifndef BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// auto_link_archive.hpp +// +// (c) Copyright Robert Ramey 2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/serialization + +//----------------------------------------------------------------------------// + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +// enable automatic library variant selection ------------------------------// + +#include + +#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) \ +&& !defined(BOOST_ARCHIVE_SOURCE) && !defined(BOOST_WARCHIVE_SOURCE) \ +&& !defined(BOOST_SERIALIZATION_SOURCE) + + // Set the name of our library, this will get undef'ed by auto_link.hpp + // once it's done with it: + // + #define BOOST_LIB_NAME boost_serialization + // + // If we're importing code from a dll, then tell auto_link.hpp about it: + // + #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK) + # define BOOST_DYN_LINK + #endif + // + // And include the header that does the work: + // + #include +#endif // auto-linking disabled + +#endif // BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/auto_link_warchive.hpp b/thirdparty/boost-1_79/boost/archive/detail/auto_link_warchive.hpp new file mode 100644 index 00000000..4f506864 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/auto_link_warchive.hpp @@ -0,0 +1,47 @@ +#ifndef BOOST_ARCHIVE_DETAIL_AUTO_LINK_WARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_AUTO_LINK_WARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// auto_link_warchive.hpp +// +// (c) Copyright Robert Ramey 2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/serialization + +//----------------------------------------------------------------------------// + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +// enable automatic library variant selection ------------------------------// + +#include + +#if !defined(BOOST_WARCHIVE_SOURCE) \ +&& !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) + +// Set the name of our library, this will get undef'ed by auto_link.hpp +// once it's done with it: +// +#define BOOST_LIB_NAME boost_wserialization +// +// If we're importing code from a dll, then tell auto_link.hpp about it: +// +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK) +# define BOOST_DYN_LINK +#endif +// +// And include the header that does the work: +// +#include +#endif // auto-linking disabled + +#endif // ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/basic_iarchive.hpp b/thirdparty/boost-1_79/boost/archive/detail/basic_iarchive.hpp new file mode 100644 index 00000000..a3eb9342 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/basic_iarchive.hpp @@ -0,0 +1,105 @@ +#ifndef BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_iarchive.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// can't use this - much as I'd like to as borland doesn't support it + +#include +#include +#include + +#include +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +class basic_iarchive_impl; +class basic_iserializer; +class basic_pointer_iserializer; + +////////////////////////////////////////////////////////////////////// +// class basic_iarchive - read serialized objects from a input stream +class BOOST_SYMBOL_VISIBLE basic_iarchive : + private boost::noncopyable, + public boost::archive::detail::helper_collection +{ + friend class basic_iarchive_impl; + // hide implementation of this class to minimize header conclusion + boost::scoped_ptr pimpl; + + virtual void vload(version_type &t) = 0; + virtual void vload(object_id_type &t) = 0; + virtual void vload(class_id_type &t) = 0; + virtual void vload(class_id_optional_type &t) = 0; + virtual void vload(class_name_type &t) = 0; + virtual void vload(tracking_type &t) = 0; +protected: + BOOST_ARCHIVE_DECL basic_iarchive(unsigned int flags); + boost::archive::detail::helper_collection & + get_helper_collection(){ + return *this; + } +public: + // some msvc versions require that the following function be public + // otherwise it should really protected. + virtual BOOST_ARCHIVE_DECL ~basic_iarchive(); + // note: NOT part of the public API. + BOOST_ARCHIVE_DECL void next_object_pointer(void *t); + BOOST_ARCHIVE_DECL void register_basic_serializer( + const basic_iserializer & bis + ); + BOOST_ARCHIVE_DECL void load_object( + void *t, + const basic_iserializer & bis + ); + BOOST_ARCHIVE_DECL const basic_pointer_iserializer * + load_pointer( + void * & t, + const basic_pointer_iserializer * bpis_ptr, + const basic_pointer_iserializer * (*finder)( + const boost::serialization::extended_type_info & eti + ) + ); + // real public API starts here + BOOST_ARCHIVE_DECL void + set_library_version(boost::serialization::library_version_type archive_library_version); + BOOST_ARCHIVE_DECL boost::serialization::library_version_type + get_library_version() const; + BOOST_ARCHIVE_DECL unsigned int + get_flags() const; + BOOST_ARCHIVE_DECL void + reset_object_address(const void * new_address, const void * old_address); + BOOST_ARCHIVE_DECL void + delete_created_pointers(); +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/basic_iserializer.hpp b/thirdparty/boost-1_79/boost/archive/detail/basic_iserializer.hpp new file mode 100644 index 00000000..98c9c474 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/basic_iserializer.hpp @@ -0,0 +1,91 @@ +#ifndef BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP +#define BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_iserializer.hpp: extenstion of type_info required for serialization. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // NULL +#include + +#include +#include +#include +#include +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization + +// forward declarations +namespace archive { +namespace detail { + +class basic_iarchive; +class basic_pointer_iserializer; + +class BOOST_SYMBOL_VISIBLE basic_iserializer : + public basic_serializer +{ +private: + basic_pointer_iserializer *m_bpis; +protected: + explicit BOOST_ARCHIVE_DECL basic_iserializer( + const boost::serialization::extended_type_info & type + ); + virtual BOOST_ARCHIVE_DECL ~basic_iserializer(); +public: + bool serialized_as_pointer() const { + return m_bpis != NULL; + } + void set_bpis(basic_pointer_iserializer *bpis){ + m_bpis = bpis; + } + const basic_pointer_iserializer * get_bpis_ptr() const { + return m_bpis; + } + virtual void load_object_data( + basic_iarchive & ar, + void *x, + const unsigned int file_version + ) const = 0; + // returns true if class_info should be saved + virtual bool class_info() const = 0 ; + // returns true if objects should be tracked + virtual bool tracking(const unsigned int) const = 0 ; + // returns class version + virtual version_type version() const = 0 ; + // returns true if this class is polymorphic + virtual bool is_polymorphic() const = 0; + virtual void destroy(/*const*/ void *address) const = 0 ; +}; + +} // namespae detail +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/basic_oarchive.hpp b/thirdparty/boost-1_79/boost/archive/detail/basic_oarchive.hpp new file mode 100644 index 00000000..36e80d10 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/basic_oarchive.hpp @@ -0,0 +1,94 @@ +#ifndef BOOST_ARCHIVE_BASIC_OARCHIVE_HPP +#define BOOST_ARCHIVE_BASIC_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_oarchive.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // NULL +#include +#include +#include + +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +class basic_oarchive_impl; +class basic_oserializer; +class basic_pointer_oserializer; + +////////////////////////////////////////////////////////////////////// +// class basic_oarchive - write serialized objects to an output stream +class BOOST_SYMBOL_VISIBLE basic_oarchive : + private boost::noncopyable, + public boost::archive::detail::helper_collection +{ + friend class basic_oarchive_impl; + // hide implementation of this class to minimize header conclusion + boost::scoped_ptr pimpl; + + // overload these to bracket object attributes. Used to implement + // xml archives + virtual void vsave(const version_type t) = 0; + virtual void vsave(const object_id_type t) = 0; + virtual void vsave(const object_reference_type t) = 0; + virtual void vsave(const class_id_type t) = 0; + virtual void vsave(const class_id_optional_type t) = 0; + virtual void vsave(const class_id_reference_type t) = 0; + virtual void vsave(const class_name_type & t) = 0; + virtual void vsave(const tracking_type t) = 0; +protected: + BOOST_ARCHIVE_DECL basic_oarchive(unsigned int flags = 0); + BOOST_ARCHIVE_DECL boost::archive::detail::helper_collection & + get_helper_collection(); + virtual BOOST_ARCHIVE_DECL ~basic_oarchive(); +public: + // note: NOT part of the public interface + BOOST_ARCHIVE_DECL void register_basic_serializer( + const basic_oserializer & bos + ); + BOOST_ARCHIVE_DECL void save_object( + const void *x, + const basic_oserializer & bos + ); + BOOST_ARCHIVE_DECL void save_pointer( + const void * t, + const basic_pointer_oserializer * bpos_ptr + ); + void save_null_pointer(){ + vsave(BOOST_SERIALIZATION_NULL_POINTER_TAG); + } + // real public interface starts here + BOOST_ARCHIVE_DECL void end_preamble(); // default implementation does nothing + BOOST_ARCHIVE_DECL boost::serialization::library_version_type get_library_version() const; + BOOST_ARCHIVE_DECL unsigned int get_flags() const; +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif //BOOST_ARCHIVE_BASIC_OARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/basic_oserializer.hpp b/thirdparty/boost-1_79/boost/archive/detail/basic_oserializer.hpp new file mode 100644 index 00000000..b3f95677 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/basic_oserializer.hpp @@ -0,0 +1,89 @@ +#ifndef BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP +#define BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_oserializer.hpp: extenstion of type_info required for serialization. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // NULL +#include +#include + +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization + +// forward declarations +namespace archive { +namespace detail { + +class basic_oarchive; +class basic_pointer_oserializer; + +class BOOST_SYMBOL_VISIBLE basic_oserializer : + public basic_serializer +{ +private: + basic_pointer_oserializer *m_bpos; +protected: + explicit BOOST_ARCHIVE_DECL basic_oserializer( + const boost::serialization::extended_type_info & type_ + ); + virtual BOOST_ARCHIVE_DECL ~basic_oserializer(); +public: + bool serialized_as_pointer() const { + return m_bpos != NULL; + } + void set_bpos(basic_pointer_oserializer *bpos){ + m_bpos = bpos; + } + const basic_pointer_oserializer * get_bpos() const { + return m_bpos; + } + virtual void save_object_data( + basic_oarchive & ar, const void * x + ) const = 0; + // returns true if class_info should be saved + virtual bool class_info() const = 0; + // returns true if objects should be tracked + virtual bool tracking(const unsigned int flags) const = 0; + // returns class version + virtual version_type version() const = 0; + // returns true if this class is polymorphic + virtual bool is_polymorphic() const = 0; +}; + +} // namespace detail +} // namespace serialization +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/basic_pointer_iserializer.hpp b/thirdparty/boost-1_79/boost/archive/detail/basic_pointer_iserializer.hpp new file mode 100644 index 00000000..be805a42 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/basic_pointer_iserializer.hpp @@ -0,0 +1,70 @@ +#ifndef BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP +#define BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_pointer_oserializer.hpp: extenstion of type_info required for +// serialization. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization + +// forward declarations +namespace archive { +namespace detail { + +class basic_iarchive; +class basic_iserializer; + +class BOOST_SYMBOL_VISIBLE basic_pointer_iserializer + : public basic_serializer { +protected: + explicit BOOST_ARCHIVE_DECL basic_pointer_iserializer( + const boost::serialization::extended_type_info & type_ + ); + virtual BOOST_ARCHIVE_DECL ~basic_pointer_iserializer(); +public: + virtual void * heap_allocation() const = 0; + virtual const basic_iserializer & get_basic_serializer() const = 0; + virtual void load_object_ptr( + basic_iarchive & ar, + void * x, + const unsigned int file_version + ) const = 0; +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/basic_pointer_oserializer.hpp b/thirdparty/boost-1_79/boost/archive/detail/basic_pointer_oserializer.hpp new file mode 100644 index 00000000..86376568 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/basic_pointer_oserializer.hpp @@ -0,0 +1,68 @@ +#ifndef BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP +#define BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_pointer_oserializer.hpp: extenstion of type_info required for +// serialization. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { +namespace detail { + +class basic_oarchive; +class basic_oserializer; + +class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer : + public basic_serializer +{ +protected: + explicit BOOST_ARCHIVE_DECL basic_pointer_oserializer( + const boost::serialization::extended_type_info & type_ + ); +public: + virtual BOOST_ARCHIVE_DECL ~basic_pointer_oserializer(); + virtual const basic_oserializer & get_basic_serializer() const = 0; + virtual void save_object_ptr( + basic_oarchive & ar, + const void * x + ) const = 0; +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/basic_serializer.hpp b/thirdparty/boost-1_79/boost/archive/detail/basic_serializer.hpp new file mode 100644 index 00000000..9c2535bf --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/basic_serializer.hpp @@ -0,0 +1,77 @@ +#ifndef BOOST_ARCHIVE_BASIC_SERIALIZER_HPP +#define BOOST_ARCHIVE_BASIC_SERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_serializer.hpp: extenstion of type_info required for serialization. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL + +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { +namespace detail { + +class basic_serializer : + private boost::noncopyable +{ + const boost::serialization::extended_type_info * m_eti; +protected: + explicit basic_serializer( + const boost::serialization::extended_type_info & eti + ) : + m_eti(& eti) + {} +public: + inline bool + operator<(const basic_serializer & rhs) const { + // can't compare address since there can be multiple eti records + // for the same type in different execution modules (that is, DLLS) + // leave this here as a reminder not to do this! + // return & lhs.get_eti() < & rhs.get_eti(); + return get_eti() < rhs.get_eti(); + } + const char * get_debug_info() const { + return m_eti->get_debug_info(); + } + const boost::serialization::extended_type_info & get_eti() const { + return * m_eti; + } +}; + +class basic_serializer_arg : public basic_serializer { +public: + basic_serializer_arg(const serialization::extended_type_info & eti) : + basic_serializer(eti) + {} +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_BASIC_SERIALIZER_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/basic_serializer_map.hpp b/thirdparty/boost-1_79/boost/archive/detail/basic_serializer_map.hpp new file mode 100644 index 00000000..78c6a52d --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/basic_serializer_map.hpp @@ -0,0 +1,69 @@ +#ifndef BOOST_SERIALIZER_MAP_HPP +#define BOOST_SERIALIZER_MAP_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_serializer_map.hpp: extenstion of type_info required for serialization. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#include +#include + +#include // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} + +namespace archive { +namespace detail { + +class basic_serializer; + +class BOOST_SYMBOL_VISIBLE +basic_serializer_map : public + boost::noncopyable +{ + struct type_info_pointer_compare + { + bool operator()( + const basic_serializer * lhs, const basic_serializer * rhs + ) const ; + }; + typedef std::set< + const basic_serializer *, + type_info_pointer_compare + > map_type; + map_type m_map; +public: + BOOST_ARCHIVE_DECL bool insert(const basic_serializer * bs); + BOOST_ARCHIVE_DECL void erase(const basic_serializer * bs); + BOOST_ARCHIVE_DECL const basic_serializer * find( + const boost::serialization::extended_type_info & type_ + ) const; +private: + // cw 8.3 requires this + basic_serializer_map& operator=(basic_serializer_map const&); +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // must be the last header + +#endif // BOOST_SERIALIZER_MAP_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/check.hpp b/thirdparty/boost-1_79/boost/archive/detail/check.hpp new file mode 100644 index 00000000..5bf0a48b --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/check.hpp @@ -0,0 +1,171 @@ +#ifndef BOOST_ARCHIVE_DETAIL_CHECK_HPP +#define BOOST_ARCHIVE_DETAIL_CHECK_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#if !defined(__clang__) +#pragma inline_depth(255) +#pragma inline_recursion(on) +#endif +#endif + +#if defined(__MWERKS__) +#pragma inline_depth(255) +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// check.hpp: interface for serialization system. + +// (C) Copyright 2009 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +namespace boost { +namespace archive { +namespace detail { + +// checks for objects + +template +inline void check_object_level(){ + typedef + typename mpl::greater_equal< + serialization::implementation_level< T >, + mpl::int_ + >::type typex; + + // trap attempts to serialize objects marked + // not_serializable + BOOST_STATIC_ASSERT(typex::value); +} + +template +inline void check_object_versioning(){ + typedef + typename mpl::or_< + typename mpl::greater< + serialization::implementation_level< T >, + mpl::int_ + >, + typename mpl::equal_to< + serialization::version< T >, + mpl::int_<0> + > + > typex; + // trap attempts to serialize with objects that don't + // save class information in the archive with versioning. + BOOST_STATIC_ASSERT(typex::value); +} + +template +inline void check_object_tracking(){ + // presume it has already been determined that + // T is not a const + BOOST_STATIC_ASSERT(! boost::is_const< T >::value); + typedef typename mpl::equal_to< + serialization::tracking_level< T >, + mpl::int_ + >::type typex; + // saving an non-const object of a type not marked "track_never) + + // may be an indicator of an error usage of the + // serialization library and should be double checked. + // See documentation on object tracking. Also, see the + // "rationale" section of the documenation + // for motivation for this checking. + + BOOST_STATIC_WARNING(typex::value); +} + +// checks for pointers + +template +inline void check_pointer_level(){ + // we should only invoke this once we KNOW that T + // has been used as a pointer!! + typedef + typename mpl::or_< + typename mpl::greater< + serialization::implementation_level< T >, + mpl::int_ + >, + typename mpl::not_< + typename mpl::equal_to< + serialization::tracking_level< T >, + mpl::int_ + > + > + > typex; + // Address the following when serializing to a pointer: + + // a) This type doesn't save class information in the + // archive. That is, the serialization trait implementation + // level <= object_serializable. + // b) Tracking for this type is set to "track selectively" + + // in this case, indication that an object is tracked is + // not stored in the archive itself - see level == object_serializable + // but rather the existence of the operation ar >> T * is used to + // infer that an object of this type should be tracked. So, if + // you save via a pointer but don't load via a pointer the operation + // will fail on load without given any valid reason for the failure. + + // So if your program traps here, consider changing the + // tracking or implementation level traits - or not + // serializing via a pointer. + BOOST_STATIC_WARNING(typex::value); +} + +template +void inline check_pointer_tracking(){ + typedef typename mpl::greater< + serialization::tracking_level< T >, + mpl::int_ + >::type typex; + // serializing an object of a type marked "track_never" through a pointer + // could result in creating more objects than were saved! + BOOST_STATIC_WARNING(typex::value); +} + +template +inline void check_const_loading(){ + typedef + typename mpl::or_< + typename boost::serialization::is_wrapper< T >, + typename mpl::not_< + typename boost::is_const< T > + > + >::type typex; + // cannot load data into a "const" object unless it's a + // wrapper around some other non-const object. + BOOST_STATIC_ASSERT(typex::value); +} + +} // detail +} // archive +} // boost + +#endif // BOOST_ARCHIVE_DETAIL_CHECK_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/common_iarchive.hpp b/thirdparty/boost-1_79/boost/archive/detail/common_iarchive.hpp new file mode 100644 index 00000000..2935e310 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/common_iarchive.hpp @@ -0,0 +1,88 @@ +#ifndef BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// common_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { +namespace detail { + +class extended_type_info; + +// note: referred to as Curiously Recurring Template Patter (CRTP) +template +class BOOST_SYMBOL_VISIBLE common_iarchive : + public basic_iarchive, + public interface_iarchive +{ + friend class interface_iarchive; + friend class basic_iarchive; +private: + void vload(version_type & t) BOOST_OVERRIDE { + * this->This() >> t; + } + void vload(object_id_type & t) BOOST_OVERRIDE { + * this->This() >> t; + } + void vload(class_id_type & t) BOOST_OVERRIDE { + * this->This() >> t; + } + void vload(class_id_optional_type & t) BOOST_OVERRIDE { + * this->This() >> t; + } + void vload(tracking_type & t) BOOST_OVERRIDE { + * this->This() >> t; + } + void vload(class_name_type &s) BOOST_OVERRIDE { + * this->This() >> s; + } +protected: + // default processing - invoke serialization library + template + void load_override(T & t){ + archive::load(* this->This(), t); + } + // default implementations of functions which emit start/end tags for + // archive types that require them. + void load_start(const char * /*name*/){} + void load_end(const char * /*name*/){} + // default archive initialization + common_iarchive(unsigned int flags = 0) : + basic_iarchive(flags), + interface_iarchive() + {} +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/common_oarchive.hpp b/thirdparty/boost-1_79/boost/archive/detail/common_oarchive.hpp new file mode 100644 index 00000000..fde60660 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/common_oarchive.hpp @@ -0,0 +1,89 @@ +#ifndef BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// common_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { +namespace detail { + +// note: referred to as Curiously Recurring Template Patter (CRTP) +template + +class BOOST_SYMBOL_VISIBLE common_oarchive : + public basic_oarchive, + public interface_oarchive +{ + friend class interface_oarchive; + friend class basic_oarchive; +private: + void vsave(const version_type t) BOOST_OVERRIDE { + * this->This() << t; + } + void vsave(const object_id_type t) BOOST_OVERRIDE { + * this->This() << t; + } + void vsave(const object_reference_type t) BOOST_OVERRIDE { + * this->This() << t; + } + void vsave(const class_id_type t) BOOST_OVERRIDE { + * this->This() << t; + } + void vsave(const class_id_reference_type t) BOOST_OVERRIDE { + * this->This() << t; + } + void vsave(const class_id_optional_type t) BOOST_OVERRIDE { + * this->This() << t; + } + void vsave(const class_name_type & t) BOOST_OVERRIDE { + * this->This() << t; + } + void vsave(const tracking_type t) BOOST_OVERRIDE { + * this->This() << t; + } +protected: + // default processing - invoke serialization library + template + void save_override(T & t){ + archive::save(* this->This(), t); + } + void save_start(const char * /*name*/){} + void save_end(const char * /*name*/){} + common_oarchive(unsigned int flags = 0) : + basic_oarchive(flags), + interface_oarchive() + {} +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/decl.hpp b/thirdparty/boost-1_79/boost/archive/detail/decl.hpp new file mode 100644 index 00000000..70555c31 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/decl.hpp @@ -0,0 +1,57 @@ +#ifndef BOOST_ARCHIVE_DETAIL_DECL_HPP +#define BOOST_ARCHIVE_DETAIL_DECL_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2///////// 3/////////4/////////5/////////6/////////7/////////8 +// decl.hpp +// +// (c) Copyright Robert Ramey 2004 +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See library home page at http://www.boost.org/libs/serialization + +//----------------------------------------------------------------------------// + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +#include + +#if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)) + #if defined(BOOST_ARCHIVE_SOURCE) + #define BOOST_ARCHIVE_DECL BOOST_SYMBOL_EXPORT + #else + #define BOOST_ARCHIVE_DECL BOOST_SYMBOL_IMPORT + #endif + + #if defined(BOOST_WARCHIVE_SOURCE) + #define BOOST_WARCHIVE_DECL BOOST_SYMBOL_EXPORT + #else + #define BOOST_WARCHIVE_DECL BOOST_SYMBOL_IMPORT + #endif + + #if defined(BOOST_WARCHIVE_SOURCE) || defined(BOOST_ARCHIVE_SOURCE) + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL BOOST_SYMBOL_EXPORT + #else + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL BOOST_SYMBOL_IMPORT + #endif + +#endif + +#if ! defined(BOOST_ARCHIVE_DECL) + #define BOOST_ARCHIVE_DECL +#endif +#if ! defined(BOOST_WARCHIVE_DECL) + #define BOOST_WARCHIVE_DECL +#endif +#if ! defined(BOOST_ARCHIVE_OR_WARCHIVE_DECL) + #define BOOST_ARCHIVE_OR_WARCHIVE_DECL +#endif + +#endif // BOOST_ARCHIVE_DETAIL_DECL_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/helper_collection.hpp b/thirdparty/boost-1_79/boost/archive/detail/helper_collection.hpp new file mode 100644 index 00000000..edb4125e --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/helper_collection.hpp @@ -0,0 +1,99 @@ +#ifndef BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP +#define BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// helper_collection.hpp: archive support for run-time helpers + +// (C) Copyright 2002-2008 Robert Ramey and Joaquin M Lopez Munoz +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // NULL +#include +#include +#include +#include + +#include + +#include +#include + +namespace boost { + +namespace archive { +namespace detail { + +class helper_collection +{ + helper_collection(const helper_collection&); // non-copyable + helper_collection& operator = (const helper_collection&); // non-copyable + + // note: we dont' actually "share" the function object pointer + // we only use shared_ptr to make sure that it get's deleted + + typedef std::pair< + const void *, + boost::shared_ptr + > helper_value_type; + template + boost::shared_ptr make_helper_ptr(){ + // use boost::shared_ptr rather than std::shared_ptr to maintain + // c++03 compatibility + return boost::make_shared(); + } + + typedef std::vector collection; + collection m_collection; + + struct predicate { + BOOST_DELETED_FUNCTION(predicate & operator=(const predicate & rhs)) + public: + const void * const m_ti; + bool operator()(helper_value_type const &rhs) const { + return m_ti == rhs.first; + } + predicate(const void * ti) : + m_ti(ti) + {} + }; +protected: + helper_collection(){} + ~helper_collection(){} +public: + template + Helper& find_helper(void * const id = 0) { + collection::const_iterator it = + std::find_if( + m_collection.begin(), + m_collection.end(), + predicate(id) + ); + + void * rval = 0; + if(it == m_collection.end()){ + m_collection.push_back( + std::make_pair(id, make_helper_ptr()) + ); + rval = m_collection.back().second.get(); + } + else{ + rval = it->second.get(); + } + return *static_cast(rval); + } +}; + +} // namespace detail +} // namespace serialization +} // namespace boost + +#endif // BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/interface_iarchive.hpp b/thirdparty/boost-1_79/boost/archive/detail/interface_iarchive.hpp new file mode 100644 index 00000000..5024a4d4 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/interface_iarchive.hpp @@ -0,0 +1,85 @@ +#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// interface_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include // NULL +#include +#include +#include +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace archive { +namespace detail { + +class basic_pointer_iserializer; + +template +class interface_iarchive +{ +protected: + interface_iarchive() {} +public: + ///////////////////////////////////////////////////////// + // archive public interface + typedef mpl::bool_ is_loading; + typedef mpl::bool_ is_saving; + + // return a pointer to the most derived class + Archive * This(){ + return static_cast(this); + } + + template + const basic_pointer_iserializer * + register_type(T * = NULL){ + const basic_pointer_iserializer & bpis = + boost::serialization::singleton< + pointer_iserializer + >::get_const_instance(); + this->This()->register_basic_serializer(bpis.get_basic_serializer()); + return & bpis; + } + template + Helper & + get_helper(void * const id = 0){ + helper_collection & hc = this->This()->get_helper_collection(); + return hc.template find_helper(id); + } + + template + Archive & operator>>(T & t){ + this->This()->load_override(t); + return * this->This(); + } + + // the & operator + template + Archive & operator&(T & t){ + return *(this->This()) >> t; + } +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/interface_oarchive.hpp b/thirdparty/boost-1_79/boost/archive/detail/interface_oarchive.hpp new file mode 100644 index 00000000..44b47e61 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/interface_oarchive.hpp @@ -0,0 +1,87 @@ +#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP +#define BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// interface_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include // NULL +#include +#include + +#include +#include +#include // must be the last header + +#include + +namespace boost { +namespace archive { +namespace detail { + +class basic_pointer_oserializer; + +template +class interface_oarchive +{ +protected: + interface_oarchive() {} +public: + ///////////////////////////////////////////////////////// + // archive public interface + typedef mpl::bool_ is_loading; + typedef mpl::bool_ is_saving; + + // return a pointer to the most derived class + Archive * This(){ + return static_cast(this); + } + + template + const basic_pointer_oserializer * + register_type(const T * = NULL){ + const basic_pointer_oserializer & bpos = + boost::serialization::singleton< + pointer_oserializer + >::get_const_instance(); + this->This()->register_basic_serializer(bpos.get_basic_serializer()); + return & bpos; + } + + template + Helper & + get_helper(void * const id = 0){ + helper_collection & hc = this->This()->get_helper_collection(); + return hc.template find_helper(id); + } + + template + Archive & operator<<(const T & t){ + this->This()->save_override(t); + return * this->This(); + } + + // the & operator + template + Archive & operator&(const T & t){ + return * this ->This() << t; + } +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/iserializer.hpp b/thirdparty/boost-1_79/boost/archive/detail/iserializer.hpp new file mode 100644 index 00000000..b1a9d438 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/iserializer.hpp @@ -0,0 +1,632 @@ +#ifndef BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP +#define BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(BOOST_MSVC) +# pragma once +#if !defined(__clang__) +#pragma inline_depth(255) +#pragma inline_recursion(on) +#endif +#endif + +#if defined(__MWERKS__) +#pragma inline_depth(255) +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// iserializer.hpp: interface for serialization system. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // for placement new +#include // size_t, NULL + +#include +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include + +#include +#include +#include +#include +#include + +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #include +#endif +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#if !defined(BOOST_MSVC) && \ + (BOOST_WORKAROUND(__IBMCPP__, < 1210) || \ + defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590)) + #define BOOST_SERIALIZATION_DONT_USE_HAS_NEW_OPERATOR 1 +#else + #define BOOST_SERIALIZATION_DONT_USE_HAS_NEW_OPERATOR 0 +#endif + +#if ! BOOST_SERIALIZATION_DONT_USE_HAS_NEW_OPERATOR +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// the following is need only for dynamic cast of polymorphic pointers +#include +#include +#include +#include +#include +#include + +#include + +namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { + +// an accessor to permit friend access to archives. Needed because +// some compilers don't handle friend templates completely +class load_access { +public: + template + static void load_primitive(Archive &ar, T &t){ + ar.load(t); + } +}; + +namespace detail { + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +template +class iserializer : public basic_iserializer +{ +private: + void destroy(/*const*/ void *address) const BOOST_OVERRIDE { + boost::serialization::access::destroy(static_cast(address)); + } +public: + explicit iserializer() : + basic_iserializer( + boost::serialization::singleton< + typename + boost::serialization::type_info_implementation< T >::type + >::get_const_instance() + ) + {} + BOOST_DLLEXPORT void load_object_data( + basic_iarchive & ar, + void *x, + const unsigned int file_version + ) const BOOST_OVERRIDE BOOST_USED; + bool class_info() const BOOST_OVERRIDE { + return boost::serialization::implementation_level< T >::value + >= boost::serialization::object_class_info; + } + bool tracking(const unsigned int /* flags */) const BOOST_OVERRIDE { + return boost::serialization::tracking_level< T >::value + == boost::serialization::track_always + || ( boost::serialization::tracking_level< T >::value + == boost::serialization::track_selectively + && serialized_as_pointer()); + } + version_type version() const BOOST_OVERRIDE { + return version_type(::boost::serialization::version< T >::value); + } + bool is_polymorphic() const BOOST_OVERRIDE { + return boost::is_polymorphic< T >::value; + } + ~iserializer() BOOST_OVERRIDE {} +}; + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +template +BOOST_DLLEXPORT void iserializer::load_object_data( + basic_iarchive & ar, + void *x, + const unsigned int file_version +) const { + // note: we now comment this out. Before we permited archive + // version # to be very large. Now we don't. To permit + // readers of these old archives, we have to suppress this + // code. Perhaps in the future we might re-enable it but + // permit its suppression with a runtime switch. + #if 0 + // trap case where the program cannot handle the current version + if(file_version > static_cast(version())) + boost::serialization::throw_exception( + archive::archive_exception( + boost::archive::archive_exception::unsupported_class_version, + get_debug_info() + ) + ); + #endif + // make sure call is routed through the higest interface that might + // be specialized by the user. + boost::serialization::serialize_adl( + boost::serialization::smart_cast_reference(ar), + * static_cast(x), + file_version + ); +} + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +// the purpose of this code is to allocate memory for an object +// without requiring the constructor to be called. Presumably +// the allocated object will be subsequently initialized with +// "placement new". +// note: we have the boost type trait has_new_operator but we +// have no corresponding has_delete_operator. So we presume +// that the former being true would imply that the a delete +// operator is also defined for the class T. + +template +struct heap_allocation { + // boost::has_new_operator< T > doesn't work on these compilers + #if BOOST_SERIALIZATION_DONT_USE_HAS_NEW_OPERATOR + // This doesn't handle operator new overload for class T + static T * invoke_new(){ + return static_cast(operator new(sizeof(T))); + } + static void invoke_delete(T *t){ + (operator delete(t)); + } + #else + // note: we presume that a true value for has_new_operator + // implies the existence of a class specific delete operator as well + // as a class specific new operator. + struct has_new_operator { + static T * invoke_new() { + return static_cast((T::operator new)(sizeof(T))); + } + static void invoke_delete(T * t) { + // if compilation fails here, the likely cause that the class + // T has a class specific new operator but no class specific + // delete operator which matches the following signature. + // note that this solution addresses the issue that two + // possible signatures. But it doesn't address the possibility + // that the class might have class specific new with NO + // class specific delete at all. Patches (compatible with + // C++03) welcome! + (operator delete)(t); + } + }; + struct doesnt_have_new_operator { + static T* invoke_new() { + return static_cast(operator new(sizeof(T))); + } + static void invoke_delete(T * t) { + // Note: I'm reliance upon automatic conversion from T * to void * here + (operator delete)(t); + } + }; + static T * invoke_new() { + typedef typename + mpl::eval_if< + boost::has_new_operator< T >, + mpl::identity, + mpl::identity + >::type typex; + return typex::invoke_new(); + } + static void invoke_delete(T *t) { + typedef typename + mpl::eval_if< + boost::has_new_operator< T >, + mpl::identity, + mpl::identity + >::type typex; + typex::invoke_delete(t); + } + #endif + explicit heap_allocation(){ + m_p = invoke_new(); + } + ~heap_allocation(){ + if (0 != m_p) + invoke_delete(m_p); + } + T* get() const { + return m_p; + } + + T* release() { + T* p = m_p; + m_p = 0; + return p; + } +private: + T* m_p; +}; + +template +class pointer_iserializer : + public basic_pointer_iserializer +{ +private: + void * heap_allocation() const BOOST_OVERRIDE { + detail::heap_allocation h; + T * t = h.get(); + h.release(); + return t; + } + const basic_iserializer & get_basic_serializer() const BOOST_OVERRIDE { + return boost::serialization::singleton< + iserializer + >::get_const_instance(); + } + BOOST_DLLEXPORT void load_object_ptr( + basic_iarchive & ar, + void * x, + const unsigned int file_version + ) const BOOST_OVERRIDE BOOST_USED; +public: + // this should alway be a singleton so make the constructor protected + pointer_iserializer(); + ~pointer_iserializer() BOOST_OVERRIDE; +}; + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +// note: BOOST_DLLEXPORT is so that code for polymorphic class +// serialized only through base class won't get optimized out +template +BOOST_DLLEXPORT void pointer_iserializer::load_object_ptr( + basic_iarchive & ar, + void * t, + const unsigned int file_version +) const +{ + Archive & ar_impl = + boost::serialization::smart_cast_reference(ar); + + // note that the above will throw std::bad_alloc if the allocation + // fails so we don't have to address this contingency here. + + // catch exception during load_construct_data so that we don't + // automatically delete the t which is most likely not fully + // constructed + BOOST_TRY { + // this addresses an obscure situation that occurs when + // load_constructor de-serializes something through a pointer. + ar.next_object_pointer(t); + boost::serialization::load_construct_data_adl( + ar_impl, + static_cast(t), + file_version + ); + } + BOOST_CATCH(...){ + // if we get here the load_construct failed. The heap_allocation + // will be automatically deleted so we don't have to do anything + // special here. + BOOST_RETHROW; + } + BOOST_CATCH_END + + ar_impl >> boost::serialization::make_nvp(NULL, * static_cast(t)); +} + +template +pointer_iserializer::pointer_iserializer() : + basic_pointer_iserializer( + boost::serialization::singleton< + typename + boost::serialization::type_info_implementation< T >::type + >::get_const_instance() + ) +{ + boost::serialization::singleton< + iserializer + >::get_mutable_instance().set_bpis(this); + archive_serializer_map::insert(this); +} + +template +pointer_iserializer::~pointer_iserializer(){ + archive_serializer_map::erase(this); +} + +template +struct load_non_pointer_type { + // note this bounces the call right back to the archive + // with no runtime overhead + struct load_primitive { + template + static void invoke(Archive & ar, T & t){ + load_access::load_primitive(ar, t); + } + }; + // note this bounces the call right back to the archive + // with no runtime overhead + struct load_only { + template + static void invoke(Archive & ar, const T & t){ + // short cut to user's serializer + // make sure call is routed through the higest interface that might + // be specialized by the user. + boost::serialization::serialize_adl( + ar, + const_cast(t), + boost::serialization::version< T >::value + ); + } + }; + + // note this save class information including version + // and serialization level to the archive + struct load_standard { + template + static void invoke(Archive &ar, const T & t){ + void * x = boost::addressof(const_cast(t)); + ar.load_object( + x, + boost::serialization::singleton< + iserializer + >::get_const_instance() + ); + } + }; + + struct load_conditional { + template + static void invoke(Archive &ar, T &t){ + //if(0 == (ar.get_flags() & no_tracking)) + load_standard::invoke(ar, t); + //else + // load_only::invoke(ar, t); + } + }; + + template + static void invoke(Archive & ar, T &t){ + typedef typename mpl::eval_if< + // if its primitive + mpl::equal_to< + boost::serialization::implementation_level< T >, + mpl::int_ + >, + mpl::identity, + // else + typename mpl::eval_if< + // class info / version + mpl::greater_equal< + boost::serialization::implementation_level< T >, + mpl::int_ + >, + // do standard load + mpl::identity, + // else + typename mpl::eval_if< + // no tracking + mpl::equal_to< + boost::serialization::tracking_level< T >, + mpl::int_ + >, + // do a fast load + mpl::identity, + // else + // do a fast load only tracking is turned off + mpl::identity + > > >::type typex; + check_object_versioning< T >(); + check_object_level< T >(); + typex::invoke(ar, t); + } +}; + +template +struct load_pointer_type { + struct abstract + { + template + static const basic_pointer_iserializer * register_type(Archive & /* ar */){ + // it has? to be polymorphic + BOOST_STATIC_ASSERT(boost::is_polymorphic< T >::value); + return static_cast(NULL); + } + }; + + struct non_abstract + { + template + static const basic_pointer_iserializer * register_type(Archive & ar){ + return ar.register_type(static_cast(NULL)); + } + }; + + template + static const basic_pointer_iserializer * register_type(Archive &ar, const T* const /*t*/){ + // there should never be any need to load an abstract polymorphic + // class pointer. Inhibiting code generation for this + // permits abstract base classes to be used - note: exception + // virtual serialize functions used for plug-ins + typedef typename + mpl::eval_if< + boost::serialization::is_abstract, + boost::mpl::identity, + boost::mpl::identity + >::type typex; + return typex::template register_type< T >(ar); + } + + template + static T * pointer_tweak( + const boost::serialization::extended_type_info & eti, + void const * const t, + const T & + ) { + // tweak the pointer back to the base class + void * upcast = const_cast( + boost::serialization::void_upcast( + eti, + boost::serialization::singleton< + typename + boost::serialization::type_info_implementation< T >::type + >::get_const_instance(), + t + ) + ); + if(NULL == upcast) + boost::serialization::throw_exception( + archive_exception(archive_exception::unregistered_class) + ); + return static_cast(upcast); + } + + template + static void check_load(T * const /* t */){ + check_pointer_level< T >(); + check_pointer_tracking< T >(); + } + + static const basic_pointer_iserializer * + find(const boost::serialization::extended_type_info & type){ + return static_cast( + archive_serializer_map::find(type) + ); + } + + template + static void invoke(Archive & ar, Tptr & t){ + check_load(t); + const basic_pointer_iserializer * bpis_ptr = register_type(ar, t); + const basic_pointer_iserializer * newbpis_ptr = ar.load_pointer( + // note major hack here !!! + // I tried every way to convert Tptr &t (where Tptr might + // include const) to void * &. This is the only way + // I could make it work. RR + (void * & )t, + bpis_ptr, + find + ); + // if the pointer isn't that of the base class + if(newbpis_ptr != bpis_ptr){ + t = pointer_tweak(newbpis_ptr->get_eti(), t, *t); + } + } +}; + +template +struct load_enum_type { + template + static void invoke(Archive &ar, T &t){ + // convert integers to correct enum to load + int i; + ar >> boost::serialization::make_nvp(NULL, i); + t = static_cast< T >(i); + } +}; + +template +struct load_array_type { + template + static void invoke(Archive &ar, T &t){ + typedef typename remove_extent< T >::type value_type; + + // convert integers to correct enum to load + // determine number of elements in the array. Consider the + // fact that some machines will align elements on boundaries + // other than characters. + std::size_t current_count = sizeof(t) / ( + static_cast(static_cast(&t[1])) + - static_cast(static_cast(&t[0])) + ); + boost::serialization::collection_size_type count; + ar >> BOOST_SERIALIZATION_NVP(count); + if(static_cast(count) > current_count) + boost::serialization::throw_exception( + archive::archive_exception( + boost::archive::archive_exception::array_size_too_short + ) + ); + // explict template arguments to pass intel C++ compiler + ar >> serialization::make_array< + value_type, + boost::serialization::collection_size_type + >( + static_cast(&t[0]), + count + ); + } +}; + +} // detail + +template +inline void load(Archive & ar, T &t){ + // if this assertion trips. It means we're trying to load a + // const object with a compiler that doesn't have correct + // function template ordering. On other compilers, this is + // handled below. + detail::check_const_loading< T >(); + typedef + typename mpl::eval_if, + mpl::identity > + ,//else + typename mpl::eval_if, + mpl::identity > + ,//else + typename mpl::eval_if, + mpl::identity > + ,//else + mpl::identity > + > + > + >::type typex; + typex::invoke(ar, t); +} + +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/oserializer.hpp b/thirdparty/boost-1_79/boost/archive/detail/oserializer.hpp new file mode 100644 index 00000000..f6a77edf --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/oserializer.hpp @@ -0,0 +1,547 @@ +#ifndef BOOST_ARCHIVE_OSERIALIZER_HPP +#define BOOST_ARCHIVE_OSERIALIZER_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#if !defined(__clang__) +#pragma inline_depth(255) +#pragma inline_recursion(on) +#endif +#endif + +#if defined(__MWERKS__) +#pragma inline_depth(255) +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// oserializer.hpp: interface for serialization system. + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO + #include +#endif +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +namespace boost { + +namespace serialization { + class extended_type_info; +} // namespace serialization + +namespace archive { + +// an accessor to permit friend access to archives. Needed because +// some compilers don't handle friend templates completely +class save_access { +public: + template + static void end_preamble(Archive & ar){ + ar.end_preamble(); + } + template + static void save_primitive(Archive & ar, const T & t){ + ar.end_preamble(); + ar.save(t); + } +}; + +namespace detail { + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +template +class oserializer : public basic_oserializer +{ +private: + // private constructor to inhibit any existence other than the + // static one +public: + explicit BOOST_DLLEXPORT oserializer() : + basic_oserializer( + boost::serialization::singleton< + typename + boost::serialization::type_info_implementation< T >::type + >::get_const_instance() + ) + {} + BOOST_DLLEXPORT void save_object_data( + basic_oarchive & ar, + const void *x + ) const BOOST_OVERRIDE BOOST_USED; + bool class_info() const BOOST_OVERRIDE { + return boost::serialization::implementation_level< T >::value + >= boost::serialization::object_class_info; + } + bool tracking(const unsigned int /* flags */) const BOOST_OVERRIDE { + return boost::serialization::tracking_level< T >::value == boost::serialization::track_always + || (boost::serialization::tracking_level< T >::value == boost::serialization::track_selectively + && serialized_as_pointer()); + } + version_type version() const BOOST_OVERRIDE { + return version_type(::boost::serialization::version< T >::value); + } + bool is_polymorphic() const BOOST_OVERRIDE { + return boost::is_polymorphic< T >::value; + } + ~oserializer() BOOST_OVERRIDE {} +}; + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +template +BOOST_DLLEXPORT void oserializer::save_object_data( + basic_oarchive & ar, + const void *x +) const { + // make sure call is routed through the highest interface that might + // be specialized by the user. + BOOST_STATIC_ASSERT(boost::is_const< T >::value == false); + boost::serialization::serialize_adl( + boost::serialization::smart_cast_reference(ar), + * static_cast(const_cast(x)), + version() + ); +} + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +template +class pointer_oserializer : + public basic_pointer_oserializer +{ +private: + const basic_oserializer & + get_basic_serializer() const BOOST_OVERRIDE { + return boost::serialization::singleton< + oserializer + >::get_const_instance(); + } + BOOST_DLLEXPORT void save_object_ptr( + basic_oarchive & ar, + const void * x + ) const BOOST_OVERRIDE BOOST_USED; +public: + pointer_oserializer(); + ~pointer_oserializer() BOOST_OVERRIDE; +}; + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +template +BOOST_DLLEXPORT void pointer_oserializer::save_object_ptr( + basic_oarchive & ar, + const void * x +) const { + BOOST_ASSERT(NULL != x); + // make sure call is routed through the highest interface that might + // be specialized by the user. + T * t = static_cast(const_cast(x)); + const unsigned int file_version = boost::serialization::version< T >::value; + Archive & ar_impl + = boost::serialization::smart_cast_reference(ar); + boost::serialization::save_construct_data_adl( + ar_impl, + t, + file_version + ); + ar_impl << boost::serialization::make_nvp(NULL, * t); +} + +template +pointer_oserializer::pointer_oserializer() : + basic_pointer_oserializer( + boost::serialization::singleton< + typename + boost::serialization::type_info_implementation< T >::type + >::get_const_instance() + ) +{ + // make sure appropriate member function is instantiated + boost::serialization::singleton< + oserializer + >::get_mutable_instance().set_bpos(this); + archive_serializer_map::insert(this); +} + +template +pointer_oserializer::~pointer_oserializer(){ + archive_serializer_map::erase(this); +} + +template +struct save_non_pointer_type { + // note this bounces the call right back to the archive + // with no runtime overhead + struct save_primitive { + template + static void invoke(Archive & ar, const T & t){ + save_access::save_primitive(ar, t); + } + }; + // same as above but passes through serialization + struct save_only { + template + static void invoke(Archive & ar, const T & t){ + // make sure call is routed through the highest interface that might + // be specialized by the user. + boost::serialization::serialize_adl( + ar, + const_cast(t), + ::boost::serialization::version< T >::value + ); + } + }; + // adds class information to the archive. This includes + // serialization level and class version + struct save_standard { + template + static void invoke(Archive &ar, const T & t){ + ar.save_object( + boost::addressof(t), + boost::serialization::singleton< + oserializer + >::get_const_instance() + ); + } + }; + + + + // adds class information to the archive. This includes + // serialization level and class version + struct save_conditional { + template + static void invoke(Archive &ar, const T &t){ + //if(0 == (ar.get_flags() & no_tracking)) + save_standard::invoke(ar, t); + //else + // save_only::invoke(ar, t); + } + }; + + + template + static void invoke(Archive & ar, const T & t){ + typedef + typename mpl::eval_if< + // if its primitive + mpl::equal_to< + boost::serialization::implementation_level< T >, + mpl::int_ + >, + mpl::identity, + // else + typename mpl::eval_if< + // class info / version + mpl::greater_equal< + boost::serialization::implementation_level< T >, + mpl::int_ + >, + // do standard save + mpl::identity, + // else + typename mpl::eval_if< + // no tracking + mpl::equal_to< + boost::serialization::tracking_level< T >, + mpl::int_ + >, + // do a fast save + mpl::identity, + // else + // do a fast save only tracking is turned off + mpl::identity + > > >::type typex; + check_object_versioning< T >(); + typex::invoke(ar, t); + } + template + static void invoke(Archive & ar, T & t){ + check_object_level< T >(); + check_object_tracking< T >(); + invoke(ar, const_cast(t)); + } +}; + +template +struct save_pointer_type { + struct abstract + { + template + static const basic_pointer_oserializer * register_type(Archive & /* ar */){ + // it has? to be polymorphic + BOOST_STATIC_ASSERT(boost::is_polymorphic< T >::value); + return NULL; + } + }; + + struct non_abstract + { + template + static const basic_pointer_oserializer * register_type(Archive & ar){ + return ar.register_type(static_cast(NULL)); + } + }; + + template + static const basic_pointer_oserializer * register_type(Archive &ar, T* const /*t*/){ + // there should never be any need to save an abstract polymorphic + // class pointer. Inhibiting code generation for this + // permits abstract base classes to be used - note: exception + // virtual serialize functions used for plug-ins + typedef + typename mpl::eval_if< + boost::serialization::is_abstract< T >, + mpl::identity, + mpl::identity + >::type typex; + return typex::template register_type< T >(ar); + } + + struct non_polymorphic + { + template + static void save( + Archive &ar, + T & t + ){ + const basic_pointer_oserializer & bpos = + boost::serialization::singleton< + pointer_oserializer + >::get_const_instance(); + // save the requested pointer type + ar.save_pointer(& t, & bpos); + } + }; + + struct polymorphic + { + template + static void save( + Archive &ar, + T & t + ){ + typename + boost::serialization::type_info_implementation< T >::type const + & i = boost::serialization::singleton< + typename + boost::serialization::type_info_implementation< T >::type + >::get_const_instance(); + + boost::serialization::extended_type_info const * const this_type = & i; + + // retrieve the true type of the object pointed to + // if this assertion fails its an error in this library + BOOST_ASSERT(NULL != this_type); + + const boost::serialization::extended_type_info * true_type = + i.get_derived_extended_type_info(t); + + // note:if this exception is thrown, be sure that derived pointer + // is either registered or exported. + if(NULL == true_type){ + boost::serialization::throw_exception( + archive_exception( + archive_exception::unregistered_class, + "derived class not registered or exported" + ) + ); + } + + // if its not a pointer to a more derived type + const void *vp = static_cast(&t); + if(*this_type == *true_type){ + const basic_pointer_oserializer * bpos = register_type(ar, &t); + ar.save_pointer(vp, bpos); + return; + } + // convert pointer to more derived type. if this is thrown + // it means that the base/derived relationship hasn't be registered + vp = serialization::void_downcast( + *true_type, + *this_type, + static_cast(&t) + ); + if(NULL == vp){ + boost::serialization::throw_exception( + archive_exception( + archive_exception::unregistered_cast, + true_type->get_debug_info(), + this_type->get_debug_info() + ) + ); + } + + // since true_type is valid, and this only gets made if the + // pointer oserializer object has been created, this should never + // fail + const basic_pointer_oserializer * bpos + = static_cast( + boost::serialization::singleton< + archive_serializer_map + >::get_const_instance().find(*true_type) + ); + BOOST_ASSERT(NULL != bpos); + if(NULL == bpos) + boost::serialization::throw_exception( + archive_exception( + archive_exception::unregistered_class, + "derived class not registered or exported" + ) + ); + ar.save_pointer(vp, bpos); + } + }; + + template + static void save( + Archive & ar, + const T & t + ){ + check_pointer_level< T >(); + check_pointer_tracking< T >(); + typedef typename mpl::eval_if< + is_polymorphic< T >, + mpl::identity, + mpl::identity + >::type type; + type::save(ar, const_cast(t)); + } + + template + static void invoke(Archive &ar, const TPtr t){ + register_type(ar, t); + if(NULL == t){ + basic_oarchive & boa + = boost::serialization::smart_cast_reference(ar); + boa.save_null_pointer(); + save_access::end_preamble(ar); + return; + } + save(ar, * t); + } +}; + +template +struct save_enum_type +{ + template + static void invoke(Archive &ar, const T &t){ + // convert enum to integers on save + const int i = static_cast(t); + ar << boost::serialization::make_nvp(NULL, i); + } +}; + +template +struct save_array_type +{ + template + static void invoke(Archive &ar, const T &t){ + typedef typename boost::remove_extent< T >::type value_type; + + save_access::end_preamble(ar); + // consider alignment + std::size_t c = sizeof(t) / ( + static_cast(static_cast(&t[1])) + - static_cast(static_cast(&t[0])) + ); + boost::serialization::collection_size_type count(c); + ar << BOOST_SERIALIZATION_NVP(count); + // explict template arguments to pass intel C++ compiler + ar << serialization::make_array< + const value_type, + boost::serialization::collection_size_type + >( + static_cast(&t[0]), + count + ); + } +}; + +} // detail + +template +inline void save(Archive & ar, /*const*/ T &t){ + typedef + typename mpl::eval_if, + mpl::identity >, + //else + typename mpl::eval_if, + mpl::identity >, + //else + typename mpl::eval_if, + mpl::identity >, + //else + mpl::identity > + > + > + >::type typex; + typex::invoke(ar, t); +} + +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_OSERIALIZER_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/polymorphic_iarchive_route.hpp b/thirdparty/boost-1_79/boost/archive/detail/polymorphic_iarchive_route.hpp new file mode 100644 index 00000000..381c50eb --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/polymorphic_iarchive_route.hpp @@ -0,0 +1,218 @@ +#ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_ROUTE_HPP +#define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_ROUTE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_iarchive_route.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization +namespace archive { +namespace detail{ + +class basic_iserializer; +class basic_pointer_iserializer; + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +template +class polymorphic_iarchive_route : + public polymorphic_iarchive, + // note: gcc dynamic cross cast fails if the the derivation below is + // not public. I think this is a mistake. + public /*protected*/ ArchiveImplementation +{ +private: + // these are used by the serialization library. + void load_object( + void *t, + const basic_iserializer & bis + ) BOOST_OVERRIDE { + ArchiveImplementation::load_object(t, bis); + } + const basic_pointer_iserializer * load_pointer( + void * & t, + const basic_pointer_iserializer * bpis_ptr, + const basic_pointer_iserializer * (*finder)( + const boost::serialization::extended_type_info & type + ) + ) BOOST_OVERRIDE { + return ArchiveImplementation::load_pointer(t, bpis_ptr, finder); + } + void set_library_version(boost::serialization::library_version_type archive_library_version) BOOST_OVERRIDE { + ArchiveImplementation::set_library_version(archive_library_version); + } + boost::serialization::library_version_type get_library_version() const BOOST_OVERRIDE { + return ArchiveImplementation::get_library_version(); + } + unsigned int get_flags() const BOOST_OVERRIDE { + return ArchiveImplementation::get_flags(); + } + void delete_created_pointers() BOOST_OVERRIDE { + ArchiveImplementation::delete_created_pointers(); + } + void reset_object_address( + const void * new_address, + const void * old_address + ) BOOST_OVERRIDE { + ArchiveImplementation::reset_object_address(new_address, old_address); + } + void load_binary(void * t, std::size_t size) BOOST_OVERRIDE { + ArchiveImplementation::load_binary(t, size); + } + // primitive types the only ones permitted by polymorphic archives + void load(bool & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + void load(char & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + void load(signed char & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + void load(unsigned char & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + #ifndef BOOST_NO_CWCHAR + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + void load(wchar_t & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + #endif + #endif + void load(short & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + void load(unsigned short & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + void load(int & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + void load(unsigned int & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + void load(long & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + void load(unsigned long & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + #if defined(BOOST_HAS_LONG_LONG) + void load(boost::long_long_type & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + void load(boost::ulong_long_type & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + #elif defined(BOOST_HAS_MS_INT64) + void load(__int64 & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + void load(unsigned __int64 & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + #endif + void load(float & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + void load(double & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + void load(std::string & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + #ifndef BOOST_NO_STD_WSTRING + void load(std::wstring & t) BOOST_OVERRIDE { + ArchiveImplementation::load(t); + } + #endif + // used for xml and other tagged formats default does nothing + void load_start(const char * name) BOOST_OVERRIDE { + ArchiveImplementation::load_start(name); + } + void load_end(const char * name) BOOST_OVERRIDE { + ArchiveImplementation::load_end(name); + } + void register_basic_serializer(const basic_iserializer & bis) BOOST_OVERRIDE { + ArchiveImplementation::register_basic_serializer(bis); + } + helper_collection & + get_helper_collection() BOOST_OVERRIDE { + return ArchiveImplementation::get_helper_collection(); + } +public: + // this can't be inherited because they appear in multiple + // parents + typedef mpl::bool_ is_loading; + typedef mpl::bool_ is_saving; + // the >> operator + template + polymorphic_iarchive & operator>>(T & t){ + return polymorphic_iarchive::operator>>(t); + } + // the & operator + template + polymorphic_iarchive & operator&(T & t){ + return polymorphic_iarchive::operator&(t); + } + // register type function + template + const basic_pointer_iserializer * + register_type(T * t = NULL){ + return ArchiveImplementation::register_type(t); + } + // all current archives take a stream as constructor argument + template + polymorphic_iarchive_route( + std::basic_istream<_Elem, _Tr> & is, + unsigned int flags = 0 + ) : + ArchiveImplementation(is, flags) + {} + ~polymorphic_iarchive_route() BOOST_OVERRIDE {} +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_DISPATCH_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/polymorphic_oarchive_route.hpp b/thirdparty/boost-1_79/boost/archive/detail/polymorphic_oarchive_route.hpp new file mode 100644 index 00000000..be67742d --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/polymorphic_oarchive_route.hpp @@ -0,0 +1,209 @@ +#ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_HPP +#define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_oarchive_route.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include // size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization +namespace archive { +namespace detail{ + +class basic_oserializer; +class basic_pointer_oserializer; + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +template +class polymorphic_oarchive_route : + public polymorphic_oarchive, + // note: gcc dynamic cross cast fails if the the derivation below is + // not public. I think this is a mistake. + public /*protected*/ ArchiveImplementation +{ +private: + // these are used by the serialization library. + void save_object( + const void *x, + const detail::basic_oserializer & bos + ) BOOST_OVERRIDE { + ArchiveImplementation::save_object(x, bos); + } + void save_pointer( + const void * t, + const detail::basic_pointer_oserializer * bpos_ptr + ) BOOST_OVERRIDE { + ArchiveImplementation::save_pointer(t, bpos_ptr); + } + void save_null_pointer() BOOST_OVERRIDE { + ArchiveImplementation::save_null_pointer(); + } + // primitive types the only ones permitted by polymorphic archives + void save(const bool t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + void save(const char t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + void save(const signed char t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + void save(const unsigned char t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + #ifndef BOOST_NO_CWCHAR + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + void save(const wchar_t t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + #endif + #endif + void save(const short t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + void save(const unsigned short t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + void save(const int t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + void save(const unsigned int t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + void save(const long t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + void save(const unsigned long t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + #if defined(BOOST_HAS_LONG_LONG) + void save(const boost::long_long_type t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + void save(const boost::ulong_long_type t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + #elif defined(BOOST_HAS_MS_INT64) + void save(const boost::int64_t t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + void save(const boost::uint64_t t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + #endif + void save(const float t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + void save(const double t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + void save(const std::string & t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + #ifndef BOOST_NO_STD_WSTRING + void save(const std::wstring & t) BOOST_OVERRIDE { + ArchiveImplementation::save(t); + } + #endif + boost::serialization::library_version_type get_library_version() const BOOST_OVERRIDE { + return ArchiveImplementation::get_library_version(); + } + unsigned int get_flags() const BOOST_OVERRIDE { + return ArchiveImplementation::get_flags(); + } + void save_binary(const void * t, std::size_t size) BOOST_OVERRIDE { + ArchiveImplementation::save_binary(t, size); + } + // used for xml and other tagged formats default does nothing + void save_start(const char * name) BOOST_OVERRIDE { + ArchiveImplementation::save_start(name); + } + void save_end(const char * name) BOOST_OVERRIDE { + ArchiveImplementation::save_end(name); + } + void end_preamble() BOOST_OVERRIDE { + ArchiveImplementation::end_preamble(); + } + void register_basic_serializer(const detail::basic_oserializer & bos) BOOST_OVERRIDE { + ArchiveImplementation::register_basic_serializer(bos); + } + helper_collection & + get_helper_collection() BOOST_OVERRIDE { + return ArchiveImplementation::get_helper_collection(); + } +public: + // this can't be inherited because they appear in multiple + // parents + typedef mpl::bool_ is_loading; + typedef mpl::bool_ is_saving; + // the << operator + template + polymorphic_oarchive & operator<<(T & t){ + return polymorphic_oarchive::operator<<(t); + } + // the & operator + template + polymorphic_oarchive & operator&(T & t){ + return polymorphic_oarchive::operator&(t); + } + // register type function + template + const basic_pointer_oserializer * + register_type(T * t = NULL){ + return ArchiveImplementation::register_type(t); + } + // all current archives take a stream as constructor argument + template + polymorphic_oarchive_route( + std::basic_ostream<_Elem, _Tr> & os, + unsigned int flags = 0 + ) : + ArchiveImplementation(os, flags) + {} + ~polymorphic_oarchive_route() BOOST_OVERRIDE {} +}; + +} // namespace detail +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_DISPATCH_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/register_archive.hpp b/thirdparty/boost-1_79/boost/archive/detail/register_archive.hpp new file mode 100644 index 00000000..ebc24c05 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/register_archive.hpp @@ -0,0 +1,91 @@ +// Copyright David Abrahams 2006. Distributed under the Boost +// Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#ifndef BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP +# define BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP + +namespace boost { namespace archive { namespace detail { + +// No instantiate_ptr_serialization overloads generated by +// BOOST_SERIALIZATION_REGISTER_ARCHIVE that lexically follow the call +// will be seen *unless* they are in an associated namespace of one of +// the arguments, so we pass one of these along to make sure this +// namespace is considered. See temp.dep.candidate (14.6.4.2) in the +// standard. +struct adl_tag {}; + +template +struct ptr_serialization_support; + +// We could've just used ptr_serialization_support, above, but using +// it with only a forward declaration causes vc6/7 to complain about a +// missing instantiate member, even if it has one. This is just a +// friendly layer of indirection. +template +struct _ptr_serialization_support + : ptr_serialization_support +{ + typedef int type; +}; + +#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5130) + +template +struct counter : counter {}; +template<> +struct counter<0> {}; + +template +void instantiate_ptr_serialization(Serializable* s, int, adl_tag) { + instantiate_ptr_serialization(s, counter<20>()); +} + +template +struct get_counter { + static const int value = sizeof(adjust_counter(counter<20>())); + typedef counter type; + typedef counter prior; + typedef char (&next)[value+1]; +}; + +char adjust_counter(counter<0>); +template +void instantiate_ptr_serialization(Serializable*, counter<0>) {} + +#define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \ +namespace boost { namespace archive { namespace detail { \ + get_counter::next adjust_counter(get_counter::type);\ + template \ + void instantiate_ptr_serialization(Serializable* s, \ + get_counter::type) { \ + ptr_serialization_support x; \ + instantiate_ptr_serialization(s, get_counter::prior()); \ + }\ +}}} + + +#else + +// This function gets called, but its only purpose is to participate +// in overload resolution with the functions declared by +// BOOST_SERIALIZATION_REGISTER_ARCHIVE, below. +template +void instantiate_ptr_serialization(Serializable*, int, adl_tag ) {} + +// The function declaration generated by this macro never actually +// gets called, but its return type gets instantiated, and that's +// enough to cause registration of serialization functions between +// Archive and any exported Serializable type. See also: +// boost/serialization/export.hpp +# define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \ +namespace boost { namespace archive { namespace detail { \ + \ +template \ +typename _ptr_serialization_support::type \ +instantiate_ptr_serialization( Serializable*, Archive*, adl_tag ); \ + \ +}}} +#endif +}}} // namespace boost::archive::detail + +#endif // BOOST_ARCHIVE_DETAIL_INSTANTIATE_SERIALIZE_DWA2006521_HPP diff --git a/thirdparty/boost-1_79/boost/archive/detail/utf8_codecvt_facet.hpp b/thirdparty/boost-1_79/boost/archive/detail/utf8_codecvt_facet.hpp new file mode 100644 index 00000000..5c785484 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/detail/utf8_codecvt_facet.hpp @@ -0,0 +1,28 @@ +// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu) +// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP +#define BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP + +#include + +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#endif + +// use boost's utf8 codecvt facet +#include +#define BOOST_UTF8_BEGIN_NAMESPACE \ + namespace boost { namespace archive { namespace detail { +#define BOOST_UTF8_END_NAMESPACE }}} + +#include + +#undef BOOST_UTF8_END_NAMESPACE +#undef BOOST_UTF8_DECL +#undef BOOST_UTF8_BEGIN_NAMESPACE + +#endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP diff --git a/thirdparty/boost-1_79/boost/archive/dinkumware.hpp b/thirdparty/boost-1_79/boost/archive/dinkumware.hpp new file mode 100644 index 00000000..97efcea1 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/dinkumware.hpp @@ -0,0 +1,222 @@ +#ifndef BOOST_ARCHIVE_DINKUMWARE_HPP +#define BOOST_ARCHIVE_DINKUMWARE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// dinkumware.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// this file adds a couple of things that are missing from the dinkumware +// implementation of the standard library. + +#include +#include + +#include +#include + +namespace std { + +// define i/o operators for 64 bit integers +template +basic_ostream & +operator<<(basic_ostream & os, boost::uint64_t t){ + // octal rendering of 64 bit number would be 22 octets + eos + CharType d[23]; + unsigned int radix; + + if(os.flags() & (int)std::ios_base::hex) + radix = 16; + else + if(os.flags() & (int)std::ios_base::oct) + radix = 8; + else + //if(s.flags() & (int)std::ios_base::dec) + radix = 10; + unsigned int i = 0; + do{ + unsigned int j = t % radix; + d[i++] = j + ((j < 10) ? '0' : ('a' - 10)); + t /= radix; + } + while(t > 0); + d[i--] = '\0'; + + // reverse digits + unsigned int j = 0; + while(j < i){ + CharType k = d[i]; + d[i] = d[j]; + d[j] = k; + --i;++j; + } + os << d; + return os; + +} + +template +basic_ostream & +operator<<(basic_ostream &os, boost::int64_t t){ + if(0 <= t){ + os << static_cast(t); + } + else{ + os.put('-'); + os << -t; + } + return os; +} + +template +basic_istream & +operator>>(basic_istream &is, boost::int64_t & t){ + CharType d; + do{ + d = is.get(); + } + while(::isspace(d)); + bool negative = (d == '-'); + if(negative) + d = is.get(); + unsigned int radix; + if(is.flags() & (int)std::ios_base::hex) + radix = 16; + else + if(is.flags() & (int)std::ios_base::oct) + radix = 8; + else + //if(s.flags() & (int)std::ios_base::dec) + radix = 10; + t = 0; + do{ + if('0' <= d && d <= '9') + t = t * radix + (d - '0'); + else + if('a' <= d && d <= 'f') + t = t * radix + (d - 'a' + 10); + else + break; + d = is.get(); + } + while(!is.fail()); + // restore the delimiter + is.putback(d); + is.clear(); + if(negative) + t = -t; + return is; +} + +template +basic_istream & +operator>>(basic_istream &is, boost::uint64_t & t){ + boost::int64_t it; + is >> it; + t = it; + return is; +} + +template<> +class back_insert_iterator > : public + iterator +{ +public: + typedef basic_string container_type; + typedef container_type::reference reference; + + explicit back_insert_iterator(container_type & s) + : container(& s) + {} // construct with container + + back_insert_iterator & operator=( + container_type::const_reference Val_ + ){ // push value into container + //container->push_back(Val_); + *container += Val_; + return (*this); + } + + back_insert_iterator & operator*(){ + return (*this); + } + + back_insert_iterator & operator++(){ + // pretend to preincrement + return (*this); + } + + back_insert_iterator operator++(int){ + // pretend to postincrement + return (*this); + } + +protected: + container_type *container; // pointer to container +}; + +template +inline back_insert_iterator > back_inserter( + basic_string & s +){ + return (std::back_insert_iterator >(s)); +} + +template<> +class back_insert_iterator > : public + iterator +{ +public: + typedef basic_string container_type; + typedef container_type::reference reference; + + explicit back_insert_iterator(container_type & s) + : container(& s) + {} // construct with container + + back_insert_iterator & operator=( + container_type::const_reference Val_ + ){ // push value into container + //container->push_back(Val_); + *container += Val_; + return (*this); + } + + back_insert_iterator & operator*(){ + return (*this); + } + + back_insert_iterator & operator++(){ + // pretend to preincrement + return (*this); + } + + back_insert_iterator operator++(int){ + // pretend to postincrement + return (*this); + } + +protected: + container_type *container; // pointer to container +}; + +template +inline back_insert_iterator > back_inserter( + basic_string & s +){ + return (std::back_insert_iterator >(s)); +} + +} // namespace std + +#endif //BOOST_ARCHIVE_DINKUMWARE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/impl/archive_serializer_map.ipp b/thirdparty/boost-1_79/boost/archive/impl/archive_serializer_map.ipp new file mode 100644 index 00000000..98e058dd --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/archive_serializer_map.ipp @@ -0,0 +1,75 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// archive_serializer_map.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +////////////////////////////////////////////////////////////////////// +// implementation of basic_text_iprimitive overrides for the combination +// of template parameters used to implement a text_iprimitive + +#include +#include +#include +#include + +namespace boost { +namespace archive { +namespace detail { + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace extra_detail { // anon + template + class map : public basic_serializer_map + {}; +} + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL bool +archive_serializer_map::insert(const basic_serializer * bs){ + return boost::serialization::singleton< + extra_detail::map + >::get_mutable_instance().insert(bs); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +archive_serializer_map::erase(const basic_serializer * bs){ + // note: previously this conditional was a runtime assertion with + // BOOST_ASSERT. We've changed it because we've discovered that at + // least one platform is not guaranteed to destroy singletons in + // reverse order of distruction. + if(boost::serialization::singleton< + extra_detail::map + >::is_destroyed()) + return; + boost::serialization::singleton< + extra_detail::map + >::get_mutable_instance().erase(bs); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL const basic_serializer * +archive_serializer_map::find( + const boost::serialization::extended_type_info & eti +) { + return boost::serialization::singleton< + extra_detail::map + >::get_const_instance().find(eti); +} + +} // namespace detail +} // namespace archive +} // namespace boost diff --git a/thirdparty/boost-1_79/boost/archive/impl/basic_binary_iarchive.ipp b/thirdparty/boost-1_79/boost/archive/impl/basic_binary_iarchive.ipp new file mode 100644 index 00000000..1755250e --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/basic_binary_iarchive.ipp @@ -0,0 +1,134 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_iarchive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include +#include +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; + using ::strlen; + using ::size_t; +} +#endif + +#include +#include + +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of binary_binary_archive +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_binary_iarchive::load_override(class_name_type & t){ + std::string cn; + cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE); + load_override(cn); + if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1)) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_class_name) + ); + std::memcpy(t, cn.data(), cn.size()); + // borland tweak + t.t[cn.size()] = '\0'; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_binary_iarchive::init() { + // read signature in an archive version independent manner + std::string file_signature; + + #if 0 // commented out since it interfers with derivation + BOOST_TRY { + std::size_t l; + this->This()->load(l); + if(l == std::strlen(BOOST_ARCHIVE_SIGNATURE())) { + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != file_signature.data()) + #endif + file_signature.resize(l); + // note breaking a rule here - could be a problem on some platform + if(0 < l) + this->This()->load_binary(&(*file_signature.begin()), l); + } + } + BOOST_CATCH(archive_exception const &) { // catch stream_error archive exceptions + // will cause invalid_signature archive exception to be thrown below + file_signature = ""; + } + BOOST_CATCH_END + #else + // https://svn.boost.org/trac/boost/ticket/7301 + * this->This() >> file_signature; + #endif + + if(file_signature != BOOST_ARCHIVE_SIGNATURE()) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_signature) + ); + + // make sure the version of the reading archive library can + // support the format of the archive being read + boost::serialization::library_version_type input_library_version; + //* this->This() >> input_library_version; + { + int v = 0; + v = this->This()->m_sb.sbumpc(); + #if BOOST_ENDIAN_LITTLE_BYTE + if(v < 6){ + ; + } + else + if(v < 7){ + // version 6 - next byte should be zero + this->This()->m_sb.sbumpc(); + } + else + if(v < 8){ + int x1; + // version 7 = might be followed by zero or some other byte + x1 = this->This()->m_sb.sgetc(); + // it's =a zero, push it back + if(0 == x1) + this->This()->m_sb.sbumpc(); + } + else{ + // version 8+ followed by a zero + this->This()->m_sb.sbumpc(); + } + #elif BOOST_ENDIAN_BIG_BYTE + if(v == 0) + v = this->This()->m_sb.sbumpc(); + #endif + input_library_version = static_cast(v); + } + + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + this->set_library_version(input_library_version); + #else + detail::basic_iarchive::set_library_version(input_library_version); + #endif + + if(BOOST_ARCHIVE_VERSION() < input_library_version) + boost::serialization::throw_exception( + archive_exception(archive_exception::unsupported_version) + ); +} + +} // namespace archive +} // namespace boost diff --git a/thirdparty/boost-1_79/boost/archive/impl/basic_binary_iprimitive.ipp b/thirdparty/boost-1_79/boost/archive/impl/basic_binary_iprimitive.ipp new file mode 100644 index 00000000..e2d05108 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/basic_binary_iprimitive.ipp @@ -0,0 +1,173 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_iprimitive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // size_t, NULL +#include // memcpy + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; + using ::memcpy; +} // namespace std +#endif + +#include +#include +#include +#include + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of basic_binary_iprimitive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_binary_iprimitive::init() +{ + // Detect attempts to pass native binary archives across + // incompatible platforms. This is not fool proof but its + // better than nothing. + unsigned char size; + this->This()->load(size); + if(sizeof(int) != size) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of int" + ) + ); + this->This()->load(size); + if(sizeof(long) != size) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of long" + ) + ); + this->This()->load(size); + if(sizeof(float) != size) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of float" + ) + ); + this->This()->load(size); + if(sizeof(double) != size) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "size of double" + ) + ); + + // for checking endian + int i; + this->This()->load(i); + if(1 != i) + boost::serialization::throw_exception( + archive_exception( + archive_exception::incompatible_native_format, + "endian setting" + ) + ); +} + +#ifndef BOOST_NO_CWCHAR +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_binary_iprimitive::load(wchar_t * ws) +{ + std::size_t l; // number of wchar_t !!! + this->This()->load(l); + load_binary(ws, l * sizeof(wchar_t) / sizeof(char)); + ws[l] = L'\0'; +} +#endif +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_binary_iprimitive::load(std::string & s) +{ + std::size_t l; + this->This()->load(l); + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != s.data()) + #endif + s.resize(l); + // note breaking a rule here - could be a problem on some platform + if(0 < l) + load_binary(&(*s.begin()), l); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_binary_iprimitive::load(char * s) +{ + std::size_t l; + this->This()->load(l); + load_binary(s, l); + s[l] = '\0'; +} + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_binary_iprimitive::load(std::wstring & ws) +{ + std::size_t l; + this->This()->load(l); + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != ws.data()) + #endif + ws.resize(l); + // note breaking a rule here - is could be a problem on some platform + load_binary(const_cast(ws.data()), l * sizeof(wchar_t) / sizeof(char)); +} +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL +basic_binary_iprimitive::basic_binary_iprimitive( + std::basic_streambuf & sb, + bool no_codecvt +) : +#ifndef BOOST_NO_STD_LOCALE + m_sb(sb), + codecvt_null_facet(1), + locale_saver(m_sb), + archive_locale(sb.getloc(), & codecvt_null_facet) +{ + if(! no_codecvt){ + m_sb.pubsync(); + m_sb.pubimbue(archive_locale); + } +} +#else + m_sb(sb) +{} +#endif + +// scoped_ptr requires that g be a complete type at time of +// destruction so define destructor here rather than in the header +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL +basic_binary_iprimitive::~basic_binary_iprimitive(){} + +} // namespace archive +} // namespace boost diff --git a/thirdparty/boost-1_79/boost/archive/impl/basic_binary_oarchive.ipp b/thirdparty/boost-1_79/boost/archive/impl/basic_binary_oarchive.ipp new file mode 100644 index 00000000..b83ac619 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/basic_binary_oarchive.ipp @@ -0,0 +1,42 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_oarchive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include +#include +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of binary_binary_oarchive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_binary_oarchive::init(){ + // write signature in an archive version independent manner + const std::string file_signature(BOOST_ARCHIVE_SIGNATURE()); + * this->This() << file_signature; + // write library version + const boost::serialization::library_version_type v(BOOST_ARCHIVE_VERSION()); + * this->This() << v; +} + +} // namespace archive +} // namespace boost diff --git a/thirdparty/boost-1_79/boost/archive/impl/basic_binary_oprimitive.ipp b/thirdparty/boost-1_79/boost/archive/impl/basic_binary_oprimitive.ipp new file mode 100644 index 00000000..7b042173 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/basic_binary_oprimitive.ipp @@ -0,0 +1,126 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_binary_oprimitive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL +#include + +#include + +#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__) +namespace std{ + using ::strlen; +} // namespace std +#endif + +#ifndef BOOST_NO_CWCHAR +#include +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::wcslen; } +#endif +#endif + +#include +#include + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of basic_binary_oprimitive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_binary_oprimitive::init() +{ + // record native sizes of fundamental types + // this is to permit detection of attempts to pass + // native binary archives accross incompatible machines. + // This is not foolproof but its better than nothing. + this->This()->save(static_cast(sizeof(int))); + this->This()->save(static_cast(sizeof(long))); + this->This()->save(static_cast(sizeof(float))); + this->This()->save(static_cast(sizeof(double))); + // for checking endianness + this->This()->save(int(1)); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_binary_oprimitive::save(const char * s) +{ + std::size_t l = std::strlen(s); + this->This()->save(l); + save_binary(s, l); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_binary_oprimitive::save(const std::string &s) +{ + std::size_t l = static_cast(s.size()); + this->This()->save(l); + save_binary(s.data(), l); +} + +#ifndef BOOST_NO_CWCHAR +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_binary_oprimitive::save(const wchar_t * ws) +{ + std::size_t l = std::wcslen(ws); + this->This()->save(l); + save_binary(ws, l * sizeof(wchar_t) / sizeof(char)); +} +#endif + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_binary_oprimitive::save(const std::wstring &ws) +{ + std::size_t l = ws.size(); + this->This()->save(l); + save_binary(ws.data(), l * sizeof(wchar_t) / sizeof(char)); +} +#endif +#endif // BOOST_NO_CWCHAR + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL +basic_binary_oprimitive::basic_binary_oprimitive( + std::basic_streambuf & sb, + bool no_codecvt +) : +#ifndef BOOST_NO_STD_LOCALE + m_sb(sb), + codecvt_null_facet(1), + locale_saver(m_sb), + archive_locale(sb.getloc(), & codecvt_null_facet) +{ + if(! no_codecvt){ + m_sb.pubsync(); + m_sb.pubimbue(archive_locale); + } +} +#else + m_sb(sb) +{} +#endif + +// scoped_ptr requires that g be a complete type at time of +// destruction so define destructor here rather than in the header +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL +basic_binary_oprimitive::~basic_binary_oprimitive(){} + +} // namespace archive +} // namespace boost diff --git a/thirdparty/boost-1_79/boost/archive/impl/basic_text_iarchive.ipp b/thirdparty/boost-1_79/boost/archive/impl/basic_text_iarchive.ipp new file mode 100644 index 00000000..3e2def95 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/basic_text_iarchive.ipp @@ -0,0 +1,76 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_iarchive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include +#include +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of text_text_archive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_text_iarchive::load_override(class_name_type & t){ + std::string cn; + cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE); + load_override(cn); + if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1)) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_class_name) + ); + std::memcpy(t, cn.data(), cn.size()); + // borland tweak + t.t[cn.size()] = '\0'; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_text_iarchive::init() { + // read signature in an archive version independent manner + std::string file_signature; + * this->This() >> file_signature; + if(file_signature != BOOST_ARCHIVE_SIGNATURE()) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_signature) + ); + + // make sure the version of the reading archive library can + // support the format of the archive being read + boost::serialization::library_version_type input_library_version; + * this->This() >> input_library_version; + + #if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205)) + this->set_library_version(input_library_version); + #else + detail::basic_iarchive::set_library_version(input_library_version); + #endif + + // extra little .t is to get around borland quirk + if(BOOST_ARCHIVE_VERSION() < input_library_version) + boost::serialization::throw_exception( + archive_exception(archive_exception::unsupported_version) + ); +} + +} // namespace archive +} // namespace boost diff --git a/thirdparty/boost-1_79/boost/archive/impl/basic_text_iprimitive.ipp b/thirdparty/boost-1_79/boost/archive/impl/basic_text_iprimitive.ipp new file mode 100644 index 00000000..cad9c3f8 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/basic_text_iprimitive.ipp @@ -0,0 +1,138 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_iprimitive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // size_t, NULL +#include // NULL + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include + +#include + +#include +#include +#include +#include + +namespace boost { +namespace archive { + +namespace detail { + template + static inline bool is_whitespace(CharType c); + + template<> + inline bool is_whitespace(char t){ + return 0 != std::isspace(t); + } + + #ifndef BOOST_NO_CWCHAR + template<> + inline bool is_whitespace(wchar_t t){ + return 0 != std::iswspace(t); + } + #endif +} // detail + +// translate base64 text into binary and copy into buffer +// until buffer is full. +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_text_iprimitive::load_binary( + void *address, + std::size_t count +){ + typedef typename IStream::char_type CharType; + + if(0 == count) + return; + + BOOST_ASSERT( + static_cast((std::numeric_limits::max)()) + > (count + sizeof(CharType) - 1)/sizeof(CharType) + ); + + if(is.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::input_stream_error) + ); + // convert from base64 to binary + typedef typename + iterators::transform_width< + iterators::binary_from_base64< + iterators::remove_whitespace< + iterators::istream_iterator + > + ,typename IStream::int_type + > + ,8 + ,6 + ,CharType + > + binary; + + binary i = binary(iterators::istream_iterator(is)); + + char * caddr = static_cast(address); + + // take care that we don't increment anymore than necessary + while(count-- > 0){ + *caddr++ = static_cast(*i++); + } + + // skip over any excess input + for(;;){ + typename IStream::int_type r; + r = is.get(); + if(is.eof()) + break; + if(detail::is_whitespace(static_cast(r))) + break; + } +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL +basic_text_iprimitive::basic_text_iprimitive( + IStream &is_, + bool no_codecvt +) : + is(is_), + flags_saver(is_), +#ifndef BOOST_NO_STD_LOCALE + precision_saver(is_), + codecvt_null_facet(1), + archive_locale(is.getloc(), & codecvt_null_facet), + locale_saver(is) +{ + if(! no_codecvt){ + is_.sync(); + is_.imbue(archive_locale); + } + is_ >> std::noboolalpha; +} +#else + precision_saver(is_) +{} +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL +basic_text_iprimitive::~basic_text_iprimitive(){ +} + +} // namespace archive +} // namespace boost diff --git a/thirdparty/boost-1_79/boost/archive/impl/basic_text_oarchive.ipp b/thirdparty/boost-1_79/boost/archive/impl/basic_text_oarchive.ipp new file mode 100644 index 00000000..50084ca0 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/basic_text_oarchive.ipp @@ -0,0 +1,62 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_oarchive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. +#include +#include +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} +#endif + +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of basic_text_oarchive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_text_oarchive::newtoken() +{ + switch(delimiter){ + default: + BOOST_ASSERT(false); + break; + case eol: + this->This()->put('\n'); + delimiter = space; + break; + case space: + this->This()->put(' '); + break; + case none: + delimiter = space; + break; + } +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_text_oarchive::init(){ + // write signature in an archive version independent manner + const std::string file_signature(BOOST_ARCHIVE_SIGNATURE()); + * this->This() << file_signature; + // write library version + const boost::serialization::library_version_type v(BOOST_ARCHIVE_VERSION()); + * this->This() << v; +} + +} // namespace archive +} // namespace boost diff --git a/thirdparty/boost-1_79/boost/archive/impl/basic_text_oprimitive.ipp b/thirdparty/boost-1_79/boost/archive/impl/basic_text_oprimitive.ipp new file mode 100644 index 00000000..98a8879b --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/basic_text_oprimitive.ipp @@ -0,0 +1,117 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_text_oprimitive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // NULL +#include // std::copy +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include + +#include + +#include +#include +#include +#include + +namespace boost { +namespace archive { + +// translate to base64 and copy in to buffer. +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_text_oprimitive::save_binary( + const void *address, + std::size_t count +){ + typedef typename OStream::char_type CharType; + + if(0 == count) + return; + + if(os.fail()) + boost::serialization::throw_exception( + archive_exception(archive_exception::output_stream_error) + ); + + os.put('\n'); + + typedef + boost::archive::iterators::insert_linebreaks< + boost::archive::iterators::base64_from_binary< + boost::archive::iterators::transform_width< + const char *, + 6, + 8 + > + > + ,76 + ,const char // cwpro8 needs this + > + base64_text; + + boost::archive::iterators::ostream_iterator oi(os); + std::copy( + base64_text(static_cast(address)), + base64_text( + static_cast(address) + count + ), + oi + ); + + std::size_t tail = count % 3; + if(tail > 0){ + *oi++ = '='; + if(tail < 2) + *oi = '='; + } +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL +basic_text_oprimitive::basic_text_oprimitive( + OStream & os_, + bool no_codecvt +) : + os(os_), + flags_saver(os_), +#ifndef BOOST_NO_STD_LOCALE + precision_saver(os_), + codecvt_null_facet(1), + archive_locale(os.getloc(), & codecvt_null_facet), + locale_saver(os) +{ + if(! no_codecvt){ + os_.flush(); + os_.imbue(archive_locale); + } + os_ << std::noboolalpha; +} +#else + precision_saver(os_) +{} +#endif + + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL +basic_text_oprimitive::~basic_text_oprimitive(){ + if(boost::core::uncaught_exceptions() > 0) + return; + os << std::endl; +} + +} //namespace boost +} //namespace archive diff --git a/thirdparty/boost-1_79/boost/archive/impl/basic_xml_grammar.hpp b/thirdparty/boost-1_79/boost/archive/impl/basic_xml_grammar.hpp new file mode 100644 index 00000000..8f70e3d2 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/basic_xml_grammar.hpp @@ -0,0 +1,173 @@ +#ifndef BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP +#define BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_grammar.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// this module is derived from simplexml.cpp - an example shipped as part of +// the spirit parser. This example contains the following notice: +/*============================================================================= + simplexml.cpp + + Spirit V1.3 + URL: http://spirit.sourceforge.net/ + + Copyright (c) 2001, Daniel C. Nuffer + + This software is provided 'as-is', without any express or implied + warranty. In no event will the copyright holder be held liable for + any damages arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute + it freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must + not claim that you wrote the original software. If you use this + software in a product, an acknowledgment in the product documentation + would be appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source + distribution. +=============================================================================*/ +#include + +#include +#include + +#include +#include + +#include +#include +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// XML grammar parsing + +template +class BOOST_SYMBOL_VISIBLE basic_xml_grammar { +public: + // The following is not necessary according to DR45, but at least + // one compiler (Compaq C++ 6.5 in strict_ansi mode) chokes otherwise. + struct return_values; + friend struct return_values; + +private: + typedef typename std::basic_istream IStream; + typedef typename std::basic_string StringType; + typedef typename boost::spirit::classic::chset chset_t; + typedef typename boost::spirit::classic::chlit chlit_t; + typedef typename boost::spirit::classic::scanner< + typename std::basic_string::iterator + > scanner_t; + typedef typename boost::spirit::classic::rule rule_t; + // Start grammar definition + rule_t + Reference, + Eq, + STag, + ETag, + LetterOrUnderscoreOrColon, + AttValue, + CharRef1, + CharRef2, + CharRef, + AmpRef, + LTRef, + GTRef, + AposRef, + QuoteRef, + CharData, + CharDataChars, + content, + AmpName, + LTName, + GTName, + ClassNameChar, + ClassName, + Name, + XMLDecl, + XMLDeclChars, + DocTypeDecl, + DocTypeDeclChars, + ClassIDAttribute, + ObjectIDAttribute, + ClassNameAttribute, + TrackingAttribute, + VersionAttribute, + UnusedAttribute, + Attribute, + SignatureAttribute, + SerializationWrapper, + NameHead, + NameTail, + AttributeList, + S; + + // XML Character classes + chset_t + BaseChar, + Ideographic, + Char, + Letter, + Digit, + CombiningChar, + Extender, + Sch, + NameChar; + + void init_chset(); + + bool my_parse( + IStream & is, + const rule_t &rule_, + const CharType delimiter = L'>' + ) const ; +public: + struct return_values { + StringType object_name; + StringType contents; + //class_id_type class_id; + int_least16_t class_id; + //object_id_type object_id; + uint_least32_t object_id; + //version_type version; + unsigned int version; + tracking_type tracking_level; + StringType class_name; + return_values() : + version(0), + tracking_level(false) + {} + } rv; + bool parse_start_tag(IStream & is) /*const*/; + bool parse_end_tag(IStream & is) const; + bool parse_string(IStream & is, StringType & s) /*const*/; + void init(IStream & is); + bool windup(IStream & is); + basic_xml_grammar(); +}; + +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP diff --git a/thirdparty/boost-1_79/boost/archive/impl/basic_xml_iarchive.ipp b/thirdparty/boost-1_79/boost/archive/impl/basic_xml_iarchive.ipp new file mode 100644 index 00000000..f7490530 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/basic_xml_iarchive.ipp @@ -0,0 +1,114 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_iarchive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL +#include + +#include +#include +#include +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation of xml_text_archive + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_iarchive::load_start(const char *name){ + // if there's no name + if(NULL == name) + return; + bool result = this->This()->gimpl->parse_start_tag(this->This()->get_is()); + if(true != result){ + boost::serialization::throw_exception( + archive_exception(archive_exception::input_stream_error) + ); + } + // don't check start tag at highest level + ++depth; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_iarchive::load_end(const char *name){ + // if there's no name + if(NULL == name) + return; + bool result = this->This()->gimpl->parse_end_tag(this->This()->get_is()); + if(true != result){ + boost::serialization::throw_exception( + archive_exception(archive_exception::input_stream_error) + ); + } + + // don't check start tag at highest level + if(0 == --depth) + return; + + if(0 == (this->get_flags() & no_xml_tag_checking)){ + // double check that the tag matches what is expected - useful for debug + if(0 != name[this->This()->gimpl->rv.object_name.size()] + || ! std::equal( + this->This()->gimpl->rv.object_name.begin(), + this->This()->gimpl->rv.object_name.end(), + name + ) + ){ + boost::serialization::throw_exception( + xml_archive_exception( + xml_archive_exception::xml_archive_tag_mismatch, + name + ) + ); + } + } +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_iarchive::load_override(object_id_type & t){ + t = object_id_type(this->This()->gimpl->rv.object_id); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_iarchive::load_override(version_type & t){ + t = version_type(this->This()->gimpl->rv.version); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_iarchive::load_override(class_id_type & t){ + t = class_id_type(this->This()->gimpl->rv.class_id); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_iarchive::load_override(tracking_type & t){ + t = this->This()->gimpl->rv.tracking_level; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL +basic_xml_iarchive::basic_xml_iarchive(unsigned int flags) : + detail::common_iarchive(flags), + depth(0) +{} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL +basic_xml_iarchive::~basic_xml_iarchive(){ +} + +} // namespace archive +} // namespace boost diff --git a/thirdparty/boost-1_79/boost/archive/impl/basic_xml_oarchive.ipp b/thirdparty/boost-1_79/boost/archive/impl/basic_xml_oarchive.ipp new file mode 100644 index 00000000..3184413f --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/basic_xml_oarchive.ipp @@ -0,0 +1,272 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// basic_xml_oarchive.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL +#include +#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__) +namespace std{ + using ::strlen; +} // namespace std +#endif + +#include +#include +#include +#include + +namespace boost { +namespace archive { + +namespace detail { +template +struct XML_name { + void operator()(CharType t) const{ + const unsigned char lookup_table[] = { + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0, // -. + 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, // 0-9 + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // A- + 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, // -Z _ + 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // a- + 1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, // -z + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 + }; + if((unsigned)t > 127) + return; + if(0 == lookup_table[(unsigned)t]) + boost::serialization::throw_exception( + xml_archive_exception( + xml_archive_exception::xml_archive_tag_name_error + ) + ); + } +}; + +} // namespace detail + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions common to both types of xml output + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::write_attribute( + const char *attribute_name, + int t, + const char *conjunction +){ + this->This()->put(' '); + this->This()->put(attribute_name); + this->This()->put(conjunction); + this->This()->save(t); + this->This()->put('"'); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::write_attribute( + const char *attribute_name, + const char *key +){ + this->This()->put(' '); + this->This()->put(attribute_name); + this->This()->put("=\""); + this->This()->save(key); + this->This()->put('"'); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::indent(){ + int i; + for(i = depth; i-- > 0;) + this->This()->put('\t'); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::save_start(const char *name) +{ + if(NULL == name) + return; + + // be sure name has no invalid characters + std::for_each(name, name + std::strlen(name), detail::XML_name()); + + end_preamble(); + if(depth > 0){ + this->This()->put('\n'); + indent(); + } + ++depth; + this->This()->put('<'); + this->This()->save(name); + pending_preamble = true; + indent_next = false; +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::save_end(const char *name) +{ + if(NULL == name) + return; + + // be sure name has no invalid characters + std::for_each(name, name + std::strlen(name), detail::XML_name()); + + end_preamble(); + --depth; + if(indent_next){ + this->This()->put('\n'); + indent(); + } + indent_next = true; + this->This()->put("This()->save(name); + this->This()->put('>'); + if(0 == depth) + this->This()->put('\n'); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::end_preamble(){ + if(pending_preamble){ + this->This()->put('>'); + pending_preamble = false; + } +} +#if 0 +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::save_override(const object_id_type & t) +{ + int i = t.t; // extra .t is for borland + write_attribute(BOOST_ARCHIVE_XML_OBJECT_ID(), i, "=\"_"); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::save_override( + const object_reference_type & t, + int +){ + int i = t.t; // extra .t is for borland + write_attribute(BOOST_ARCHIVE_XML_OBJECT_REFERENCE(), i, "=\"_"); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::save_override(const version_type & t) +{ + int i = t.t; // extra .t is for borland + write_attribute(BOOST_ARCHIVE_XML_VERSION(), i); +} +#endif + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::save_override(const object_id_type & t) +{ + // borland doesn't do conversion of STRONG_TYPEDEFs very well + const unsigned int i = t; + write_attribute(BOOST_ARCHIVE_XML_OBJECT_ID(), i, "=\"_"); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::save_override( + const object_reference_type & t +){ + const unsigned int i = t; + write_attribute(BOOST_ARCHIVE_XML_OBJECT_REFERENCE(), i, "=\"_"); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::save_override(const version_type & t) +{ + const unsigned int i = t; + write_attribute(BOOST_ARCHIVE_XML_VERSION(), i); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::save_override(const class_id_type & t) +{ + write_attribute(BOOST_ARCHIVE_XML_CLASS_ID(), t); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::save_override( + const class_id_reference_type & t +){ + write_attribute(BOOST_ARCHIVE_XML_CLASS_ID_REFERENCE(), t); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::save_override( + const class_id_optional_type & t +){ + write_attribute(BOOST_ARCHIVE_XML_CLASS_ID(), t); +} +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::save_override(const class_name_type & t) +{ + const char * key = t; + if(NULL == key) + return; + write_attribute(BOOST_ARCHIVE_XML_CLASS_NAME(), key); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::save_override(const tracking_type & t) +{ + write_attribute(BOOST_ARCHIVE_XML_TRACKING(), t.t); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::init(){ + // xml header + this->This()->put("\n"); + this->This()->put("\n"); + // xml document wrapper - outer root + this->This()->put("This()->put(">\n"); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL void +basic_xml_oarchive::windup(){ + // xml_trailer + this->This()->put("\n"); +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL +basic_xml_oarchive::basic_xml_oarchive(unsigned int flags) : + detail::common_oarchive(flags), + depth(0), + pending_preamble(false), + indent_next(false) +{ +} + +template +BOOST_ARCHIVE_OR_WARCHIVE_DECL +basic_xml_oarchive::~basic_xml_oarchive(){ +} + +} // namespace archive +} // namespace boost diff --git a/thirdparty/boost-1_79/boost/archive/impl/text_iarchive_impl.ipp b/thirdparty/boost-1_79/boost/archive/impl/text_iarchive_impl.ipp new file mode 100644 index 00000000..a3a80c04 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/text_iarchive_impl.ipp @@ -0,0 +1,121 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_iarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +////////////////////////////////////////////////////////////////////// +// implementation of basic_text_iprimitive overrides for the combination +// of template parameters used to implement a text_iprimitive + +#include // size_t, NULL +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include // RogueWave + +#include + +namespace boost { +namespace archive { + +template +BOOST_ARCHIVE_DECL void +text_iarchive_impl::load(char *s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + // Works on all tested platforms + is.read(s, size); + s[size] = '\0'; +} + +template +BOOST_ARCHIVE_DECL void +text_iarchive_impl::load(std::string &s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != s.data()) + #endif + s.resize(size); + if(0 < size) + is.read(&(*s.begin()), size); +} + +#ifndef BOOST_NO_CWCHAR +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_ARCHIVE_DECL void +text_iarchive_impl::load(wchar_t *ws) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + is.read((char *)ws, size * sizeof(wchar_t)/sizeof(char)); + ws[size] = L'\0'; +} +#endif // BOOST_NO_INTRINSIC_WCHAR_T + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_DECL void +text_iarchive_impl::load(std::wstring &ws) +{ + std::size_t size; + * this->This() >> size; + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != ws.data()) + #endif + ws.resize(size); + // skip separating space + is.get(); + is.read((char *)ws.data(), size * sizeof(wchar_t)/sizeof(char)); +} + +#endif // BOOST_NO_STD_WSTRING +#endif // BOOST_NO_CWCHAR + +template +BOOST_ARCHIVE_DECL void +text_iarchive_impl::load_override(class_name_type & t){ + basic_text_iarchive::load_override(t); +} + +template +BOOST_ARCHIVE_DECL void +text_iarchive_impl::init(){ + basic_text_iarchive::init(); +} + +template +BOOST_ARCHIVE_DECL +text_iarchive_impl::text_iarchive_impl( + std::istream & is, + unsigned int flags +) : + basic_text_iprimitive( + is, + 0 != (flags & no_codecvt) + ), + basic_text_iarchive(flags) +{} + +} // namespace archive +} // namespace boost diff --git a/thirdparty/boost-1_79/boost/archive/impl/text_oarchive_impl.ipp b/thirdparty/boost-1_79/boost/archive/impl/text_oarchive_impl.ipp new file mode 100644 index 00000000..26fbc23a --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/text_oarchive_impl.ipp @@ -0,0 +1,116 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_oarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include // size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#ifndef BOOST_NO_CWCHAR +#include +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::wcslen; } +#endif +#endif + +#include + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of basic_text_oprimitive overrides for the combination +// of template parameters used to create a text_oprimitive + +template +BOOST_ARCHIVE_DECL void +text_oarchive_impl::save(const char * s) +{ + const std::size_t len = std::ostream::traits_type::length(s); + *this->This() << len; + this->This()->newtoken(); + os << s; +} + +template +BOOST_ARCHIVE_DECL void +text_oarchive_impl::save(const std::string &s) +{ + const std::size_t size = s.size(); + *this->This() << size; + this->This()->newtoken(); + os << s; +} + +#ifndef BOOST_NO_CWCHAR +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_ARCHIVE_DECL void +text_oarchive_impl::save(const wchar_t * ws) +{ + const std::size_t l = std::wcslen(ws); + * this->This() << l; + this->This()->newtoken(); + os.write((const char *)ws, l * sizeof(wchar_t)/sizeof(char)); +} +#endif + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_DECL void +text_oarchive_impl::save(const std::wstring &ws) +{ + const std::size_t l = ws.size(); + * this->This() << l; + this->This()->newtoken(); + os.write((const char *)(ws.data()), l * sizeof(wchar_t)/sizeof(char)); +} +#endif +#endif // BOOST_NO_CWCHAR + +template +BOOST_ARCHIVE_DECL +text_oarchive_impl::text_oarchive_impl( + std::ostream & os, + unsigned int flags +) : + basic_text_oprimitive( + os, + 0 != (flags & no_codecvt) + ), + basic_text_oarchive(flags) +{ +} + +template +BOOST_ARCHIVE_DECL void +text_oarchive_impl::save_binary(const void *address, std::size_t count){ + put('\n'); + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + this->delimiter = this->eol; +} + +} // namespace archive +} // namespace boost + diff --git a/thirdparty/boost-1_79/boost/archive/impl/text_wiarchive_impl.ipp b/thirdparty/boost-1_79/boost/archive/impl/text_wiarchive_impl.ipp new file mode 100644 index 00000000..e421fa55 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/text_wiarchive_impl.ipp @@ -0,0 +1,116 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_text_wiarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // size_t, NULL + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include // fixup for RogueWave + +#ifndef BOOST_NO_STD_WSTREAMBUF +#include + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of wiprimtives functions +// +template +BOOST_WARCHIVE_DECL void +text_wiarchive_impl::load(char *s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + while(size-- > 0){ + *s++ = is.narrow(is.get(), '\0'); + } + *s = '\0'; +} + +template +BOOST_WARCHIVE_DECL void +text_wiarchive_impl::load(std::string &s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != s.data()) + #endif + s.resize(0); + s.reserve(size); + while(size-- > 0){ + char x = is.narrow(is.get(), '\0'); + s += x; + } +} + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_WARCHIVE_DECL void +text_wiarchive_impl::load(wchar_t *s) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + // Works on all tested platforms + is.read(s, size); + s[size] = L'\0'; +} +#endif + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_WARCHIVE_DECL void +text_wiarchive_impl::load(std::wstring &ws) +{ + std::size_t size; + * this->This() >> size; + // skip separating space + is.get(); + // borland complains about resize + // borland de-allocator fixup + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != ws.data()) + #endif + ws.resize(size); + // note breaking a rule here - is this a problem on some platform + is.read(const_cast(ws.data()), size); +} +#endif + +template +BOOST_WARCHIVE_DECL +text_wiarchive_impl::text_wiarchive_impl( + std::wistream & is, + unsigned int flags +) : + basic_text_iprimitive( + is, + 0 != (flags & no_codecvt) + ), + basic_text_iarchive(flags) +{ +} + +} // archive +} // boost + +#endif // BOOST_NO_STD_WSTREAMBUF diff --git a/thirdparty/boost-1_79/boost/archive/impl/text_woarchive_impl.ipp b/thirdparty/boost-1_79/boost/archive/impl/text_woarchive_impl.ipp new file mode 100644 index 00000000..2b6d427c --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/text_woarchive_impl.ipp @@ -0,0 +1,85 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_woarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifndef BOOST_NO_STD_WSTREAMBUF + +#include +#include // size_t +#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__) +namespace std{ + using ::strlen; + using ::size_t; +} // namespace std +#endif + +#include + +#include + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// implementation of woarchive functions +// +template +BOOST_WARCHIVE_DECL void +text_woarchive_impl::save(const char *s) +{ + // note: superfluous local variable fixes borland warning + const std::size_t size = std::strlen(s); + * this->This() << size; + this->This()->newtoken(); + while(*s != '\0') + os.put(os.widen(*s++)); +} + +template +BOOST_WARCHIVE_DECL void +text_woarchive_impl::save(const std::string &s) +{ + const std::size_t size = s.size(); + * this->This() << size; + this->This()->newtoken(); + const char * cptr = s.data(); + for(std::size_t i = size; i-- > 0;) + os.put(os.widen(*cptr++)); +} + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_WARCHIVE_DECL void +text_woarchive_impl::save(const wchar_t *ws) +{ + const std::size_t size = std::wostream::traits_type::length(ws); + * this->This() << size; + this->This()->newtoken(); + os.write(ws, size); +} +#endif + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_WARCHIVE_DECL void +text_woarchive_impl::save(const std::wstring &ws) +{ + const std::size_t size = ws.length(); + * this->This() << size; + this->This()->newtoken(); + os.write(ws.data(), size); +} +#endif + +} // namespace archive +} // namespace boost + +#endif + diff --git a/thirdparty/boost-1_79/boost/archive/impl/xml_iarchive_impl.ipp b/thirdparty/boost-1_79/boost/archive/impl/xml_iarchive_impl.ipp new file mode 100644 index 00000000..b0847d4a --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/xml_iarchive_impl.ipp @@ -0,0 +1,196 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_iarchive_impl.cpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // memcpy +#include // NULL + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} // namespace std +#endif + +#ifndef BOOST_NO_CWCHAR +#include // mbstate_t and mbrtowc +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::mbstate_t; + using ::mbrtowc; + } // namespace std +#endif +#endif // BOOST_NO_CWCHAR + +#include // RogueWave and Dinkumware +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#endif + +#include +#include + +#include +#include +#include +#include + +#include "basic_xml_grammar.hpp" + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions specific to char archives + +// wide char stuff used by char archives + +#ifndef BOOST_NO_CWCHAR +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_DECL void +xml_iarchive_impl::load(std::wstring &ws){ + std::string s; + bool result = gimpl->parse_string(is, s); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != ws.data()) + #endif + ws.resize(0); + std::mbstate_t mbs = std::mbstate_t(); + const char * start = s.data(); + const char * end = start + s.size(); + while(start < end){ + wchar_t wc; + std::size_t count = std::mbrtowc(&wc, start, end - start, &mbs); + if(count == static_cast(-1)) + boost::serialization::throw_exception( + iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + ) + ); + if(count == static_cast(-2)) + continue; + start += count; + ws += wc; + } +} +#endif // BOOST_NO_STD_WSTRING + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_ARCHIVE_DECL void +xml_iarchive_impl::load(wchar_t * ws){ + std::string s; + bool result = gimpl->parse_string(is, s); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception( + xml_archive_exception::xml_archive_parsing_error + ) + ); + + std::mbstate_t mbs = std::mbstate_t(); + const char * start = s.data(); + const char * end = start + s.size(); + while(start < end){ + wchar_t wc; + std::size_t length = std::mbrtowc(&wc, start, end - start, &mbs); + if(static_cast(-1) == length) + boost::serialization::throw_exception( + iterators::dataflow_exception( + iterators::dataflow_exception::invalid_conversion + ) + ); + if(static_cast(-2) == length) + continue; + + start += length; + *ws++ = wc; + } + *ws = L'\0'; +} +#endif // BOOST_NO_INTRINSIC_WCHAR_T + +#endif // BOOST_NO_CWCHAR + +template +BOOST_ARCHIVE_DECL void +xml_iarchive_impl::load(std::string &s){ + bool result = gimpl->parse_string(is, s); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); +} + +template +BOOST_ARCHIVE_DECL void +xml_iarchive_impl::load(char * s){ + std::string tstring; + bool result = gimpl->parse_string(is, tstring); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + std::memcpy(s, tstring.data(), tstring.size()); + s[tstring.size()] = 0; +} + +template +BOOST_ARCHIVE_DECL void +xml_iarchive_impl::load_override(class_name_type & t){ + const std::string & s = gimpl->rv.class_name; + if(s.size() > BOOST_SERIALIZATION_MAX_KEY_SIZE - 1) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_class_name) + ); + char * tptr = t; + std::memcpy(tptr, s.data(), s.size()); + tptr[s.size()] = '\0'; +} + +template +BOOST_ARCHIVE_DECL void +xml_iarchive_impl::init(){ + gimpl->init(is); + this->set_library_version( + boost::serialization::library_version_type(gimpl->rv.version) + ); +} + +template +BOOST_ARCHIVE_DECL +xml_iarchive_impl::xml_iarchive_impl( + std::istream &is_, + unsigned int flags +) : + basic_text_iprimitive( + is_, + 0 != (flags & no_codecvt) + ), + basic_xml_iarchive(flags), + gimpl(new xml_grammar()) +{} + +template +BOOST_ARCHIVE_DECL +xml_iarchive_impl::~xml_iarchive_impl(){ + if(boost::core::uncaught_exceptions() > 0) + return; + if(0 == (this->get_flags() & no_header)){ + gimpl->windup(is); + } +} +} // namespace archive +} // namespace boost diff --git a/thirdparty/boost-1_79/boost/archive/impl/xml_oarchive_impl.ipp b/thirdparty/boost-1_79/boost/archive/impl/xml_oarchive_impl.ipp new file mode 100644 index 00000000..0f4ccbbf --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/xml_oarchive_impl.ipp @@ -0,0 +1,139 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_oarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#include +#include // std::copy +#include + +#include // strlen +#include // msvc 6.0 needs this to suppress warnings +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::strlen; +} // namespace std +#endif + +#include +#include +#include + +#ifndef BOOST_NO_CWCHAR +#include +#include +#endif + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions specific to char archives + +// wide char stuff used by char archives +#ifndef BOOST_NO_CWCHAR +// copy chars to output escaping to xml and translating wide chars to mb chars +template +void save_iterator(std::ostream &os, InputIterator begin, InputIterator end){ + typedef boost::archive::iterators::mb_from_wchar< + boost::archive::iterators::xml_escape + > translator; + std::copy( + translator(begin), + translator(end), + boost::archive::iterators::ostream_iterator(os) + ); +} + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_ARCHIVE_DECL void +xml_oarchive_impl::save(const std::wstring & ws){ +// at least one library doesn't typedef value_type for strings +// so rather than using string directly make a pointer iterator out of it +// save_iterator(os, ws.data(), ws.data() + std::wcslen(ws.data())); + save_iterator(os, ws.data(), ws.data() + ws.size()); +} +#endif + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_ARCHIVE_DECL void +xml_oarchive_impl::save(const wchar_t * ws){ + save_iterator(os, ws, ws + std::wcslen(ws)); +} +#endif + +#endif // BOOST_NO_CWCHAR + +template +BOOST_ARCHIVE_DECL void +xml_oarchive_impl::save(const std::string & s){ +// at least one library doesn't typedef value_type for strings +// so rather than using string directly make a pointer iterator out of it + typedef boost::archive::iterators::xml_escape< + const char * + > xml_escape_translator; + std::copy( + xml_escape_translator(s.data()), + xml_escape_translator(s.data()+ s.size()), + boost::archive::iterators::ostream_iterator(os) + ); +} + +template +BOOST_ARCHIVE_DECL void +xml_oarchive_impl::save(const char * s){ + typedef boost::archive::iterators::xml_escape< + const char * + > xml_escape_translator; + std::copy( + xml_escape_translator(s), + xml_escape_translator(s + std::strlen(s)), + boost::archive::iterators::ostream_iterator(os) + ); +} + +template +BOOST_ARCHIVE_DECL +xml_oarchive_impl::xml_oarchive_impl( + std::ostream & os_, + unsigned int flags +) : + basic_text_oprimitive( + os_, + 0 != (flags & no_codecvt) + ), + basic_xml_oarchive(flags) +{} + +template +BOOST_ARCHIVE_DECL void +xml_oarchive_impl::save_binary(const void *address, std::size_t count){ + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + this->indent_next = true; +} + +template +BOOST_ARCHIVE_DECL +xml_oarchive_impl::~xml_oarchive_impl(){ + if(boost::core::uncaught_exceptions() > 0) + return; + if(0 == (this->get_flags() & no_header)) + this->windup(); +} + +} // namespace archive +} // namespace boost diff --git a/thirdparty/boost-1_79/boost/archive/impl/xml_wiarchive_impl.ipp b/thirdparty/boost-1_79/boost/archive/impl/xml_wiarchive_impl.ipp new file mode 100644 index 00000000..198dfafb --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/xml_wiarchive_impl.ipp @@ -0,0 +1,187 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_wiarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::memcpy; +} //std +#endif + +#include // msvc 6.0 needs this to suppress warnings +#ifndef BOOST_NO_STD_WSTREAMBUF + +#include +#include // std::copy +#include // Dinkumware and RogueWave +#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) +#include +#endif + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include "basic_xml_grammar.hpp" + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions specific to wide char archives + +namespace { // anonymous + +void copy_to_ptr(char * s, const std::wstring & ws){ + std::copy( + iterators::mb_from_wchar( + ws.begin() + ), + iterators::mb_from_wchar( + ws.end() + ), + s + ); + s[ws.size()] = 0; +} + +} // anonymous + +template +BOOST_WARCHIVE_DECL void +xml_wiarchive_impl::load(std::string & s){ + std::wstring ws; + bool result = gimpl->parse_string(is, ws); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101)) + if(NULL != s.data()) + #endif + s.resize(0); + s.reserve(ws.size()); + std::copy( + iterators::mb_from_wchar( + ws.begin() + ), + iterators::mb_from_wchar( + ws.end() + ), + std::back_inserter(s) + ); +} + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_WARCHIVE_DECL void +xml_wiarchive_impl::load(std::wstring & ws){ + bool result = gimpl->parse_string(is, ws); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); +} +#endif + +template +BOOST_WARCHIVE_DECL void +xml_wiarchive_impl::load(char * s){ + std::wstring ws; + bool result = gimpl->parse_string(is, ws); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + copy_to_ptr(s, ws); +} + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_WARCHIVE_DECL void +xml_wiarchive_impl::load(wchar_t * ws){ + std::wstring twstring; + bool result = gimpl->parse_string(is, twstring); + if(! result) + boost::serialization::throw_exception( + xml_archive_exception(xml_archive_exception::xml_archive_parsing_error) + ); + std::memcpy(ws, twstring.c_str(), twstring.size()); + ws[twstring.size()] = L'\0'; +} +#endif + +template +BOOST_WARCHIVE_DECL void +xml_wiarchive_impl::load_override(class_name_type & t){ + const std::wstring & ws = gimpl->rv.class_name; + if(ws.size() > BOOST_SERIALIZATION_MAX_KEY_SIZE - 1) + boost::serialization::throw_exception( + archive_exception(archive_exception::invalid_class_name) + ); + copy_to_ptr(t, ws); +} + +template +BOOST_WARCHIVE_DECL void +xml_wiarchive_impl::init(){ + gimpl->init(is); + this->set_library_version( + boost::serialization::library_version_type(gimpl->rv.version) + ); +} + +template +BOOST_WARCHIVE_DECL +xml_wiarchive_impl::xml_wiarchive_impl( + std::wistream &is_, + unsigned int flags +) : + basic_text_iprimitive( + is_, + true // don't change the codecvt - use the one below + ), + basic_xml_iarchive(flags), + gimpl(new xml_wgrammar()) +{ + if(0 == (flags & no_codecvt)){ + archive_locale = std::locale( + is_.getloc(), + new boost::archive::detail::utf8_codecvt_facet + ); + // libstdc++ crashes without this + is_.sync(); + is_.imbue(archive_locale); + } +} + +template +BOOST_WARCHIVE_DECL +xml_wiarchive_impl::~xml_wiarchive_impl(){ + if(boost::core::uncaught_exceptions() > 0) + return; + if(0 == (this->get_flags() & no_header)){ + gimpl->windup(is); + } +} + +} // namespace archive +} // namespace boost + +#endif // BOOST_NO_STD_WSTREAMBUF diff --git a/thirdparty/boost-1_79/boost/archive/impl/xml_woarchive_impl.ipp b/thirdparty/boost-1_79/boost/archive/impl/xml_woarchive_impl.ipp new file mode 100644 index 00000000..dabaf230 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/impl/xml_woarchive_impl.ipp @@ -0,0 +1,169 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_woarchive_impl.ipp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include +#ifndef BOOST_NO_STD_WSTREAMBUF + +#include +#include +#include // std::copy +#include + +#include // strlen +#include // mbtowc +#ifndef BOOST_NO_CWCHAR +#include // wcslen +#endif + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::strlen; + #if ! defined(BOOST_NO_INTRINSIC_WCHAR_T) + using ::mbtowc; + using ::wcslen; + #endif +} // namespace std +#endif + +#include + +#include +#include + +#include + +#include +#include +#include +#include + +namespace boost { +namespace archive { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implemenations of functions specific to wide char archives + +// copy chars to output escaping to xml and widening characters as we go +template +void save_iterator(std::wostream &os, InputIterator begin, InputIterator end){ + typedef iterators::wchar_from_mb< + iterators::xml_escape + > xmbtows; + std::copy( + xmbtows(begin), + xmbtows(end), + boost::archive::iterators::ostream_iterator(os) + ); +} + +template +BOOST_WARCHIVE_DECL void +xml_woarchive_impl::save(const std::string & s){ + // note: we don't use s.begin() and s.end() because dinkumware + // doesn't have string::value_type defined. So use a wrapper + // around these values to implement the definitions. + const char * begin = s.data(); + const char * end = begin + s.size(); + save_iterator(os, begin, end); +} + +#ifndef BOOST_NO_STD_WSTRING +template +BOOST_WARCHIVE_DECL void +xml_woarchive_impl::save(const std::wstring & ws){ +#if 0 + typedef iterators::xml_escape xmbtows; + std::copy( + xmbtows(ws.begin()), + xmbtows(ws.end()), + boost::archive::iterators::ostream_iterator(os) + ); +#endif + typedef iterators::xml_escape xmbtows; + std::copy( + xmbtows(ws.data()), + xmbtows(ws.data() + ws.size()), + boost::archive::iterators::ostream_iterator(os) + ); +} +#endif //BOOST_NO_STD_WSTRING + +template +BOOST_WARCHIVE_DECL void +xml_woarchive_impl::save(const char * s){ + save_iterator(os, s, s + std::strlen(s)); +} + +#ifndef BOOST_NO_INTRINSIC_WCHAR_T +template +BOOST_WARCHIVE_DECL void +xml_woarchive_impl::save(const wchar_t * ws){ + typedef iterators::xml_escape xmbtows; + std::copy( + xmbtows(ws), + xmbtows(ws + std::wcslen(ws)), + boost::archive::iterators::ostream_iterator(os) + ); +} +#endif + +template +BOOST_WARCHIVE_DECL +xml_woarchive_impl::xml_woarchive_impl( + std::wostream & os_, + unsigned int flags +) : + basic_text_oprimitive( + os_, + true // don't change the codecvt - use the one below + ), + basic_xml_oarchive(flags) +{ + if(0 == (flags & no_codecvt)){ + archive_locale = std::locale( + os_.getloc(), + new boost::archive::detail::utf8_codecvt_facet + ); + os_.flush(); + os_.imbue(archive_locale); + } +} + +template +BOOST_WARCHIVE_DECL +xml_woarchive_impl::~xml_woarchive_impl(){ + if(boost::core::uncaught_exceptions() > 0) + return; + if(0 == (this->get_flags() & no_header)){ + os << L""; + } +} + +template +BOOST_WARCHIVE_DECL void +xml_woarchive_impl::save_binary( + const void *address, + std::size_t count +){ + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + this->indent_next = true; +} + +} // namespace archive +} // namespace boost + +#endif //BOOST_NO_STD_WSTREAMBUF diff --git a/thirdparty/boost-1_79/boost/archive/iterators/base64_from_binary.hpp b/thirdparty/boost-1_79/boost/archive/iterators/base64_from_binary.hpp new file mode 100644 index 00000000..bd0b38fa --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/base64_from_binary.hpp @@ -0,0 +1,109 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_HPP +#define BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// base64_from_binary.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include // size_t +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// convert binary integers to base64 characters + +namespace detail { + +template +struct from_6_bit { + typedef CharType result_type; + CharType operator()(CharType t) const{ + static const char * lookup_table = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789" + "+/"; + BOOST_ASSERT(t < 64); + return lookup_table[static_cast(t)]; + } +}; + +} // namespace detail + +// note: what we would like to do is +// template +// typedef transform_iterator< +// from_6_bit, +// transform_width +// > base64_from_binary; +// but C++ won't accept this. Rather than using a "type generator" and +// using a different syntax, make a derivation which should be equivalent. +// +// Another issue addressed here is that the transform_iterator doesn't have +// a templated constructor. This makes it incompatible with the dataflow +// ideal. This is also addressed here. + +//template +template< + class Base, + class CharType = typename boost::iterator_value::type +> +class base64_from_binary : + public transform_iterator< + detail::from_6_bit, + Base + > +{ + friend class boost::iterator_core_access; + typedef transform_iterator< + typename detail::from_6_bit, + Base + > super_t; + +public: + // make composible buy using templated constructor + template + base64_from_binary(T start) : + super_t( + Base(static_cast< T >(start)), + detail::from_6_bit() + ) + {} + // intel 7.1 doesn't like default copy constructor + base64_from_binary(const base64_from_binary & rhs) : + super_t( + Base(rhs.base_reference()), + detail::from_6_bit() + ) + {} +// base64_from_binary(){}; +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_HPP diff --git a/thirdparty/boost-1_79/boost/archive/iterators/binary_from_base64.hpp b/thirdparty/boost-1_79/boost/archive/iterators/binary_from_base64.hpp new file mode 100644 index 00000000..5aeccb3a --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/binary_from_base64.hpp @@ -0,0 +1,118 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_HPP +#define BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// binary_from_base64.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#include + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// convert base64 characters to binary data + +namespace detail { + +template +struct to_6_bit { + typedef CharType result_type; + CharType operator()(CharType t) const{ + static const signed char lookup_table[] = { + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, + 52,53,54,55,56,57,58,59,60,61,-1,-1,-1, 0,-1,-1, // render '=' as 0 + -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, + 15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1, + -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, + 41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1 + }; + // metrowerks trips this assertion - how come? + #if ! defined(__MWERKS__) + BOOST_STATIC_ASSERT(128 == sizeof(lookup_table)); + #endif + signed char value = -1; + if((unsigned)t <= 127) + value = lookup_table[(unsigned)t]; + if(-1 == value) + boost::serialization::throw_exception( + dataflow_exception(dataflow_exception::invalid_base64_character) + ); + return value; + } +}; + +} // namespace detail + +// note: what we would like to do is +// template +// typedef transform_iterator< +// from_6_bit, +// transform_width +// > base64_from_binary; +// but C++ won't accept this. Rather than using a "type generator" and +// using a different syntax, make a derivation which should be equivalent. +// +// Another issue addressed here is that the transform_iterator doesn't have +// a templated constructor. This makes it incompatible with the dataflow +// ideal. This is also addressed here. + +template< + class Base, + class CharType = typename boost::iterator_value::type +> +class binary_from_base64 : public + transform_iterator< + detail::to_6_bit, + Base + > +{ + friend class boost::iterator_core_access; + typedef transform_iterator< + detail::to_6_bit, + Base + > super_t; +public: + // make composible buy using templated constructor + template + binary_from_base64(T start) : + super_t( + Base(static_cast< T >(start)), + detail::to_6_bit() + ) + {} + // intel 7.1 doesn't like default copy constructor + binary_from_base64(const binary_from_base64 & rhs) : + super_t( + Base(rhs.base_reference()), + detail::to_6_bit() + ) + {} +// binary_from_base64(){}; +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_HPP diff --git a/thirdparty/boost-1_79/boost/archive/iterators/dataflow_exception.hpp b/thirdparty/boost-1_79/boost/archive/iterators/dataflow_exception.hpp new file mode 100644 index 00000000..a144a8bd --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/dataflow_exception.hpp @@ -0,0 +1,80 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP +#define BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// dataflow_exception.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifndef BOOST_NO_EXCEPTIONS +#include +#endif //BOOST_NO_EXCEPTIONS + +#include + +namespace boost { +namespace archive { +namespace iterators { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by dataflows +// +class dataflow_exception : public std::exception +{ +public: + typedef enum { + invalid_6_bitcode, + invalid_base64_character, + invalid_xml_escape_sequence, + comparison_not_permitted, + invalid_conversion, + other_exception + } exception_code; + exception_code code; + + dataflow_exception(exception_code c = other_exception) : code(c) + {} + + const char *what( ) const throw( ) BOOST_OVERRIDE + { + const char *msg = "unknown exception code"; + switch(code){ + case invalid_6_bitcode: + msg = "attempt to encode a value > 6 bits"; + break; + case invalid_base64_character: + msg = "attempt to decode a value not in base64 char set"; + break; + case invalid_xml_escape_sequence: + msg = "invalid xml escape_sequence"; + break; + case comparison_not_permitted: + msg = "cannot invoke iterator comparison now"; + break; + case invalid_conversion: + msg = "invalid multbyte/wide char conversion"; + break; + default: + BOOST_ASSERT(false); + break; + } + return msg; + } +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif //BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP diff --git a/thirdparty/boost-1_79/boost/archive/iterators/escape.hpp b/thirdparty/boost-1_79/boost/archive/iterators/escape.hpp new file mode 100644 index 00000000..9af34ac9 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/escape.hpp @@ -0,0 +1,115 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// escape.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // NULL + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// insert escapes into text + +template +class escape : + public boost::iterator_adaptor< + Derived, + Base, + typename boost::iterator_value::type, + single_pass_traversal_tag, + typename boost::iterator_value::type + > +{ + typedef typename boost::iterator_value::type base_value_type; + typedef typename boost::iterator_reference::type reference_type; + friend class boost::iterator_core_access; + + typedef typename boost::iterator_adaptor< + Derived, + Base, + base_value_type, + single_pass_traversal_tag, + base_value_type + > super_t; + + typedef escape this_t; + + void dereference_impl() { + m_current_value = static_cast(this)->fill(m_bnext, m_bend); + m_full = true; + } + + //Access the value referred to + reference_type dereference() const { + if(!m_full) + const_cast(this)->dereference_impl(); + return m_current_value; + } + + bool equal(const this_t & rhs) const { + if(m_full){ + if(! rhs.m_full) + const_cast(& rhs)->dereference_impl(); + } + else{ + if(rhs.m_full) + const_cast(this)->dereference_impl(); + } + if(m_bnext != rhs.m_bnext) + return false; + if(this->base_reference() != rhs.base_reference()) + return false; + return true; + } + + void increment(){ + if(++m_bnext < m_bend){ + m_current_value = *m_bnext; + return; + } + ++(this->base_reference()); + m_bnext = NULL; + m_bend = NULL; + m_full = false; + } + + // buffer to handle pending characters + const base_value_type *m_bnext; + const base_value_type *m_bend; + bool m_full; + base_value_type m_current_value; +public: + escape(Base base) : + super_t(base), + m_bnext(NULL), + m_bend(NULL), + m_full(false), + m_current_value(0) + { + } +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/iterators/insert_linebreaks.hpp b/thirdparty/boost-1_79/boost/archive/iterators/insert_linebreaks.hpp new file mode 100644 index 00000000..c75ea841 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/insert_linebreaks.hpp @@ -0,0 +1,99 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP +#define BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// insert_linebreaks.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ using ::memcpy; } +#endif + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// insert line break every N characters +template< + class Base, + int N, + class CharType = typename boost::iterator_value::type +> +class insert_linebreaks : + public iterator_adaptor< + insert_linebreaks, + Base, + CharType, + single_pass_traversal_tag, + CharType + > +{ +private: + friend class boost::iterator_core_access; + typedef iterator_adaptor< + insert_linebreaks, + Base, + CharType, + single_pass_traversal_tag, + CharType + > super_t; + + bool equal(const insert_linebreaks & rhs) const { + return +// m_count == rhs.m_count +// && base_reference() == rhs.base_reference() + this->base_reference() == rhs.base_reference() + ; + } + + void increment() { + if(m_count == N){ + m_count = 0; + return; + } + ++m_count; + ++(this->base_reference()); + } + CharType dereference() const { + if(m_count == N) + return '\n'; + return * (this->base_reference()); + } + unsigned int m_count; +public: + // make composible buy using templated constructor + template + insert_linebreaks(T start) : + super_t(Base(static_cast< T >(start))), + m_count(0) + {} + // intel 7.1 doesn't like default copy constructor + insert_linebreaks(const insert_linebreaks & rhs) : + super_t(rhs.base_reference()), + m_count(rhs.m_count) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP diff --git a/thirdparty/boost-1_79/boost/archive/iterators/istream_iterator.hpp b/thirdparty/boost-1_79/boost/archive/iterators/istream_iterator.hpp new file mode 100644 index 00000000..05b87996 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/istream_iterator.hpp @@ -0,0 +1,92 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP +#define BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// istream_iterator.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// note: this is a custom version of the standard istream_iterator. +// This is necessary as the standard version doesn't work as expected +// for wchar_t based streams on systems for which wchar_t not a true +// type but rather a synonym for some integer type. + +#include // NULL +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +// given a type, make an input iterator based on a pointer to that type +template +class istream_iterator : + public boost::iterator_facade< + istream_iterator, + Elem, + std::input_iterator_tag, + Elem + > +{ + friend class boost::iterator_core_access; + typedef istream_iterator this_t ; + typedef typename boost::iterator_facade< + istream_iterator, + Elem, + std::input_iterator_tag, + Elem + > super_t; + typedef typename std::basic_istream istream_type; + + bool equal(const this_t & rhs) const { + // note: only works for comparison against end of stream + return m_istream == rhs.m_istream; + } + + //Access the value referred to + Elem dereference() const { + return static_cast(m_istream->peek()); + } + + void increment(){ + if(NULL != m_istream){ + m_istream->ignore(1); + } + } + + istream_type *m_istream; + Elem m_current_value; +public: + istream_iterator(istream_type & is) : + m_istream(& is) + { + //increment(); + } + + istream_iterator() : + m_istream(NULL), + m_current_value(NULL) + {} + + istream_iterator(const istream_iterator & rhs) : + m_istream(rhs.m_istream), + m_current_value(rhs.m_current_value) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP diff --git a/thirdparty/boost-1_79/boost/archive/iterators/mb_from_wchar.hpp b/thirdparty/boost-1_79/boost/archive/iterators/mb_from_wchar.hpp new file mode 100644 index 00000000..dbd17b7c --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/mb_from_wchar.hpp @@ -0,0 +1,142 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_HPP +#define BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// mb_from_wchar.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // size_t +#ifndef BOOST_NO_CWCHAR +#include // mbstate_t +#endif +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::mbstate_t; +} // namespace std +#endif + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// class used by text archives to translate wide strings and to char +// strings of the currently selected locale +template // the input iterator +class mb_from_wchar + : public boost::iterator_adaptor< + mb_from_wchar, + Base, + wchar_t, + single_pass_traversal_tag, + char + > +{ + friend class boost::iterator_core_access; + + typedef typename boost::iterator_adaptor< + mb_from_wchar, + Base, + wchar_t, + single_pass_traversal_tag, + char + > super_t; + + typedef mb_from_wchar this_t; + + char dereference_impl() { + if(! m_full){ + fill(); + m_full = true; + } + return m_buffer[m_bnext]; + } + + char dereference() const { + return (const_cast(this))->dereference_impl(); + } + // test for iterator equality + bool equal(const mb_from_wchar & rhs) const { + // once the value is filled, the base_reference has been incremented + // so don't permit comparison anymore. + return + 0 == m_bend + && 0 == m_bnext + && this->base_reference() == rhs.base_reference() + ; + } + + void fill(){ + wchar_t value = * this->base_reference(); + const wchar_t *wend; + char *bend; + BOOST_VERIFY( + m_codecvt_facet.out( + m_mbs, + & value, & value + 1, wend, + m_buffer, m_buffer + sizeof(m_buffer), bend + ) + == + std::codecvt_base::ok + ); + m_bnext = 0; + m_bend = bend - m_buffer; + } + + void increment(){ + if(++m_bnext < m_bend) + return; + m_bend = + m_bnext = 0; + ++(this->base_reference()); + m_full = false; + } + + boost::archive::detail::utf8_codecvt_facet m_codecvt_facet; + std::mbstate_t m_mbs; + // buffer to handle pending characters + char m_buffer[9 /* MB_CUR_MAX */]; + std::size_t m_bend; + std::size_t m_bnext; + bool m_full; + +public: + // make composible buy using templated constructor + template + mb_from_wchar(T start) : + super_t(Base(static_cast< T >(start))), + m_mbs(std::mbstate_t()), + m_bend(0), + m_bnext(0), + m_full(false) + {} + // intel 7.1 doesn't like default copy constructor + mb_from_wchar(const mb_from_wchar & rhs) : + super_t(rhs.base_reference()), + m_bend(rhs.m_bend), + m_bnext(rhs.m_bnext), + m_full(rhs.m_full) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_HPP diff --git a/thirdparty/boost-1_79/boost/archive/iterators/ostream_iterator.hpp b/thirdparty/boost-1_79/boost/archive/iterators/ostream_iterator.hpp new file mode 100644 index 00000000..80b5d1d4 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/ostream_iterator.hpp @@ -0,0 +1,83 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_OSTREAM_ITERATOR_HPP +#define BOOST_ARCHIVE_ITERATORS_OSTREAM_ITERATOR_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// ostream_iterator.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// note: this is a custom version of the standard ostream_iterator. +// This is necessary as the standard version doesn't work as expected +// for wchar_t based streams on systems for which wchar_t not a true +// type but rather a synonym for some integer type. + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +// given a type, make an input iterator based on a pointer to that type +template +class ostream_iterator : + public boost::iterator_facade< + ostream_iterator, + Elem, + std::output_iterator_tag, + ostream_iterator & + > +{ + friend class boost::iterator_core_access; + typedef ostream_iterator this_t ; + typedef Elem char_type; + typedef std::basic_ostream ostream_type; + + //emulate the behavior of std::ostream + ostream_iterator & dereference() const { + return const_cast(*this); + } + bool equal(const this_t & rhs) const { + return m_ostream == rhs.m_ostream; + } + void increment(){} +protected: + ostream_type *m_ostream; + void put_val(char_type e){ + if(NULL != m_ostream){ + m_ostream->put(e); + if(! m_ostream->good()) + m_ostream = NULL; + } + } +public: + this_t & operator=(char_type c){ + put_val(c); + return *this; + } + ostream_iterator(ostream_type & os) : + m_ostream (& os) + {} + ostream_iterator() : + m_ostream (NULL) + {} + ostream_iterator(const ostream_iterator & rhs) : + m_ostream (rhs.m_ostream) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_OSTREAM_ITERATOR_HPP diff --git a/thirdparty/boost-1_79/boost/archive/iterators/remove_whitespace.hpp b/thirdparty/boost-1_79/boost/archive/iterators/remove_whitespace.hpp new file mode 100644 index 00000000..eb756f37 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/remove_whitespace.hpp @@ -0,0 +1,167 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_REMOVE_WHITESPACE_HPP +#define BOOST_ARCHIVE_ITERATORS_REMOVE_WHITESPACE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// remove_whitespace.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#include +#include + +// here is the default standard implementation of the functor used +// by the filter iterator to remove spaces. Unfortunately usage +// of this implementation in combination with spirit trips a bug +// VC 6.5. The only way I can find to work around it is to +// implement a special non-standard version for this platform + +#ifndef BOOST_NO_CWCTYPE +#include // iswspace +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ using ::iswspace; } +#endif +#endif + +#include // isspace +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ using ::isspace; } +#endif + +#if defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) +// this is required for the RW STL on Linux and Tru64. +#undef isspace +#undef iswspace +#endif + +namespace { // anonymous + +template +struct remove_whitespace_predicate; + +template<> +struct remove_whitespace_predicate +{ + bool operator()(unsigned char t){ + return ! std::isspace(t); + } +}; + +#ifndef BOOST_NO_CWCHAR +template<> +struct remove_whitespace_predicate +{ + bool operator()(wchar_t t){ + return ! std::iswspace(t); + } +}; +#endif + +} // namespace anonymous + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// convert base64 file data (including whitespace and padding) to binary + +namespace boost { +namespace archive { +namespace iterators { + +// custom version of filter iterator which doesn't look ahead further than +// necessary + +template +class filter_iterator + : public boost::iterator_adaptor< + filter_iterator, + Base, + use_default, + single_pass_traversal_tag + > +{ + friend class boost::iterator_core_access; + typedef typename boost::iterator_adaptor< + filter_iterator, + Base, + use_default, + single_pass_traversal_tag + > super_t; + typedef filter_iterator this_t; + typedef typename super_t::reference reference_type; + + reference_type dereference_impl(){ + if(! m_full){ + while(! m_predicate(* this->base_reference())) + ++(this->base_reference()); + m_full = true; + } + return * this->base_reference(); + } + + reference_type dereference() const { + return const_cast(this)->dereference_impl(); + } + + Predicate m_predicate; + bool m_full; +public: + // note: this function is public only because comeau compiler complained + // I don't know if this is because the compiler is wrong or what + void increment(){ + m_full = false; + ++(this->base_reference()); + } + filter_iterator(Base start) : + super_t(start), + m_full(false) + {} + filter_iterator(){} +}; + +template +class remove_whitespace : + public filter_iterator< + remove_whitespace_predicate< + typename boost::iterator_value::type + //typename Base::value_type + >, + Base + > +{ + friend class boost::iterator_core_access; + typedef filter_iterator< + remove_whitespace_predicate< + typename boost::iterator_value::type + //typename Base::value_type + >, + Base + > super_t; +public: +// remove_whitespace(){} // why is this needed? + // make composible buy using templated constructor + template + remove_whitespace(T start) : + super_t(Base(static_cast< T >(start))) + {} + // intel 7.1 doesn't like default copy constructor + remove_whitespace(const remove_whitespace & rhs) : + super_t(rhs.base_reference()) + {} +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_REMOVE_WHITESPACE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/iterators/transform_width.hpp b/thirdparty/boost-1_79/boost/archive/iterators/transform_width.hpp new file mode 100644 index 00000000..162dccfa --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/transform_width.hpp @@ -0,0 +1,177 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_TRANSFORM_WIDTH_HPP +#define BOOST_ARCHIVE_ITERATORS_TRANSFORM_WIDTH_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// transform_width.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +// iterator which takes elements of x bits and returns elements of y bits. +// used to change streams of 8 bit characters into streams of 6 bit characters. +// and vice-versa for implementing base64 encodeing/decoding. Be very careful +// when using and end iterator. end is only reliable detected when the input +// stream length is some common multiple of x and y. E.G. Base64 6 bit +// character and 8 bit bytes. Lowest common multiple is 24 => 4 6 bit characters +// or 3 8 bit characters + +#include +#include + +#include // std::min + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// class used by text archives to translate char strings to wchar_t +// strings of the currently selected locale +template< + class Base, + int BitsOut, + int BitsIn, + class CharType = typename boost::iterator_value::type // output character +> +class transform_width : + public boost::iterator_adaptor< + transform_width, + Base, + CharType, + single_pass_traversal_tag, + CharType + > +{ + friend class boost::iterator_core_access; + typedef typename boost::iterator_adaptor< + transform_width, + Base, + CharType, + single_pass_traversal_tag, + CharType + > super_t; + + typedef transform_width this_t; + typedef typename iterator_value::type base_value_type; + + void fill(); + + CharType dereference() const { + if(!m_buffer_out_full) + const_cast(this)->fill(); + return m_buffer_out; + } + + bool equal_impl(const this_t & rhs){ + if(BitsIn < BitsOut) // discard any left over bits + return this->base_reference() == rhs.base_reference(); + else{ + // BitsIn > BitsOut // zero fill + if(this->base_reference() == rhs.base_reference()){ + m_end_of_sequence = true; + return 0 == m_remaining_bits; + } + return false; + } + } + + // standard iterator interface + bool equal(const this_t & rhs) const { + return const_cast(this)->equal_impl(rhs); + } + + void increment(){ + m_buffer_out_full = false; + } + + bool m_buffer_out_full; + CharType m_buffer_out; + + // last read element from input + base_value_type m_buffer_in; + + // number of bits to left in the input buffer. + unsigned int m_remaining_bits; + + // flag to indicate we've reached end of data. + bool m_end_of_sequence; + +public: + // make composible buy using templated constructor + template + transform_width(T start) : + super_t(Base(static_cast< T >(start))), + m_buffer_out_full(false), + m_buffer_out(0), + // To disable GCC warning, but not truly necessary + //(m_buffer_in will be initialized later before being + //used because m_remaining_bits == 0) + m_buffer_in(0), + m_remaining_bits(0), + m_end_of_sequence(false) + {} + // intel 7.1 doesn't like default copy constructor + transform_width(const transform_width & rhs) : + super_t(rhs.base_reference()), + m_buffer_out_full(rhs.m_buffer_out_full), + m_buffer_out(rhs.m_buffer_out), + m_buffer_in(rhs.m_buffer_in), + m_remaining_bits(rhs.m_remaining_bits), + m_end_of_sequence(false) + {} +}; + +template< + class Base, + int BitsOut, + int BitsIn, + class CharType +> +void transform_width::fill() { + unsigned int missing_bits = BitsOut; + m_buffer_out = 0; + do{ + if(0 == m_remaining_bits){ + if(m_end_of_sequence){ + m_buffer_in = 0; + m_remaining_bits = missing_bits; + } + else{ + m_buffer_in = * this->base_reference()++; + m_remaining_bits = BitsIn; + } + } + + // append these bits to the next output + // up to the size of the output + unsigned int i = (std::min)(missing_bits, m_remaining_bits); + // shift interesting bits to least significant position + base_value_type j = m_buffer_in >> (m_remaining_bits - i); + // and mask off the un interesting higher bits + // note presumption of twos complement notation + j &= (1 << i) - 1; + // append then interesting bits to the output value + m_buffer_out <<= i; + m_buffer_out |= j; + + // and update counters + missing_bits -= i; + m_remaining_bits -= i; + }while(0 < missing_bits); + m_buffer_out_full = true; +} + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_TRANSFORM_WIDTH_HPP diff --git a/thirdparty/boost-1_79/boost/archive/iterators/unescape.hpp b/thirdparty/boost-1_79/boost/archive/iterators/unescape.hpp new file mode 100644 index 00000000..6753c644 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/unescape.hpp @@ -0,0 +1,89 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// unescape.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// class used by text archives to translate char strings to wchar_t +// strings of the currently selected locale +template +class unescape + : public boost::iterator_adaptor< + unescape, + Base, + typename pointee::type, + single_pass_traversal_tag, + typename pointee::type + > +{ + friend class boost::iterator_core_access; + typedef typename boost::iterator_adaptor< + unescape, + Base, + typename pointee::type, + single_pass_traversal_tag, + typename pointee::type + > super_t; + + typedef unescape this_t; +public: + typedef typename this_t::value_type value_type; + typedef typename this_t::reference reference; +private: + value_type dereference_impl() { + if(! m_full){ + m_current_value = static_cast(this)->drain(); + m_full = true; + } + return m_current_value; + } + + reference dereference() const { + return const_cast(this)->dereference_impl(); + } + + value_type m_current_value; + bool m_full; + + void increment(){ + ++(this->base_reference()); + dereference_impl(); + m_full = false; + } + +public: + + unescape(Base base) : + super_t(base), + m_full(false) + {} + +}; + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_UNESCAPE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/iterators/wchar_from_mb.hpp b/thirdparty/boost-1_79/boost/archive/iterators/wchar_from_mb.hpp new file mode 100644 index 00000000..6067245d --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/wchar_from_mb.hpp @@ -0,0 +1,196 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_HPP +#define BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// wchar_from_mb.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // size_t +#ifndef BOOST_NO_CWCHAR +#include // mbstate_t +#endif +#include // copy + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::mbstate_t; +} // namespace std +#endif +#include +#include +#include +#include +#include +#include +#include + +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// class used by text archives to translate char strings to wchar_t +// strings of the currently selected locale +template +class wchar_from_mb + : public boost::iterator_adaptor< + wchar_from_mb, + Base, + wchar_t, + single_pass_traversal_tag, + wchar_t + > +{ + friend class boost::iterator_core_access; + typedef typename boost::iterator_adaptor< + wchar_from_mb, + Base, + wchar_t, + single_pass_traversal_tag, + wchar_t + > super_t; + + typedef wchar_from_mb this_t; + + void drain(); + + wchar_t dereference() const { + if(m_output.m_next == m_output.m_next_available) + return static_cast(0); + return * m_output.m_next; + } + + void increment(){ + if(m_output.m_next == m_output.m_next_available) + return; + if(++m_output.m_next == m_output.m_next_available){ + if(m_input.m_done) + return; + drain(); + } + } + + bool equal(this_t const & rhs) const { + return dereference() == rhs.dereference(); + } + + boost::archive::detail::utf8_codecvt_facet m_codecvt_facet; + std::mbstate_t m_mbs; + + template + struct sliding_buffer { + boost::array m_buffer; + typename boost::array::const_iterator m_next_available; + typename boost::array::iterator m_next; + bool m_done; + // default ctor + sliding_buffer() : + m_next_available(m_buffer.begin()), + m_next(m_buffer.begin()), + m_done(false) + {} + // copy ctor + sliding_buffer(const sliding_buffer & rhs) : + m_next_available( + std::copy( + rhs.m_buffer.begin(), + rhs.m_next_available, + m_buffer.begin() + ) + ), + m_next( + m_buffer.begin() + (rhs.m_next - rhs.m_buffer.begin()) + ), + m_done(rhs.m_done) + {} + }; + + sliding_buffer::type> m_input; + sliding_buffer::type> m_output; + +public: + // make composible buy using templated constructor + template + wchar_from_mb(T start) : + super_t(Base(static_cast< T >(start))), + m_mbs(std::mbstate_t()) + { + BOOST_ASSERT(std::mbsinit(&m_mbs)); + drain(); + } + // default constructor used as an end iterator + wchar_from_mb(){} + + // copy ctor + wchar_from_mb(const wchar_from_mb & rhs) : + super_t(rhs.base_reference()), + m_mbs(rhs.m_mbs), + m_input(rhs.m_input), + m_output(rhs.m_output) + {} +}; + +template +void wchar_from_mb::drain(){ + BOOST_ASSERT(! m_input.m_done); + for(;;){ + typename boost::iterators::iterator_reference::type c = *(this->base_reference()); + // a null character in a multibyte stream is takes as end of string + if(0 == c){ + m_input.m_done = true; + break; + } + ++(this->base_reference()); + * const_cast::type *>( + (m_input.m_next_available++) + ) = c; + // if input buffer is full - we're done for now + if(m_input.m_buffer.end() == m_input.m_next_available) + break; + } + const typename boost::iterators::iterator_value::type * input_new_start; + typename iterator_value::type * next_available; + + BOOST_ATTRIBUTE_UNUSED // redundant with ignore_unused below but clarifies intention + std::codecvt_base::result r = m_codecvt_facet.in( + m_mbs, + m_input.m_buffer.begin(), + m_input.m_next_available, + input_new_start, + m_output.m_buffer.begin(), + m_output.m_buffer.end(), + next_available + ); + BOOST_ASSERT(std::codecvt_base::ok == r); + m_output.m_next_available = next_available; + m_output.m_next = m_output.m_buffer.begin(); + + // we're done with some of the input so shift left. + m_input.m_next_available = std::copy( + input_new_start, + m_input.m_next_available, + m_input.m_buffer.begin() + ); + m_input.m_next = m_input.m_buffer.begin(); +} + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_WCHAR_FROM_MB_HPP diff --git a/thirdparty/boost-1_79/boost/archive/iterators/xml_escape.hpp b/thirdparty/boost-1_79/boost/archive/iterators/xml_escape.hpp new file mode 100644 index 00000000..c45733ea --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/xml_escape.hpp @@ -0,0 +1,121 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_escape.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// insert escapes into xml text + +template +class xml_escape + : public escape, Base> +{ + friend class boost::iterator_core_access; + + typedef escape, Base> super_t; + +public: + char fill(const char * & bstart, const char * & bend); + wchar_t fill(const wchar_t * & bstart, const wchar_t * & bend); + + template + xml_escape(T start) : + super_t(Base(static_cast< T >(start))) + {} + // intel 7.1 doesn't like default copy constructor + xml_escape(const xml_escape & rhs) : + super_t(rhs.base_reference()) + {} +}; + +template +char xml_escape::fill( + const char * & bstart, + const char * & bend +){ + char current_value = * this->base_reference(); + switch(current_value){ + case '<': + bstart = "<"; + bend = bstart + 4; + break; + case '>': + bstart = ">"; + bend = bstart + 4; + break; + case '&': + bstart = "&"; + bend = bstart + 5; + break; + case '"': + bstart = """; + bend = bstart + 6; + break; + case '\'': + bstart = "'"; + bend = bstart + 6; + break; + default: + return current_value; + } + return *bstart; +} + +template +wchar_t xml_escape::fill( + const wchar_t * & bstart, + const wchar_t * & bend +){ + wchar_t current_value = * this->base_reference(); + switch(current_value){ + case '<': + bstart = L"<"; + bend = bstart + 4; + break; + case '>': + bstart = L">"; + bend = bstart + 4; + break; + case '&': + bstart = L"&"; + bend = bstart + 5; + break; + case '"': + bstart = L"""; + bend = bstart + 6; + break; + case '\'': + bstart = L"'"; + bend = bstart + 6; + break; + default: + return current_value; + } + return *bstart; +} + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_XML_ESCAPE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/iterators/xml_unescape.hpp b/thirdparty/boost-1_79/boost/archive/iterators/xml_unescape.hpp new file mode 100644 index 00000000..7fc9fd5f --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/iterators/xml_unescape.hpp @@ -0,0 +1,127 @@ +#ifndef BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_HPP +#define BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_unescape.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +#include + +#include +#include + +namespace boost { +namespace archive { +namespace iterators { + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// replace &??? xml escape sequences with the corresponding characters +template +class xml_unescape + : public unescape, Base> +{ + friend class boost::iterator_core_access; + typedef xml_unescape this_t; + typedef unescape super_t; + typedef typename boost::iterator_reference reference_type; + + reference_type dereference() const { + return unescape, Base>::dereference(); + } +public: + // msvc versions prior to 14.0 crash with and ICE + #if BOOST_WORKAROUND(BOOST_MSVC, < 1900) + typedef int value_type; + #else + typedef typename super_t::value_type value_type; + #endif + + void drain_residue(const char *literal); + value_type drain(); + + template + xml_unescape(T start) : + super_t(Base(static_cast< T >(start))) + {} + // intel 7.1 doesn't like default copy constructor + xml_unescape(const xml_unescape & rhs) : + super_t(rhs.base_reference()) + {} +}; + +template +void xml_unescape::drain_residue(const char * literal){ + do{ + if(* literal != * ++(this->base_reference())) + boost::serialization::throw_exception( + dataflow_exception( + dataflow_exception::invalid_xml_escape_sequence + ) + ); + } + while('\0' != * ++literal); +} + +// note key constraint on this function is that can't "look ahead" any +// more than necessary into base iterator. Doing so would alter the base +// iterator refenence which would make subsequent iterator comparisons +// incorrect and thereby break the composiblity of iterators. +template +typename xml_unescape::value_type +//int +xml_unescape::drain(){ + value_type retval = * this->base_reference(); + if('&' != retval){ + return retval; + } + retval = * ++(this->base_reference()); + switch(retval){ + case 'l': // < + drain_residue("t;"); + retval = '<'; + break; + case 'g': // > + drain_residue("t;"); + retval = '>'; + break; + case 'a': + retval = * ++(this->base_reference()); + switch(retval){ + case 'p': // ' + drain_residue("os;"); + retval = '\''; + break; + case 'm': // & + drain_residue("p;"); + retval = '&'; + break; + } + break; + case 'q': + drain_residue("uot;"); + retval = '"'; + break; + } + return retval; +} + +} // namespace iterators +} // namespace archive +} // namespace boost + +#endif // BOOST_ARCHIVE_ITERATORS_XML_UNESCAPE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/polymorphic_binary_iarchive.hpp b/thirdparty/boost-1_79/boost/archive/polymorphic_binary_iarchive.hpp new file mode 100644 index 00000000..c1af77a3 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/polymorphic_binary_iarchive.hpp @@ -0,0 +1,53 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_BINARY_IARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_BINARY_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_binary_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE polymorphic_binary_iarchive : + public detail::polymorphic_iarchive_route +{ +public: + polymorphic_binary_iarchive(std::istream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route(is, flags) + {} + ~polymorphic_binary_iarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_binary_iarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_BINARY_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/polymorphic_binary_oarchive.hpp b/thirdparty/boost-1_79/boost/archive/polymorphic_binary_oarchive.hpp new file mode 100644 index 00000000..e9282484 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/polymorphic_binary_oarchive.hpp @@ -0,0 +1,44 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_BINARY_OARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_BINARY_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_binary_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE polymorphic_binary_oarchive : + public detail::polymorphic_oarchive_route +{ +public: + polymorphic_binary_oarchive(std::ostream & os, unsigned int flags = 0) : + detail::polymorphic_oarchive_route(os, flags) + {} + ~polymorphic_binary_oarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_binary_oarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_BINARY_OARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/polymorphic_iarchive.hpp b/thirdparty/boost-1_79/boost/archive/polymorphic_iarchive.hpp new file mode 100644 index 00000000..ade9e5da --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/polymorphic_iarchive.hpp @@ -0,0 +1,171 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // std::size_t +#include // ULONG_MAX +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include + +#include +#include +#include +#include +#include + +#include +#include // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization +namespace archive { +namespace detail { + class basic_iarchive; + class basic_iserializer; +} + +class polymorphic_iarchive; + +class BOOST_SYMBOL_VISIBLE polymorphic_iarchive_impl : + public detail::interface_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_iarchive; + friend class load_access; +#endif + // primitive types the only ones permitted by polymorphic archives + virtual void load(bool & t) = 0; + + virtual void load(char & t) = 0; + virtual void load(signed char & t) = 0; + virtual void load(unsigned char & t) = 0; + #ifndef BOOST_NO_CWCHAR + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + virtual void load(wchar_t & t) = 0; + #endif + #endif + virtual void load(short & t) = 0; + virtual void load(unsigned short & t) = 0; + virtual void load(int & t) = 0; + virtual void load(unsigned int & t) = 0; + virtual void load(long & t) = 0; + virtual void load(unsigned long & t) = 0; + + #if defined(BOOST_HAS_LONG_LONG) + virtual void load(boost::long_long_type & t) = 0; + virtual void load(boost::ulong_long_type & t) = 0; + #elif defined(BOOST_HAS_MS_INT64) + virtual void load(__int64 & t) = 0; + virtual void load(unsigned __int64 & t) = 0; + #endif + + virtual void load(float & t) = 0; + virtual void load(double & t) = 0; + + // string types are treated as primitives + virtual void load(std::string & t) = 0; + #ifndef BOOST_NO_STD_WSTRING + virtual void load(std::wstring & t) = 0; + #endif + + // used for xml and other tagged formats + virtual void load_start(const char * name) = 0; + virtual void load_end(const char * name) = 0; + virtual void register_basic_serializer(const detail::basic_iserializer & bis) = 0; + virtual detail::helper_collection & get_helper_collection() = 0; + + // msvc and borland won't automatically pass these to the base class so + // make it explicit here + template + void load_override(T & t) + { + archive::load(* this->This(), t); + } + // special treatment for name-value pairs. + template + void load_override( + const boost::serialization::nvp< T > & t + ){ + load_start(t.name()); + archive::load(* this->This(), t.value()); + load_end(t.name()); + } +protected: + virtual ~polymorphic_iarchive_impl() {} +public: + // utility function implemented by all legal archives + virtual void set_library_version( + boost::serialization::library_version_type archive_library_version + ) = 0; + virtual boost::serialization::library_version_type get_library_version() const = 0; + virtual unsigned int get_flags() const = 0; + virtual void delete_created_pointers() = 0; + virtual void reset_object_address( + const void * new_address, + const void * old_address + ) = 0; + + virtual void load_binary(void * t, std::size_t size) = 0; + + // these are used by the serialization library implementation. + virtual void load_object( + void *t, + const detail::basic_iserializer & bis + ) = 0; + virtual const detail::basic_pointer_iserializer * load_pointer( + void * & t, + const detail::basic_pointer_iserializer * bpis_ptr, + const detail::basic_pointer_iserializer * (*finder)( + const boost::serialization::extended_type_info & type + ) + ) = 0; +}; + +} // namespace archive +} // namespace boost + +#include // pops abi_suffix.hpp pragmas + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE polymorphic_iarchive : + public polymorphic_iarchive_impl +{ +public: + ~polymorphic_iarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_iarchive) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/polymorphic_oarchive.hpp b/thirdparty/boost-1_79/boost/archive/polymorphic_oarchive.hpp new file mode 100644 index 00000000..c8146105 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/polymorphic_oarchive.hpp @@ -0,0 +1,154 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // size_t +#include // ULONG_MAX +#include + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include +#include + +#include +#include // must be the last header + +namespace boost { +namespace serialization { + class extended_type_info; +} // namespace serialization +namespace archive { +namespace detail { + class basic_oarchive; + class basic_oserializer; +} + +class polymorphic_oarchive; + +class BOOST_SYMBOL_VISIBLE polymorphic_oarchive_impl : + public detail::interface_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else + friend class detail::interface_oarchive; + friend class save_access; +#endif + // primitive types the only ones permitted by polymorphic archives + virtual void save(const bool t) = 0; + + virtual void save(const char t) = 0; + virtual void save(const signed char t) = 0; + virtual void save(const unsigned char t) = 0; + #ifndef BOOST_NO_CWCHAR + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + virtual void save(const wchar_t t) = 0; + #endif + #endif + virtual void save(const short t) = 0; + virtual void save(const unsigned short t) = 0; + virtual void save(const int t) = 0; + virtual void save(const unsigned int t) = 0; + virtual void save(const long t) = 0; + virtual void save(const unsigned long t) = 0; + + #if defined(BOOST_HAS_LONG_LONG) + virtual void save(const boost::long_long_type t) = 0; + virtual void save(const boost::ulong_long_type t) = 0; + #elif defined(BOOST_HAS_MS_INT64) + virtual void save(const __int64 t) = 0; + virtual void save(const unsigned __int64 t) = 0; + #endif + + virtual void save(const float t) = 0; + virtual void save(const double t) = 0; + + // string types are treated as primitives + virtual void save(const std::string & t) = 0; + #ifndef BOOST_NO_STD_WSTRING + virtual void save(const std::wstring & t) = 0; + #endif + + virtual void save_null_pointer() = 0; + // used for xml and other tagged formats + virtual void save_start(const char * name) = 0; + virtual void save_end(const char * name) = 0; + virtual void register_basic_serializer(const detail::basic_oserializer & bos) = 0; + virtual detail::helper_collection & get_helper_collection() = 0; + + virtual void end_preamble() = 0; + + // msvc and borland won't automatically pass these to the base class so + // make it explicit here + template + void save_override(T & t) + { + archive::save(* this->This(), t); + } + // special treatment for name-value pairs. + template + void save_override( + const ::boost::serialization::nvp< T > & t + ){ + save_start(t.name()); + archive::save(* this->This(), t.const_value()); + save_end(t.name()); + } +protected: + virtual ~polymorphic_oarchive_impl() {} +public: + // utility functions implemented by all legal archives + virtual unsigned int get_flags() const = 0; + virtual boost::serialization::library_version_type get_library_version() const = 0; + virtual void save_binary(const void * t, std::size_t size) = 0; + + virtual void save_object( + const void *x, + const detail::basic_oserializer & bos + ) = 0; + virtual void save_pointer( + const void * t, + const detail::basic_pointer_oserializer * bpos_ptr + ) = 0; +}; + +// note: preserve naming symmetry +class BOOST_SYMBOL_VISIBLE polymorphic_oarchive : + public polymorphic_oarchive_impl +{ +public: + ~polymorphic_oarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_oarchive) + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/polymorphic_text_iarchive.hpp b/thirdparty/boost-1_79/boost/archive/polymorphic_text_iarchive.hpp new file mode 100644 index 00000000..790d8def --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/polymorphic_text_iarchive.hpp @@ -0,0 +1,53 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_TEXT_IARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_TEXT_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_text_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE polymorphic_text_iarchive : + public detail::polymorphic_iarchive_route +{ +public: + polymorphic_text_iarchive(std::istream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route(is, flags) + {} + ~polymorphic_text_iarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_text_iarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_TEXT_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/polymorphic_text_oarchive.hpp b/thirdparty/boost-1_79/boost/archive/polymorphic_text_oarchive.hpp new file mode 100644 index 00000000..82b3ed78 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/polymorphic_text_oarchive.hpp @@ -0,0 +1,44 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_TEXT_OARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_TEXT_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_text_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE polymorphic_text_oarchive : + public detail::polymorphic_oarchive_route +{ +public: + polymorphic_text_oarchive(std::ostream & os, unsigned int flags = 0) : + detail::polymorphic_oarchive_route(os, flags) + {} + ~polymorphic_text_oarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_text_oarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_TEXT_OARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/polymorphic_text_wiarchive.hpp b/thirdparty/boost-1_79/boost/archive/polymorphic_text_wiarchive.hpp new file mode 100644 index 00000000..b32d5334 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/polymorphic_text_wiarchive.hpp @@ -0,0 +1,58 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_TEXT_WIARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_TEXT_WIARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_text_wiarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE polymorphic_text_wiarchive : + public detail::polymorphic_iarchive_route +{ +public: + polymorphic_text_wiarchive(std::wistream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route(is, flags) + {} + ~polymorphic_text_wiarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_text_wiarchive +) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_POLYMORPHIC_TEXT_WIARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/polymorphic_text_woarchive.hpp b/thirdparty/boost-1_79/boost/archive/polymorphic_text_woarchive.hpp new file mode 100644 index 00000000..4e0f5ea4 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/polymorphic_text_woarchive.hpp @@ -0,0 +1,49 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_TEXT_WOARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_TEXT_WOARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_text_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE polymorphic_text_woarchive : + public detail::polymorphic_oarchive_route +{ +public: + polymorphic_text_woarchive(std::wostream & os, unsigned int flags = 0) : + detail::polymorphic_oarchive_route(os, flags) + {} + ~polymorphic_text_woarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_text_woarchive +) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_POLYMORPHIC_TEXT_WOARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/polymorphic_xml_iarchive.hpp b/thirdparty/boost-1_79/boost/archive/polymorphic_xml_iarchive.hpp new file mode 100644 index 00000000..f8ddaf96 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/polymorphic_xml_iarchive.hpp @@ -0,0 +1,53 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_XML_IARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_XML_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_xml_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE polymorphic_xml_iarchive : + public detail::polymorphic_iarchive_route +{ +public: + polymorphic_xml_iarchive(std::istream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route(is, flags) + {} + ~polymorphic_xml_iarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_xml_iarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_XML_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/polymorphic_xml_oarchive.hpp b/thirdparty/boost-1_79/boost/archive/polymorphic_xml_oarchive.hpp new file mode 100644 index 00000000..08324e50 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/polymorphic_xml_oarchive.hpp @@ -0,0 +1,43 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_XML_OARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_XML_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_xml_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include +#include + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE polymorphic_xml_oarchive : + public detail::polymorphic_oarchive_route +{ +public: + polymorphic_xml_oarchive(std::ostream & os, unsigned int flags = 0) : + detail::polymorphic_oarchive_route(os, flags) + {} + ~polymorphic_xml_oarchive() BOOST_OVERRIDE {} +}; +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_xml_oarchive +) + +#endif // BOOST_ARCHIVE_POLYMORPHIC_XML_OARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/polymorphic_xml_wiarchive.hpp b/thirdparty/boost-1_79/boost/archive/polymorphic_xml_wiarchive.hpp new file mode 100644 index 00000000..5b325329 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/polymorphic_xml_wiarchive.hpp @@ -0,0 +1,49 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_XML_WIARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_XML_WIARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_xml_wiarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE polymorphic_xml_wiarchive : + public detail::polymorphic_iarchive_route +{ +public: + polymorphic_xml_wiarchive(std::wistream & is, unsigned int flags = 0) : + detail::polymorphic_iarchive_route(is, flags) + {} + ~polymorphic_xml_wiarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_xml_wiarchive +) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_POLYMORPHIC_XML_WIARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/polymorphic_xml_woarchive.hpp b/thirdparty/boost-1_79/boost/archive/polymorphic_xml_woarchive.hpp new file mode 100644 index 00000000..f7a3349f --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/polymorphic_xml_woarchive.hpp @@ -0,0 +1,49 @@ +#ifndef BOOST_ARCHIVE_POLYMORPHIC_XML_WOARCHIVE_HPP +#define BOOST_ARCHIVE_POLYMORPHIC_XML_WOARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// polymorphic_xml_woarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE polymorphic_xml_woarchive : + public detail::polymorphic_oarchive_route +{ +public: + polymorphic_xml_woarchive(std::wostream & os, unsigned int flags = 0) : + detail::polymorphic_oarchive_route(os, flags) + {} + ~polymorphic_xml_woarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE( + boost::archive::polymorphic_xml_woarchive +) + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_POLYMORPHIC_XML_WOARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/text_iarchive.hpp b/thirdparty/boost-1_79/boost/archive/text_iarchive.hpp new file mode 100644 index 00000000..73fc39f5 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/text_iarchive.hpp @@ -0,0 +1,135 @@ +#ifndef BOOST_ARCHIVE_TEXT_IARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +template +class BOOST_SYMBOL_VISIBLE text_iarchive_impl : + public basic_text_iprimitive, + public basic_text_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + friend class detail::interface_iarchive; + friend class load_access; +#endif + template + void load(T & t){ + basic_text_iprimitive::load(t); + } + void load(version_type & t){ + unsigned int v; + load(v); + t = version_type(v); + } + void load(boost::serialization::item_version_type & t){ + unsigned int v; + load(v); + t = boost::serialization::item_version_type(v); + } + BOOST_ARCHIVE_DECL void + load(char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_ARCHIVE_DECL void + load(wchar_t * t); + #endif + BOOST_ARCHIVE_DECL void + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_DECL void + load(std::wstring &ws); + #endif + template + void load_override(T & t){ + basic_text_iarchive::load_override(t); + } + BOOST_ARCHIVE_DECL void + load_override(class_name_type & t); + BOOST_ARCHIVE_DECL void + init(); + BOOST_ARCHIVE_DECL + text_iarchive_impl(std::istream & is, unsigned int flags); + // don't import inline definitions! leave this as a reminder. + //BOOST_ARCHIVE_DECL + ~text_iarchive_impl() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE text_iarchive : + public text_iarchive_impl{ +public: + text_iarchive(std::istream & is_, unsigned int flags = 0) : + // note: added _ to suppress useless gcc warning + text_iarchive_impl(is_, flags) + { + if(0 == (flags & no_header)) + init(); + } + ~text_iarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_iarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_TEXT_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/text_oarchive.hpp b/thirdparty/boost-1_79/boost/archive/text_oarchive.hpp new file mode 100644 index 00000000..f94f876d --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/text_oarchive.hpp @@ -0,0 +1,124 @@ +#ifndef BOOST_ARCHIVE_TEXT_OARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include // std::size_t + +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +template +class BOOST_SYMBOL_VISIBLE text_oarchive_impl : + /* protected ? */ public basic_text_oprimitive, + public basic_text_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + friend class detail::interface_oarchive; + friend class basic_text_oarchive; + friend class save_access; +#endif + template + void save(const T & t){ + this->newtoken(); + basic_text_oprimitive::save(t); + } + void save(const version_type & t){ + save(static_cast(t)); + } + void save(const boost::serialization::item_version_type & t){ + save(static_cast(t)); + } + BOOST_ARCHIVE_DECL void + save(const char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_ARCHIVE_DECL void + save(const wchar_t * t); + #endif + BOOST_ARCHIVE_DECL void + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_DECL void + save(const std::wstring &ws); + #endif + BOOST_ARCHIVE_DECL + text_oarchive_impl(std::ostream & os, unsigned int flags); + // don't import inline definitions! leave this as a reminder. + //BOOST_ARCHIVE_DECL + ~text_oarchive_impl() BOOST_OVERRIDE {} +public: + BOOST_ARCHIVE_DECL void + save_binary(const void *address, std::size_t count); +}; + +// do not derive from this class. If you want to extend this functionality +// via inheritance, derived from text_oarchive_impl instead. This will +// preserve correct static polymorphism. +class BOOST_SYMBOL_VISIBLE text_oarchive : + public text_oarchive_impl +{ +public: + text_oarchive(std::ostream & os_, unsigned int flags = 0) : + // note: added _ to suppress useless gcc warning + text_oarchive_impl(os_, flags) + { + if(0 == (flags & no_header)) + init(); + } + ~text_oarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_oarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_ARCHIVE_TEXT_OARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/text_wiarchive.hpp b/thirdparty/boost-1_79/boost/archive/text_wiarchive.hpp new file mode 100644 index 00000000..5daf52f5 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/text_wiarchive.hpp @@ -0,0 +1,140 @@ +#ifndef BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_wiarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include + +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +template +class BOOST_SYMBOL_VISIBLE text_wiarchive_impl : + public basic_text_iprimitive, + public basic_text_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_iarchive; + friend load_access; + #else + friend class detail::interface_iarchive; + friend class load_access; + #endif +#endif + template + void load(T & t){ + basic_text_iprimitive::load(t); + } + void load(version_type & t){ + unsigned int v; + load(v); + t = version_type(v); + } + void load(boost::serialization::item_version_type & t){ + unsigned int v; + load(v); + t = boost::serialization::item_version_type(v); + } + BOOST_WARCHIVE_DECL void + load(char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_WARCHIVE_DECL void + load(wchar_t * t); + #endif + BOOST_WARCHIVE_DECL void + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_WARCHIVE_DECL void + load(std::wstring &ws); + #endif + template + void load_override(T & t){ + basic_text_iarchive::load_override(t); + } + BOOST_WARCHIVE_DECL + text_wiarchive_impl(std::wistream & is, unsigned int flags); + ~text_wiarchive_impl() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE text_wiarchive : + public text_wiarchive_impl{ +public: + text_wiarchive(std::wistream & is, unsigned int flags = 0) : + text_wiarchive_impl(is, flags) + { + if(0 == (flags & no_header)) + init(); + } + ~text_wiarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_wiarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_TEXT_WIARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/text_woarchive.hpp b/thirdparty/boost-1_79/boost/archive/text_woarchive.hpp new file mode 100644 index 00000000..713d89fc --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/text_woarchive.hpp @@ -0,0 +1,155 @@ +#ifndef BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP +#define BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// text_woarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include +#include // size_t + +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +template +class BOOST_SYMBOL_VISIBLE text_woarchive_impl : + public basic_text_oprimitive, + public basic_text_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + #if BOOST_WORKAROUND(BOOST_MSVC, < 1500) + // for some inexplicable reason insertion of "class" generates compile erro + // on msvc 7.1 + friend detail::interface_oarchive; + friend basic_text_oarchive; + friend save_access; + #else + friend class detail::interface_oarchive; + friend class basic_text_oarchive; + friend class save_access; + #endif +#endif + template + void save(const T & t){ + this->newtoken(); + basic_text_oprimitive::save(t); + } + void save(const version_type & t){ + save(static_cast(t)); + } + void save(const boost::serialization::item_version_type & t){ + save(static_cast(t)); + } + BOOST_WARCHIVE_DECL void + save(const char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_WARCHIVE_DECL void + save(const wchar_t * t); + #endif + BOOST_WARCHIVE_DECL void + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_WARCHIVE_DECL void + save(const std::wstring &ws); + #endif + text_woarchive_impl(std::wostream & os, unsigned int flags) : + basic_text_oprimitive( + os, + 0 != (flags & no_codecvt) + ), + basic_text_oarchive(flags) + {} +public: + void save_binary(const void *address, std::size_t count){ + put(static_cast('\n')); + this->end_preamble(); + #if ! defined(__MWERKS__) + this->basic_text_oprimitive::save_binary( + #else + this->basic_text_oprimitive::save_binary( + #endif + address, + count + ); + put(static_cast('\n')); + this->delimiter = this->none; + } + +}; + +// we use the following because we can't use +// typedef text_oarchive_impl > text_oarchive; + +// do not derive from this class. If you want to extend this functionality +// via inheritance, derived from text_oarchive_impl instead. This will +// preserve correct static polymorphism. +class BOOST_SYMBOL_VISIBLE text_woarchive : + public text_woarchive_impl +{ +public: + text_woarchive(std::wostream & os, unsigned int flags = 0) : + text_woarchive_impl(os, flags) + { + if(0 == (flags & no_header)) + init(); + } + ~text_woarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_woarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_TEXT_WOARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/wcslen.hpp b/thirdparty/boost-1_79/boost/archive/wcslen.hpp new file mode 100644 index 00000000..6138c3e4 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/wcslen.hpp @@ -0,0 +1,58 @@ +#ifndef BOOST_ARCHIVE_WCSLEN_HPP +#define BOOST_ARCHIVE_WCSLEN_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// wcslen.hpp: + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include // size_t +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#ifndef BOOST_NO_CWCHAR + +// a couple of libraries which include wchar_t don't include +// wcslen + +#if defined(BOOST_DINKUMWARE_STDLIB) && BOOST_DINKUMWARE_STDLIB < 306 \ +|| defined(__LIBCOMO__) + +namespace std { +inline std::size_t wcslen(const wchar_t * ws) +{ + const wchar_t * eows = ws; + while(* eows != 0) + ++eows; + return eows - ws; +} +} // namespace std + +#else + +#ifndef BOOST_NO_CWCHAR +#include +#endif +#ifdef BOOST_NO_STDC_NAMESPACE +namespace std{ using ::wcslen; } +#endif + +#endif // wcslen + +#endif //BOOST_NO_CWCHAR + +#endif //BOOST_ARCHIVE_WCSLEN_HPP diff --git a/thirdparty/boost-1_79/boost/archive/xml_archive_exception.hpp b/thirdparty/boost-1_79/boost/archive/xml_archive_exception.hpp new file mode 100644 index 00000000..1852d428 --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/xml_archive_exception.hpp @@ -0,0 +1,57 @@ +#ifndef BOOST_ARCHIVE_XML_ARCHIVE_EXCEPTION_HPP +#define BOOST_ARCHIVE_XML_ARCHIVE_EXCEPTION_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_archive_exception.hpp: + +// (C) Copyright 2007 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#include + +#include +#include +#include + +#include // must be the last header + +namespace boost { +namespace archive { + +////////////////////////////////////////////////////////////////////// +// exceptions thrown by xml archives +// +class BOOST_SYMBOL_VISIBLE xml_archive_exception : + public virtual boost::archive::archive_exception +{ +public: + typedef enum { + xml_archive_parsing_error, // see save_register + xml_archive_tag_mismatch, + xml_archive_tag_name_error + } exception_code; + BOOST_ARCHIVE_DECL xml_archive_exception( + exception_code c, + const char * e1 = NULL, + const char * e2 = NULL + ); + BOOST_ARCHIVE_DECL xml_archive_exception(xml_archive_exception const &); + BOOST_ARCHIVE_DECL ~xml_archive_exception() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE; +}; + +}// namespace archive +}// namespace boost + +#include // pops abi_suffix.hpp pragmas + +#endif //BOOST_XML_ARCHIVE_ARCHIVE_EXCEPTION_HPP diff --git a/thirdparty/boost-1_79/boost/archive/xml_iarchive.hpp b/thirdparty/boost-1_79/boost/archive/xml_iarchive.hpp new file mode 100644 index 00000000..2d04edcb --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/xml_iarchive.hpp @@ -0,0 +1,145 @@ +#ifndef BOOST_ARCHIVE_XML_IARCHIVE_HPP +#define BOOST_ARCHIVE_XML_IARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_iarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +template +class basic_xml_grammar; +typedef basic_xml_grammar xml_grammar; + +template +class BOOST_SYMBOL_VISIBLE xml_iarchive_impl : + public basic_text_iprimitive, + public basic_xml_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + friend class detail::interface_iarchive; + friend class basic_xml_iarchive; + friend class load_access; +#endif + // use boost:scoped_ptr to implement automatic deletion; + boost::scoped_ptr gimpl; + + std::istream & get_is(){ + return is; + } + template + void load(T & t){ + basic_text_iprimitive::load(t); + } + void + load(version_type & t){ + unsigned int v; + load(v); + t = version_type(v); + } + void + load(boost::serialization::item_version_type & t){ + unsigned int v; + load(v); + t = boost::serialization::item_version_type(v); + } + BOOST_ARCHIVE_DECL void + load(char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_ARCHIVE_DECL void + load(wchar_t * t); + #endif + BOOST_ARCHIVE_DECL void + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_DECL void + load(std::wstring &ws); + #endif + template + void load_override(T & t){ + basic_xml_iarchive::load_override(t); + } + BOOST_ARCHIVE_DECL void + load_override(class_name_type & t); + BOOST_ARCHIVE_DECL void + init(); + BOOST_ARCHIVE_DECL + xml_iarchive_impl(std::istream & is, unsigned int flags); + BOOST_ARCHIVE_DECL + ~xml_iarchive_impl() BOOST_OVERRIDE; +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE xml_iarchive : + public xml_iarchive_impl{ +public: + xml_iarchive(std::istream & is, unsigned int flags = 0) : + xml_iarchive_impl(is, flags) + { + if(0 == (flags & no_header)) + init(); + } + ~xml_iarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_iarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_XML_IARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/xml_oarchive.hpp b/thirdparty/boost-1_79/boost/archive/xml_oarchive.hpp new file mode 100644 index 00000000..84871b2d --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/xml_oarchive.hpp @@ -0,0 +1,140 @@ +#ifndef BOOST_ARCHIVE_XML_OARCHIVE_HPP +#define BOOST_ARCHIVE_XML_OARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_oarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include + +#include // size_t +#include +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +template +class BOOST_SYMBOL_VISIBLE xml_oarchive_impl : + public basic_text_oprimitive, + public basic_xml_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + friend class detail::interface_oarchive; + friend class basic_xml_oarchive; + friend class save_access; +#endif + template + void save(const T & t){ + basic_text_oprimitive::save(t); + } + void + save(const version_type & t){ + save(static_cast(t)); + } + void + save(const boost::serialization::item_version_type & t){ + save(static_cast(t)); + } + BOOST_ARCHIVE_DECL void + save(const char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_ARCHIVE_DECL void + save(const wchar_t * t); + #endif + BOOST_ARCHIVE_DECL void + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_ARCHIVE_DECL void + save(const std::wstring &ws); + #endif + BOOST_ARCHIVE_DECL + xml_oarchive_impl(std::ostream & os, unsigned int flags); + BOOST_ARCHIVE_DECL + ~xml_oarchive_impl() BOOST_OVERRIDE; +public: + BOOST_ARCHIVE_DECL + void save_binary(const void *address, std::size_t count); +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +// we use the following because we can't use +// typedef xml_oarchive_impl > xml_oarchive; + +// do not derive from this class. If you want to extend this functionality +// via inheritance, derived from xml_oarchive_impl instead. This will +// preserve correct static polymorphism. +class BOOST_SYMBOL_VISIBLE xml_oarchive : + public xml_oarchive_impl +{ +public: + xml_oarchive(std::ostream & os, unsigned int flags = 0) : + xml_oarchive_impl(os, flags) + { + if(0 == (flags & no_header)) + init(); + } + ~xml_oarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_oarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/xml_wiarchive.hpp b/thirdparty/boost-1_79/boost/archive/xml_wiarchive.hpp new file mode 100644 index 00000000..e496621c --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/xml_wiarchive.hpp @@ -0,0 +1,152 @@ +#ifndef BOOST_ARCHIVE_XML_WIARCHIVE_HPP +#define BOOST_ARCHIVE_XML_WIARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_wiarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else + +#include + +#include +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_iarchive; +} // namespace detail + +template +class basic_xml_grammar; +typedef basic_xml_grammar xml_wgrammar; + +template +class BOOST_SYMBOL_VISIBLE xml_wiarchive_impl : + public basic_text_iprimitive, + public basic_xml_iarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + friend class detail::interface_iarchive; + friend class basic_xml_iarchive; + friend class load_access; +#endif + std::locale archive_locale; + boost::scoped_ptr gimpl; + std::wistream & get_is(){ + return is; + } + template + void + load(T & t){ + basic_text_iprimitive::load(t); + } + void + load(version_type & t){ + unsigned int v; + load(v); + t = version_type(v); + } + void + load(boost::serialization::item_version_type & t){ + unsigned int v; + load(v); + t = boost::serialization::item_version_type(v); + } + BOOST_WARCHIVE_DECL void + load(char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_WARCHIVE_DECL void + load(wchar_t * t); + #endif + BOOST_WARCHIVE_DECL void + load(std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_WARCHIVE_DECL void + load(std::wstring &ws); + #endif + template + void load_override(T & t){ + basic_xml_iarchive::load_override(t); + } + BOOST_WARCHIVE_DECL void + load_override(class_name_type & t); + BOOST_WARCHIVE_DECL void + init(); + BOOST_WARCHIVE_DECL + xml_wiarchive_impl(std::wistream & is, unsigned int flags); + BOOST_WARCHIVE_DECL + ~xml_wiarchive_impl() BOOST_OVERRIDE; +}; + +} // namespace archive +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +class BOOST_SYMBOL_VISIBLE xml_wiarchive : + public xml_wiarchive_impl{ +public: + xml_wiarchive(std::wistream & is, unsigned int flags = 0) : + xml_wiarchive_impl(is, flags) + { + if(0 == (flags & no_header)) + init(); + } + ~xml_wiarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_wiarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_XML_WIARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/archive/xml_woarchive.hpp b/thirdparty/boost-1_79/boost/archive/xml_woarchive.hpp new file mode 100644 index 00000000..9f4a4c8e --- /dev/null +++ b/thirdparty/boost-1_79/boost/archive/xml_woarchive.hpp @@ -0,0 +1,135 @@ +#ifndef BOOST_ARCHIVE_XML_WOARCHIVE_HPP +#define BOOST_ARCHIVE_XML_WOARCHIVE_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// xml_woarchive.hpp + +// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . +// Use, modification and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for updates, documentation, and revision history. + +#include +#ifdef BOOST_NO_STD_WSTREAMBUF +#error "wide char i/o not supported on this platform" +#else +#include // size_t +#if defined(BOOST_NO_STDC_NAMESPACE) +namespace std{ + using ::size_t; +} // namespace std +#endif + +#include + +#include +#include +#include +#include +#include + +#include // must be the last header + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable : 4511 4512) +#endif + +namespace boost { +namespace archive { + +namespace detail { + template class interface_oarchive; +} // namespace detail + +template +class BOOST_SYMBOL_VISIBLE xml_woarchive_impl : + public basic_text_oprimitive, + public basic_xml_oarchive +{ +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +public: +#else +protected: + friend class detail::interface_oarchive; + friend class basic_xml_oarchive; + friend class save_access; +#endif + //void end_preamble(){ + // basic_xml_oarchive::end_preamble(); + //} + template + void + save(const T & t){ + basic_text_oprimitive::save(t); + } + void + save(const version_type & t){ + save(static_cast(t)); + } + void + save(const boost::serialization::item_version_type & t){ + save(static_cast(t)); + } + BOOST_WARCHIVE_DECL void + save(const char * t); + #ifndef BOOST_NO_INTRINSIC_WCHAR_T + BOOST_WARCHIVE_DECL void + save(const wchar_t * t); + #endif + BOOST_WARCHIVE_DECL void + save(const std::string &s); + #ifndef BOOST_NO_STD_WSTRING + BOOST_WARCHIVE_DECL void + save(const std::wstring &ws); + #endif + BOOST_WARCHIVE_DECL + xml_woarchive_impl(std::wostream & os, unsigned int flags); + BOOST_WARCHIVE_DECL + ~xml_woarchive_impl() BOOST_OVERRIDE; +public: + BOOST_WARCHIVE_DECL void + save_binary(const void *address, std::size_t count); + +}; + +// we use the following because we can't use +// typedef xml_woarchive_impl > xml_woarchive; + +// do not derive from this class. If you want to extend this functionality +// via inheritance, derived from xml_woarchive_impl instead. This will +// preserve correct static polymorphism. +class BOOST_SYMBOL_VISIBLE xml_woarchive : + public xml_woarchive_impl +{ +public: + xml_woarchive(std::wostream & os, unsigned int flags = 0) : + xml_woarchive_impl(os, flags) + { + if(0 == (flags & no_header)) + init(); + } + ~xml_woarchive() BOOST_OVERRIDE {} +}; + +} // namespace archive +} // namespace boost + +// required by export +BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_woarchive) + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#include // pops abi_suffix.hpp pragmas + +#endif // BOOST_NO_STD_WSTREAMBUF +#endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP diff --git a/thirdparty/boost-1_79/boost/array.hpp b/thirdparty/boost-1_79/boost/array.hpp new file mode 100644 index 00000000..a32d1e99 --- /dev/null +++ b/thirdparty/boost-1_79/boost/array.hpp @@ -0,0 +1,456 @@ +/* The following code declares class array, + * an STL container (as wrapper) for arrays of constant size. + * + * See + * http://www.boost.org/libs/array/ + * for documentation. + * + * The original author site is at: http://www.josuttis.com/ + * + * (C) Copyright Nicolai M. Josuttis 2001. + * + * Distributed under the Boost Software License, Version 1.0. (See + * accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + * 9 Jan 2013 - (mtc) Added constexpr + * 14 Apr 2012 - (mtc) Added support for boost::hash + * 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility. + * 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group. + * See or Trac issue #3168 + * Eventually, we should remove "assign" which is now a synonym for "fill" (Marshall Clow) + * 10 Mar 2010 - added workaround for SUNCC and !STLPort [trac #3893] (Marshall Clow) + * 29 Jan 2004 - c_array() added, BOOST_NO_PRIVATE_IN_AGGREGATE removed (Nico Josuttis) + * 23 Aug 2002 - fix for Non-MSVC compilers combined with MSVC libraries. + * 05 Aug 2001 - minor update (Nico Josuttis) + * 20 Jan 2001 - STLport fix (Beman Dawes) + * 29 Sep 2000 - Initial Revision (Nico Josuttis) + * + * Jan 29, 2004 + */ +#ifndef BOOST_ARRAY_HPP +#define BOOST_ARRAY_HPP + +#include + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +# pragma warning(push) +# pragma warning(disable:4996) // 'std::equal': Function call with parameters that may be unsafe +# pragma warning(disable:4510) // boost::array' : default constructor could not be generated +# pragma warning(disable:4610) // warning C4610: class 'boost::array' can never be instantiated - user defined constructor required +#endif + +#include +#include +#include +#include +#include +#include + +#include +#include + +// FIXES for broken compilers +#include + + +namespace boost { + + template + class array { + public: + T elems[N]; // fixed-size array of elements of type T + + public: + // type definitions + typedef T value_type; + typedef T* iterator; + typedef const T* const_iterator; + typedef T& reference; + typedef const T& const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + // iterator support + iterator begin() { return elems; } + const_iterator begin() const { return elems; } + const_iterator cbegin() const { return elems; } + + iterator end() { return elems+N; } + const_iterator end() const { return elems+N; } + const_iterator cend() const { return elems+N; } + + // reverse iterator support +#if !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#else + // workaround for broken reverse_iterator implementations + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#endif + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + const_reverse_iterator crbegin() const { + return const_reverse_iterator(end()); + } + + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + const_reverse_iterator crend() const { + return const_reverse_iterator(begin()); + } + + // operator[] + reference operator[](size_type i) + { + return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i]; + } + + /*BOOST_CONSTEXPR*/ const_reference operator[](size_type i) const + { + return BOOST_ASSERT_MSG( i < N, "out of range" ), elems[i]; + } + + // at() with range check + reference at(size_type i) { return rangecheck(i), elems[i]; } + /*BOOST_CONSTEXPR*/ const_reference at(size_type i) const { return rangecheck(i), elems[i]; } + + // front() and back() + reference front() + { + return elems[0]; + } + + BOOST_CONSTEXPR const_reference front() const + { + return elems[0]; + } + + reference back() + { + return elems[N-1]; + } + + BOOST_CONSTEXPR const_reference back() const + { + return elems[N-1]; + } + + // size is constant + static BOOST_CONSTEXPR size_type size() { return N; } + static BOOST_CONSTEXPR bool empty() { return false; } + static BOOST_CONSTEXPR size_type max_size() { return N; } + enum { static_size = N }; + + // swap (note: linear complexity) + void swap (array& y) { + for (size_type i = 0; i < N; ++i) + boost::swap(elems[i],y.elems[i]); + } + + // direct access to data (read-only) + const T* data() const { return elems; } + T* data() { return elems; } + + // use array as C array (direct read/write access to data) + T* c_array() { return elems; } + + // assignment with type conversion + template + array& operator= (const array& rhs) { + std::copy(rhs.begin(),rhs.end(), begin()); + return *this; + } + + // assign one value to all elements + void assign (const T& value) { fill ( value ); } // A synonym for fill + void fill (const T& value) + { + std::fill_n(begin(),size(),value); + } + + // check range (may be private because it is static) + static BOOST_CONSTEXPR bool rangecheck (size_type i) { + return i >= size() ? boost::throw_exception(std::out_of_range ("array<>: index out of range")), true : true; + } + + }; + + template< class T > + class array< T, 0 > { + + public: + // type definitions + typedef T value_type; + typedef T* iterator; + typedef const T* const_iterator; + typedef T& reference; + typedef const T& const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + // iterator support + iterator begin() { return iterator( reinterpret_cast< T * >( this ) ); } + const_iterator begin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); } + const_iterator cbegin() const { return const_iterator( reinterpret_cast< const T * >( this ) ); } + + iterator end() { return begin(); } + const_iterator end() const { return begin(); } + const_iterator cend() const { return cbegin(); } + + // reverse iterator support +#if !defined(BOOST_MSVC_STD_ITERATOR) && !defined(BOOST_NO_STD_ITERATOR_TRAITS) + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#elif defined(_RWSTD_NO_CLASS_PARTIAL_SPEC) + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#else + // workaround for broken reverse_iterator implementations + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; +#endif + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(end()); + } + const_reverse_iterator crbegin() const { + return const_reverse_iterator(end()); + } + + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { + return const_reverse_iterator(begin()); + } + const_reverse_iterator crend() const { + return const_reverse_iterator(begin()); + } + + // operator[] + reference operator[](size_type /*i*/) + { + return failed_rangecheck(); + } + + /*BOOST_CONSTEXPR*/ const_reference operator[](size_type /*i*/) const + { + return failed_rangecheck(); + } + + // at() with range check + reference at(size_type /*i*/) { return failed_rangecheck(); } + /*BOOST_CONSTEXPR*/ const_reference at(size_type /*i*/) const { return failed_rangecheck(); } + + // front() and back() + reference front() + { + return failed_rangecheck(); + } + + BOOST_CONSTEXPR const_reference front() const + { + return failed_rangecheck(); + } + + reference back() + { + return failed_rangecheck(); + } + + BOOST_CONSTEXPR const_reference back() const + { + return failed_rangecheck(); + } + + // size is constant + static BOOST_CONSTEXPR size_type size() { return 0; } + static BOOST_CONSTEXPR bool empty() { return true; } + static BOOST_CONSTEXPR size_type max_size() { return 0; } + enum { static_size = 0 }; + + void swap (array& /*y*/) { + } + + // direct access to data (read-only) + const T* data() const { return 0; } + T* data() { return 0; } + + // use array as C array (direct read/write access to data) + T* c_array() { return 0; } + + // assignment with type conversion + template + array& operator= (const array& ) { + return *this; + } + + // assign one value to all elements + void assign (const T& value) { fill ( value ); } + void fill (const T& ) {} + + // check range (may be private because it is static) + static reference failed_rangecheck () { + std::out_of_range e("attempt to access element of an empty array"); + boost::throw_exception(e); +#if defined(BOOST_NO_EXCEPTIONS) || (!defined(BOOST_MSVC) && !defined(__PATHSCALE__)) + // + // We need to return something here to keep + // some compilers happy: however we will never + // actually get here.... + // + static T placeholder; + return placeholder; +#endif + } + }; + + // comparisons + template + bool operator== (const array& x, const array& y) { + return std::equal(x.begin(), x.end(), y.begin()); + } + template + bool operator< (const array& x, const array& y) { + return std::lexicographical_compare(x.begin(),x.end(),y.begin(),y.end()); + } + template + bool operator!= (const array& x, const array& y) { + return !(x==y); + } + template + bool operator> (const array& x, const array& y) { + return y + bool operator<= (const array& x, const array& y) { + return !(y + bool operator>= (const array& x, const array& y) { + return !(x + inline void swap (array& x, array& y) { + x.swap(y); + } + +#if defined(__SUNPRO_CC) +// Trac ticket #4757; the Sun Solaris compiler can't handle +// syntax like 'T(&get_c_array(boost::array& arg))[N]' +// +// We can't just use this for all compilers, because the +// borland compilers can't handle this form. + namespace detail { + template struct c_array + { + typedef T type[N]; + }; + } + + // Specific for boost::array: simply returns its elems data member. + template + typename detail::c_array::type& get_c_array(boost::array& arg) + { + return arg.elems; + } + + // Specific for boost::array: simply returns its elems data member. + template + typename detail::c_array::type const& get_c_array(const boost::array& arg) + { + return arg.elems; + } +#else +// Specific for boost::array: simply returns its elems data member. + template + T(&get_c_array(boost::array& arg))[N] + { + return arg.elems; + } + + // Const version. + template + const T(&get_c_array(const boost::array& arg))[N] + { + return arg.elems; + } +#endif + +#if 0 + // Overload for std::array, assuming that std::array will have + // explicit conversion functions as discussed at the WG21 meeting + // in Summit, March 2009. + template + T(&get_c_array(std::array& arg))[N] + { + return static_cast(arg); + } + + // Const version. + template + const T(&get_c_array(const std::array& arg))[N] + { + return static_cast(arg); + } +#endif + + template std::size_t hash_range(It, It); + + template + std::size_t hash_value(const array& arr) + { + return boost::hash_range(arr.begin(), arr.end()); + } + + template + T &get(boost::array &arr) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(boost::array &) index out of range" ); + return arr[Idx]; + } + + template + const T &get(const boost::array &arr) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(const boost::array &) index out of range" ); + return arr[Idx]; + } + +} /* namespace boost */ + +#ifndef BOOST_NO_CXX11_HDR_ARRAY +// If we don't have std::array, I'm assuming that we don't have std::get +namespace std { + template + T &get(boost::array &arr) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT_MSG ( Idx < N, "std::get<>(boost::array &) index out of range" ); + return arr[Idx]; + } + + template + const T &get(const boost::array &arr) BOOST_NOEXCEPT { + BOOST_STATIC_ASSERT_MSG ( Idx < N, "std::get<>(const boost::array &) index out of range" ); + return arr[Idx]; + } +} +#endif + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +# pragma warning(pop) +#endif + +#endif /*BOOST_ARRAY_HPP*/ diff --git a/thirdparty/boost-1_79/boost/assert.hpp b/thirdparty/boost-1_79/boost/assert.hpp new file mode 100644 index 00000000..9650d7a2 --- /dev/null +++ b/thirdparty/boost-1_79/boost/assert.hpp @@ -0,0 +1,85 @@ +// +// boost/assert.hpp - BOOST_ASSERT(expr) +// BOOST_ASSERT_MSG(expr, msg) +// BOOST_VERIFY(expr) +// BOOST_VERIFY_MSG(expr, msg) +// BOOST_ASSERT_IS_VOID +// +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2007, 2014 Peter Dimov +// Copyright (c) Beman Dawes 2011 +// Copyright (c) 2015 Ion Gaztanaga +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// Note: There are no include guards. This is intentional. +// +// See http://www.boost.org/libs/assert/assert.html for documentation. +// + +// +// Stop inspect complaining about use of 'assert': +// +// boostinspect:naassert_macro +// + +// +// BOOST_ASSERT, BOOST_ASSERT_MSG, BOOST_ASSERT_IS_VOID +// + +#undef BOOST_ASSERT +#undef BOOST_ASSERT_MSG +#undef BOOST_ASSERT_IS_VOID + +#if defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) ) + +# define BOOST_ASSERT(expr) ((void)0) +# define BOOST_ASSERT_MSG(expr, msg) ((void)0) +# define BOOST_ASSERT_IS_VOID + +#elif defined(BOOST_ENABLE_ASSERT_HANDLER) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && !defined(NDEBUG) ) + +#include // for BOOST_LIKELY +#include + +namespace boost +{ + void assertion_failed(char const * expr, char const * function, char const * file, long line); // user defined + void assertion_failed_msg(char const * expr, char const * msg, char const * function, char const * file, long line); // user defined +} // namespace boost + +#define BOOST_ASSERT(expr) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed(#expr, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)) +#define BOOST_ASSERT_MSG(expr, msg) (BOOST_LIKELY(!!(expr))? ((void)0): ::boost::assertion_failed_msg(#expr, msg, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__)) + +#else + +# include // .h to support old libraries w/o - effect is the same + +# define BOOST_ASSERT(expr) assert(expr) +# define BOOST_ASSERT_MSG(expr, msg) assert((expr)&&(msg)) +#if defined(NDEBUG) +# define BOOST_ASSERT_IS_VOID +#endif + +#endif + +// +// BOOST_VERIFY, BOOST_VERIFY_MSG +// + +#undef BOOST_VERIFY +#undef BOOST_VERIFY_MSG + +#if defined(BOOST_DISABLE_ASSERTS) || ( !defined(BOOST_ENABLE_ASSERT_HANDLER) && defined(NDEBUG) ) + +# define BOOST_VERIFY(expr) ((void)(expr)) +# define BOOST_VERIFY_MSG(expr, msg) ((void)(expr)) + +#else + +# define BOOST_VERIFY(expr) BOOST_ASSERT(expr) +# define BOOST_VERIFY_MSG(expr, msg) BOOST_ASSERT_MSG(expr,msg) + +#endif diff --git a/thirdparty/boost-1_79/boost/assert/source_location.hpp b/thirdparty/boost-1_79/boost/assert/source_location.hpp new file mode 100644 index 00000000..dd1cfd73 --- /dev/null +++ b/thirdparty/boost-1_79/boost/assert/source_location.hpp @@ -0,0 +1,163 @@ +#ifndef BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED +#define BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED + +// http://www.boost.org/libs/assert +// +// Copyright 2019, 2021 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// http://www.boost.org/LICENSE_1_0.txt + +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907L +# include +#endif + +namespace boost +{ + +struct source_location +{ +private: + + char const * file_; + char const * function_; + boost::uint_least32_t line_; + boost::uint_least32_t column_; + +public: + + BOOST_CONSTEXPR source_location() BOOST_NOEXCEPT: file_( "" ), function_( "" ), line_( 0 ), column_( 0 ) + { + } + + BOOST_CONSTEXPR source_location( char const * file, boost::uint_least32_t ln, char const * function, boost::uint_least32_t col = 0 ) BOOST_NOEXCEPT: file_( file ), function_( function ), line_( ln ), column_( col ) + { + } + +#if defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907L + + BOOST_CONSTEXPR source_location( std::source_location const& loc ) BOOST_NOEXCEPT: file_( loc.file_name() ), function_( loc.function_name() ), line_( loc.line() ), column_( loc.column() ) + { + } + +#endif + + BOOST_CONSTEXPR char const * file_name() const BOOST_NOEXCEPT + { + return file_; + } + + BOOST_CONSTEXPR char const * function_name() const BOOST_NOEXCEPT + { + return function_; + } + + BOOST_CONSTEXPR boost::uint_least32_t line() const BOOST_NOEXCEPT + { + return line_; + } + + BOOST_CONSTEXPR boost::uint_least32_t column() const BOOST_NOEXCEPT + { + return column_; + } + +#if defined(BOOST_MSVC) +# pragma warning( push ) +# pragma warning( disable: 4996 ) +#endif + + std::string to_string() const + { + unsigned long ln = line(); + + if( ln == 0 ) + { + return "(unknown source location)"; + } + + std::string r = file_name(); + + char buffer[ 16 ]; + + std::sprintf( buffer, ":%lu", ln ); + r += buffer; + + unsigned long co = column(); + + if( co ) + { + std::sprintf( buffer, ":%lu", co ); + r += buffer; + } + + char const* fn = function_name(); + + if( *fn != 0 ) + { + r += " in function '"; + r += fn; + r += '\''; + } + + return r; + } + +#if defined(BOOST_MSVC) +# pragma warning( pop ) +#endif + +}; + +template std::basic_ostream & operator<<( std::basic_ostream & os, source_location const & loc ) +{ + os << loc.to_string(); + return os; +} + +} // namespace boost + +#if defined(BOOST_DISABLE_CURRENT_LOCATION) + +# define BOOST_CURRENT_LOCATION ::boost::source_location() + +#elif defined(BOOST_MSVC) && BOOST_MSVC >= 1926 + +// std::source_location::current() is available in -std:c++20, but fails with consteval errors before 19.31, and doesn't produce +// the correct result under 19.31, so prefer the built-ins +# define BOOST_CURRENT_LOCATION ::boost::source_location(__builtin_FILE(), __builtin_LINE(), __builtin_FUNCTION(), __builtin_COLUMN()) + +#elif defined(__cpp_lib_source_location) && __cpp_lib_source_location >= 201907L + +# define BOOST_CURRENT_LOCATION ::boost::source_location(::std::source_location::current()) + +#elif defined(BOOST_CLANG) && BOOST_CLANG_VERSION >= 90000 + +# define BOOST_CURRENT_LOCATION ::boost::source_location(__builtin_FILE(), __builtin_LINE(), __builtin_FUNCTION(), __builtin_COLUMN()) + +#elif defined(BOOST_GCC) && BOOST_GCC >= 70000 + +// The built-ins are available in 4.8+, but are not constant expressions until 7 +# define BOOST_CURRENT_LOCATION ::boost::source_location(__builtin_FILE(), __builtin_LINE(), __builtin_FUNCTION()) + +#elif defined(BOOST_GCC) && BOOST_GCC >= 50000 + +// __PRETTY_FUNCTION__ is allowed outside functions under GCC, but 4.x suffers from codegen bugs +# define BOOST_CURRENT_LOCATION ::boost::source_location(__FILE__, __LINE__, __PRETTY_FUNCTION__) + +#else + +// __func__ macros aren't allowed outside functions, but BOOST_CURRENT_LOCATION is +# define BOOST_CURRENT_LOCATION ::boost::source_location(__FILE__, __LINE__, "") + +#endif + +#endif // #ifndef BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED diff --git a/thirdparty/boost-1_79/boost/bind/arg.hpp b/thirdparty/boost-1_79/boost/bind/arg.hpp new file mode 100644 index 00000000..cb52e668 --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/arg.hpp @@ -0,0 +1,69 @@ +#ifndef BOOST_BIND_ARG_HPP_INCLUDED +#define BOOST_BIND_ARG_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind/arg.hpp +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +#include +#include + +namespace boost +{ + +template struct _arg_eq +{ +}; + +template<> struct _arg_eq +{ + typedef void type; +}; + +template< int I > struct arg +{ + BOOST_CONSTEXPR arg() + { + } + + template< class T > BOOST_CONSTEXPR arg( T const & /* t */, typename _arg_eq< I == is_placeholder::value >::type * = 0 ) + { + } +}; + +template< int I > BOOST_CONSTEXPR bool operator==( arg const &, arg const & ) +{ + return true; +} + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< int I > struct is_placeholder< arg > +{ + enum _vt { value = I }; +}; + +template< int I > struct is_placeholder< arg (*) () > +{ + enum _vt { value = I }; +}; + +#endif + +} // namespace boost + +#endif // #ifndef BOOST_BIND_ARG_HPP_INCLUDED diff --git a/thirdparty/boost-1_79/boost/bind/bind.hpp b/thirdparty/boost-1_79/boost/bind/bind.hpp new file mode 100644 index 00000000..2762641e --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/bind.hpp @@ -0,0 +1,2345 @@ +#ifndef BOOST_BIND_BIND_HPP_INCLUDED +#define BOOST_BIND_BIND_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind.hpp - binds function objects to arguments +// +// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2001 David Abrahams +// Copyright (c) 2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) +#include // std::forward +#endif + +// Borland-specific bug, visit_each() silently fails to produce code + +#if defined(BOOST_BORLANDC) +# define BOOST_BIND_VISIT_EACH boost::visit_each +#else +# define BOOST_BIND_VISIT_EACH visit_each +#endif + +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated +#endif + +namespace boost +{ + +template class weak_ptr; + +namespace _bi // implementation details +{ + +// ref_compare + +template bool ref_compare( T const & a, T const & b, long ) +{ + return a == b; +} + +template bool ref_compare( arg const &, arg const &, int ) +{ + return true; +} + +template bool ref_compare( arg (*) (), arg (*) (), int ) +{ + return true; +} + +template bool ref_compare( reference_wrapper const & a, reference_wrapper const & b, int ) +{ + return a.get_pointer() == b.get_pointer(); +} + +// bind_t forward declaration for listN + +template class bind_t; + +template bool ref_compare( bind_t const & a, bind_t const & b, int ) +{ + return a.compare( b ); +} + +// value + +template class value +{ +public: + + value(T const & t): t_(t) {} + + T & get() { return t_; } + T const & get() const { return t_; } + + bool operator==(value const & rhs) const + { + return t_ == rhs.t_; + } + +private: + + T t_; +}; + +// ref_compare for weak_ptr + +template bool ref_compare( value< weak_ptr > const & a, value< weak_ptr > const & b, int ) +{ + return !(a.get() < b.get()) && !(b.get() < a.get()); +} + +// type + +template class type {}; + +// unwrap + +template struct unwrapper +{ + static inline F & unwrap( F & f, long ) + { + return f; + } + + template static inline F2 & unwrap( reference_wrapper rf, int ) + { + return rf.get(); + } + + template static inline _mfi::dm unwrap( R T::* pm, int ) + { + return _mfi::dm( pm ); + } +}; + +// listN + +class list0 +{ +public: + + list0() {} + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A &, long) + { + return unwrapper::unwrap(f, 0)(); + } + + template R operator()(type, F const & f, A &, long) const + { + return unwrapper::unwrap(f, 0)(); + } + + template void operator()(type, F & f, A &, int) + { + unwrapper::unwrap(f, 0)(); + } + + template void operator()(type, F const & f, A &, int) const + { + unwrapper::unwrap(f, 0)(); + } + + template void accept(V &) const + { + } + + bool operator==(list0 const &) const + { + return true; + } +}; + +#ifdef BOOST_MSVC +// MSVC is bright enough to realise that the parameter rhs +// in operator==may be unused for some template argument types: +#pragma warning(push) +#pragma warning(disable:4100) +#endif + +template< class A1 > class list1: private storage1< A1 > +{ +private: + + typedef storage1< A1 > base_type; + +public: + + explicit list1( A1 a1 ): base_type( a1 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list1 const & rhs) const + { + return ref_compare(base_type::a1_, rhs.a1_, 0); + } +}; + +struct logical_and; +struct logical_or; + +template< class A1, class A2 > class list2: private storage2< A1, A2 > +{ +private: + + typedef storage2< A1, A2 > base_type; + +public: + + list2( A1 a1, A2 a2 ): base_type( a1, a2 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]); + } + + template bool operator()( type, logical_and & /*f*/, A & a, int ) + { + return a[ base_type::a1_ ] && a[ base_type::a2_ ]; + } + + template bool operator()( type, logical_and const & /*f*/, A & a, int ) const + { + return a[ base_type::a1_ ] && a[ base_type::a2_ ]; + } + + template bool operator()( type, logical_or & /*f*/, A & a, int ) + { + return a[ base_type::a1_ ] || a[ base_type::a2_ ]; + } + + template bool operator()( type, logical_or const & /*f*/, A & a, int ) const + { + return a[ base_type::a1_ ] || a[ base_type::a2_ ]; + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list2 const & rhs) const + { + return ref_compare(base_type::a1_, rhs.a1_, 0) && ref_compare(base_type::a2_, rhs.a2_, 0); + } +}; + +template< class A1, class A2, class A3 > class list3: private storage3< A1, A2, A3 > +{ +private: + + typedef storage3< A1, A2, A3 > base_type; + +public: + + list3( A1 a1, A2 a2, A3 a3 ): base_type( a1, a2, a3 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list3 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ); + } +}; + +template< class A1, class A2, class A3, class A4 > class list4: private storage4< A1, A2, A3, A4 > +{ +private: + + typedef storage4< A1, A2, A3, A4 > base_type; + +public: + + list4( A1 a1, A2 a2, A3 a3, A4 a4 ): base_type( a1, a2, a3, a4 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list4 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5 > class list5: private storage5< A1, A2, A3, A4, A5 > +{ +private: + + typedef storage5< A1, A2, A3, A4, A5 > base_type; + +public: + + list5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): base_type( a1, a2, a3, a4, a5 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list5 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ); + } +}; + +template class list6: private storage6< A1, A2, A3, A4, A5, A6 > +{ +private: + + typedef storage6< A1, A2, A3, A4, A5, A6 > base_type; + +public: + + list6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): base_type( a1, a2, a3, a4, a5, a6 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list6 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ); + } +}; + +template class list7: private storage7< A1, A2, A3, A4, A5, A6, A7 > +{ +private: + + typedef storage7< A1, A2, A3, A4, A5, A6, A7 > base_type; + +public: + + list7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): base_type( a1, a2, a3, a4, a5, a6, a7 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + A7 operator[] (boost::arg<7>) const { return base_type::a7_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list7 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ) && + ref_compare( base_type::a7_, rhs.a7_, 0 ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class list8: private storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ +private: + + typedef storage8< A1, A2, A3, A4, A5, A6, A7, A8 > base_type; + +public: + + list8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + A7 operator[] (boost::arg<7>) const { return base_type::a7_; } + A8 operator[] (boost::arg<8>) const { return base_type::a8_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } + A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list8 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ) && + ref_compare( base_type::a7_, rhs.a7_, 0 ) && + ref_compare( base_type::a8_, rhs.a8_, 0 ); + } +}; + +template class list9: private storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > +{ +private: + + typedef storage9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > base_type; + +public: + + list9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): base_type( a1, a2, a3, a4, a5, a6, a7, a8, a9 ) {} + + A1 operator[] (boost::arg<1>) const { return base_type::a1_; } + A2 operator[] (boost::arg<2>) const { return base_type::a2_; } + A3 operator[] (boost::arg<3>) const { return base_type::a3_; } + A4 operator[] (boost::arg<4>) const { return base_type::a4_; } + A5 operator[] (boost::arg<5>) const { return base_type::a5_; } + A6 operator[] (boost::arg<6>) const { return base_type::a6_; } + A7 operator[] (boost::arg<7>) const { return base_type::a7_; } + A8 operator[] (boost::arg<8>) const { return base_type::a8_; } + A9 operator[] (boost::arg<9>) const { return base_type::a9_; } + + A1 operator[] (boost::arg<1> (*) ()) const { return base_type::a1_; } + A2 operator[] (boost::arg<2> (*) ()) const { return base_type::a2_; } + A3 operator[] (boost::arg<3> (*) ()) const { return base_type::a3_; } + A4 operator[] (boost::arg<4> (*) ()) const { return base_type::a4_; } + A5 operator[] (boost::arg<5> (*) ()) const { return base_type::a5_; } + A6 operator[] (boost::arg<6> (*) ()) const { return base_type::a6_; } + A7 operator[] (boost::arg<7> (*) ()) const { return base_type::a7_; } + A8 operator[] (boost::arg<8> (*) ()) const { return base_type::a8_; } + A9 operator[] (boost::arg<9> (*) ()) const { return base_type::a9_; } + + template T & operator[] (_bi::value & v) const { return v.get(); } + + template T const & operator[] (_bi::value const & v) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const { return b.eval(*this); } + + template typename result_traits::type operator[] (bind_t const & b) const { return b.eval(*this); } + + template R operator()(type, F & f, A & a, long) + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); + } + + template R operator()(type, F const & f, A & a, long) const + { + return unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); + } + + template void operator()(type, F & f, A & a, int) + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); + } + + template void operator()(type, F const & f, A & a, int) const + { + unwrapper::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_], a[base_type::a3_], a[base_type::a4_], a[base_type::a5_], a[base_type::a6_], a[base_type::a7_], a[base_type::a8_], a[base_type::a9_]); + } + + template void accept(V & v) const + { + base_type::accept(v); + } + + bool operator==(list9 const & rhs) const + { + return + + ref_compare( base_type::a1_, rhs.a1_, 0 ) && + ref_compare( base_type::a2_, rhs.a2_, 0 ) && + ref_compare( base_type::a3_, rhs.a3_, 0 ) && + ref_compare( base_type::a4_, rhs.a4_, 0 ) && + ref_compare( base_type::a5_, rhs.a5_, 0 ) && + ref_compare( base_type::a6_, rhs.a6_, 0 ) && + ref_compare( base_type::a7_, rhs.a7_, 0 ) && + ref_compare( base_type::a8_, rhs.a8_, 0 ) && + ref_compare( base_type::a9_, rhs.a9_, 0 ); + } +}; + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +// bind_t + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !(defined(BOOST_GCC) && BOOST_GCC < 40600) + +template< class A1 > class rrlist1 +{ +private: + + A1 & a1_; // not A1&& because of msvc-10.0 + +public: + + explicit rrlist1( A1 & a1 ): a1_( a1 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } // not static_cast because of g++ 4.9 + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist1 a( a1_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist1 a( a1_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2 > class rrlist2 +{ +private: + + A1 & a1_; + A2 & a2_; + +public: + + rrlist2( A1 & a1, A2 & a2 ): a1_( a1 ), a2_( a2 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist2 a( a1_, a2_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist2 a( a1_, a2_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3 > class rrlist3 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + +public: + + rrlist3( A1 & a1, A2 & a2, A3 & a3 ): a1_( a1 ), a2_( a2 ), a3_( a3 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist3 a( a1_, a2_, a3_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist3 a( a1_, a2_, a3_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4 > class rrlist4 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + +public: + + rrlist4( A1 & a1, A2 & a2, A3 & a3, A4 & a4 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist4 a( a1_, a2_, a3_, a4_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist4 a( a1_, a2_, a3_, a4_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5 > class rrlist5 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + +public: + + rrlist5( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist5 a( a1_, a2_, a3_, a4_, a5_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist5 a( a1_, a2_, a3_, a4_, a5_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6 > class rrlist6 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + A6 & a6_; + +public: + + rrlist6( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist6 a( a1_, a2_, a3_, a4_, a5_, a6_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist6 a( a1_, a2_, a3_, a4_, a5_, a6_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6, class A7 > class rrlist7 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + A6 & a6_; + A7 & a7_; + +public: + + rrlist7( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist7 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist7 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > class rrlist8 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + A6 & a6_; + A7 & a7_; + A8 & a8_; + +public: + + rrlist8( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } + A8 && operator[] (boost::arg<8>) const { return std::forward( a8_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } + A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward( a8_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist8 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist8 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_ ); + return b.eval( a ); + } +}; + +template< class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > class rrlist9 +{ +private: + + A1 & a1_; + A2 & a2_; + A3 & a3_; + A4 & a4_; + A5 & a5_; + A6 & a6_; + A7 & a7_; + A8 & a8_; + A9 & a9_; + +public: + + rrlist9( A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9 ): a1_( a1 ), a2_( a2 ), a3_( a3 ), a4_( a4 ), a5_( a5 ), a6_( a6 ), a7_( a7 ), a8_( a8 ), a9_( a9 ) {} + + A1 && operator[] (boost::arg<1>) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2>) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3>) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4>) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5>) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6>) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7>) const { return std::forward( a7_ ); } + A8 && operator[] (boost::arg<8>) const { return std::forward( a8_ ); } + A9 && operator[] (boost::arg<9>) const { return std::forward( a9_ ); } + + A1 && operator[] (boost::arg<1> (*) ()) const { return std::forward( a1_ ); } + A2 && operator[] (boost::arg<2> (*) ()) const { return std::forward( a2_ ); } + A3 && operator[] (boost::arg<3> (*) ()) const { return std::forward( a3_ ); } + A4 && operator[] (boost::arg<4> (*) ()) const { return std::forward( a4_ ); } + A5 && operator[] (boost::arg<5> (*) ()) const { return std::forward( a5_ ); } + A6 && operator[] (boost::arg<6> (*) ()) const { return std::forward( a6_ ); } + A7 && operator[] (boost::arg<7> (*) ()) const { return std::forward( a7_ ); } + A8 && operator[] (boost::arg<8> (*) ()) const { return std::forward( a8_ ); } + A9 && operator[] (boost::arg<9> (*) ()) const { return std::forward( a9_ ); } + + template T & operator[] ( _bi::value & v ) const { return v.get(); } + + template T const & operator[] ( _bi::value const & v ) const { return v.get(); } + + template T & operator[] (reference_wrapper const & v) const { return v.get(); } + + template typename result_traits::type operator[] (bind_t & b) const + { + rrlist9 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ ); + return b.eval( a ); + } + + template typename result_traits::type operator[] (bind_t const & b) const + { + rrlist9 a( a1_, a2_, a3_, a4_, a5_, a6_, a7_, a8_, a9_ ); + return b.eval( a ); + } +}; + +template class bind_t +{ +private: + + F f_; + L l_; + +public: + + typedef typename result_traits::type result_type; + typedef bind_t this_type; + + bind_t( F f, L const & l ): f_( f ), l_( l ) {} + + // + + result_type operator()() + { + list0 a; + return l_( type(), f_, a, 0 ); + } + + result_type operator()() const + { + list0 a; + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1 ) + { + rrlist1< A1 > a( a1 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1 ) const + { + rrlist1< A1 > a( a1 ); + return l_(type(), f_, a, 0); + } + + template result_type operator()( A1 && a1, A2 && a2 ) + { + rrlist2< A1, A2 > a( a1, a2 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2 ) const + { + rrlist2< A1, A2 > a( a1, a2 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) + { + rrlist3< A1, A2, A3 > a( a1, a2, a3 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3 ) const + { + rrlist3< A1, A2, A3 > a( a1, a2, a3 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) + { + rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) const + { + rrlist4< A1, A2, A3, A4 > a( a1, a2, a3, a4 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) + { + rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) const + { + rrlist5< A1, A2, A3, A4, A5 > a( a1, a2, a3, a4, a5 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) + { + rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) const + { + rrlist6< A1, A2, A3, A4, A5, A6 > a( a1, a2, a3, a4, a5, a6 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) + { + rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) const + { + rrlist7< A1, A2, A3, A4, A5, A6, A7 > a( a1, a2, a3, a4, a5, a6, a7 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) + { + rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) const + { + rrlist8< A1, A2, A3, A4, A5, A6, A7, A8 > a( a1, a2, a3, a4, a5, a6, a7, a8 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) + { + rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); + return l_( type(), f_, a, 0 ); + } + + template result_type operator()( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) const + { + rrlist9< A1, A2, A3, A4, A5, A6, A7, A8, A9 > a( a1, a2, a3, a4, a5, a6, a7, a8, a9 ); + return l_( type(), f_, a, 0 ); + } + + // + + template result_type eval( A & a ) + { + return l_( type(), f_, a, 0 ); + } + + template result_type eval( A & a ) const + { + return l_( type(), f_, a, 0 ); + } + + template void accept( V & v ) const + { +#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( BOOST_BORLANDC ) + using boost::visit_each; +#endif + + BOOST_BIND_VISIT_EACH( v, f_, 0 ); + l_.accept( v ); + } + + bool compare( this_type const & rhs ) const + { + return ref_compare( f_, rhs.f_, 0 ) && l_ == rhs.l_; + } +}; + +#elif !defined( BOOST_NO_VOID_RETURNS ) + +template class bind_t +{ +public: + + typedef bind_t this_type; + + bind_t(F f, L const & l): f_(f), l_(l) {} + +#define BOOST_BIND_RETURN return +#include +#undef BOOST_BIND_RETURN + +}; + +#else // no void returns + +template struct bind_t_generator +{ + +template class implementation +{ +public: + + typedef implementation this_type; + + implementation(F f, L const & l): f_(f), l_(l) {} + +#define BOOST_BIND_RETURN return +#include +#undef BOOST_BIND_RETURN + +}; + +}; + +template<> struct bind_t_generator +{ + +template class implementation +{ +private: + + typedef void R; + +public: + + typedef implementation this_type; + + implementation(F f, L const & l): f_(f), l_(l) {} + +#define BOOST_BIND_RETURN +#include +#undef BOOST_BIND_RETURN + +}; + +}; + +template class bind_t: public bind_t_generator::BOOST_NESTED_TEMPLATE implementation +{ +public: + + bind_t(F f, L const & l): bind_t_generator::BOOST_NESTED_TEMPLATE implementation(f, l) {} + +}; + +#endif + +// function_equal + +#ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP + +// put overloads in _bi, rely on ADL + +# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +template bool function_equal( bind_t const & a, bind_t const & b ) +{ + return a.compare(b); +} + +# else + +template bool function_equal_impl( bind_t const & a, bind_t const & b, int ) +{ + return a.compare(b); +} + +# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +#else // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP + +// put overloads in boost + +} // namespace _bi + +# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +template bool function_equal( _bi::bind_t const & a, _bi::bind_t const & b ) +{ + return a.compare(b); +} + +# else + +template bool function_equal_impl( _bi::bind_t const & a, _bi::bind_t const & b, int ) +{ + return a.compare(b); +} + +# endif // #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING + +namespace _bi +{ + +#endif // BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP + +// add_value + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || (__SUNPRO_CC >= 0x530) + +#if defined( BOOST_BORLANDC ) && BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x582) ) + +template struct add_value +{ + typedef _bi::value type; +}; + +#else + +template< class T, int I > struct add_value_2 +{ + typedef boost::arg type; +}; + +template< class T > struct add_value_2< T, 0 > +{ + typedef _bi::value< T > type; +}; + +template struct add_value +{ + typedef typename add_value_2< T, boost::is_placeholder< T >::value >::type type; +}; + +#endif + +template struct add_value< value > +{ + typedef _bi::value type; +}; + +template struct add_value< reference_wrapper > +{ + typedef reference_wrapper type; +}; + +template struct add_value< arg > +{ + typedef boost::arg type; +}; + +template struct add_value< arg (*) () > +{ + typedef boost::arg (*type) (); +}; + +template struct add_value< bind_t > +{ + typedef bind_t type; +}; + +#else + +template struct _avt_0; + +template<> struct _avt_0<1> +{ + template struct inner + { + typedef T type; + }; +}; + +template<> struct _avt_0<2> +{ + template struct inner + { + typedef value type; + }; +}; + +typedef char (&_avt_r1) [1]; +typedef char (&_avt_r2) [2]; + +template _avt_r1 _avt_f(value); +template _avt_r1 _avt_f(reference_wrapper); +template _avt_r1 _avt_f(arg); +template _avt_r1 _avt_f(arg (*) ()); +template _avt_r1 _avt_f(bind_t); + +_avt_r2 _avt_f(...); + +template struct add_value +{ + static T t(); + typedef typename _avt_0::template inner::type type; +}; + +#endif + +// list_av_N + +template struct list_av_1 +{ + typedef typename add_value::type B1; + typedef list1 type; +}; + +template struct list_av_2 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef list2 type; +}; + +template struct list_av_3 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef list3 type; +}; + +template struct list_av_4 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef list4 type; +}; + +template struct list_av_5 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef list5 type; +}; + +template struct list_av_6 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef list6 type; +}; + +template struct list_av_7 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef typename add_value::type B7; + typedef list7 type; +}; + +template struct list_av_8 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef typename add_value::type B7; + typedef typename add_value::type B8; + typedef list8 type; +}; + +template struct list_av_9 +{ + typedef typename add_value::type B1; + typedef typename add_value::type B2; + typedef typename add_value::type B3; + typedef typename add_value::type B4; + typedef typename add_value::type B5; + typedef typename add_value::type B6; + typedef typename add_value::type B7; + typedef typename add_value::type B8; + typedef typename add_value::type B9; + typedef list9 type; +}; + +// operator! + +struct logical_not +{ + template bool operator()(V const & v) const { return !v; } +}; + +template + bind_t< bool, logical_not, list1< bind_t > > + operator! (bind_t const & f) +{ + typedef list1< bind_t > list_type; + return bind_t ( logical_not(), list_type(f) ); +} + +// relational operators + +#define BOOST_BIND_OPERATOR( op, name ) \ +\ +struct name \ +{ \ + template bool operator()(V const & v, W const & w) const { return v op w; } \ +}; \ + \ +template \ + bind_t< bool, name, list2< bind_t, typename add_value::type > > \ + operator op (bind_t const & f, A2 a2) \ +{ \ + typedef typename add_value::type B2; \ + typedef list2< bind_t, B2> list_type; \ + return bind_t ( name(), list_type(f, a2) ); \ +} + +BOOST_BIND_OPERATOR( ==, equal ) +BOOST_BIND_OPERATOR( !=, not_equal ) + +BOOST_BIND_OPERATOR( <, less ) +BOOST_BIND_OPERATOR( <=, less_equal ) + +BOOST_BIND_OPERATOR( >, greater ) +BOOST_BIND_OPERATOR( >=, greater_equal ) + +BOOST_BIND_OPERATOR( &&, logical_and ) +BOOST_BIND_OPERATOR( ||, logical_or ) + +#undef BOOST_BIND_OPERATOR + +#if defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) + +// resolve ambiguity with rel_ops + +#define BOOST_BIND_OPERATOR( op, name ) \ +\ +template \ + bind_t< bool, name, list2< bind_t, bind_t > > \ + operator op (bind_t const & f, bind_t const & g) \ +{ \ + typedef list2< bind_t, bind_t > list_type; \ + return bind_t ( name(), list_type(f, g) ); \ +} + +BOOST_BIND_OPERATOR( !=, not_equal ) +BOOST_BIND_OPERATOR( <=, less_equal ) +BOOST_BIND_OPERATOR( >, greater ) +BOOST_BIND_OPERATOR( >=, greater_equal ) + +#endif + +// visit_each, ADL + +#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( BOOST_BORLANDC ) \ + && !(defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) + +template void visit_each( V & v, value const & t, int ) +{ + using boost::visit_each; + BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); +} + +template void visit_each( V & v, bind_t const & t, int ) +{ + t.accept( v ); +} + +#endif + +} // namespace _bi + +// visit_each, no ADL + +#if defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) || defined( BOOST_BORLANDC ) \ + || (defined(__GNUC__) && __GNUC__ == 3 && __GNUC_MINOR__ <= 3) + +template void visit_each( V & v, _bi::value const & t, int ) +{ + BOOST_BIND_VISIT_EACH( v, t.get(), 0 ); +} + +template void visit_each( V & v, _bi::bind_t const & t, int ) +{ + t.accept( v ); +} + +#endif + +// is_bind_expression + +template< class T > struct is_bind_expression +{ + enum _vt { value = 0 }; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template< class R, class F, class L > struct is_bind_expression< _bi::bind_t< R, F, L > > +{ + enum _vt { value = 1 }; +}; + +#endif + +// bind + +#ifndef BOOST_BIND +#define BOOST_BIND bind +#endif + +// generic function objects + +template + _bi::bind_t + BOOST_BIND(F f) +{ + typedef _bi::list0 list_type; + return _bi::bind_t (f, list_type()); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1) +{ + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t (f, list_type(a1)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2) +{ + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t (f, list_type(a1, a2)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) +{ + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +// generic function objects, alternative syntax + +template + _bi::bind_t + BOOST_BIND(boost::type, F f) +{ + typedef _bi::list0 list_type; + return _bi::bind_t (f, list_type()); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1) +{ + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t (f, list_type(a1)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2) +{ + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t (f, list_type(a1, a2)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3) +{ + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t::type> + BOOST_BIND(boost::type, F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + +// adaptable function objects + +template + _bi::bind_t<_bi::unspecified, F, _bi::list0> + BOOST_BIND(F f) +{ + typedef _bi::list0 list_type; + return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type()); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_1::type> + BOOST_BIND(F f, A1 a1) +{ + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_2::type> + BOOST_BIND(F f, A1 a1, A2 a2) +{ + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type> (f, list_type(a1, a2)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_3::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3) +{ + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_4::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_5::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_6::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_7::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_8::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t<_bi::unspecified, F, typename _bi::list_av_9::type> + BOOST_BIND(F f, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t<_bi::unspecified, F, list_type>(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) + +// function pointers + +#define BOOST_BIND_CC +#define BOOST_BIND_ST +#define BOOST_BIND_NOEXCEPT + +#include + +# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) +# undef BOOST_BIND_NOEXCEPT +# define BOOST_BIND_NOEXCEPT noexcept +# include +# endif + +#undef BOOST_BIND_CC +#undef BOOST_BIND_ST +#undef BOOST_BIND_NOEXCEPT + +#if defined(BOOST_BIND_ENABLE_STDCALL) && !defined(_M_X64) + +#define BOOST_BIND_CC __stdcall +#define BOOST_BIND_ST +#define BOOST_BIND_NOEXCEPT + +#include + +#undef BOOST_BIND_CC +#undef BOOST_BIND_ST +#undef BOOST_BIND_NOEXCEPT + +#endif + +#if defined(BOOST_BIND_ENABLE_FASTCALL) && !defined(_M_X64) + +#define BOOST_BIND_CC __fastcall +#define BOOST_BIND_ST +#define BOOST_BIND_NOEXCEPT + +#include + +#undef BOOST_BIND_CC +#undef BOOST_BIND_ST +#undef BOOST_BIND_NOEXCEPT + +#endif + +#ifdef BOOST_BIND_ENABLE_PASCAL + +#define BOOST_BIND_ST pascal +#define BOOST_BIND_CC +#define BOOST_BIND_NOEXCEPT + +#include + +#undef BOOST_BIND_ST +#undef BOOST_BIND_CC +#undef BOOST_BIND_NOEXCEPT + +#endif + +// member function pointers + +#define BOOST_BIND_MF_NAME(X) X +#define BOOST_BIND_MF_CC +#define BOOST_BIND_MF_NOEXCEPT + +#include +#include + +# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) +# undef BOOST_BIND_MF_NOEXCEPT +# define BOOST_BIND_MF_NOEXCEPT noexcept +# include +# include +# endif + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC +#undef BOOST_BIND_MF_NOEXCEPT + +#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) + +#define BOOST_BIND_MF_NAME(X) X##_cdecl +#define BOOST_BIND_MF_CC __cdecl +#define BOOST_BIND_MF_NOEXCEPT + +#include +#include + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC +#undef BOOST_BIND_MF_NOEXCEPT + +#endif + +#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) + +#define BOOST_BIND_MF_NAME(X) X##_stdcall +#define BOOST_BIND_MF_CC __stdcall +#define BOOST_BIND_MF_NOEXCEPT + +#include +#include + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC +#undef BOOST_BIND_MF_NOEXCEPT + +#endif + +#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) + +#define BOOST_BIND_MF_NAME(X) X##_fastcall +#define BOOST_BIND_MF_CC __fastcall +#define BOOST_BIND_MF_NOEXCEPT + +#include +#include + +#undef BOOST_BIND_MF_NAME +#undef BOOST_BIND_MF_CC +#undef BOOST_BIND_MF_NOEXCEPT + +#endif + +// data member pointers + +#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + || ( defined(BOOST_BORLANDC) && BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT( 0x620 ) ) ) + +template +_bi::bind_t< R, _mfi::dm, typename _bi::list_av_1::type > + BOOST_BIND(R T::*f, A1 a1) +{ + typedef _mfi::dm F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t( F(f), list_type(a1) ); +} + +#else + +namespace _bi +{ + +template< class Pm, int I > struct add_cref; + +template< class M, class T > struct add_cref< M T::*, 0 > +{ + typedef M type; +}; + +template< class M, class T > struct add_cref< M T::*, 1 > +{ +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4180) +#endif + typedef M const & type; +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif +}; + +template< class R, class T > struct add_cref< R (T::*) (), 1 > +{ + typedef void type; +}; + +#if !defined(__IBMCPP__) || __IBMCPP_FUNC_CV_TMPL_ARG_DEDUCTION + +template< class R, class T > struct add_cref< R (T::*) () const, 1 > +{ + typedef void type; +}; + +#if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) + +template< class R, class T > struct add_cref< R (T::*) () const noexcept, 1 > +{ + typedef void type; +}; + +#endif // __cpp_noexcept_function_type + +#endif // __IBMCPP__ + +template struct isref +{ + enum value_type { value = 0 }; +}; + +template struct isref< R& > +{ + enum value_type { value = 1 }; +}; + +template struct isref< R* > +{ + enum value_type { value = 1 }; +}; + +template struct dm_result +{ + typedef typename add_cref< Pm, 1 >::type type; +}; + +template struct dm_result< Pm, bind_t > +{ + typedef typename bind_t::result_type result_type; + typedef typename add_cref< Pm, isref< result_type >::value >::type type; +}; + +} // namespace _bi + +template< class A1, class M, class T > + +_bi::bind_t< + typename _bi::dm_result< M T::*, A1 >::type, + _mfi::dm, + typename _bi::list_av_1::type +> + +BOOST_BIND( M T::*f, A1 a1 ) +{ + typedef typename _bi::dm_result< M T::*, A1 >::type result_type; + typedef _mfi::dm F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t< result_type, F, list_type >( F( f ), list_type( a1 ) ); +} + +#endif + +} // namespace boost + +#ifndef BOOST_BIND_NO_PLACEHOLDERS + +# include + +#endif + +#ifdef BOOST_MSVC +# pragma warning(default: 4512) // assignment operator could not be generated +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_BIND_BIND_HPP_INCLUDED diff --git a/thirdparty/boost-1_79/boost/bind/bind_cc.hpp b/thirdparty/boost-1_79/boost/bind/bind_cc.hpp new file mode 100644 index 00000000..278aa9a2 --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/bind_cc.hpp @@ -0,0 +1,117 @@ +// +// bind/bind_cc.hpp - support for different calling conventions +// +// Do not include this header directly. +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +template + _bi::bind_t + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) () BOOST_BIND_NOEXCEPT) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) () BOOST_BIND_NOEXCEPT; + typedef _bi::list0 list_type; + return _bi::bind_t (f, list_type()); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1) BOOST_BIND_NOEXCEPT, A1 a1) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t (f, list_type(a1)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t (f, list_type(a1, a2)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t::type> + BOOST_BIND(BOOST_BIND_ST R (BOOST_BIND_CC *f) (B1, B2, B3, B4, B5, B6, B7, B8, B9) BOOST_BIND_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef BOOST_BIND_ST R (BOOST_BIND_CC *F) (B1, B2, B3, B4, B5, B6, B7, B8, B9) BOOST_BIND_NOEXCEPT; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(f, list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} diff --git a/thirdparty/boost-1_79/boost/bind/bind_mf2_cc.hpp b/thirdparty/boost-1_79/boost/bind/bind_mf2_cc.hpp new file mode 100644 index 00000000..be20b1d9 --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/bind_mf2_cc.hpp @@ -0,0 +1,228 @@ +// +// bind/bind_mf2_cc.hpp - member functions, type<> syntax +// +// Do not include this header directly. +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2008 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +// 0 + +template + _bi::bind_t, typename _bi::list_av_1::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) () BOOST_BIND_MF_NOEXCEPT, A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +template + _bi::bind_t, typename _bi::list_av_1::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) () const BOOST_BIND_MF_NOEXCEPT, A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +// 1 + +template + _bi::bind_t, typename _bi::list_av_2::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +template + _bi::bind_t, typename _bi::list_av_2::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +// 2 + +template + _bi::bind_t, typename _bi::list_av_3::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +template + _bi::bind_t, typename _bi::list_av_3::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +// 3 + +template + _bi::bind_t, typename _bi::list_av_4::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t, typename _bi::list_av_4::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +// 4 + +template + _bi::bind_t, typename _bi::list_av_5::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t, typename _bi::list_av_5::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +// 5 + +template + _bi::bind_t, typename _bi::list_av_6::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t, typename _bi::list_av_6::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +// 6 + +template + _bi::bind_t, typename _bi::list_av_7::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t, typename _bi::list_av_7::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +// 7 + +template + _bi::bind_t, typename _bi::list_av_8::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t, typename _bi::list_av_8::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +// 8 + +template + _bi::bind_t, typename _bi::list_av_9::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +template + _bi::bind_t, typename _bi::list_av_9::type> + BOOST_BIND(boost::type, R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} diff --git a/thirdparty/boost-1_79/boost/bind/bind_mf_cc.hpp b/thirdparty/boost-1_79/boost/bind/bind_mf_cc.hpp new file mode 100644 index 00000000..bbfd3719 --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/bind_mf_cc.hpp @@ -0,0 +1,441 @@ +// +// bind/bind_mf_cc.hpp - support for different calling conventions +// +// Do not include this header directly. +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +// 0 + +template + _bi::bind_t, typename _bi::list_av_1::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () BOOST_BIND_MF_NOEXCEPT, A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +template + _bi::bind_t, typename _bi::list_av_1::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const BOOST_BIND_MF_NOEXCEPT, A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_1::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () BOOST_BIND_MF_NOEXCEPT, A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_1::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) () const BOOST_BIND_MF_NOEXCEPT, A1 a1) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf0) F; + typedef typename _bi::list_av_1::type list_type; + return _bi::bind_t(F(f), list_type(a1)); +} + +// 1 + +template + _bi::bind_t, typename _bi::list_av_2::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +template + _bi::bind_t, typename _bi::list_av_2::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_2::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_2::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf1) F; + typedef typename _bi::list_av_2::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2)); +} + +// 2 + +template + _bi::bind_t, typename _bi::list_av_3::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +template + _bi::bind_t, typename _bi::list_av_3::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_3::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_3::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf2) F; + typedef typename _bi::list_av_3::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3)); +} + +// 3 + +template + _bi::bind_t, typename _bi::list_av_4::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +template + _bi::bind_t, typename _bi::list_av_4::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_4::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_4::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf3) F; + typedef typename _bi::list_av_4::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4)); +} + +// 4 + +template + _bi::bind_t, typename _bi::list_av_5::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +template + _bi::bind_t, typename _bi::list_av_5::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_5::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_5::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf4) F; + typedef typename _bi::list_av_5::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5)); +} + +// 5 + +template + _bi::bind_t, typename _bi::list_av_6::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +template + _bi::bind_t, typename _bi::list_av_6::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_6::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_6::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf5) F; + typedef typename _bi::list_av_6::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6)); +} + +// 6 + +template + _bi::bind_t, typename _bi::list_av_7::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + _bi::bind_t, typename _bi::list_av_7::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_7::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_7::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf6) F; + typedef typename _bi::list_av_7::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7)); +} + +// 7 + +template + _bi::bind_t, typename _bi::list_av_8::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + _bi::bind_t, typename _bi::list_av_8::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_8::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_8::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf7) F; + typedef typename _bi::list_av_8::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8)); +} + +// 8 + +template + _bi::bind_t, typename _bi::list_av_9::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +template + _bi::bind_t, typename _bi::list_av_9::type> + BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_9::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(mf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} + +template + typename boost::enable_if_c::value, + _bi::bind_t, typename _bi::list_av_9::type> + >::type BOOST_BIND(R (BOOST_BIND_MF_CC T::*f) (B1, B2, B3, B4, B5, B6, B7, B8) const BOOST_BIND_MF_NOEXCEPT, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) +{ + typedef _mfi::BOOST_BIND_MF_NAME(cmf8) F; + typedef typename _bi::list_av_9::type list_type; + return _bi::bind_t(F(f), list_type(a1, a2, a3, a4, a5, a6, a7, a8, a9)); +} diff --git a/thirdparty/boost-1_79/boost/bind/bind_template.hpp b/thirdparty/boost-1_79/boost/bind/bind_template.hpp new file mode 100644 index 00000000..212ced7f --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/bind_template.hpp @@ -0,0 +1,345 @@ +// +// bind/bind_template.hpp +// +// Do not include this header directly. +// +// Copyright (c) 2001-2004 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + + typedef typename result_traits::type result_type; + + result_type operator()() + { + list0 a; + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + result_type operator()() const + { + list0 a; + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1) + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1) const + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1) + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1) const + { + list1 a(a1); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + + template result_type operator()(A1 & a1, A2 const & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 const & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + + template result_type operator()(A1 const & a1, A2 const & a2) + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2) const + { + list2 a(a1, a2); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3) + { + list3 a(a1, a2, a3); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3) const + { + list3 a(a1, a2, a3); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) + { + list3 a(a1, a2, a3); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3) const + { + list3 a(a1, a2, a3); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) + { + list4 a(a1, a2, a3, a4); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4) const + { + list4 a(a1, a2, a3, a4); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) + { + list4 a(a1, a2, a3, a4); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4) const + { + list4 a(a1, a2, a3, a4); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) + { + list5 a(a1, a2, a3, a4, a5); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5) const + { + list5 a(a1, a2, a3, a4, a5); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) + { + list5 a(a1, a2, a3, a4, a5); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5) const + { + list5 a(a1, a2, a3, a4, a5); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) + { + list6 a(a1, a2, a3, a4, a5, a6); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6) const + { + list6 a(a1, a2, a3, a4, a5, a6); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) + { + list6 a(a1, a2, a3, a4, a5, a6); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6) const + { + list6 a(a1, a2, a3, a4, a5, a6); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) + { + list7 a(a1, a2, a3, a4, a5, a6, a7); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7) const + { + list7 a(a1, a2, a3, a4, a5, a6, a7); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) + { + list7 a(a1, a2, a3, a4, a5, a6, a7); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7) const + { + list7 a(a1, a2, a3, a4, a5, a6, a7); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) + { + list8 a(a1, a2, a3, a4, a5, a6, a7, a8); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8) const + { + list8 a(a1, a2, a3, a4, a5, a6, a7, a8); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) + { + list8 a(a1, a2, a3, a4, a5, a6, a7, a8); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8) const + { + list8 a(a1, a2, a3, a4, a5, a6, a7, a8); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) + { + list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 & a1, A2 & a2, A3 & a3, A4 & a4, A5 & a5, A6 & a6, A7 & a7, A8 & a8, A9 & a9) const + { + list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) \ + && !BOOST_WORKAROUND(__EDG_VERSION__, <= 238) + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) + { + list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type operator()(A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9) const + { + list9 a(a1, a2, a3, a4, a5, a6, a7, a8, a9); + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + +#endif + + template result_type eval(A & a) + { + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template result_type eval(A & a) const + { + BOOST_BIND_RETURN l_(type(), f_, a, 0); + } + + template void accept(V & v) const + { +#if !defined( BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP ) && !defined( BOOST_BORLANDC ) + + using boost::visit_each; + +#endif + BOOST_BIND_VISIT_EACH(v, f_, 0); + l_.accept(v); + } + + bool compare(this_type const & rhs) const + { + return ref_compare(f_, rhs.f_, 0) && l_ == rhs.l_; + } + +private: + + F f_; + L l_; diff --git a/thirdparty/boost-1_79/boost/bind/detail/result_traits.hpp b/thirdparty/boost-1_79/boost/bind/detail/result_traits.hpp new file mode 100644 index 00000000..f8de9cd1 --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/detail/result_traits.hpp @@ -0,0 +1,164 @@ +#ifndef BOOST_BIND_DETAIL_RESULT_TRAITS_HPP_INCLUDED +#define BOOST_BIND_DETAIL_RESULT_TRAITS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind/detail/result_traits.hpp +// +// boost/bind.hpp support header, return type deduction +// +// Copyright 2006, 2020 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +#include + +#if BOOST_CXX_VERSION >= 201700L +#include +#endif + +namespace boost +{ + +namespace _bi +{ + +template struct result_traits +{ + typedef R type; +}; + +struct unspecified {}; + +template struct result_traits +{ + typedef typename F::result_type type; +}; + +template struct result_traits< unspecified, reference_wrapper > +{ + typedef typename F::result_type type; +}; + +#if BOOST_CXX_VERSION >= 201700L + +template struct result_traits< unspecified, std::plus > +{ + typedef T type; +}; + +template struct result_traits< unspecified, std::minus > +{ + typedef T type; +}; + +template struct result_traits< unspecified, std::multiplies > +{ + typedef T type; +}; + +template struct result_traits< unspecified, std::divides > +{ + typedef T type; +}; + +template struct result_traits< unspecified, std::modulus > +{ + typedef T type; +}; + +template struct result_traits< unspecified, std::negate > +{ + typedef T type; +}; + +template struct result_traits< unspecified, std::equal_to > +{ + typedef bool type; +}; + +template struct result_traits< unspecified, std::not_equal_to > +{ + typedef bool type; +}; + +template struct result_traits< unspecified, std::greater > +{ + typedef bool type; +}; + +template struct result_traits< unspecified, std::less > +{ + typedef bool type; +}; + +template struct result_traits< unspecified, std::greater_equal > +{ + typedef bool type; +}; + +template struct result_traits< unspecified, std::less_equal > +{ + typedef bool type; +}; + +template struct result_traits< unspecified, std::logical_and > +{ + typedef bool type; +}; + +template struct result_traits< unspecified, std::logical_or > +{ + typedef bool type; +}; + +template struct result_traits< unspecified, std::logical_not > +{ + typedef bool type; +}; + +template struct result_traits< unspecified, std::bit_and > +{ + typedef T type; +}; + +template struct result_traits< unspecified, std::bit_or > +{ + typedef T type; +}; + +template struct result_traits< unspecified, std::bit_xor > +{ + typedef T type; +}; + +#if defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 40900 + +// libstdc++ 4.8 and below don't have std::bit_not + +#else + +template struct result_traits< unspecified, std::bit_not > +{ + typedef T type; +}; + +#endif + +#endif + +} // namespace _bi + +} // namespace boost + +#endif // #ifndef BOOST_BIND_DETAIL_RESULT_TRAITS_HPP_INCLUDED diff --git a/thirdparty/boost-1_79/boost/bind/mem_fn.hpp b/thirdparty/boost-1_79/boost/bind/mem_fn.hpp new file mode 100644 index 00000000..5afb0a1a --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/mem_fn.hpp @@ -0,0 +1,403 @@ +#ifndef BOOST_BIND_MEM_FN_HPP_INCLUDED +#define BOOST_BIND_MEM_FN_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// mem_fn.hpp - a generalization of std::mem_fun[_ref] +// +// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2001 David Abrahams +// Copyright (c) 2003-2005 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/mem_fn.html for documentation. +// + +#include +#include +#include + +namespace boost +{ + +#if defined(BOOST_NO_VOID_RETURNS) + +#define BOOST_MEM_FN_CLASS_F , class F +#define BOOST_MEM_FN_TYPEDEF(X) + +namespace _mfi // mem_fun_impl +{ + +template struct mf +{ + +#define BOOST_MEM_FN_RETURN return + +#define BOOST_MEM_FN_NAME(X) inner_##X +#define BOOST_MEM_FN_CC + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) + +#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl +#define BOOST_MEM_FN_CC __cdecl + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) + +#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall +#define BOOST_MEM_FN_CC __stdcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) + +#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#undef BOOST_MEM_FN_RETURN + +}; // struct mf + +template<> struct mf +{ + +#define BOOST_MEM_FN_RETURN + +#define BOOST_MEM_FN_NAME(X) inner_##X +#define BOOST_MEM_FN_CC + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) + +#define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl +#define BOOST_MEM_FN_CC __cdecl + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_STDCALL + +#define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall +#define BOOST_MEM_FN_CC __stdcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#undef BOOST_MEM_FN_RETURN + +}; // struct mf + +#undef BOOST_MEM_FN_CLASS_F +#undef BOOST_MEM_FN_TYPEDEF_F + +#define BOOST_MEM_FN_NAME(X) X +#define BOOST_MEM_FN_NAME2(X) inner_##X +#define BOOST_MEM_FN_CC + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_NAME2 +#undef BOOST_MEM_FN_CC + +#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) + +#define BOOST_MEM_FN_NAME(X) X##_cdecl +#define BOOST_MEM_FN_NAME2(X) inner_##X##_cdecl +#define BOOST_MEM_FN_CC __cdecl + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_NAME2 +#undef BOOST_MEM_FN_CC + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_STDCALL + +#define BOOST_MEM_FN_NAME(X) X##_stdcall +#define BOOST_MEM_FN_NAME2(X) inner_##X##_stdcall +#define BOOST_MEM_FN_CC __stdcall + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_NAME2 +#undef BOOST_MEM_FN_CC + +#endif + +#ifdef BOOST_MEM_FN_ENABLE_FASTCALL + +#define BOOST_MEM_FN_NAME(X) X##_fastcall +#define BOOST_MEM_FN_NAME2(X) inner_##X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_NAME2 +#undef BOOST_MEM_FN_CC + +#endif + +} // namespace _mfi + +#else // #ifdef BOOST_NO_VOID_RETURNS + +#define BOOST_MEM_FN_CLASS_F +#define BOOST_MEM_FN_TYPEDEF(X) typedef X; + +namespace _mfi +{ + +#define BOOST_MEM_FN_RETURN return + +#define BOOST_MEM_FN_NAME(X) X +#define BOOST_MEM_FN_CC + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) + +#define BOOST_MEM_FN_NAME(X) X##_cdecl +#define BOOST_MEM_FN_CC __cdecl + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) + +#define BOOST_MEM_FN_NAME(X) X##_stdcall +#define BOOST_MEM_FN_CC __stdcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) + +#define BOOST_MEM_FN_NAME(X) X##_fastcall +#define BOOST_MEM_FN_CC __fastcall + +#include + +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NAME + +#endif + +#undef BOOST_MEM_FN_RETURN + +} // namespace _mfi + +#undef BOOST_MEM_FN_CLASS_F +#undef BOOST_MEM_FN_TYPEDEF + +#endif // #ifdef BOOST_NO_VOID_RETURNS + +#define BOOST_MEM_FN_NAME(X) X +#define BOOST_MEM_FN_CC +#define BOOST_MEM_FN_NOEXCEPT + +#include + +#if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) +# undef BOOST_MEM_FN_NOEXCEPT +# define BOOST_MEM_FN_NOEXCEPT noexcept +# include +#endif + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NOEXCEPT + +#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) + +#define BOOST_MEM_FN_NAME(X) X##_cdecl +#define BOOST_MEM_FN_CC __cdecl +#define BOOST_MEM_FN_NOEXCEPT + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NOEXCEPT + +#endif + +#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) + +#define BOOST_MEM_FN_NAME(X) X##_stdcall +#define BOOST_MEM_FN_CC __stdcall +#define BOOST_MEM_FN_NOEXCEPT + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NOEXCEPT + +#endif + +#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) + +#define BOOST_MEM_FN_NAME(X) X##_fastcall +#define BOOST_MEM_FN_CC __fastcall +#define BOOST_MEM_FN_NOEXCEPT + +#include + +#undef BOOST_MEM_FN_NAME +#undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NOEXCEPT + +#endif + +// data member support + +namespace _mfi +{ + +template class dm +{ +public: + + typedef R const & result_type; + typedef T const * argument_type; + +private: + + typedef R (T::*F); + F f_; + + template R const & call(U & u, T const *) const + { + return (u.*f_); + } + + template R const & call(U & u, void const *) const + { + return (get_pointer(u)->*f_); + } + +public: + + explicit dm(F f): f_(f) {} + + R & operator()(T * p) const + { + return (p->*f_); + } + + R const & operator()(T const * p) const + { + return (p->*f_); + } + + template R const & operator()(U const & u) const + { + return call(u, &u); + } + +#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__MWERKS__, < 0x3200) + + R & operator()(T & t) const + { + return (t.*f_); + } + + R const & operator()(T const & t) const + { + return (t.*f_); + } + +#endif + + bool operator==(dm const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(dm const & rhs) const + { + return f_ != rhs.f_; + } +}; + +} // namespace _mfi + +template _mfi::dm mem_fn(R T::*f) +{ + return _mfi::dm(f); +} + +} // namespace boost + +#endif // #ifndef BOOST_BIND_MEM_FN_HPP_INCLUDED diff --git a/thirdparty/boost-1_79/boost/bind/mem_fn_cc.hpp b/thirdparty/boost-1_79/boost/bind/mem_fn_cc.hpp new file mode 100644 index 00000000..03e38300 --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/mem_fn_cc.hpp @@ -0,0 +1,103 @@ +// +// bind/mem_fn_cc.hpp - support for different calling conventions +// +// Do not include this header directly. +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/mem_fn.html for documentation. +// + +template _mfi::BOOST_MEM_FN_NAME(mf0) mem_fn(R (BOOST_MEM_FN_CC T::*f) () BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(mf0)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf0) mem_fn(R (BOOST_MEM_FN_CC T::*f) () const BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf0)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf1) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(mf1)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf1) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) const BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf1)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf2) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(mf2)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf2) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) const BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf2)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf3) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(mf3)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf3) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) const BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf3)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf4) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(mf4)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf4) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) const BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf4)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf5) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(mf5)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf5) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) const BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf5)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf6) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(mf6)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf6) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) const BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf6)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf7) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(mf7)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf7) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) const BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf7)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(mf8) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(mf8)(f); +} + +template _mfi::BOOST_MEM_FN_NAME(cmf8) mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) const BOOST_MEM_FN_NOEXCEPT) +{ + return _mfi::BOOST_MEM_FN_NAME(cmf8)(f); +} diff --git a/thirdparty/boost-1_79/boost/bind/mem_fn_template.hpp b/thirdparty/boost-1_79/boost/bind/mem_fn_template.hpp new file mode 100644 index 00000000..b26d585d --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/mem_fn_template.hpp @@ -0,0 +1,1047 @@ +// +// bind/mem_fn_template.hpp +// +// Do not include this header directly +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/mem_fn.html for documentation. +// + +#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) +# define BOOST_MEM_FN_ENABLE_CONST_OVERLOADS +#endif + +// mf0 + +template class BOOST_MEM_FN_NAME(mf0) +{ +public: + + typedef R result_type; + typedef T * argument_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) ()) + F f_; + + template R call(U & u, T const *) const + { + BOOST_MEM_FN_RETURN (u.*f_)(); + } + + template R call(U & u, void const *) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf0)(F f): f_(f) {} + + R operator()(T * p) const + { + BOOST_MEM_FN_RETURN (p->*f_)(); + } + + template R operator()(U & u) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p); + } + +#endif + + R operator()(T & t) const + { + BOOST_MEM_FN_RETURN (t.*f_)(); + } + + bool operator==(BOOST_MEM_FN_NAME(mf0) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf0) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf0 + +template class BOOST_MEM_FN_NAME(cmf0) +{ +public: + + typedef R result_type; + typedef T const * argument_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) () const) + F f_; + + template R call(U & u, T const *) const + { + BOOST_MEM_FN_RETURN (u.*f_)(); + } + + template R call(U & u, void const *) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf0)(F f): f_(f) {} + + template R operator()(U const & u) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p); + } + + R operator()(T const & t) const + { + BOOST_MEM_FN_RETURN (t.*f_)(); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf0) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf0) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf1 + +template class BOOST_MEM_FN_NAME(mf1) +{ +public: + + typedef R result_type; + typedef T * first_argument_type; + typedef A1 second_argument_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1)) + F f_; + + template R call(U & u, T const *, B1 & b1) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1); + } + + template R call(U & u, void const *, B1 & b1) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf1)(F f): f_(f) {} + + R operator()(T * p, A1 a1) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1); + } + + template R operator()(U & u, A1 a1) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1); + } + +#endif + + R operator()(T & t, A1 a1) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1); + } + + bool operator==(BOOST_MEM_FN_NAME(mf1) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf1) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf1 + +template class BOOST_MEM_FN_NAME(cmf1) +{ +public: + + typedef R result_type; + typedef T const * first_argument_type; + typedef A1 second_argument_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1) const) + F f_; + + template R call(U & u, T const *, B1 & b1) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1); + } + + template R call(U & u, void const *, B1 & b1) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf1)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1); + } + + R operator()(T const & t, A1 a1) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf1) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf1) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf2 + +template class BOOST_MEM_FN_NAME(mf2) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf2)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2); + } + + template R operator()(U & u, A1 a1, A2 a2) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2); + } + + bool operator==(BOOST_MEM_FN_NAME(mf2) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf2) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf2 + +template class BOOST_MEM_FN_NAME(cmf2) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf2)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2); + } + + R operator()(T const & t, A1 a1, A2 a2) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf2) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf2) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf3 + +template class BOOST_MEM_FN_NAME(mf3) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf3)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3); + } + + bool operator==(BOOST_MEM_FN_NAME(mf3) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf3) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf3 + +template class BOOST_MEM_FN_NAME(cmf3) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf3)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf3) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf3) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf4 + +template class BOOST_MEM_FN_NAME(mf4) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf4)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4); + } + + bool operator==(BOOST_MEM_FN_NAME(mf4) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf4) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf4 + +template class BOOST_MEM_FN_NAME(cmf4) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf4)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf4) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf4) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf5 + +template class BOOST_MEM_FN_NAME(mf5) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf5)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5); + } + + bool operator==(BOOST_MEM_FN_NAME(mf5) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf5) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf5 + +template class BOOST_MEM_FN_NAME(cmf5) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf5)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf5) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf5) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf6 + +template class BOOST_MEM_FN_NAME(mf6) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf6)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6); + } + + bool operator==(BOOST_MEM_FN_NAME(mf6) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf6) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf6 + +template class BOOST_MEM_FN_NAME(cmf6) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf6)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf6) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf6) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf7 + +template class BOOST_MEM_FN_NAME(mf7) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf7)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7); + } + + bool operator==(BOOST_MEM_FN_NAME(mf7) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf7) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf7 + +template class BOOST_MEM_FN_NAME(cmf7) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf7)(F f): f_(f) {} + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf7) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf7) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// mf8 + +template class BOOST_MEM_FN_NAME(mf8) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8)) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8); + } + +public: + + explicit BOOST_MEM_FN_NAME(mf8)(F f): f_(f) {} + + R operator()(T * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + template R operator()(U & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8); + } + +#ifdef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8); + } + +#endif + + R operator()(T & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + bool operator==(BOOST_MEM_FN_NAME(mf8) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(mf8) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +// cmf8 + +template class BOOST_MEM_FN_NAME(cmf8) +{ +public: + + typedef R result_type; + +private: + + BOOST_MEM_FN_TYPEDEF(R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const) + F f_; + + template R call(U & u, T const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const + { + BOOST_MEM_FN_RETURN (u.*f_)(b1, b2, b3, b4, b5, b6, b7, b8); + } + + template R call(U & u, void const *, B1 & b1, B2 & b2, B3 & b3, B4 & b4, B5 & b5, B6 & b6, B7 & b7, B8 & b8) const + { + BOOST_MEM_FN_RETURN (get_pointer(u)->*f_)(b1, b2, b3, b4, b5, b6, b7, b8); + } + +public: + + explicit BOOST_MEM_FN_NAME(cmf8)(F f): f_(f) {} + + R operator()(T const * p, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN (p->*f_)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + template R operator()(U const & u, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + U const * p = 0; + BOOST_MEM_FN_RETURN call(u, p, a1, a2, a3, a4, a5, a6, a7, a8); + } + + R operator()(T const & t, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) const + { + BOOST_MEM_FN_RETURN (t.*f_)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + bool operator==(BOOST_MEM_FN_NAME(cmf8) const & rhs) const + { + return f_ == rhs.f_; + } + + bool operator!=(BOOST_MEM_FN_NAME(cmf8) const & rhs) const + { + return f_ != rhs.f_; + } +}; + +#undef BOOST_MEM_FN_ENABLE_CONST_OVERLOADS diff --git a/thirdparty/boost-1_79/boost/bind/mem_fn_vw.hpp b/thirdparty/boost-1_79/boost/bind/mem_fn_vw.hpp new file mode 100644 index 00000000..f3fc58db --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/mem_fn_vw.hpp @@ -0,0 +1,130 @@ +// +// bind/mem_fn_vw.hpp - void return helper wrappers +// +// Do not include this header directly +// +// Copyright (c) 2001 Peter Dimov and Multi Media Ltd. +// +// Distributed under the Boost Software License, Version 1.0. (See +// accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/bind/mem_fn.html for documentation. +// + +template struct BOOST_MEM_FN_NAME(mf0): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (); + explicit BOOST_MEM_FN_NAME(mf0)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf0)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf0): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0) +{ + typedef R (BOOST_MEM_FN_CC T::*F) () const; + explicit BOOST_MEM_FN_NAME(cmf0)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf0)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf1): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1); + explicit BOOST_MEM_FN_NAME(mf1)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf1)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf1): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1) const; + explicit BOOST_MEM_FN_NAME(cmf1)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf1)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf2): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2); + explicit BOOST_MEM_FN_NAME(mf2)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf2)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf2): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2) const; + explicit BOOST_MEM_FN_NAME(cmf2)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf2)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf3): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3); + explicit BOOST_MEM_FN_NAME(mf3)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf3)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf3): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3) const; + explicit BOOST_MEM_FN_NAME(cmf3)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf3)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf4): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4); + explicit BOOST_MEM_FN_NAME(mf4)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf4)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf4): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4) const; + explicit BOOST_MEM_FN_NAME(cmf4)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf4)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf5): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5); + explicit BOOST_MEM_FN_NAME(mf5)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf5)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf5): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5) const; + explicit BOOST_MEM_FN_NAME(cmf5)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf5)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf6): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6); + explicit BOOST_MEM_FN_NAME(mf6)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf6)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf6): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6) const; + explicit BOOST_MEM_FN_NAME(cmf6)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf6)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf7): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7); + explicit BOOST_MEM_FN_NAME(mf7)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf7)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf7): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7) const; + explicit BOOST_MEM_FN_NAME(cmf7)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf7)(f) {} +}; + + +template struct BOOST_MEM_FN_NAME(mf8): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8); + explicit BOOST_MEM_FN_NAME(mf8)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(mf8)(f) {} +}; + +template struct BOOST_MEM_FN_NAME(cmf8): public mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8) +{ + typedef R (BOOST_MEM_FN_CC T::*F) (A1, A2, A3, A4, A5, A6, A7, A8) const; + explicit BOOST_MEM_FN_NAME(cmf8)(F f): mf::BOOST_NESTED_TEMPLATE BOOST_MEM_FN_NAME2(cmf8)(f) {} +}; + diff --git a/thirdparty/boost-1_79/boost/bind/placeholders.hpp b/thirdparty/boost-1_79/boost/bind/placeholders.hpp new file mode 100644 index 00000000..5e4b96d8 --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/placeholders.hpp @@ -0,0 +1,74 @@ +#ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED +#define BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind/placeholders.hpp - _N definitions +// +// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright 2015 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +#include +#include + +namespace boost +{ + +namespace placeholders +{ + +#if defined(BOOST_BORLANDC) || defined(__GNUC__) && (__GNUC__ < 4) + +inline boost::arg<1> _1() { return boost::arg<1>(); } +inline boost::arg<2> _2() { return boost::arg<2>(); } +inline boost::arg<3> _3() { return boost::arg<3>(); } +inline boost::arg<4> _4() { return boost::arg<4>(); } +inline boost::arg<5> _5() { return boost::arg<5>(); } +inline boost::arg<6> _6() { return boost::arg<6>(); } +inline boost::arg<7> _7() { return boost::arg<7>(); } +inline boost::arg<8> _8() { return boost::arg<8>(); } +inline boost::arg<9> _9() { return boost::arg<9>(); } + +#elif !defined(BOOST_NO_CXX17_INLINE_VARIABLES) + +BOOST_INLINE_CONSTEXPR boost::arg<1> _1; +BOOST_INLINE_CONSTEXPR boost::arg<2> _2; +BOOST_INLINE_CONSTEXPR boost::arg<3> _3; +BOOST_INLINE_CONSTEXPR boost::arg<4> _4; +BOOST_INLINE_CONSTEXPR boost::arg<5> _5; +BOOST_INLINE_CONSTEXPR boost::arg<6> _6; +BOOST_INLINE_CONSTEXPR boost::arg<7> _7; +BOOST_INLINE_CONSTEXPR boost::arg<8> _8; +BOOST_INLINE_CONSTEXPR boost::arg<9> _9; + +#else + +BOOST_STATIC_CONSTEXPR boost::arg<1> _1; +BOOST_STATIC_CONSTEXPR boost::arg<2> _2; +BOOST_STATIC_CONSTEXPR boost::arg<3> _3; +BOOST_STATIC_CONSTEXPR boost::arg<4> _4; +BOOST_STATIC_CONSTEXPR boost::arg<5> _5; +BOOST_STATIC_CONSTEXPR boost::arg<6> _6; +BOOST_STATIC_CONSTEXPR boost::arg<7> _7; +BOOST_STATIC_CONSTEXPR boost::arg<8> _8; +BOOST_STATIC_CONSTEXPR boost::arg<9> _9; + +#endif + +} // namespace placeholders + +} // namespace boost + +#endif // #ifndef BOOST_BIND_PLACEHOLDERS_HPP_INCLUDED diff --git a/thirdparty/boost-1_79/boost/bind/std_placeholders.hpp b/thirdparty/boost-1_79/boost/bind/std_placeholders.hpp new file mode 100644 index 00000000..04c9ba55 --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/std_placeholders.hpp @@ -0,0 +1,39 @@ +#ifndef BOOST_BIND_STD_PLACEHOLDERS_HPP_INCLUDED +#define BOOST_BIND_STD_PLACEHOLDERS_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// Copyright 2021 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include +#include + +#if !defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) && !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) + +#include +#include + +namespace boost +{ + +template<> struct is_placeholder< typename std::decay::type > { enum _vt { value = 1 }; }; +template<> struct is_placeholder< typename std::decay::type > { enum _vt { value = 2 }; }; +template<> struct is_placeholder< typename std::decay::type > { enum _vt { value = 3 }; }; +template<> struct is_placeholder< typename std::decay::type > { enum _vt { value = 4 }; }; +template<> struct is_placeholder< typename std::decay::type > { enum _vt { value = 5 }; }; +template<> struct is_placeholder< typename std::decay::type > { enum _vt { value = 6 }; }; +template<> struct is_placeholder< typename std::decay::type > { enum _vt { value = 7 }; }; +template<> struct is_placeholder< typename std::decay::type > { enum _vt { value = 8 }; }; +template<> struct is_placeholder< typename std::decay::type > { enum _vt { value = 9 }; }; + +} // namespace boost + +#endif + +#endif // #ifndef BOOST_BIND_STD_PLACEHOLDERS_HPP_INCLUDED diff --git a/thirdparty/boost-1_79/boost/bind/storage.hpp b/thirdparty/boost-1_79/boost/bind/storage.hpp new file mode 100644 index 00000000..5d84027b --- /dev/null +++ b/thirdparty/boost-1_79/boost/bind/storage.hpp @@ -0,0 +1,475 @@ +#ifndef BOOST_BIND_STORAGE_HPP_INCLUDED +#define BOOST_BIND_STORAGE_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// +// bind/storage.hpp +// +// boost/bind.hpp support header, optimized storage +// +// Copyright (c) 2006 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt +// +// See http://www.boost.org/libs/bind/bind.html for documentation. +// + +#include +#include + +#ifdef BOOST_MSVC +# pragma warning(push) +# pragma warning(disable: 4512) // assignment operator could not be generated +#endif + +namespace boost +{ + +namespace _bi +{ + +// 1 + +template struct storage1 +{ + explicit storage1( A1 a1 ): a1_( a1 ) {} + + template void accept(V & v) const + { + BOOST_BIND_VISIT_EACH(v, a1_, 0); + } + + A1 a1_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_BORLANDC ) + +template struct storage1< boost::arg > +{ + explicit storage1( boost::arg ) {} + + template void accept(V &) const { } + + static boost::arg a1_() { return boost::arg(); } +}; + +template struct storage1< boost::arg (*) () > +{ + explicit storage1( boost::arg (*) () ) {} + + template void accept(V &) const { } + + static boost::arg a1_() { return boost::arg(); } +}; + +#endif + +// 2 + +template struct storage2: public storage1 +{ + typedef storage1 inherited; + + storage2( A1 a1, A2 a2 ): storage1( a1 ), a2_( a2 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a2_, 0); + } + + A2 a2_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage2< A1, boost::arg >: public storage1 +{ + typedef storage1 inherited; + + storage2( A1 a1, boost::arg ): storage1( a1 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a2_() { return boost::arg(); } +}; + +template struct storage2< A1, boost::arg (*) () >: public storage1 +{ + typedef storage1 inherited; + + storage2( A1 a1, boost::arg (*) () ): storage1( a1 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a2_() { return boost::arg(); } +}; + +#endif + +// 3 + +template struct storage3: public storage2< A1, A2 > +{ + typedef storage2 inherited; + + storage3( A1 a1, A2 a2, A3 a3 ): storage2( a1, a2 ), a3_( a3 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a3_, 0); + } + + A3 a3_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage3< A1, A2, boost::arg >: public storage2< A1, A2 > +{ + typedef storage2 inherited; + + storage3( A1 a1, A2 a2, boost::arg ): storage2( a1, a2 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a3_() { return boost::arg(); } +}; + +template struct storage3< A1, A2, boost::arg (*) () >: public storage2< A1, A2 > +{ + typedef storage2 inherited; + + storage3( A1 a1, A2 a2, boost::arg (*) () ): storage2( a1, a2 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a3_() { return boost::arg(); } +}; + +#endif + +// 4 + +template struct storage4: public storage3< A1, A2, A3 > +{ + typedef storage3 inherited; + + storage4( A1 a1, A2 a2, A3 a3, A4 a4 ): storage3( a1, a2, a3 ), a4_( a4 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a4_, 0); + } + + A4 a4_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage4< A1, A2, A3, boost::arg >: public storage3< A1, A2, A3 > +{ + typedef storage3 inherited; + + storage4( A1 a1, A2 a2, A3 a3, boost::arg ): storage3( a1, a2, a3 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a4_() { return boost::arg(); } +}; + +template struct storage4< A1, A2, A3, boost::arg (*) () >: public storage3< A1, A2, A3 > +{ + typedef storage3 inherited; + + storage4( A1 a1, A2 a2, A3 a3, boost::arg (*) () ): storage3( a1, a2, a3 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a4_() { return boost::arg(); } +}; + +#endif + +// 5 + +template struct storage5: public storage4< A1, A2, A3, A4 > +{ + typedef storage4 inherited; + + storage5( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5 ): storage4( a1, a2, a3, a4 ), a5_( a5 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a5_, 0); + } + + A5 a5_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage5< A1, A2, A3, A4, boost::arg >: public storage4< A1, A2, A3, A4 > +{ + typedef storage4 inherited; + + storage5( A1 a1, A2 a2, A3 a3, A4 a4, boost::arg ): storage4( a1, a2, a3, a4 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a5_() { return boost::arg(); } +}; + +template struct storage5< A1, A2, A3, A4, boost::arg (*) () >: public storage4< A1, A2, A3, A4 > +{ + typedef storage4 inherited; + + storage5( A1 a1, A2 a2, A3 a3, A4 a4, boost::arg (*) () ): storage4( a1, a2, a3, a4 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a5_() { return boost::arg(); } +}; + +#endif + +// 6 + +template struct storage6: public storage5< A1, A2, A3, A4, A5 > +{ + typedef storage5 inherited; + + storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6 ): storage5( a1, a2, a3, a4, a5 ), a6_( a6 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a6_, 0); + } + + A6 a6_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage6< A1, A2, A3, A4, A5, boost::arg >: public storage5< A1, A2, A3, A4, A5 > +{ + typedef storage5 inherited; + + storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, boost::arg ): storage5( a1, a2, a3, a4, a5 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a6_() { return boost::arg(); } +}; + +template struct storage6< A1, A2, A3, A4, A5, boost::arg (*) () >: public storage5< A1, A2, A3, A4, A5 > +{ + typedef storage5 inherited; + + storage6( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, boost::arg (*) () ): storage5( a1, a2, a3, a4, a5 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a6_() { return boost::arg(); } +}; + +#endif + +// 7 + +template struct storage7: public storage6< A1, A2, A3, A4, A5, A6 > +{ + typedef storage6 inherited; + + storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7 ): storage6( a1, a2, a3, a4, a5, a6 ), a7_( a7 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a7_, 0); + } + + A7 a7_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage7< A1, A2, A3, A4, A5, A6, boost::arg >: public storage6< A1, A2, A3, A4, A5, A6 > +{ + typedef storage6 inherited; + + storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, boost::arg ): storage6( a1, a2, a3, a4, a5, a6 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a7_() { return boost::arg(); } +}; + +template struct storage7< A1, A2, A3, A4, A5, A6, boost::arg (*) () >: public storage6< A1, A2, A3, A4, A5, A6 > +{ + typedef storage6 inherited; + + storage7( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, boost::arg (*) () ): storage6( a1, a2, a3, a4, a5, a6 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a7_() { return boost::arg(); } +}; + +#endif + +// 8 + +template struct storage8: public storage7< A1, A2, A3, A4, A5, A6, A7 > +{ + typedef storage7 inherited; + + storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8 ): storage7( a1, a2, a3, a4, a5, a6, a7 ), a8_( a8 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a8_, 0); + } + + A8 a8_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage8< A1, A2, A3, A4, A5, A6, A7, boost::arg >: public storage7< A1, A2, A3, A4, A5, A6, A7 > +{ + typedef storage7 inherited; + + storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, boost::arg ): storage7( a1, a2, a3, a4, a5, a6, a7 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a8_() { return boost::arg(); } +}; + +template struct storage8< A1, A2, A3, A4, A5, A6, A7, boost::arg (*) () >: public storage7< A1, A2, A3, A4, A5, A6, A7 > +{ + typedef storage7 inherited; + + storage8( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, boost::arg (*) () ): storage7( a1, a2, a3, a4, a5, a6, a7 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a8_() { return boost::arg(); } +}; + +#endif + +// 9 + +template struct storage9: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ + typedef storage8 inherited; + + storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9 ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ), a9_( a9 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + BOOST_BIND_VISIT_EACH(v, a9_, 0); + } + + A9 a9_; +}; + +#if !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) + +template struct storage9< A1, A2, A3, A4, A5, A6, A7, A8, boost::arg >: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ + typedef storage8 inherited; + + storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, boost::arg ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a9_() { return boost::arg(); } +}; + +template struct storage9< A1, A2, A3, A4, A5, A6, A7, A8, boost::arg (*) () >: public storage8< A1, A2, A3, A4, A5, A6, A7, A8 > +{ + typedef storage8 inherited; + + storage9( A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, boost::arg (*) () ): storage8( a1, a2, a3, a4, a5, a6, a7, a8 ) {} + + template void accept(V & v) const + { + inherited::accept(v); + } + + static boost::arg a9_() { return boost::arg(); } +}; + +#endif + +} // namespace _bi + +} // namespace boost + +#ifdef BOOST_MSVC +# pragma warning(default: 4512) // assignment operator could not be generated +# pragma warning(pop) +#endif + +#endif // #ifndef BOOST_BIND_STORAGE_HPP_INCLUDED diff --git a/thirdparty/boost-1_79/boost/call_traits.hpp b/thirdparty/boost-1_79/boost/call_traits.hpp new file mode 100644 index 00000000..2c1328e9 --- /dev/null +++ b/thirdparty/boost-1_79/boost/call_traits.hpp @@ -0,0 +1,20 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/utility for most recent version including documentation. + +// See boost/detail/call_traits.hpp +// for full copyright notices. + +#ifndef BOOST_CALL_TRAITS_HPP +#define BOOST_CALL_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +#include +#endif + +#include + +#endif // BOOST_CALL_TRAITS_HPP diff --git a/thirdparty/boost-1_79/boost/checked_delete.hpp b/thirdparty/boost-1_79/boost/checked_delete.hpp new file mode 100644 index 00000000..fb71c789 --- /dev/null +++ b/thirdparty/boost-1_79/boost/checked_delete.hpp @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2014 Glen Fernandes + * + * Distributed under the Boost Software License, Version 1.0. (See + * accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + */ + +#ifndef BOOST_CHECKED_DELETE_HPP +#define BOOST_CHECKED_DELETE_HPP + +// The header file at this path is deprecated; +// use boost/core/checked_delete.hpp instead. + +#include + +#endif diff --git a/thirdparty/boost-1_79/boost/compressed_pair.hpp b/thirdparty/boost-1_79/boost/compressed_pair.hpp new file mode 100644 index 00000000..a7be0f2b --- /dev/null +++ b/thirdparty/boost-1_79/boost/compressed_pair.hpp @@ -0,0 +1,20 @@ +// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. +// Use, modification and distribution are subject to the Boost Software License, +// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt). +// +// See http://www.boost.org/libs/utility for most recent version including documentation. + +// See boost/detail/compressed_pair.hpp +// for full copyright notices. + +#ifndef BOOST_COMPRESSED_PAIR_HPP +#define BOOST_COMPRESSED_PAIR_HPP + +#ifndef BOOST_CONFIG_HPP +#include +#endif + +#include + +#endif // BOOST_COMPRESSED_PAIR_HPP diff --git a/thirdparty/boost-1_75/boost/config.hpp b/thirdparty/boost-1_79/boost/config.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config.hpp rename to thirdparty/boost-1_79/boost/config.hpp diff --git a/thirdparty/boost-1_75/boost/config/abi/borland_prefix.hpp b/thirdparty/boost-1_79/boost/config/abi/borland_prefix.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/abi/borland_prefix.hpp rename to thirdparty/boost-1_79/boost/config/abi/borland_prefix.hpp diff --git a/thirdparty/boost-1_75/boost/config/abi/borland_suffix.hpp b/thirdparty/boost-1_79/boost/config/abi/borland_suffix.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/abi/borland_suffix.hpp rename to thirdparty/boost-1_79/boost/config/abi/borland_suffix.hpp diff --git a/thirdparty/boost-1_75/boost/config/abi/msvc_prefix.hpp b/thirdparty/boost-1_79/boost/config/abi/msvc_prefix.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/abi/msvc_prefix.hpp rename to thirdparty/boost-1_79/boost/config/abi/msvc_prefix.hpp diff --git a/thirdparty/boost-1_75/boost/config/abi/msvc_suffix.hpp b/thirdparty/boost-1_79/boost/config/abi/msvc_suffix.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/abi/msvc_suffix.hpp rename to thirdparty/boost-1_79/boost/config/abi/msvc_suffix.hpp diff --git a/thirdparty/boost-1_75/boost/config/abi_prefix.hpp b/thirdparty/boost-1_79/boost/config/abi_prefix.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/abi_prefix.hpp rename to thirdparty/boost-1_79/boost/config/abi_prefix.hpp diff --git a/thirdparty/boost-1_75/boost/config/abi_suffix.hpp b/thirdparty/boost-1_79/boost/config/abi_suffix.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/abi_suffix.hpp rename to thirdparty/boost-1_79/boost/config/abi_suffix.hpp diff --git a/thirdparty/boost-1_79/boost/config/assert_cxx03.hpp b/thirdparty/boost-1_79/boost/config/assert_cxx03.hpp new file mode 100644 index 00000000..682309d4 --- /dev/null +++ b/thirdparty/boost-1_79/boost/config/assert_cxx03.hpp @@ -0,0 +1,211 @@ +// This file was automatically generated on Thu Feb 3 18:10:41 2022 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-21. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + +#include + +#ifdef BOOST_NO_ADL_BARRIER +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_ADL_BARRIER." +#endif +#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP." +#endif +#ifdef BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS." +#endif +#ifdef BOOST_NO_COMPLETE_VALUE_INITIALIZATION +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_COMPLETE_VALUE_INITIALIZATION." +#endif +#ifdef BOOST_NO_CTYPE_FUNCTIONS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_CTYPE_FUNCTIONS." +#endif +#ifdef BOOST_NO_CV_SPECIALIZATIONS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_CV_SPECIALIZATIONS." +#endif +#ifdef BOOST_NO_CV_VOID_SPECIALIZATIONS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_CV_VOID_SPECIALIZATIONS." +#endif +#ifdef BOOST_NO_CWCHAR +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_CWCHAR." +#endif +#ifdef BOOST_NO_CWCTYPE +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_CWCTYPE." +#endif +#ifdef BOOST_NO_DEPENDENT_NESTED_DERIVATIONS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_DEPENDENT_NESTED_DERIVATIONS." +#endif +#ifdef BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS." +#endif +#ifdef BOOST_NO_EXCEPTIONS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_EXCEPTIONS." +#endif +#ifdef BOOST_NO_EXCEPTION_STD_NAMESPACE +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_EXCEPTION_STD_NAMESPACE." +#endif +#ifdef BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS." +#endif +#ifdef BOOST_NO_FENV_H +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_FENV_H." +#endif +#ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_FUNCTION_TEMPLATE_ORDERING." +#endif +#ifdef BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS." +#endif +#ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_INCLASS_MEMBER_INITIALIZATION." +#endif +#ifdef BOOST_NO_INTEGRAL_INT64_T +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_INTEGRAL_INT64_T." +#endif +#ifdef BOOST_NO_INTRINSIC_WCHAR_T +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_INTRINSIC_WCHAR_T." +#endif +#ifdef BOOST_NO_IOSFWD +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_IOSFWD." +#endif +#ifdef BOOST_NO_IOSTREAM +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_IOSTREAM." +#endif +#ifdef BOOST_NO_IS_ABSTRACT +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_IS_ABSTRACT." +#endif +#ifdef BOOST_NO_LIMITS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_LIMITS." +#endif +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS." +#endif +#ifdef BOOST_NO_LONG_LONG +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_LONG_LONG." +#endif +#ifdef BOOST_NO_LONG_LONG_NUMERIC_LIMITS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_LONG_LONG_NUMERIC_LIMITS." +#endif +#ifdef BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS." +#endif +#ifdef BOOST_NO_MEMBER_TEMPLATES +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_MEMBER_TEMPLATES." +#endif +#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_MEMBER_TEMPLATE_FRIENDS." +#endif +#ifdef BOOST_NO_MEMBER_TEMPLATE_KEYWORD +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_MEMBER_TEMPLATE_KEYWORD." +#endif +#ifdef BOOST_NO_NESTED_FRIENDSHIP +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_NESTED_FRIENDSHIP." +#endif +#ifdef BOOST_NO_OPERATORS_IN_NAMESPACE +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_OPERATORS_IN_NAMESPACE." +#endif +#ifdef BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS." +#endif +#ifdef BOOST_NO_POINTER_TO_MEMBER_CONST +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_POINTER_TO_MEMBER_CONST." +#endif +#ifdef BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS." +#endif +#ifdef BOOST_NO_PRIVATE_IN_AGGREGATE +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_PRIVATE_IN_AGGREGATE." +#endif +#ifdef BOOST_NO_RESTRICT_REFERENCES +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_RESTRICT_REFERENCES." +#endif +#ifdef BOOST_NO_RTTI +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_RTTI." +#endif +#ifdef BOOST_NO_SFINAE +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_SFINAE." +#endif +#ifdef BOOST_NO_SFINAE_EXPR +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_SFINAE_EXPR." +#endif +#ifdef BOOST_NO_STDC_NAMESPACE +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STDC_NAMESPACE." +#endif +#ifdef BOOST_NO_STD_ALLOCATOR +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STD_ALLOCATOR." +#endif +#ifdef BOOST_NO_STD_DISTANCE +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STD_DISTANCE." +#endif +#ifdef BOOST_NO_STD_ITERATOR +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STD_ITERATOR." +#endif +#ifdef BOOST_NO_STD_ITERATOR_TRAITS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STD_ITERATOR_TRAITS." +#endif +#ifdef BOOST_NO_STD_LOCALE +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STD_LOCALE." +#endif +#ifdef BOOST_NO_STD_MESSAGES +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STD_MESSAGES." +#endif +#ifdef BOOST_NO_STD_MIN_MAX +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STD_MIN_MAX." +#endif +#ifdef BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN." +#endif +#ifdef BOOST_NO_STD_TYPEINFO +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STD_TYPEINFO." +#endif +#ifdef BOOST_NO_STD_USE_FACET +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STD_USE_FACET." +#endif +#ifdef BOOST_NO_STD_WSTREAMBUF +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STD_WSTREAMBUF." +#endif +#ifdef BOOST_NO_STD_WSTRING +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STD_WSTRING." +#endif +#ifdef BOOST_NO_STRINGSTREAM +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_STRINGSTREAM." +#endif +#ifdef BOOST_NO_TEMPLATED_IOSTREAMS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_TEMPLATED_IOSTREAMS." +#endif +#ifdef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS." +#endif +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION." +#endif +#ifdef BOOST_NO_TEMPLATE_TEMPLATES +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_TEMPLATE_TEMPLATES." +#endif +#ifdef BOOST_NO_TWO_PHASE_NAME_LOOKUP +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_TWO_PHASE_NAME_LOOKUP." +#endif +#ifdef BOOST_NO_TYPEID +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_TYPEID." +#endif +#ifdef BOOST_NO_TYPENAME_WITH_CTOR +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_TYPENAME_WITH_CTOR." +#endif +#ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_UNREACHABLE_RETURN_DETECTION." +#endif +#ifdef BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE." +#endif +#ifdef BOOST_NO_USING_TEMPLATE +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_USING_TEMPLATE." +#endif +#ifdef BOOST_NO_VOID_RETURNS +# error "Your compiler appears not to be fully C++03 compliant. Detected via defect macro BOOST_NO_VOID_RETURNS." +#endif diff --git a/thirdparty/boost-1_79/boost/config/assert_cxx11.hpp b/thirdparty/boost-1_79/boost/config/assert_cxx11.hpp new file mode 100644 index 00000000..c3712c27 --- /dev/null +++ b/thirdparty/boost-1_79/boost/config/assert_cxx11.hpp @@ -0,0 +1,209 @@ +// This file was automatically generated on Thu Feb 3 18:10:41 2022 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-21. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + +#include +#include + +#ifdef BOOST_NO_CXX11_ADDRESSOF +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_ADDRESSOF." +#endif +#ifdef BOOST_NO_CXX11_ALIGNAS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_ALIGNAS." +#endif +#ifdef BOOST_NO_CXX11_ALLOCATOR +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_ALLOCATOR." +#endif +#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_AUTO_DECLARATIONS." +#endif +#ifdef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS." +#endif +#ifdef BOOST_NO_CXX11_CHAR16_T +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_CHAR16_T." +#endif +#ifdef BOOST_NO_CXX11_CHAR32_T +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_CHAR32_T." +#endif +#ifdef BOOST_NO_CXX11_CONSTEXPR +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_CONSTEXPR." +#endif +#ifdef BOOST_NO_CXX11_DECLTYPE +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_DECLTYPE." +#endif +#ifdef BOOST_NO_CXX11_DECLTYPE_N3276 +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_DECLTYPE_N3276." +#endif +#ifdef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_DEFAULTED_FUNCTIONS." +#endif +#ifdef BOOST_NO_CXX11_DEFAULTED_MOVES +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_DEFAULTED_MOVES." +#endif +#ifdef BOOST_NO_CXX11_DELETED_FUNCTIONS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_DELETED_FUNCTIONS." +#endif +#ifdef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS." +#endif +#ifdef BOOST_NO_CXX11_EXTERN_TEMPLATE +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_EXTERN_TEMPLATE." +#endif +#ifdef BOOST_NO_CXX11_FINAL +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_FINAL." +#endif +#ifdef BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS." +#endif +#ifdef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS." +#endif +#ifdef BOOST_NO_CXX11_HDR_ARRAY +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_ARRAY." +#endif +#ifdef BOOST_NO_CXX11_HDR_ATOMIC +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_ATOMIC." +#endif +#ifdef BOOST_NO_CXX11_HDR_CHRONO +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_CHRONO." +#endif +#ifdef BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_CONDITION_VARIABLE." +#endif +#ifdef BOOST_NO_CXX11_HDR_EXCEPTION +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_EXCEPTION." +#endif +#ifdef BOOST_NO_CXX11_HDR_FORWARD_LIST +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_FORWARD_LIST." +#endif +#ifdef BOOST_NO_CXX11_HDR_FUNCTIONAL +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_FUNCTIONAL." +#endif +#ifdef BOOST_NO_CXX11_HDR_FUTURE +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_FUTURE." +#endif +#ifdef BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_INITIALIZER_LIST." +#endif +#ifdef BOOST_NO_CXX11_HDR_MUTEX +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_MUTEX." +#endif +#ifdef BOOST_NO_CXX11_HDR_RANDOM +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_RANDOM." +#endif +#ifdef BOOST_NO_CXX11_HDR_RATIO +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_RATIO." +#endif +#ifdef BOOST_NO_CXX11_HDR_REGEX +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_REGEX." +#endif +#ifdef BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_SYSTEM_ERROR." +#endif +#ifdef BOOST_NO_CXX11_HDR_THREAD +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_THREAD." +#endif +#ifdef BOOST_NO_CXX11_HDR_TUPLE +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_TUPLE." +#endif +#ifdef BOOST_NO_CXX11_HDR_TYPEINDEX +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_TYPEINDEX." +#endif +#ifdef BOOST_NO_CXX11_HDR_TYPE_TRAITS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_TYPE_TRAITS." +#endif +#ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_UNORDERED_MAP." +#endif +#ifdef BOOST_NO_CXX11_HDR_UNORDERED_SET +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_HDR_UNORDERED_SET." +#endif +#ifdef BOOST_NO_CXX11_INLINE_NAMESPACES +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_INLINE_NAMESPACES." +#endif +#ifdef BOOST_NO_CXX11_LAMBDAS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_LAMBDAS." +#endif +#ifdef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS." +#endif +#ifdef BOOST_NO_CXX11_NOEXCEPT +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_NOEXCEPT." +#endif +#ifdef BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS." +#endif +#ifdef BOOST_NO_CXX11_NULLPTR +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_NULLPTR." +#endif +#ifdef BOOST_NO_CXX11_NUMERIC_LIMITS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_NUMERIC_LIMITS." +#endif +#ifdef BOOST_NO_CXX11_OVERRIDE +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_OVERRIDE." +#endif +#ifdef BOOST_NO_CXX11_POINTER_TRAITS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_POINTER_TRAITS." +#endif +#ifdef BOOST_NO_CXX11_RANGE_BASED_FOR +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_RANGE_BASED_FOR." +#endif +#ifdef BOOST_NO_CXX11_RAW_LITERALS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_RAW_LITERALS." +#endif +#ifdef BOOST_NO_CXX11_REF_QUALIFIERS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_REF_QUALIFIERS." +#endif +#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_RVALUE_REFERENCES." +#endif +#ifdef BOOST_NO_CXX11_SCOPED_ENUMS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_SCOPED_ENUMS." +#endif +#ifdef BOOST_NO_CXX11_SFINAE_EXPR +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_SFINAE_EXPR." +#endif +#ifdef BOOST_NO_CXX11_SMART_PTR +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_SMART_PTR." +#endif +#ifdef BOOST_NO_CXX11_STATIC_ASSERT +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_STATIC_ASSERT." +#endif +#ifdef BOOST_NO_CXX11_STD_ALIGN +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_STD_ALIGN." +#endif +#ifdef BOOST_NO_CXX11_TEMPLATE_ALIASES +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_TEMPLATE_ALIASES." +#endif +#ifdef BOOST_NO_CXX11_THREAD_LOCAL +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_THREAD_LOCAL." +#endif +#ifdef BOOST_NO_CXX11_TRAILING_RESULT_TYPES +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_TRAILING_RESULT_TYPES." +#endif +#ifdef BOOST_NO_CXX11_UNICODE_LITERALS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_UNICODE_LITERALS." +#endif +#ifdef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX." +#endif +#ifdef BOOST_NO_CXX11_UNRESTRICTED_UNION +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_UNRESTRICTED_UNION." +#endif +#ifdef BOOST_NO_CXX11_USER_DEFINED_LITERALS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_USER_DEFINED_LITERALS." +#endif +#ifdef BOOST_NO_CXX11_VARIADIC_MACROS +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_VARIADIC_MACROS." +#endif +#ifdef BOOST_NO_CXX11_VARIADIC_TEMPLATES +# error "Your compiler appears not to be fully C++11 compliant. Detected via defect macro BOOST_NO_CXX11_VARIADIC_TEMPLATES." +#endif diff --git a/thirdparty/boost-1_79/boost/config/assert_cxx14.hpp b/thirdparty/boost-1_79/boost/config/assert_cxx14.hpp new file mode 100644 index 00000000..3f979cbf --- /dev/null +++ b/thirdparty/boost-1_79/boost/config/assert_cxx14.hpp @@ -0,0 +1,47 @@ +// This file was automatically generated on Thu Feb 3 18:10:41 2022 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-21. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + +#include +#include + +#ifdef BOOST_NO_CXX14_AGGREGATE_NSDMI +# error "Your compiler appears not to be fully C++14 compliant. Detected via defect macro BOOST_NO_CXX14_AGGREGATE_NSDMI." +#endif +#ifdef BOOST_NO_CXX14_BINARY_LITERALS +# error "Your compiler appears not to be fully C++14 compliant. Detected via defect macro BOOST_NO_CXX14_BINARY_LITERALS." +#endif +#ifdef BOOST_NO_CXX14_CONSTEXPR +# error "Your compiler appears not to be fully C++14 compliant. Detected via defect macro BOOST_NO_CXX14_CONSTEXPR." +#endif +#ifdef BOOST_NO_CXX14_DECLTYPE_AUTO +# error "Your compiler appears not to be fully C++14 compliant. Detected via defect macro BOOST_NO_CXX14_DECLTYPE_AUTO." +#endif +#ifdef BOOST_NO_CXX14_DIGIT_SEPARATORS +# error "Your compiler appears not to be fully C++14 compliant. Detected via defect macro BOOST_NO_CXX14_DIGIT_SEPARATORS." +#endif +#ifdef BOOST_NO_CXX14_GENERIC_LAMBDAS +# error "Your compiler appears not to be fully C++14 compliant. Detected via defect macro BOOST_NO_CXX14_GENERIC_LAMBDAS." +#endif +#ifdef BOOST_NO_CXX14_HDR_SHARED_MUTEX +# error "Your compiler appears not to be fully C++14 compliant. Detected via defect macro BOOST_NO_CXX14_HDR_SHARED_MUTEX." +#endif +#ifdef BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES +# error "Your compiler appears not to be fully C++14 compliant. Detected via defect macro BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES." +#endif +#ifdef BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION +# error "Your compiler appears not to be fully C++14 compliant. Detected via defect macro BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION." +#endif +#ifdef BOOST_NO_CXX14_STD_EXCHANGE +# error "Your compiler appears not to be fully C++14 compliant. Detected via defect macro BOOST_NO_CXX14_STD_EXCHANGE." +#endif +#ifdef BOOST_NO_CXX14_VARIABLE_TEMPLATES +# error "Your compiler appears not to be fully C++14 compliant. Detected via defect macro BOOST_NO_CXX14_VARIABLE_TEMPLATES." +#endif diff --git a/thirdparty/boost-1_79/boost/config/assert_cxx17.hpp b/thirdparty/boost-1_79/boost/config/assert_cxx17.hpp new file mode 100644 index 00000000..f06b9ed4 --- /dev/null +++ b/thirdparty/boost-1_79/boost/config/assert_cxx17.hpp @@ -0,0 +1,59 @@ +// This file was automatically generated on Thu Feb 3 18:10:41 2022 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-21. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + +#include +#include + +#ifdef BOOST_NO_CXX17_FOLD_EXPRESSIONS +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_FOLD_EXPRESSIONS." +#endif +#ifdef BOOST_NO_CXX17_HDR_ANY +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_HDR_ANY." +#endif +#ifdef BOOST_NO_CXX17_HDR_CHARCONV +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_HDR_CHARCONV." +#endif +#ifdef BOOST_NO_CXX17_HDR_EXECUTION +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_HDR_EXECUTION." +#endif +#ifdef BOOST_NO_CXX17_HDR_FILESYSTEM +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_HDR_FILESYSTEM." +#endif +#ifdef BOOST_NO_CXX17_HDR_MEMORY_RESOURCE +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_HDR_MEMORY_RESOURCE." +#endif +#ifdef BOOST_NO_CXX17_HDR_OPTIONAL +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_HDR_OPTIONAL." +#endif +#ifdef BOOST_NO_CXX17_HDR_STRING_VIEW +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_HDR_STRING_VIEW." +#endif +#ifdef BOOST_NO_CXX17_HDR_VARIANT +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_HDR_VARIANT." +#endif +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_IF_CONSTEXPR." +#endif +#ifdef BOOST_NO_CXX17_INLINE_VARIABLES +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_INLINE_VARIABLES." +#endif +#ifdef BOOST_NO_CXX17_ITERATOR_TRAITS +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_ITERATOR_TRAITS." +#endif +#ifdef BOOST_NO_CXX17_STD_APPLY +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_STD_APPLY." +#endif +#ifdef BOOST_NO_CXX17_STD_INVOKE +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_STD_INVOKE." +#endif +#ifdef BOOST_NO_CXX17_STRUCTURED_BINDINGS +# error "Your compiler appears not to be fully C++17 compliant. Detected via defect macro BOOST_NO_CXX17_STRUCTURED_BINDINGS." +#endif diff --git a/thirdparty/boost-1_79/boost/config/assert_cxx20.hpp b/thirdparty/boost-1_79/boost/config/assert_cxx20.hpp new file mode 100644 index 00000000..af7e0414 --- /dev/null +++ b/thirdparty/boost-1_79/boost/config/assert_cxx20.hpp @@ -0,0 +1,59 @@ +// This file was automatically generated on Thu Feb 3 18:10:41 2022 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-21. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + +#include +#include + +#ifdef BOOST_NO_CXX20_HDR_BARRIER +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_BARRIER." +#endif +#ifdef BOOST_NO_CXX20_HDR_BIT +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_BIT." +#endif +#ifdef BOOST_NO_CXX20_HDR_COMPARE +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_COMPARE." +#endif +#ifdef BOOST_NO_CXX20_HDR_CONCEPTS +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_CONCEPTS." +#endif +#ifdef BOOST_NO_CXX20_HDR_COROUTINE +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_COROUTINE." +#endif +#ifdef BOOST_NO_CXX20_HDR_FORMAT +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_FORMAT." +#endif +#ifdef BOOST_NO_CXX20_HDR_LATCH +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_LATCH." +#endif +#ifdef BOOST_NO_CXX20_HDR_NUMBERS +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_NUMBERS." +#endif +#ifdef BOOST_NO_CXX20_HDR_RANGES +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_RANGES." +#endif +#ifdef BOOST_NO_CXX20_HDR_SEMAPHORE +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_SEMAPHORE." +#endif +#ifdef BOOST_NO_CXX20_HDR_SOURCE_LOCATION +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_SOURCE_LOCATION." +#endif +#ifdef BOOST_NO_CXX20_HDR_SPAN +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_SPAN." +#endif +#ifdef BOOST_NO_CXX20_HDR_STOP_TOKEN +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_STOP_TOKEN." +#endif +#ifdef BOOST_NO_CXX20_HDR_SYNCSTREAM +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_SYNCSTREAM." +#endif +#ifdef BOOST_NO_CXX20_HDR_VERSION +# error "Your compiler appears not to be fully C++20 compliant. Detected via defect macro BOOST_NO_CXX20_HDR_VERSION." +#endif diff --git a/thirdparty/boost-1_79/boost/config/assert_cxx98.hpp b/thirdparty/boost-1_79/boost/config/assert_cxx98.hpp new file mode 100644 index 00000000..aa745d43 --- /dev/null +++ b/thirdparty/boost-1_79/boost/config/assert_cxx98.hpp @@ -0,0 +1,23 @@ +// This file was automatically generated on Wed Mar 3 08:46:11 2021 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-4. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + +#include +#include + +#ifdef BOOST_NO_CXX98_BINDERS +# error "Your compiler appears not to be fully C++98 compliant. Detected via defect macro BOOST_NO_CXX98_BINDERS." +#endif +#ifdef BOOST_NO_CXX98_FUNCTION_BASE +# error "Your compiler appears not to be fully C++98 compliant. Detected via defect macro BOOST_NO_CXX98_FUNCTION_BASE." +#endif +#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE +# error "Your compiler appears not to be fully C++98 compliant. Detected via defect macro BOOST_NO_CXX98_RANDOM_SHUFFLE." +#endif diff --git a/thirdparty/boost-1_75/boost/config/auto_link.hpp b/thirdparty/boost-1_79/boost/config/auto_link.hpp similarity index 99% rename from thirdparty/boost-1_75/boost/config/auto_link.hpp rename to thirdparty/boost-1_79/boost/config/auto_link.hpp index 1ea6faa7..64dee1ef 100644 --- a/thirdparty/boost-1_75/boost/config/auto_link.hpp +++ b/thirdparty/boost-1_79/boost/config/auto_link.hpp @@ -182,19 +182,20 @@ BOOST_LIB_SUFFIX: Static/import libraries extension (".lib", ".a") for the c // vc14.1: # define BOOST_LIB_TOOLSET "vc141" -# elif defined(BOOST_MSVC) +# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1930) // vc14.2: # define BOOST_LIB_TOOLSET "vc142" +# elif defined(BOOST_MSVC) + + // vc14.3: +# define BOOST_LIB_TOOLSET "vc143" + # elif defined(BOOST_EMBTC_WINDOWS) // Embarcadero Clang based compilers: -# if defined(BOOST_EMBTC_WIN32C) -# define BOOST_LIB_TOOLSET "bcb32" -# elif defined(BOOST_EMBTC_WIN64) -# define BOOST_LIB_TOOLSET "bcb64" -# endif +# define BOOST_LIB_TOOLSET "embtc" # elif defined(BOOST_BORLANDC) diff --git a/thirdparty/boost-1_75/boost/config/compiler/borland.hpp b/thirdparty/boost-1_79/boost/config/compiler/borland.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/borland.hpp rename to thirdparty/boost-1_79/boost/config/compiler/borland.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/clang.hpp b/thirdparty/boost-1_79/boost/config/compiler/clang.hpp similarity index 99% rename from thirdparty/boost-1_75/boost/config/compiler/clang.hpp rename to thirdparty/boost-1_79/boost/config/compiler/clang.hpp index 9d8ba7d7..f28da107 100644 --- a/thirdparty/boost-1_75/boost/config/compiler/clang.hpp +++ b/thirdparty/boost-1_79/boost/config/compiler/clang.hpp @@ -351,3 +351,5 @@ // Macro used to identify the Clang compiler. #define BOOST_CLANG 1 +// BOOST_CLANG_VERSION +#include diff --git a/thirdparty/boost-1_79/boost/config/compiler/clang_version.hpp b/thirdparty/boost-1_79/boost/config/compiler/clang_version.hpp new file mode 100644 index 00000000..9e5b408a --- /dev/null +++ b/thirdparty/boost-1_79/boost/config/compiler/clang_version.hpp @@ -0,0 +1,77 @@ +// Copyright 2021 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt) + +#if !defined(__APPLE__) + +# define BOOST_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) + +#else +# define BOOST_CLANG_REPORTED_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) + +// https://en.wikipedia.org/wiki/Xcode#Toolchain_versions + +# if BOOST_CLANG_REPORTED_VERSION >= 130000 +# define BOOST_CLANG_VERSION 120000 + +# elif BOOST_CLANG_REPORTED_VERSION >= 120005 +# define BOOST_CLANG_VERSION 110100 + +# elif BOOST_CLANG_REPORTED_VERSION >= 120000 +# define BOOST_CLANG_VERSION 100000 + +# elif BOOST_CLANG_REPORTED_VERSION >= 110003 +# define BOOST_CLANG_VERSION 90000 + +# elif BOOST_CLANG_REPORTED_VERSION >= 110000 +# define BOOST_CLANG_VERSION 80000 + +# elif BOOST_CLANG_REPORTED_VERSION >= 100001 +# define BOOST_CLANG_VERSION 70000 + +# elif BOOST_CLANG_REPORTED_VERSION >= 100000 +# define BOOST_CLANG_VERSION 60001 + +# elif BOOST_CLANG_REPORTED_VERSION >= 90100 +# define BOOST_CLANG_VERSION 50002 + +# elif BOOST_CLANG_REPORTED_VERSION >= 90000 +# define BOOST_CLANG_VERSION 40000 + +# elif BOOST_CLANG_REPORTED_VERSION >= 80000 +# define BOOST_CLANG_VERSION 30900 + +# elif BOOST_CLANG_REPORTED_VERSION >= 70300 +# define BOOST_CLANG_VERSION 30800 + +# elif BOOST_CLANG_REPORTED_VERSION >= 70000 +# define BOOST_CLANG_VERSION 30700 + +# elif BOOST_CLANG_REPORTED_VERSION >= 60100 +# define BOOST_CLANG_VERSION 30600 + +# elif BOOST_CLANG_REPORTED_VERSION >= 60000 +# define BOOST_CLANG_VERSION 30500 + +# elif BOOST_CLANG_REPORTED_VERSION >= 50100 +# define BOOST_CLANG_VERSION 30400 + +# elif BOOST_CLANG_REPORTED_VERSION >= 50000 +# define BOOST_CLANG_VERSION 30300 + +# elif BOOST_CLANG_REPORTED_VERSION >= 40200 +# define BOOST_CLANG_VERSION 30200 + +# elif BOOST_CLANG_REPORTED_VERSION >= 30100 +# define BOOST_CLANG_VERSION 30100 + +# elif BOOST_CLANG_REPORTED_VERSION >= 20100 +# define BOOST_CLANG_VERSION 30000 + +# else +# define BOOST_CLANG_VERSION 20900 + +# endif + +# undef BOOST_CLANG_REPORTED_VERSION +#endif diff --git a/thirdparty/boost-1_75/boost/config/compiler/codegear.hpp b/thirdparty/boost-1_79/boost/config/compiler/codegear.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/codegear.hpp rename to thirdparty/boost-1_79/boost/config/compiler/codegear.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/comeau.hpp b/thirdparty/boost-1_79/boost/config/compiler/comeau.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/comeau.hpp rename to thirdparty/boost-1_79/boost/config/compiler/comeau.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/common_edg.hpp b/thirdparty/boost-1_79/boost/config/compiler/common_edg.hpp similarity index 83% rename from thirdparty/boost-1_75/boost/config/compiler/common_edg.hpp rename to thirdparty/boost-1_79/boost/config/compiler/common_edg.hpp index 6597cd2a..7887b30a 100644 --- a/thirdparty/boost-1_75/boost/config/compiler/common_edg.hpp +++ b/thirdparty/boost-1_79/boost/config/compiler/common_edg.hpp @@ -77,31 +77,20 @@ #define BOOST_NO_CXX11_AUTO_DECLARATIONS #define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CXX11_CHAR16_T -#define BOOST_NO_CXX11_CHAR32_T -#define BOOST_NO_CXX11_CONSTEXPR -#define BOOST_NO_CXX11_DECLTYPE -#define BOOST_NO_CXX11_DECLTYPE_N3276 #define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS #define BOOST_NO_CXX11_DELETED_FUNCTIONS #define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS #define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_CXX11_LAMBDAS #define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS #define BOOST_NO_CXX11_NOEXCEPT #define BOOST_NO_CXX11_NULLPTR -#define BOOST_NO_CXX11_RANGE_BASED_FOR -#define BOOST_NO_CXX11_RAW_LITERALS #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_CXX11_TEMPLATE_ALIASES -#define BOOST_NO_CXX11_UNICODE_LITERALS -#define BOOST_NO_CXX11_VARIADIC_TEMPLATES #define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX -#define BOOST_NO_CXX11_USER_DEFINED_LITERALS #define BOOST_NO_CXX11_ALIGNAS #define BOOST_NO_CXX11_TRAILING_RESULT_TYPES #define BOOST_NO_CXX11_INLINE_NAMESPACES @@ -111,6 +100,37 @@ #define BOOST_NO_CXX11_THREAD_LOCAL #define BOOST_NO_CXX11_UNRESTRICTED_UNION +//__cpp_decltype 200707 possibly? +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 + +#if !defined(__cpp_unicode_characters) || (__cpp_unicode_characters < 200704) +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +#endif +#if !defined(__cpp_unicode_literals) || (__cpp_unicode_literals < 200710) +# define BOOST_NO_CXX11_UNICODE_LITERALS +#endif +#if !defined(__cpp_user_defined_literals) || (__cpp_user_defined_literals < 200809) +# define BOOST_NO_CXX11_USER_DEFINED_LITERALS +#endif +#if !defined(__cpp_variadic_templates) || (__cpp_variadic_templates < 200704) +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#endif +#if !defined(__cpp_constexpr) || (__cpp_constexpr < 200907) +# define BOOST_NO_CXX11_CONSTEXPR +#endif +#if !defined(__cpp_lambdas) || (__cpp_lambdas < 200907) +# define BOOST_NO_CXX11_LAMBDAS +#endif +#if !defined(__cpp_range_based_for) || (__cpp_range_based_for < 200710) +# define BOOST_NO_CXX11_RANGE_BASED_FOR +#endif +#if !defined(__cpp_raw_strings) || (__cpp_raw_strings < 200610) +# define BOOST_NO_CXX11_RAW_LITERALS +#endif + + // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) # define BOOST_NO_CXX14_AGGREGATE_NSDMI diff --git a/thirdparty/boost-1_75/boost/config/compiler/compaq_cxx.hpp b/thirdparty/boost-1_79/boost/config/compiler/compaq_cxx.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/compaq_cxx.hpp rename to thirdparty/boost-1_79/boost/config/compiler/compaq_cxx.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/cray.hpp b/thirdparty/boost-1_79/boost/config/compiler/cray.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/cray.hpp rename to thirdparty/boost-1_79/boost/config/compiler/cray.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/diab.hpp b/thirdparty/boost-1_79/boost/config/compiler/diab.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/diab.hpp rename to thirdparty/boost-1_79/boost/config/compiler/diab.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/digitalmars.hpp b/thirdparty/boost-1_79/boost/config/compiler/digitalmars.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/digitalmars.hpp rename to thirdparty/boost-1_79/boost/config/compiler/digitalmars.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/gcc.hpp b/thirdparty/boost-1_79/boost/config/compiler/gcc.hpp similarity index 97% rename from thirdparty/boost-1_75/boost/config/compiler/gcc.hpp rename to thirdparty/boost-1_79/boost/config/compiler/gcc.hpp index da1a4322..d4cf0e9c 100644 --- a/thirdparty/boost-1_75/boost/config/compiler/gcc.hpp +++ b/thirdparty/boost-1_79/boost/config/compiler/gcc.hpp @@ -271,7 +271,7 @@ // #if (BOOST_GCC_VERSION < 40900) || !defined(BOOST_GCC_CXX11) // Although alignas support is added in gcc 4.8, it does not accept -// constant expressions as an argument until gcc 4.9. +// dependent constant expressions as an argument until gcc 4.9. # define BOOST_NO_CXX11_ALIGNAS #endif @@ -323,9 +323,10 @@ # define BOOST_FALLTHROUGH __attribute__((fallthrough)) #endif -#if defined(__MINGW32__) && !defined(__MINGW64__) -// Currently (March 2019) thread_local is broken on mingw for all current 32bit compiler releases, see +#if (__GNUC__ < 11) && defined(__MINGW32__) && !defined(__MINGW64__) +// thread_local was broken on mingw for all 32bit compiler releases prior to 11.x, see // https://sourceforge.net/p/mingw-w64/bugs/527/ +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83562 // Not setting this causes program termination on thread exit. #define BOOST_NO_CXX11_THREAD_LOCAL #endif diff --git a/thirdparty/boost-1_75/boost/config/compiler/gcc_xml.hpp b/thirdparty/boost-1_79/boost/config/compiler/gcc_xml.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/gcc_xml.hpp rename to thirdparty/boost-1_79/boost/config/compiler/gcc_xml.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/greenhills.hpp b/thirdparty/boost-1_79/boost/config/compiler/greenhills.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/greenhills.hpp rename to thirdparty/boost-1_79/boost/config/compiler/greenhills.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/hp_acc.hpp b/thirdparty/boost-1_79/boost/config/compiler/hp_acc.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/hp_acc.hpp rename to thirdparty/boost-1_79/boost/config/compiler/hp_acc.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/intel.hpp b/thirdparty/boost-1_79/boost/config/compiler/intel.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/intel.hpp rename to thirdparty/boost-1_79/boost/config/compiler/intel.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/kai.hpp b/thirdparty/boost-1_79/boost/config/compiler/kai.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/kai.hpp rename to thirdparty/boost-1_79/boost/config/compiler/kai.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/metrowerks.hpp b/thirdparty/boost-1_79/boost/config/compiler/metrowerks.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/metrowerks.hpp rename to thirdparty/boost-1_79/boost/config/compiler/metrowerks.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/mpw.hpp b/thirdparty/boost-1_79/boost/config/compiler/mpw.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/mpw.hpp rename to thirdparty/boost-1_79/boost/config/compiler/mpw.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/nvcc.hpp b/thirdparty/boost-1_79/boost/config/compiler/nvcc.hpp similarity index 97% rename from thirdparty/boost-1_75/boost/config/compiler/nvcc.hpp rename to thirdparty/boost-1_79/boost/config/compiler/nvcc.hpp index ed035fcf..419dd724 100644 --- a/thirdparty/boost-1_75/boost/config/compiler/nvcc.hpp +++ b/thirdparty/boost-1_79/boost/config/compiler/nvcc.hpp @@ -22,6 +22,7 @@ // BOOST_GPU_ENABLED : Flag a function or a method as being enabled on the host and device #define BOOST_GPU_ENABLED __host__ __device__ +#if !defined(__clang__) || defined(__NVCC__) // A bug in version 7.0 of CUDA prevents use of variadic templates in some occasions // https://svn.boost.org/trac/boost/ticket/11897 // This is fixed in 7.5. As the following version macro was introduced in 7.5 an existance @@ -38,6 +39,8 @@ # define BOOST_NO_CXX11_CONSTEXPR #endif +#endif + #ifdef __CUDACC__ // // When compiing .cu files, there's a bunch of stuff that doesn't work with msvc: diff --git a/thirdparty/boost-1_75/boost/config/compiler/pathscale.hpp b/thirdparty/boost-1_79/boost/config/compiler/pathscale.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/pathscale.hpp rename to thirdparty/boost-1_79/boost/config/compiler/pathscale.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/pgi.hpp b/thirdparty/boost-1_79/boost/config/compiler/pgi.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/pgi.hpp rename to thirdparty/boost-1_79/boost/config/compiler/pgi.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/sgi_mipspro.hpp b/thirdparty/boost-1_79/boost/config/compiler/sgi_mipspro.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/sgi_mipspro.hpp rename to thirdparty/boost-1_79/boost/config/compiler/sgi_mipspro.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/sunpro_cc.hpp b/thirdparty/boost-1_79/boost/config/compiler/sunpro_cc.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/sunpro_cc.hpp rename to thirdparty/boost-1_79/boost/config/compiler/sunpro_cc.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/vacpp.hpp b/thirdparty/boost-1_79/boost/config/compiler/vacpp.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/vacpp.hpp rename to thirdparty/boost-1_79/boost/config/compiler/vacpp.hpp diff --git a/thirdparty/boost-1_75/boost/config/compiler/visualc.hpp b/thirdparty/boost-1_79/boost/config/compiler/visualc.hpp similarity index 97% rename from thirdparty/boost-1_75/boost/config/compiler/visualc.hpp rename to thirdparty/boost-1_79/boost/config/compiler/visualc.hpp index 7335540d..4859c7c8 100644 --- a/thirdparty/boost-1_75/boost/config/compiler/visualc.hpp +++ b/thirdparty/boost-1_79/boost/config/compiler/visualc.hpp @@ -236,7 +236,9 @@ // if this is in effect or not, in any case nothing in Boost is currently using this, so we'll just go // on defining it for now: // +#if (_MSC_FULL_VER < 193030705) || (_MSVC_LANG < 202004) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif #if (_MSC_VER < 1912) || (_MSVC_LANG < 201402) // Supported from msvc-15.5 onwards: @@ -283,6 +285,17 @@ # define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp" #endif +// +// Approximate compiler conformance version +// +#ifdef _MSVC_LANG +# define BOOST_CXX_VERSION _MSVC_LANG +#elif defined(_HAS_CXX17) +# define BOOST_CXX_VERSION 201703L +#elif BOOST_MSVC >= 1916 +# define BOOST_CXX_VERSION 201402L +#endif + #ifndef BOOST_COMPILER // TODO: // these things are mostly bogus. 1200 means version 12.0 of the compiler. The diff --git a/thirdparty/boost-1_75/boost/config/compiler/xlcpp.hpp b/thirdparty/boost-1_79/boost/config/compiler/xlcpp.hpp similarity index 98% rename from thirdparty/boost-1_75/boost/config/compiler/xlcpp.hpp rename to thirdparty/boost-1_79/boost/config/compiler/xlcpp.hpp index c24b2c51..6e868817 100644 --- a/thirdparty/boost-1_75/boost/config/compiler/xlcpp.hpp +++ b/thirdparty/boost-1_79/boost/config/compiler/xlcpp.hpp @@ -288,3 +288,4 @@ // Macro used to identify the Clang compiler. #define BOOST_CLANG 1 +#define BOOST_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) diff --git a/thirdparty/boost-1_75/boost/config/compiler/xlcpp_zos.hpp b/thirdparty/boost-1_79/boost/config/compiler/xlcpp_zos.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/compiler/xlcpp_zos.hpp rename to thirdparty/boost-1_79/boost/config/compiler/xlcpp_zos.hpp diff --git a/thirdparty/boost-1_79/boost/config/detail/cxx_composite.hpp b/thirdparty/boost-1_79/boost/config/detail/cxx_composite.hpp new file mode 100644 index 00000000..5178c25a --- /dev/null +++ b/thirdparty/boost-1_79/boost/config/detail/cxx_composite.hpp @@ -0,0 +1,202 @@ +// This file was automatically generated on Thu Feb 3 18:10:41 2022 +// by libs/config/tools/generate.cpp +// Copyright John Maddock 2002-21. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org/libs/config for the most recent version.// +// Revision $Id$ +// + +#if defined(BOOST_NO_ADL_BARRIER)\ + || defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)\ + || defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)\ + || defined(BOOST_NO_COMPLETE_VALUE_INITIALIZATION)\ + || defined(BOOST_NO_CTYPE_FUNCTIONS)\ + || defined(BOOST_NO_CV_SPECIALIZATIONS)\ + || defined(BOOST_NO_CV_VOID_SPECIALIZATIONS)\ + || defined(BOOST_NO_CWCHAR)\ + || defined(BOOST_NO_CWCTYPE)\ + || defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS)\ + || defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS)\ + || defined(BOOST_NO_EXCEPTIONS)\ + || defined(BOOST_NO_EXCEPTION_STD_NAMESPACE)\ + || defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS)\ + || defined(BOOST_NO_FENV_H)\ + || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)\ + || defined(BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS)\ + || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)\ + || defined(BOOST_NO_INTEGRAL_INT64_T)\ + || defined(BOOST_NO_INTRINSIC_WCHAR_T)\ + || defined(BOOST_NO_IOSFWD)\ + || defined(BOOST_NO_IOSTREAM)\ + || defined(BOOST_NO_IS_ABSTRACT)\ + || defined(BOOST_NO_LIMITS)\ + || defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS)\ + || defined(BOOST_NO_LONG_LONG)\ + || defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)\ + || defined(BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS)\ + || defined(BOOST_NO_MEMBER_TEMPLATES)\ + || defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)\ + || defined(BOOST_NO_MEMBER_TEMPLATE_KEYWORD)\ + || defined(BOOST_NO_NESTED_FRIENDSHIP)\ + || defined(BOOST_NO_OPERATORS_IN_NAMESPACE)\ + || defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)\ + || defined(BOOST_NO_POINTER_TO_MEMBER_CONST)\ + || defined(BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS)\ + || defined(BOOST_NO_PRIVATE_IN_AGGREGATE)\ + || defined(BOOST_NO_RESTRICT_REFERENCES)\ + || defined(BOOST_NO_RTTI)\ + || defined(BOOST_NO_SFINAE)\ + || defined(BOOST_NO_SFINAE_EXPR)\ + || defined(BOOST_NO_STDC_NAMESPACE)\ + || defined(BOOST_NO_STD_ALLOCATOR)\ + || defined(BOOST_NO_STD_DISTANCE)\ + || defined(BOOST_NO_STD_ITERATOR)\ + || defined(BOOST_NO_STD_ITERATOR_TRAITS)\ + || defined(BOOST_NO_STD_LOCALE)\ + || defined(BOOST_NO_STD_MESSAGES)\ + || defined(BOOST_NO_STD_MIN_MAX)\ + || defined(BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN)\ + || defined(BOOST_NO_STD_TYPEINFO)\ + || defined(BOOST_NO_STD_USE_FACET)\ + || defined(BOOST_NO_STD_WSTREAMBUF)\ + || defined(BOOST_NO_STD_WSTRING)\ + || defined(BOOST_NO_STRINGSTREAM)\ + || defined(BOOST_NO_TEMPLATED_IOSTREAMS)\ + || defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\ + || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)\ + || defined(BOOST_NO_TEMPLATE_TEMPLATES)\ + || defined(BOOST_NO_TWO_PHASE_NAME_LOOKUP)\ + || defined(BOOST_NO_TYPEID)\ + || defined(BOOST_NO_TYPENAME_WITH_CTOR)\ + || defined(BOOST_NO_UNREACHABLE_RETURN_DETECTION)\ + || defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE)\ + || defined(BOOST_NO_USING_TEMPLATE)\ + || defined(BOOST_NO_VOID_RETURNS) +# define BOOST_NO_CXX03 +#endif + +#if defined(BOOST_NO_CXX03)\ + || defined(BOOST_NO_CXX11_ADDRESSOF)\ + || defined(BOOST_NO_CXX11_ALIGNAS)\ + || defined(BOOST_NO_CXX11_ALLOCATOR)\ + || defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)\ + || defined(BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS)\ + || defined(BOOST_NO_CXX11_CHAR16_T)\ + || defined(BOOST_NO_CXX11_CHAR32_T)\ + || defined(BOOST_NO_CXX11_CONSTEXPR)\ + || defined(BOOST_NO_CXX11_DECLTYPE)\ + || defined(BOOST_NO_CXX11_DECLTYPE_N3276)\ + || defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS)\ + || defined(BOOST_NO_CXX11_DEFAULTED_MOVES)\ + || defined(BOOST_NO_CXX11_DELETED_FUNCTIONS)\ + || defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)\ + || defined(BOOST_NO_CXX11_EXTERN_TEMPLATE)\ + || defined(BOOST_NO_CXX11_FINAL)\ + || defined(BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS)\ + || defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS)\ + || defined(BOOST_NO_CXX11_HDR_ARRAY)\ + || defined(BOOST_NO_CXX11_HDR_ATOMIC)\ + || defined(BOOST_NO_CXX11_HDR_CHRONO)\ + || defined(BOOST_NO_CXX11_HDR_CONDITION_VARIABLE)\ + || defined(BOOST_NO_CXX11_HDR_EXCEPTION)\ + || defined(BOOST_NO_CXX11_HDR_FORWARD_LIST)\ + || defined(BOOST_NO_CXX11_HDR_FUNCTIONAL)\ + || defined(BOOST_NO_CXX11_HDR_FUTURE)\ + || defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)\ + || defined(BOOST_NO_CXX11_HDR_MUTEX)\ + || defined(BOOST_NO_CXX11_HDR_RANDOM)\ + || defined(BOOST_NO_CXX11_HDR_RATIO)\ + || defined(BOOST_NO_CXX11_HDR_REGEX)\ + || defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR)\ + || defined(BOOST_NO_CXX11_HDR_THREAD)\ + || defined(BOOST_NO_CXX11_HDR_TUPLE)\ + || defined(BOOST_NO_CXX11_HDR_TYPEINDEX)\ + || defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)\ + || defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP)\ + || defined(BOOST_NO_CXX11_HDR_UNORDERED_SET)\ + || defined(BOOST_NO_CXX11_INLINE_NAMESPACES)\ + || defined(BOOST_NO_CXX11_LAMBDAS)\ + || defined(BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS)\ + || defined(BOOST_NO_CXX11_NOEXCEPT)\ + || defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS)\ + || defined(BOOST_NO_CXX11_NULLPTR)\ + || defined(BOOST_NO_CXX11_NUMERIC_LIMITS)\ + || defined(BOOST_NO_CXX11_OVERRIDE)\ + || defined(BOOST_NO_CXX11_POINTER_TRAITS)\ + || defined(BOOST_NO_CXX11_RANGE_BASED_FOR)\ + || defined(BOOST_NO_CXX11_RAW_LITERALS)\ + || defined(BOOST_NO_CXX11_REF_QUALIFIERS)\ + || defined(BOOST_NO_CXX11_RVALUE_REFERENCES)\ + || defined(BOOST_NO_CXX11_SCOPED_ENUMS)\ + || defined(BOOST_NO_CXX11_SFINAE_EXPR)\ + || defined(BOOST_NO_CXX11_SMART_PTR)\ + || defined(BOOST_NO_CXX11_STATIC_ASSERT)\ + || defined(BOOST_NO_CXX11_STD_ALIGN)\ + || defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)\ + || defined(BOOST_NO_CXX11_THREAD_LOCAL)\ + || defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES)\ + || defined(BOOST_NO_CXX11_UNICODE_LITERALS)\ + || defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)\ + || defined(BOOST_NO_CXX11_UNRESTRICTED_UNION)\ + || defined(BOOST_NO_CXX11_USER_DEFINED_LITERALS)\ + || defined(BOOST_NO_CXX11_VARIADIC_MACROS)\ + || defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +# define BOOST_NO_CXX11 +#endif + +#if defined(BOOST_NO_CXX11)\ + || defined(BOOST_NO_CXX14_AGGREGATE_NSDMI)\ + || defined(BOOST_NO_CXX14_BINARY_LITERALS)\ + || defined(BOOST_NO_CXX14_CONSTEXPR)\ + || defined(BOOST_NO_CXX14_DECLTYPE_AUTO)\ + || defined(BOOST_NO_CXX14_DIGIT_SEPARATORS)\ + || defined(BOOST_NO_CXX14_GENERIC_LAMBDAS)\ + || defined(BOOST_NO_CXX14_HDR_SHARED_MUTEX)\ + || defined(BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES)\ + || defined(BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION)\ + || defined(BOOST_NO_CXX14_STD_EXCHANGE)\ + || defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) +# define BOOST_NO_CXX14 +#endif + +#if defined(BOOST_NO_CXX14)\ + || defined(BOOST_NO_CXX17_FOLD_EXPRESSIONS)\ + || defined(BOOST_NO_CXX17_HDR_ANY)\ + || defined(BOOST_NO_CXX17_HDR_CHARCONV)\ + || defined(BOOST_NO_CXX17_HDR_EXECUTION)\ + || defined(BOOST_NO_CXX17_HDR_FILESYSTEM)\ + || defined(BOOST_NO_CXX17_HDR_MEMORY_RESOURCE)\ + || defined(BOOST_NO_CXX17_HDR_OPTIONAL)\ + || defined(BOOST_NO_CXX17_HDR_STRING_VIEW)\ + || defined(BOOST_NO_CXX17_HDR_VARIANT)\ + || defined(BOOST_NO_CXX17_IF_CONSTEXPR)\ + || defined(BOOST_NO_CXX17_INLINE_VARIABLES)\ + || defined(BOOST_NO_CXX17_ITERATOR_TRAITS)\ + || defined(BOOST_NO_CXX17_STD_APPLY)\ + || defined(BOOST_NO_CXX17_STD_INVOKE)\ + || defined(BOOST_NO_CXX17_STRUCTURED_BINDINGS) +# define BOOST_NO_CXX17 +#endif + +#if defined(BOOST_NO_CXX17)\ + || defined(BOOST_NO_CXX20_HDR_BARRIER)\ + || defined(BOOST_NO_CXX20_HDR_BIT)\ + || defined(BOOST_NO_CXX20_HDR_COMPARE)\ + || defined(BOOST_NO_CXX20_HDR_CONCEPTS)\ + || defined(BOOST_NO_CXX20_HDR_COROUTINE)\ + || defined(BOOST_NO_CXX20_HDR_FORMAT)\ + || defined(BOOST_NO_CXX20_HDR_LATCH)\ + || defined(BOOST_NO_CXX20_HDR_NUMBERS)\ + || defined(BOOST_NO_CXX20_HDR_RANGES)\ + || defined(BOOST_NO_CXX20_HDR_SEMAPHORE)\ + || defined(BOOST_NO_CXX20_HDR_SOURCE_LOCATION)\ + || defined(BOOST_NO_CXX20_HDR_SPAN)\ + || defined(BOOST_NO_CXX20_HDR_STOP_TOKEN)\ + || defined(BOOST_NO_CXX20_HDR_SYNCSTREAM)\ + || defined(BOOST_NO_CXX20_HDR_VERSION) +# define BOOST_NO_CXX20 +#endif + diff --git a/thirdparty/boost-1_75/boost/config/detail/posix_features.hpp b/thirdparty/boost-1_79/boost/config/detail/posix_features.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/detail/posix_features.hpp rename to thirdparty/boost-1_79/boost/config/detail/posix_features.hpp diff --git a/thirdparty/boost-1_75/boost/config/detail/select_compiler_config.hpp b/thirdparty/boost-1_79/boost/config/detail/select_compiler_config.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/detail/select_compiler_config.hpp rename to thirdparty/boost-1_79/boost/config/detail/select_compiler_config.hpp diff --git a/thirdparty/boost-1_75/boost/config/detail/select_platform_config.hpp b/thirdparty/boost-1_79/boost/config/detail/select_platform_config.hpp similarity index 97% rename from thirdparty/boost-1_75/boost/config/detail/select_platform_config.hpp rename to thirdparty/boost-1_79/boost/config/detail/select_platform_config.hpp index b36eca57..dbff74aa 100644 --- a/thirdparty/boost-1_75/boost/config/detail/select_platform_config.hpp +++ b/thirdparty/boost-1_79/boost/config/detail/select_platform_config.hpp @@ -88,6 +88,11 @@ #elif defined(__CloudABI__) // Nuxi CloudABI: # define BOOST_PLATFORM_CONFIG "boost/config/platform/cloudabi.hpp" + +#elif defined (__wasm__) +// Web assembly: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/wasm.hpp" + #else # if defined(unix) \ diff --git a/thirdparty/boost-1_75/boost/config/detail/select_stdlib_config.hpp b/thirdparty/boost-1_79/boost/config/detail/select_stdlib_config.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/detail/select_stdlib_config.hpp rename to thirdparty/boost-1_79/boost/config/detail/select_stdlib_config.hpp diff --git a/thirdparty/boost-1_75/boost/config/detail/suffix.hpp b/thirdparty/boost-1_79/boost/config/detail/suffix.hpp similarity index 88% rename from thirdparty/boost-1_75/boost/config/detail/suffix.hpp rename to thirdparty/boost-1_79/boost/config/detail/suffix.hpp index 994dce92..2423c35d 100644 --- a/thirdparty/boost-1_75/boost/config/detail/suffix.hpp +++ b/thirdparty/boost-1_79/boost/config/detail/suffix.hpp @@ -475,6 +475,16 @@ namespace std { # define BOOST_CTOR_TYPENAME #endif +// +// If we're on a CUDA device (note DEVICE not HOST, irrespective of compiler) then disable __int128 and __float128 support if present: +// +#if defined(__CUDA_ARCH__) && defined(BOOST_HAS_FLOAT128) +# undef BOOST_HAS_FLOAT128 +#endif +#if defined(__CUDA_ARCH__) && defined(BOOST_HAS_INT128) +# undef BOOST_HAS_INT128 +#endif + // long long workaround ------------------------------------------// // On gcc (and maybe other compilers?) long long is alway supported // but it's use may generate either warnings (with -ansi), or errors @@ -622,6 +632,9 @@ namespace std{ using ::type_info; } // nvcc doesn't always parse __noinline__, // see: https://svn.boost.org/trac/boost/ticket/9392 # define BOOST_NOINLINE __attribute__ ((noinline)) +# elif defined(HIP_VERSION) + // See https://github.com/boostorg/config/issues/392 +# define BOOST_NOINLINE __attribute__ ((noinline)) # else # define BOOST_NOINLINE __attribute__ ((__noinline__)) # endif @@ -1040,7 +1053,7 @@ namespace std{ using ::type_info; } #endif #elif defined(__has_cpp_attribute) // clang-6 accepts [[nodiscard]] with -std=c++14, but warns about it -pedantic -#if __has_cpp_attribute(nodiscard) && !(defined(__clang__) && (__cplusplus < 201703L)) +#if __has_cpp_attribute(nodiscard) && !(defined(__clang__) && (__cplusplus < 201703L)) && !(defined(__GNUC__) && (__cplusplus < 201100)) # define BOOST_ATTRIBUTE_NODISCARD [[nodiscard]] #endif #if __has_cpp_attribute(no_unique_address) && !(defined(__GNUC__) && (__cplusplus < 201100)) @@ -1090,6 +1103,11 @@ namespace std{ using ::type_info; } # define BOOST_NO_CXX17_HDR_OPTIONAL # define BOOST_NO_CXX17_HDR_STRING_VIEW # define BOOST_NO_CXX17_HDR_VARIANT +# define BOOST_NO_CXX17_HDR_ANY +# define BOOST_NO_CXX17_HDR_MEMORY_RESOURCE +# define BOOST_NO_CXX17_HDR_CHARCONV +# define BOOST_NO_CXX17_HDR_EXECUTION +# define BOOST_NO_CXX17_HDR_FILESYSTEM #else #if !__has_include() # define BOOST_NO_CXX17_HDR_OPTIONAL @@ -1100,8 +1118,105 @@ namespace std{ using ::type_info; } #if !__has_include() # define BOOST_NO_CXX17_HDR_VARIANT #endif +#if !__has_include() +# define BOOST_NO_CXX17_HDR_ANY +#endif +#if !__has_include() +# define BOOST_NO_CXX17_HDR_MEMORY_RESOURCE +#endif +#if !__has_include() +# define BOOST_NO_CXX17_HDR_CHARCONV +#endif +#if !__has_include() +# define BOOST_NO_CXX17_HDR_EXECUTION +#endif +#if !__has_include() +# define BOOST_NO_CXX17_HDR_FILESYSTEM +#endif +#endif +#endif +// +// Define the std level that the compiler claims to support: +// +#ifndef BOOST_CXX_VERSION +# define BOOST_CXX_VERSION __cplusplus +#endif + +#if (!defined(__has_include) || (BOOST_CXX_VERSION < 201704)) +# define BOOST_NO_CXX20_HDR_BARRIER +# define BOOST_NO_CXX20_HDR_FORMAT +# define BOOST_NO_CXX20_HDR_SOURCE_LOCATION +# define BOOST_NO_CXX20_HDR_BIT +# define BOOST_NO_CXX20_HDR_LATCH +# define BOOST_NO_CXX20_HDR_SPAN +# define BOOST_NO_CXX20_HDR_COMPARE +# define BOOST_NO_CXX20_HDR_NUMBERS +# define BOOST_NO_CXX20_HDR_STOP_TOKEN +# define BOOST_NO_CXX20_HDR_CONCEPTS +# define BOOST_NO_CXX20_HDR_RANGES +# define BOOST_NO_CXX20_HDR_SYNCSTREAM +# define BOOST_NO_CXX20_HDR_COROUTINE +# define BOOST_NO_CXX20_HDR_SEMAPHORE +#else +#if (!__has_include() || !defined(__cpp_lib_barrier) || (__cpp_lib_barrier < 201907L)) && !defined(BOOST_NO_CXX20_HDR_BARRIER) +# define BOOST_NO_CXX20_HDR_BARRIER +#endif +#if (!__has_include() || !defined(__cpp_lib_format) || (__cpp_lib_format < 201907L)) && !defined(BOOST_NO_CXX20_HDR_FORMAT) +# define BOOST_NO_CXX20_HDR_FORMAT +#endif +#if (!__has_include() || !defined(__cpp_lib_source_location) || (__cpp_lib_source_location < 201907L)) && !defined(BOOST_NO_CXX20_HDR_SOURCE_LOCATION) +# define BOOST_NO_CXX20_HDR_SOURCE_LOCATION #endif +#if (!__has_include() || !defined(__cpp_lib_bit_cast) || (__cpp_lib_bit_cast < 201806L) || !defined(__cpp_lib_bitops) || (__cpp_lib_bitops < 201907L) || !defined(__cpp_lib_endian) || (__cpp_lib_endian < 201907L)) && !defined(BOOST_NO_CXX20_HDR_BIT) +# define BOOST_NO_CXX20_HDR_BIT #endif +#if (!__has_include() || !defined(__cpp_lib_latch) || (__cpp_lib_latch < 201907L)) && !defined(BOOST_NO_CXX20_HDR_LATCH) +# define BOOST_NO_CXX20_HDR_LATCH +#endif +#if (!__has_include() || !defined(__cpp_lib_span) || (__cpp_lib_span < 202002L)) && !defined(BOOST_NO_CXX20_HDR_SPAN) +# define BOOST_NO_CXX20_HDR_SPAN +#endif +#if (!__has_include() || !defined(__cpp_lib_three_way_comparison) || (__cpp_lib_three_way_comparison < 201907L)) && !defined(BOOST_NO_CXX20_HDR_COMPARE) +# define BOOST_NO_CXX20_HDR_COMPARE +#endif +#if (!__has_include() || !defined(__cpp_lib_math_constants) || (__cpp_lib_math_constants < 201907L)) && !defined(BOOST_NO_CXX20_HDR_NUMBERS) +# define BOOST_NO_CXX20_HDR_NUMBERS +#endif +#if (!__has_include() || !defined(__cpp_lib_jthread) || (__cpp_lib_jthread < 201911L)) && !defined(BOOST_NO_CXX20_HDR_STOP_TOKEN) +# define BOOST_NO_CXX20_HDR_STOP_TOKEN +#endif +#if (!__has_include() || !defined(__cpp_lib_concepts) || (__cpp_lib_concepts < 202002L)) && !defined(_YVALS) && !defined(_CPPLIB_VER) && !defined(BOOST_NO_CXX20_HDR_CONCEPTS) +# define BOOST_NO_CXX20_HDR_CONCEPTS +#endif +#if (!__has_include() || !defined(__cpp_lib_ranges) || (__cpp_lib_ranges < 201911L)) && !defined(BOOST_NO_CXX20_HDR_RANGES) +# define BOOST_NO_CXX20_HDR_RANGES +#endif +#if (!__has_include() || !defined(__cpp_lib_syncbuf) || (__cpp_lib_syncbuf < 201803L)) && !defined(BOOST_NO_CXX20_HDR_SYNCSTREAM) +# define BOOST_NO_CXX20_HDR_SYNCSTREAM +#endif +#if (!__has_include() || !defined(__cpp_lib_coroutine) || (__cpp_lib_coroutine < 201902L)) && !defined(BOOST_NO_CXX20_HDR_COROUTINE) +# define BOOST_NO_CXX20_HDR_COROUTINE +#endif +#if (!__has_include() || !defined(__cpp_lib_semaphore) || (__cpp_lib_semaphore < 201907L)) && !defined(BOOST_NO_CXX20_HDR_SEMAPHORE) +# define BOOST_NO_CXX20_HDR_SEMAPHORE +#endif +#endif + +#if defined(__cplusplus) && defined(__has_include) +#if !__has_include() +# define BOOST_NO_CXX20_HDR_VERSION +#else +// For convenience, this is always included: +# include +#endif +#else +# define BOOST_NO_CXX20_HDR_VERSION +#endif + +// +// Define composite agregate macros: +// +#include // // Finish off with checks for macros that are depricated / no longer supported, diff --git a/thirdparty/boost-1_75/boost/config/header_deprecated.hpp b/thirdparty/boost-1_79/boost/config/header_deprecated.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/header_deprecated.hpp rename to thirdparty/boost-1_79/boost/config/header_deprecated.hpp diff --git a/thirdparty/boost-1_75/boost/config/helper_macros.hpp b/thirdparty/boost-1_79/boost/config/helper_macros.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/helper_macros.hpp rename to thirdparty/boost-1_79/boost/config/helper_macros.hpp diff --git a/thirdparty/boost-1_75/boost/config/no_tr1/cmath.hpp b/thirdparty/boost-1_79/boost/config/no_tr1/cmath.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/no_tr1/cmath.hpp rename to thirdparty/boost-1_79/boost/config/no_tr1/cmath.hpp diff --git a/thirdparty/boost-1_75/boost/config/no_tr1/complex.hpp b/thirdparty/boost-1_79/boost/config/no_tr1/complex.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/no_tr1/complex.hpp rename to thirdparty/boost-1_79/boost/config/no_tr1/complex.hpp diff --git a/thirdparty/boost-1_75/boost/config/no_tr1/functional.hpp b/thirdparty/boost-1_79/boost/config/no_tr1/functional.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/no_tr1/functional.hpp rename to thirdparty/boost-1_79/boost/config/no_tr1/functional.hpp diff --git a/thirdparty/boost-1_75/boost/config/no_tr1/memory.hpp b/thirdparty/boost-1_79/boost/config/no_tr1/memory.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/no_tr1/memory.hpp rename to thirdparty/boost-1_79/boost/config/no_tr1/memory.hpp diff --git a/thirdparty/boost-1_75/boost/config/no_tr1/utility.hpp b/thirdparty/boost-1_79/boost/config/no_tr1/utility.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/no_tr1/utility.hpp rename to thirdparty/boost-1_79/boost/config/no_tr1/utility.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/aix.hpp b/thirdparty/boost-1_79/boost/config/platform/aix.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/aix.hpp rename to thirdparty/boost-1_79/boost/config/platform/aix.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/amigaos.hpp b/thirdparty/boost-1_79/boost/config/platform/amigaos.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/amigaos.hpp rename to thirdparty/boost-1_79/boost/config/platform/amigaos.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/beos.hpp b/thirdparty/boost-1_79/boost/config/platform/beos.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/beos.hpp rename to thirdparty/boost-1_79/boost/config/platform/beos.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/bsd.hpp b/thirdparty/boost-1_79/boost/config/platform/bsd.hpp similarity index 92% rename from thirdparty/boost-1_75/boost/config/platform/bsd.hpp rename to thirdparty/boost-1_79/boost/config/platform/bsd.hpp index 79e74a08..ccc7eb05 100644 --- a/thirdparty/boost-1_75/boost/config/platform/bsd.hpp +++ b/thirdparty/boost-1_79/boost/config/platform/bsd.hpp @@ -28,7 +28,8 @@ // FreeBSD has but does not // advertise the fact in : // -#if (defined(__FreeBSD__) && (__FreeBSD__ >= 3)) || defined(__DragonFly__) +#if (defined(__FreeBSD__) && (__FreeBSD__ >= 3)) \ + || defined(__OpenBSD__) || defined(__DragonFly__) # define BOOST_HAS_NL_TYPES_H #endif @@ -56,7 +57,8 @@ #endif #if !((defined(__FreeBSD__) && (__FreeBSD__ >= 5)) \ - || (defined(__NetBSD_GCC__) && (__NetBSD_GCC__ >= 2095003)) || defined(__DragonFly__)) + || (defined(__NetBSD_GCC__) && (__NetBSD_GCC__ >= 2095003)) \ + || defined(__OpenBSD__) || defined(__DragonFly__)) # define BOOST_NO_CWCHAR #endif // @@ -74,13 +76,8 @@ #define BOOST_HAS_GETTIMEOFDAY #define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE #define BOOST_HAS_SIGACTION +#define BOOST_HAS_CLOCK_GETTIME // boilerplate code: #define BOOST_HAS_UNISTD_H #include - - - - - - diff --git a/thirdparty/boost-1_75/boost/config/platform/cloudabi.hpp b/thirdparty/boost-1_79/boost/config/platform/cloudabi.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/cloudabi.hpp rename to thirdparty/boost-1_79/boost/config/platform/cloudabi.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/cray.hpp b/thirdparty/boost-1_79/boost/config/platform/cray.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/cray.hpp rename to thirdparty/boost-1_79/boost/config/platform/cray.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/cygwin.hpp b/thirdparty/boost-1_79/boost/config/platform/cygwin.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/cygwin.hpp rename to thirdparty/boost-1_79/boost/config/platform/cygwin.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/haiku.hpp b/thirdparty/boost-1_79/boost/config/platform/haiku.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/haiku.hpp rename to thirdparty/boost-1_79/boost/config/platform/haiku.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/hpux.hpp b/thirdparty/boost-1_79/boost/config/platform/hpux.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/hpux.hpp rename to thirdparty/boost-1_79/boost/config/platform/hpux.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/irix.hpp b/thirdparty/boost-1_79/boost/config/platform/irix.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/irix.hpp rename to thirdparty/boost-1_79/boost/config/platform/irix.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/linux.hpp b/thirdparty/boost-1_79/boost/config/platform/linux.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/linux.hpp rename to thirdparty/boost-1_79/boost/config/platform/linux.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/macos.hpp b/thirdparty/boost-1_79/boost/config/platform/macos.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/macos.hpp rename to thirdparty/boost-1_79/boost/config/platform/macos.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/qnxnto.hpp b/thirdparty/boost-1_79/boost/config/platform/qnxnto.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/qnxnto.hpp rename to thirdparty/boost-1_79/boost/config/platform/qnxnto.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/solaris.hpp b/thirdparty/boost-1_79/boost/config/platform/solaris.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/solaris.hpp rename to thirdparty/boost-1_79/boost/config/platform/solaris.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/symbian.hpp b/thirdparty/boost-1_79/boost/config/platform/symbian.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/symbian.hpp rename to thirdparty/boost-1_79/boost/config/platform/symbian.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/vms.hpp b/thirdparty/boost-1_79/boost/config/platform/vms.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/vms.hpp rename to thirdparty/boost-1_79/boost/config/platform/vms.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/vxworks.hpp b/thirdparty/boost-1_79/boost/config/platform/vxworks.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/vxworks.hpp rename to thirdparty/boost-1_79/boost/config/platform/vxworks.hpp diff --git a/thirdparty/boost-1_79/boost/config/platform/wasm.hpp b/thirdparty/boost-1_79/boost/config/platform/wasm.hpp new file mode 100644 index 00000000..682b8485 --- /dev/null +++ b/thirdparty/boost-1_79/boost/config/platform/wasm.hpp @@ -0,0 +1,23 @@ +// (C) Copyright John Maddock 2020. +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + +// See http://www.boost.org for most recent version. + +// WASM specific config options: + +#define BOOST_PLATFORM "Wasm" + +#ifdef __has_include +#if __has_include() +# define BOOST_HAS_UNISTD_H +#endif +#endif + +// boilerplate code: +#include +// +// fenv lacks the C++11 macros: +// +#define BOOST_NO_FENV_H diff --git a/thirdparty/boost-1_75/boost/config/platform/win32.hpp b/thirdparty/boost-1_79/boost/config/platform/win32.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/win32.hpp rename to thirdparty/boost-1_79/boost/config/platform/win32.hpp diff --git a/thirdparty/boost-1_75/boost/config/platform/zos.hpp b/thirdparty/boost-1_79/boost/config/platform/zos.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/platform/zos.hpp rename to thirdparty/boost-1_79/boost/config/platform/zos.hpp diff --git a/thirdparty/boost-1_75/boost/config/pragma_message.hpp b/thirdparty/boost-1_79/boost/config/pragma_message.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/pragma_message.hpp rename to thirdparty/boost-1_79/boost/config/pragma_message.hpp diff --git a/thirdparty/boost-1_75/boost/config/requires_threads.hpp b/thirdparty/boost-1_79/boost/config/requires_threads.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/requires_threads.hpp rename to thirdparty/boost-1_79/boost/config/requires_threads.hpp diff --git a/thirdparty/boost-1_75/boost/config/stdlib/dinkumware.hpp b/thirdparty/boost-1_79/boost/config/stdlib/dinkumware.hpp similarity index 89% rename from thirdparty/boost-1_75/boost/config/stdlib/dinkumware.hpp rename to thirdparty/boost-1_79/boost/config/stdlib/dinkumware.hpp index 3dc6d508..8feccc65 100644 --- a/thirdparty/boost-1_75/boost/config/stdlib/dinkumware.hpp +++ b/thirdparty/boost-1_79/boost/config/stdlib/dinkumware.hpp @@ -176,17 +176,29 @@ #endif // C++17 features -#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(BOOST_MSVC) || (BOOST_MSVC < 1910) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0) +#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) \ + || ((!defined(BOOST_MSVC) || (BOOST_MSVC < 1910))) && (!defined(__clang__) || !defined(_MSC_VER) || (_MSC_VER < 1929))\ + || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0) # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_ITERATOR_TRAITS # define BOOST_NO_CXX17_HDR_STRING_VIEW # define BOOST_NO_CXX17_HDR_OPTIONAL # define BOOST_NO_CXX17_HDR_VARIANT +# define BOOST_NO_CXX17_HDR_ANY +# define BOOST_NO_CXX17_HDR_MEMORY_RESOURCE +# define BOOST_NO_CXX17_HDR_CHARCONV +# define BOOST_NO_CXX17_HDR_EXECUTION +# define BOOST_NO_CXX17_HDR_FILESYSTEM #endif #if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0) || !defined(_MSVC_STL_UPDATE) || (_MSVC_STL_UPDATE < 201709) # define BOOST_NO_CXX17_STD_INVOKE #endif +// C++20 features which aren't configured in suffix.hpp correctly: +#if !defined(_MSVC_STL_UPDATE) || (_MSVC_STL_UPDATE < 202008L) || !defined(_HAS_CXX20) || (_HAS_CXX20 == 0) +# define BOOST_NO_CXX20_HDR_CONCEPTS +#endif + #if !(!defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(BOOST_MSVC) || (BOOST_MSVC < 1912) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0)) // Deprecated std::iterator: # define BOOST_NO_STD_ITERATOR @@ -207,7 +219,15 @@ // Bug specific to VC14, // See https://connect.microsoft.com/VisualStudio/feedback/details/1348277/link-error-when-using-std-codecvt-utf8-utf16-char16-t // and discussion here: http://blogs.msdn.com/b/vcblog/archive/2014/11/12/visual-studio-2015-preview-now-available.aspx?PageIndex=2 -#if defined(_CPPLIB_VER) && (_CPPLIB_VER == 650) +#if defined(_CPPLIB_VER) && (_CPPLIB_VER == 650) && (!defined(_MSVC_STL_VERSION) || (_MSVC_STL_VERSION < 142)) +# define BOOST_NO_CXX11_HDR_CODECVT +#endif + +#if (_MSVC_LANG > 201700) && !defined(BOOST_NO_CXX11_HDR_CODECVT) +// +// is deprected as of C++17, and by default MSVC emits hard errors +// if you try to use it, so mark it as unavailable: +// # define BOOST_NO_CXX11_HDR_CODECVT #endif @@ -222,6 +242,12 @@ # define BOOST_NO_CXX98_BINDERS # endif #endif +// +// Things deprecated in C++20: +// +#if defined(_HAS_CXX20) +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +#endif // diff --git a/thirdparty/boost-1_75/boost/config/stdlib/libcomo.hpp b/thirdparty/boost-1_79/boost/config/stdlib/libcomo.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/stdlib/libcomo.hpp rename to thirdparty/boost-1_79/boost/config/stdlib/libcomo.hpp diff --git a/thirdparty/boost-1_75/boost/config/stdlib/libcpp.hpp b/thirdparty/boost-1_79/boost/config/stdlib/libcpp.hpp similarity index 87% rename from thirdparty/boost-1_75/boost/config/stdlib/libcpp.hpp rename to thirdparty/boost-1_79/boost/config/stdlib/libcpp.hpp index e8eea911..bc8536ea 100644 --- a/thirdparty/boost-1_75/boost/config/stdlib/libcpp.hpp +++ b/thirdparty/boost-1_79/boost/config/stdlib/libcpp.hpp @@ -104,8 +104,34 @@ # define BOOST_NO_CXX98_BINDERS #endif -#define BOOST_NO_CXX17_ITERATOR_TRAITS +#if defined(__cplusplus) && defined(__has_include) +#if __has_include() +#include + +#if !defined(__cpp_lib_execution) || (__cpp_lib_execution < 201603L) +# define BOOST_NO_CXX17_HDR_EXECUTION +#endif +#if !defined(__cpp_lib_invoke) || (__cpp_lib_invoke < 201411L) +#define BOOST_NO_CXX17_STD_INVOKE +#endif + +#if(_LIBCPP_VERSION < 9000) +// as_writable_bytes is missing. +# define BOOST_NO_CXX20_HDR_SPAN +#endif + +#else #define BOOST_NO_CXX17_STD_INVOKE // Invoke support is incomplete (no invoke_result) +#define BOOST_NO_CXX17_HDR_EXECUTION +#endif +#else +#define BOOST_NO_CXX17_STD_INVOKE // Invoke support is incomplete (no invoke_result) +#define BOOST_NO_CXX17_HDR_EXECUTION +#endif + +#if _LIBCPP_VERSION < 10000 // What's the correct version check here? +#define BOOST_NO_CXX17_ITERATOR_TRAITS +#endif #if (_LIBCPP_VERSION <= 1101) && !defined(BOOST_NO_CXX11_THREAD_LOCAL) // This is a bit of a sledgehammer, because really it's just libc++abi that has no diff --git a/thirdparty/boost-1_75/boost/config/stdlib/libstdcpp3.hpp b/thirdparty/boost-1_79/boost/config/stdlib/libstdcpp3.hpp similarity index 85% rename from thirdparty/boost-1_75/boost/config/stdlib/libstdcpp3.hpp rename to thirdparty/boost-1_79/boost/config/stdlib/libstdcpp3.hpp index ee8f2a20..abcdad54 100644 --- a/thirdparty/boost-1_75/boost/config/stdlib/libstdcpp3.hpp +++ b/thirdparty/boost-1_79/boost/config/stdlib/libstdcpp3.hpp @@ -94,6 +94,20 @@ #endif #endif +#if defined(__has_include) +#if defined(BOOST_HAS_HASH) +#if !__has_include(BOOST_HASH_SET_HEADER) || (__GNUC__ >= 10) +#undef BOOST_HAS_HASH +#undef BOOST_HAS_SET_HEADER +#undef BOOST_HAS_MAP_HEADER +#endif +#if !__has_include(BOOST_SLIST_HEADER) +#undef BOOST_HAS_SLIST +#undef BOOST_HAS_SLIST_HEADER +#endif +#endif +#endif + // // Decide whether we have C++11 support turned on: // @@ -152,6 +166,33 @@ #elif __has_include() # define BOOST_LIBSTDCXX_VERSION 40300 #endif +// +// If BOOST_HAS_FLOAT128 is set, now that we know the std lib is libstdc++3, check to see if the std lib is +// configured to support this type. If not disable it: +// +#if defined(BOOST_HAS_FLOAT128) && !defined(_GLIBCXX_USE_FLOAT128) +# undef BOOST_HAS_FLOAT128 +#endif + +#if (BOOST_LIBSTDCXX_VERSION >= 100000) && defined(BOOST_HAS_HASH) +// +// hash_set/hash_map deprecated and have terminal bugs: +// +#undef BOOST_HAS_HASH +#undef BOOST_HAS_SET_HEADER +#undef BOOST_HAS_MAP_HEADER +#endif + + +#if (BOOST_LIBSTDCXX_VERSION >= 100000) && defined(BOOST_HAS_HASH) +// +// hash_set/hash_map deprecated and have terminal bugs: +// +#undef BOOST_HAS_HASH +#undef BOOST_HAS_SET_HEADER +#undef BOOST_HAS_MAP_HEADER +#endif + #if (BOOST_LIBSTDCXX_VERSION < 50100) // libstdc++ does not define this function as it's deprecated in C++11, but clang still looks for it, @@ -216,6 +257,7 @@ extern "C" char *gets (char *__s); # endif # elif !_GLIBCXX_USE_DEPRECATED # define BOOST_NO_AUTO_PTR +# define BOOST_NO_CXX98_BINDERS # endif #endif @@ -288,10 +330,6 @@ extern "C" char *gets (char *__s); # define BOOST_NO_CXX14_STD_EXCHANGE #endif -#if defined(__clang_major__) && ((__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ < 7))) -// As of clang-3.6, libstdc++ header throws up errors with clang: -# define BOOST_NO_CXX11_HDR_ATOMIC -#endif // // C++0x features in GCC 5.1 and later // @@ -319,10 +357,56 @@ extern "C" char *gets (char *__s); #elif __cplusplus <= 201103 # define BOOST_NO_CXX14_HDR_SHARED_MUTEX #endif +// +// has a dependency to Intel's thread building blocks: +// unless these are installed seperately, including leads +// to inscrutable errors inside libstdc++'s own headers. +// +#if (BOOST_LIBSTDCXX_VERSION < 100100) +#if !__has_include() +#define BOOST_NO_CXX17_HDR_EXECUTION +#endif +#endif #elif __cplusplus < 201402 || (BOOST_LIBSTDCXX_VERSION < 40900) || !defined(BOOST_LIBSTDCXX11) # define BOOST_NO_CXX14_HDR_SHARED_MUTEX #endif +#if BOOST_LIBSTDCXX_VERSION < 100100 +// +// The header may be present but is incomplete: +// +# define BOOST_NO_CXX17_HDR_CHARCONV +#endif + +#if BOOST_LIBSTDCXX_VERSION < 110000 +// +// Header may be present but lacks std::bit_cast: +// +#define BOOST_NO_CXX20_HDR_BIT +#endif + +#ifndef __cpp_impl_coroutine +# define BOOST_NO_CXX20_HDR_COROUTINE +#endif + +// +// These next defines are mostly for older clang versions with a newer libstdc++ : +// +#if !defined(__cpp_lib_concepts) +#if !defined(BOOST_NO_CXX20_HDR_COMPARE) +# define BOOST_NO_CXX20_HDR_COMPARE +#endif +#if !defined(BOOST_NO_CXX20_HDR_CONCEPTS) +# define BOOST_NO_CXX20_HDR_CONCEPTS +#endif +#if !defined(BOOST_NO_CXX20_HDR_SPAN) +# define BOOST_NO_CXX20_HDR_SPAN +#endif +#if !defined(BOOST_NO_CXX20_HDR_RANGES) +# define BOOST_NO_CXX20_HDR_RANGES +#endif +#endif + // // Headers not present on Solaris with the Oracle compiler: #if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140) diff --git a/thirdparty/boost-1_75/boost/config/stdlib/modena.hpp b/thirdparty/boost-1_79/boost/config/stdlib/modena.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/stdlib/modena.hpp rename to thirdparty/boost-1_79/boost/config/stdlib/modena.hpp diff --git a/thirdparty/boost-1_75/boost/config/stdlib/msl.hpp b/thirdparty/boost-1_79/boost/config/stdlib/msl.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/stdlib/msl.hpp rename to thirdparty/boost-1_79/boost/config/stdlib/msl.hpp diff --git a/thirdparty/boost-1_75/boost/config/stdlib/roguewave.hpp b/thirdparty/boost-1_79/boost/config/stdlib/roguewave.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/stdlib/roguewave.hpp rename to thirdparty/boost-1_79/boost/config/stdlib/roguewave.hpp diff --git a/thirdparty/boost-1_75/boost/config/stdlib/sgi.hpp b/thirdparty/boost-1_79/boost/config/stdlib/sgi.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/stdlib/sgi.hpp rename to thirdparty/boost-1_79/boost/config/stdlib/sgi.hpp diff --git a/thirdparty/boost-1_75/boost/config/stdlib/stlport.hpp b/thirdparty/boost-1_79/boost/config/stdlib/stlport.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/stdlib/stlport.hpp rename to thirdparty/boost-1_79/boost/config/stdlib/stlport.hpp diff --git a/thirdparty/boost-1_75/boost/config/stdlib/vacpp.hpp b/thirdparty/boost-1_79/boost/config/stdlib/vacpp.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/stdlib/vacpp.hpp rename to thirdparty/boost-1_79/boost/config/stdlib/vacpp.hpp diff --git a/thirdparty/boost-1_75/boost/config/stdlib/xlcpp_zos.hpp b/thirdparty/boost-1_79/boost/config/stdlib/xlcpp_zos.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/stdlib/xlcpp_zos.hpp rename to thirdparty/boost-1_79/boost/config/stdlib/xlcpp_zos.hpp diff --git a/thirdparty/boost-1_75/boost/config/user.hpp b/thirdparty/boost-1_79/boost/config/user.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/user.hpp rename to thirdparty/boost-1_79/boost/config/user.hpp diff --git a/thirdparty/boost-1_75/boost/config/warning_disable.hpp b/thirdparty/boost-1_79/boost/config/warning_disable.hpp similarity index 100% rename from thirdparty/boost-1_75/boost/config/warning_disable.hpp rename to thirdparty/boost-1_79/boost/config/warning_disable.hpp diff --git a/thirdparty/boost-1_75/boost/config/workaround.hpp b/thirdparty/boost-1_79/boost/config/workaround.hpp similarity index 96% rename from thirdparty/boost-1_75/boost/config/workaround.hpp rename to thirdparty/boost-1_79/boost/config/workaround.hpp index 7c6a2e62..688f9636 100644 --- a/thirdparty/boost-1_75/boost/config/workaround.hpp +++ b/thirdparty/boost-1_79/boost/config/workaround.hpp @@ -192,6 +192,11 @@ #else #define _COMPILER_VERSION_WORKAROUND_GUARD 0 #endif +#ifndef __clang_major__ +#define __clang_major___WORKAROUND_GUARD 1 +#else +#define __clang_major___WORKAROUND_GUARD 0 +#endif #ifndef _RWSTD_VER #define _RWSTD_VER_WORKAROUND_GUARD 1 @@ -254,6 +259,12 @@ #else #define BOOST_INTEL_WORKAROUND_GUARD 0 #endif +#ifndef BOOST_CLANG_VERSION +#define BOOST_CLANG_VERSION_WORKAROUND_GUARD 1 +#else +#define BOOST_CLANG_VERSION_WORKAROUND_GUARD 0 +#endif + // Always define to zero, if it's used it'll be defined my MPL: #define BOOST_MPL_CFG_GCC_WORKAROUND_GUARD 0 diff --git a/thirdparty/boost-1_79/boost/container/allocator_traits.hpp b/thirdparty/boost-1_79/boost/container/allocator_traits.hpp new file mode 100644 index 00000000..f5f73efa --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/allocator_traits.hpp @@ -0,0 +1,502 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Pablo Halpern 2009. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP +#define BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include + +// container +#include +#include +#include //is_empty +#include +#ifndef BOOST_CONTAINER_DETAIL_STD_FWD_HPP +#include +#endif +// intrusive +#include +#include +// move +#include +// move/detail +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#include +#endif +// other boost +#include + +#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +#if defined(BOOST_GCC) && (BOOST_GCC >= 40600) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-result" +#endif + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME allocate +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 2 +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 2 +#include + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME destroy +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 1 +#include + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME construct +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 9 +#include + +#if defined(BOOST_GCC) && (BOOST_GCC >= 40600) +#pragma GCC diagnostic pop +#endif + +#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +namespace boost { +namespace container { + +#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +template +class small_vector_allocator; + +namespace allocator_traits_detail { + +BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_max_size, max_size) +BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_select_on_container_copy_construction, select_on_container_copy_construction) + +} //namespace allocator_traits_detail { + +namespace dtl { + +//workaround needed for C++03 compilers with no construct() +//supporting rvalue references +template +struct is_std_allocator +{ static const bool value = false; }; + +template +struct is_std_allocator< std::allocator > +{ static const bool value = true; }; + +template +struct is_std_allocator< small_vector_allocator, Options > > +{ static const bool value = true; }; + +template +struct is_not_std_allocator +{ static const bool value = !is_std_allocator::value; }; + +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(pointer) +BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(const_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(reference) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_reference) +BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(void_pointer) +BOOST_INTRUSIVE_INSTANTIATE_EVAL_DEFAULT_TYPE_TMPLT(const_void_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(size_type) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assignment) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_move_assignment) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_swap) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(is_always_equal) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(is_partially_propagable) + +} //namespace dtl { + +#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +//! The class template allocator_traits supplies a uniform interface to all allocator types. +//! This class is a C++03-compatible implementation of std::allocator_traits +template +struct allocator_traits +{ + //allocator_type + typedef Allocator allocator_type; + //value_type + typedef typename allocator_type::value_type value_type; + + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + //! Allocator::pointer if such a type exists; otherwise, value_type* + //! + typedef unspecified pointer; + //! Allocator::const_pointer if such a type exists ; otherwise, pointer_traits::rebind::rebind. + //! + typedef see_documentation void_pointer; + //! Allocator::const_void_pointer if such a type exists ; otherwise, pointer_traits::rebind::difference_type. + //! + typedef see_documentation difference_type; + //! Allocator::size_type if such a type exists ; otherwise, make_unsigned::type + //! + typedef see_documentation size_type; + //! Allocator::propagate_on_container_copy_assignment if such a type exists, otherwise a type + //! with an internal constant static boolean member value == false. + typedef see_documentation propagate_on_container_copy_assignment; + //! Allocator::propagate_on_container_move_assignment if such a type exists, otherwise a type + //! with an internal constant static boolean member value == false. + typedef see_documentation propagate_on_container_move_assignment; + //! Allocator::propagate_on_container_swap if such a type exists, otherwise a type + //! with an internal constant static boolean member value == false. + typedef see_documentation propagate_on_container_swap; + //! Allocator::is_always_equal if such a type exists, otherwise a type + //! with an internal constant static boolean member value == is_empty::value + typedef see_documentation is_always_equal; + //! Allocator::is_partially_propagable if such a type exists, otherwise a type + //! with an internal constant static boolean member value == false + //! Note: Non-standard extension used to implement `small_vector_allocator`. + typedef see_documentation is_partially_propagable; + //! Defines an allocator: Allocator::rebind::other if such a type exists; otherwise, Allocator + //! if Allocator is a class template instantiation of the form Allocator, where Args is zero or + //! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed. + //! + //! In C++03 compilers rebind_alloc is a struct derived from an allocator + //! deduced by previously detailed rules. + template using rebind_alloc = see_documentation; + + //! In C++03 compilers rebind_traits is a struct derived from + //! allocator_traits, where OtherAlloc is + //! the allocator deduced by rules explained in rebind_alloc. + template using rebind_traits = allocator_traits >; + + //! Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers. + //! type is an allocator related to Allocator deduced deduced by rules explained in rebind_alloc. + template + struct portable_rebind_alloc + { typedef see_documentation type; }; + #else + //pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + pointer, value_type*) + pointer; + //const_pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::dtl::, Allocator, + const_pointer, typename boost::intrusive::pointer_traits::template + rebind_pointer) + const_pointer; + //reference + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + reference, typename dtl::unvoid_ref::type) + reference; + //const_reference + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + const_reference, typename dtl::unvoid_ref::type) + const_reference; + //void_pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::dtl::, Allocator, + void_pointer, typename boost::intrusive::pointer_traits::template + rebind_pointer) + void_pointer; + //const_void_pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::dtl::, Allocator, + const_void_pointer, typename boost::intrusive::pointer_traits::template + rebind_pointer) + const_void_pointer; + //difference_type + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + difference_type, std::ptrdiff_t) + difference_type; + //size_type + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + size_type, std::size_t) + size_type; + //propagate_on_container_copy_assignment + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + propagate_on_container_copy_assignment, dtl::false_type) + propagate_on_container_copy_assignment; + //propagate_on_container_move_assignment + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + propagate_on_container_move_assignment, dtl::false_type) + propagate_on_container_move_assignment; + //propagate_on_container_swap + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + propagate_on_container_swap, dtl::false_type) + propagate_on_container_swap; + //is_always_equal + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + is_always_equal, dtl::is_empty) + is_always_equal; + //is_partially_propagable + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + is_partially_propagable, dtl::false_type) + is_partially_propagable; + + //rebind_alloc & rebind_traits + #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + //C++11 + template using rebind_alloc = typename boost::intrusive::pointer_rebind::type; + template using rebind_traits = allocator_traits< rebind_alloc >; + #else // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + //Some workaround for C++03 or C++11 compilers with no template aliases + template + struct rebind_alloc : boost::intrusive::pointer_rebind::type + { + typedef typename boost::intrusive::pointer_rebind::type Base; + #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + template + rebind_alloc(BOOST_FWD_REF(Args)... args) : Base(boost::forward(args)...) {} + #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + #define BOOST_CONTAINER_ALLOCATOR_TRAITS_REBIND_ALLOC(N) \ + BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N\ + explicit rebind_alloc(BOOST_MOVE_UREF##N) : Base(BOOST_MOVE_FWD##N){}\ + // + BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_ALLOCATOR_TRAITS_REBIND_ALLOC) + #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_REBIND_ALLOC + #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + }; + + template + struct rebind_traits + : allocator_traits::type> + {}; + #endif // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + + //portable_rebind_alloc + template + struct portable_rebind_alloc + { typedef typename boost::intrusive::pointer_rebind::type type; }; + #endif //BOOST_CONTAINER_DOXYGEN_INVOKED + + //! Returns: a.allocate(n) + //! + BOOST_CONTAINER_FORCEINLINE static pointer allocate(Allocator &a, size_type n) + { return a.allocate(n); } + + //! Returns: a.deallocate(p, n) + //! + //! Throws: Nothing + BOOST_CONTAINER_FORCEINLINE static void deallocate(Allocator &a, pointer p, size_type n) + { a.deallocate(p, n); } + + //! Effects: calls a.allocate(n, p) if that call is well-formed; + //! otherwise, invokes a.allocate(n) + BOOST_CONTAINER_FORCEINLINE static pointer allocate(Allocator &a, size_type n, const_void_pointer p) + { + const bool value = boost::container::dtl:: + has_member_function_callable_with_allocate + ::value; + dtl::bool_ flag; + return allocator_traits::priv_allocate(flag, a, n, p); + } + + //! Effects: calls a.destroy(p) if that call is well-formed; + //! otherwise, invokes p->~T(). + template + BOOST_CONTAINER_FORCEINLINE static void destroy(Allocator &a, T*p) BOOST_NOEXCEPT_OR_NOTHROW + { + typedef T* destroy_pointer; + const bool value = boost::container::dtl:: + has_member_function_callable_with_destroy + ::value; + dtl::bool_ flag; + allocator_traits::priv_destroy(flag, a, p); + } + + //! Returns: a.max_size() if that expression is well-formed; otherwise, + //! numeric_limits::max(). + BOOST_CONTAINER_FORCEINLINE static size_type max_size(const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW + { + const bool value = allocator_traits_detail::has_max_size::value; + dtl::bool_ flag; + return allocator_traits::priv_max_size(flag, a); + } + + //! Returns: a.select_on_container_copy_construction() if that expression is well-formed; + //! otherwise, a. + BOOST_CONTAINER_FORCEINLINE static BOOST_CONTAINER_DOC1ST(Allocator, + typename dtl::if_c + < allocator_traits_detail::has_select_on_container_copy_construction::value + BOOST_MOVE_I Allocator BOOST_MOVE_I const Allocator & >::type) + select_on_container_copy_construction(const Allocator &a) + { + const bool value = allocator_traits_detail::has_select_on_container_copy_construction + ::value; + dtl::bool_ flag; + return allocator_traits::priv_select_on_container_copy_construction(flag, a); + } + + #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + //! Effects: calls a.construct(p, std::forward(args)...) if that call is well-formed; + //! otherwise, invokes `placement new` (static_cast(p)) T(std::forward(args)...) + template + BOOST_CONTAINER_FORCEINLINE static void construct(Allocator & a, T* p, BOOST_FWD_REF(Args)... args) + { + static const bool value = ::boost::move_detail::and_ + < dtl::is_not_std_allocator + , boost::container::dtl::has_member_function_callable_with_construct + < Allocator, T*, Args... > + >::value; + dtl::bool_ flag; + allocator_traits::priv_construct(flag, a, p, ::boost::forward(args)...); + } + #endif + + //! Returns: a.storage_is_unpropagable(p) if is_partially_propagable::value is true; otherwise, + //! false. + BOOST_CONTAINER_FORCEINLINE static bool storage_is_unpropagable(const Allocator &a, pointer p) BOOST_NOEXCEPT_OR_NOTHROW + { + dtl::bool_ flag; + return allocator_traits::priv_storage_is_unpropagable(flag, a, p); + } + + //! Returns: true if is_always_equal::value == true, otherwise, + //! a == b. + BOOST_CONTAINER_FORCEINLINE static bool equal(const Allocator &a, const Allocator &b) BOOST_NOEXCEPT_OR_NOTHROW + { + dtl::bool_ flag; + return allocator_traits::priv_equal(flag, a, b); + } + + #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + private: + BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(dtl::true_type, Allocator &a, size_type n, const_void_pointer p) + { return a.allocate(n, p); } + + BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(dtl::false_type, Allocator &a, size_type n, const_void_pointer) + { return a.allocate(n); } + + template + BOOST_CONTAINER_FORCEINLINE static void priv_destroy(dtl::true_type, Allocator &a, T* p) BOOST_NOEXCEPT_OR_NOTHROW + { a.destroy(p); } + + template + BOOST_CONTAINER_FORCEINLINE static void priv_destroy(dtl::false_type, Allocator &, T* p) BOOST_NOEXCEPT_OR_NOTHROW + { p->~T(); (void)p; } + + BOOST_CONTAINER_FORCEINLINE static size_type priv_max_size(dtl::true_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW + { return a.max_size(); } + + BOOST_CONTAINER_FORCEINLINE static size_type priv_max_size(dtl::false_type, const Allocator &) BOOST_NOEXCEPT_OR_NOTHROW + { return size_type(-1)/sizeof(value_type); } + + BOOST_CONTAINER_FORCEINLINE static Allocator priv_select_on_container_copy_construction(dtl::true_type, const Allocator &a) + { return a.select_on_container_copy_construction(); } + + BOOST_CONTAINER_FORCEINLINE static const Allocator &priv_select_on_container_copy_construction(dtl::false_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW + { return a; } + + #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + template + BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args) + { a.construct( p, ::boost::forward(args)...); } + + template + BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args) + { ::new((void*)p, boost_container_new_t()) T(::boost::forward(args)...); } + #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + public: + + #define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL(N) \ + template\ + BOOST_CONTAINER_FORCEINLINE static void construct(Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + {\ + static const bool value = ::boost::move_detail::and_ \ + < dtl::is_not_std_allocator \ + , boost::container::dtl::has_member_function_callable_with_construct \ + < Allocator, T* BOOST_MOVE_I##N BOOST_MOVE_FWD_T##N > \ + >::value; \ + dtl::bool_ flag;\ + (priv_construct)(flag, a, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ + }\ + // + BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL) + #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL + + private: + ///////////////////////////////// + // priv_construct + ///////////////////////////////// + #define BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL(N) \ + template\ + BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + { a.construct( p BOOST_MOVE_I##N BOOST_MOVE_FWD##N ); }\ + \ + template\ + BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + { ::new((void*)p, boost_container_new_t()) T(BOOST_MOVE_FWD##N); }\ + // + BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL) + #undef BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL + + #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + template + BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::false_type, Allocator &, T *p, const ::boost::container::default_init_t&) + { ::new((void*)p, boost_container_new_t()) T; } + + BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(dtl::true_type, const Allocator &a, pointer p) + { return a.storage_is_unpropagable(p); } + + BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(dtl::false_type, const Allocator &, pointer) + { return false; } + + BOOST_CONTAINER_FORCEINLINE static bool priv_equal(dtl::true_type, const Allocator &, const Allocator &) + { return true; } + + BOOST_CONTAINER_FORCEINLINE static bool priv_equal(dtl::false_type, const Allocator &a, const Allocator &b) + { return a == b; } + + #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) +}; + +#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + +template +struct real_allocator +{ + typedef AllocatorOrVoid type; +}; + +template +struct real_allocator +{ + typedef new_allocator type; +}; + +#endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + +} //namespace container { +} //namespace boost { + +#include + +#endif // ! defined(BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP) diff --git a/thirdparty/boost-1_79/boost/container/container_fwd.hpp b/thirdparty/boost-1_79/boost/container/container_fwd.hpp new file mode 100644 index 00000000..9e82fdef --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/container_fwd.hpp @@ -0,0 +1,388 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2014. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_FWD_HPP +#define BOOST_CONTAINER_CONTAINER_FWD_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +//! \file +//! This header file forward declares the following containers: +//! - boost::container::vector +//! - boost::container::stable_vector +//! - boost::container::static_vector +//! - boost::container::small_vector_base +//! - boost::container::small_vector +//! - boost::container::devector +//! - boost::container::slist +//! - boost::container::list +//! - boost::container::set +//! - boost::container::multiset +//! - boost::container::map +//! - boost::container::multimap +//! - boost::container::flat_set +//! - boost::container::flat_multiset +//! - boost::container::flat_map +//! - boost::container::flat_multimap +//! - boost::container::basic_string +//! - boost::container::string +//! - boost::container::wstring +//! +//! Forward declares the following allocators: +//! - boost::container::allocator +//! - boost::container::node_allocator +//! - boost::container::adaptive_pool +//! +//! Forward declares the following polymorphic resource classes: +//! - boost::container::pmr::memory_resource +//! - boost::container::pmr::polymorphic_allocator +//! - boost::container::pmr::monotonic_buffer_resource +//! - boost::container::pmr::pool_options +//! - boost::container::pmr::unsynchronized_pool_resource +//! - boost::container::pmr::synchronized_pool_resource +//! +//! And finally it defines the following types + +#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +//Std forward declarations +#ifndef BOOST_CONTAINER_DETAIL_STD_FWD_HPP + #include +#endif + +namespace boost{ +namespace intrusive{ +namespace detail{ + //Create namespace to avoid compilation errors +}}} + +namespace boost{ namespace container{ namespace dtl{ + namespace bi = boost::intrusive; + namespace bid = boost::intrusive::detail; +}}} + +namespace boost{ namespace container{ namespace pmr{ + namespace bi = boost::intrusive; + namespace bid = boost::intrusive::detail; +}}} + +#include + +#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +////////////////////////////////////////////////////////////////////////////// +// Containers +////////////////////////////////////////////////////////////////////////////// + +namespace boost { +namespace container { + +#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +template +class new_allocator; + +template +class vector; + +template +class stable_vector; + +template < class T + , std::size_t Capacity + , class Options = void> +class static_vector; + +template < class T + , class Allocator = void + , class Options = void > +class small_vector_base; + +template < class T + , std::size_t N + , class Allocator = void + , class Options = void > +class small_vector; + +template +class devector; + +template +class deque; + +template +class list; + +template +class slist; + +template + ,class Allocator = void + ,class Options = void> +class set; + +template + ,class Allocator = void + ,class Options = void > +class multiset; + +template + ,class Allocator = void + ,class Options = void > +class map; + +template + ,class Allocator = void + ,class Options = void > +class multimap; + +template + ,class Allocator = void > +class flat_set; + +template + ,class Allocator = void > +class flat_multiset; + +template + ,class Allocator = void > +class flat_map; + +template + ,class Allocator = void > +class flat_multimap; + +#ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES + +//! Alias templates for small_flat_[multi]{set|map} using small_vector as container + +template < class Key + , std::size_t N + , class Compare = std::less + , class SmallVectorAllocator = void + , class SmallVectorOptions = void > +using small_flat_set = flat_set>; + +template < class Key + , std::size_t N + , class Compare = std::less + , class SmallVectorAllocator = void + , class SmallVectorOptions = void > +using small_flat_multiset = flat_multiset>; + +template < class Key + , class T + , std::size_t N + , class Compare = std::less + , class SmallVectorAllocator = void + , class SmallVectorOptions = void > +using small_flat_map = flat_map, N, SmallVectorAllocator, SmallVectorOptions>>; + +template < class Key + , class T + , std::size_t N + , class Compare = std::less + , class SmallVectorAllocator = void + , class SmallVectorOptions = void > +using small_flat_multimap = flat_multimap, N, SmallVectorAllocator, SmallVectorOptions>>; + +#endif // #ifndef BOOST_NO_CXX11_TEMPLATE_ALIASES + + +//! A portable metafunction to obtain a small_flat_set +template < class Key + , std::size_t N + , class Compare = std::less + , class SmallVectorAllocator = void + , class SmallVectorOptions = void > +struct small_flat_set_of +{ + typedef flat_set > type; +}; + +//! A portable metafunction to obtain a small_flat_multiset +template < class Key + , std::size_t N + , class Compare = std::less + , class SmallVectorAllocator = void + , class SmallVectorOptions = void > +struct small_flat_multiset_of +{ + typedef flat_multiset > type; +}; + +//! A portable metafunction to obtain a small_flat_map +template < class Key + , class T + , std::size_t N + , class Compare = std::less + , class SmallVectorAllocator = void + , class SmallVectorOptions = void > +struct small_flat_map_of +{ + typedef flat_map, N, SmallVectorAllocator, SmallVectorOptions> > type; +}; + +//! A portable metafunction to obtain a small_flat_multimap +template < class Key + , class T + , std::size_t N + , class Compare = std::less + , class SmallVectorAllocator = void + , class SmallVectorOptions = void > +struct small_flat_multimap_of +{ + typedef flat_multimap, N, SmallVectorAllocator, SmallVectorOptions> > type; +}; + +template + ,class Allocator = void > +class basic_string; + +typedef basic_string string; +typedef basic_string wstring; + +static const std::size_t ADP_nodes_per_block = 256u; +static const std::size_t ADP_max_free_blocks = 2u; +static const std::size_t ADP_overhead_percent = 1u; +static const std::size_t ADP_only_alignment = 0u; + +template < class T + , std::size_t NodesPerBlock = ADP_nodes_per_block + , std::size_t MaxFreeBlocks = ADP_max_free_blocks + , std::size_t OverheadPercent = ADP_overhead_percent + , unsigned Version = 2 + > +class adaptive_pool; + +template < class T + , unsigned Version = 2 + , unsigned int AllocationDisableMask = 0> +class allocator; + +static const std::size_t NodeAlloc_nodes_per_block = 256u; + +template + < class T + , std::size_t NodesPerBlock = NodeAlloc_nodes_per_block + , std::size_t Version = 2> +class node_allocator; + +namespace pmr { + +class memory_resource; + +template +class polymorphic_allocator; + +class monotonic_buffer_resource; + +struct pool_options; + +template +class resource_adaptor_imp; + +class unsynchronized_pool_resource; + +class synchronized_pool_resource; + +} //namespace pmr { + +#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +//! Type used to tag that the input range is +//! guaranteed to be ordered +struct ordered_range_t +{}; + +//! Value used to tag that the input range is +//! guaranteed to be ordered +static const ordered_range_t ordered_range = ordered_range_t(); + +//! Type used to tag that the input range is +//! guaranteed to be ordered and unique +struct ordered_unique_range_t + : public ordered_range_t +{}; + +//! Value used to tag that the input range is +//! guaranteed to be ordered and unique +static const ordered_unique_range_t ordered_unique_range = ordered_unique_range_t(); + +//! Type used to tag that the inserted values +//! should be default initialized +struct default_init_t +{}; + +//! Value used to tag that the inserted values +//! should be default initialized +static const default_init_t default_init = default_init_t(); +#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +//! Type used to tag that the inserted values +//! should be value initialized +struct value_init_t +{}; + +//! Value used to tag that the inserted values +//! should be value initialized +static const value_init_t value_init = value_init_t(); + +namespace container_detail_really_deep_namespace { + +//Otherwise, gcc issues a warning of previously defined +//anonymous_instance and unique_instance +struct dummy +{ + dummy() + { + (void)ordered_range; + (void)ordered_unique_range; + (void)default_init; + } +}; + +} //detail_really_deep_namespace { + +typedef const std::piecewise_construct_t & piecewise_construct_t; + +#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +}} //namespace boost { namespace container { + +#endif //#ifndef BOOST_CONTAINER_CONTAINER_FWD_HPP diff --git a/thirdparty/boost-1_79/boost/container/detail/addressof.hpp b/thirdparty/boost-1_79/boost/container/detail/addressof.hpp new file mode 100644 index 00000000..00679b8f --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/detail/addressof.hpp @@ -0,0 +1,33 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_DETAIL_ADDRESSOF_HPP +#define BOOST_CONTAINER_DETAIL_ADDRESSOF_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include + +namespace boost { +namespace container { +namespace dtl { + +using boost::move_detail::addressof; + +} //namespace dtl { +} //namespace container { +} //namespace boost { + +#endif //#ifndef BOOST_CONTAINER_DETAIL_ADDRESSOF_HPP diff --git a/thirdparty/boost-1_79/boost/container/detail/advanced_insert_int.hpp b/thirdparty/boost-1_79/boost/container/detail/advanced_insert_int.hpp new file mode 100644 index 00000000..18c79356 --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/detail/advanced_insert_int.hpp @@ -0,0 +1,558 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2008-2013. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP +#define BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include + +// container +#include +// container/detail +#include +#include +#include +#include +#include +#include +#include +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#include +#endif +// move + +#include +#include +// other +#include +#include + +namespace boost { namespace container { namespace dtl { + +template +struct move_insert_range_proxy +{ + typedef typename allocator_traits::value_type value_type; + + BOOST_CONTAINER_FORCEINLINE explicit move_insert_range_proxy(FwdIt first) + : first_(first) + {} + + BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) + { + this->first_ = ::boost::container::uninitialized_move_alloc_n_source + (a, this->first_, n, p); + } + + BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n) + { + this->first_ = ::boost::container::move_n_source(this->first_, n, p); + } + + FwdIt first_; +}; + + +template +struct insert_range_proxy +{ + typedef typename allocator_traits::value_type value_type; + + BOOST_CONTAINER_FORCEINLINE explicit insert_range_proxy(FwdIt first) + : first_(first) + {} + + BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) + { + this->first_ = ::boost::container::uninitialized_copy_alloc_n_source(a, this->first_, n, p); + } + + BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n) + { + this->first_ = ::boost::container::copy_n_source(this->first_, n, p); + } + + FwdIt first_; +}; + + +template +struct insert_n_copies_proxy +{ + typedef typename allocator_traits::value_type value_type; + + BOOST_CONTAINER_FORCEINLINE explicit insert_n_copies_proxy(const value_type &v) + : v_(v) + {} + + BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const + { boost::container::uninitialized_fill_alloc_n(a, v_, n, p); } + + BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n) const + { + while (n){ + --n; + *p = v_; + ++p; + } + } + + const value_type &v_; +}; + +template +struct insert_value_initialized_n_proxy +{ + typedef ::boost::container::allocator_traits alloc_traits; + typedef typename allocator_traits::value_type value_type; + typedef typename dtl::aligned_storage::value>::type storage_t; + + BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const + { boost::container::uninitialized_value_init_alloc_n(a, n, p); } + + void copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const + { + while (n){ + --n; + storage_t v; + alloc_traits::construct(a, move_detail::force_ptr(&v)); + value_type *vp = move_detail::force_ptr(&v); + value_destructor on_exit(a, *vp); (void)on_exit; + *p = ::boost::move(*vp); + ++p; + } + } +}; + +template +struct insert_default_initialized_n_proxy +{ + typedef ::boost::container::allocator_traits alloc_traits; + typedef typename allocator_traits::value_type value_type; + typedef typename dtl::aligned_storage::value>::type storage_t; + + BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const + { boost::container::uninitialized_default_init_alloc_n(a, n, p); } + + void copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const + { + if(!is_pod::value){ + while (n){ + --n; + typename dtl::aligned_storage::value>::type v; + alloc_traits::construct(a, move_detail::force_ptr(&v), default_init); + value_type *vp = move_detail::force_ptr(&v); + value_destructor on_exit(a, *vp); (void)on_exit; + *p = ::boost::move(*vp); + ++p; + } + } + } +}; + +template +struct insert_copy_proxy +{ + typedef boost::container::allocator_traits alloc_traits; + typedef typename alloc_traits::value_type value_type; + + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_copy_proxy(const value_type &v) + : v_(v) + {} + + BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const + { + BOOST_ASSERT(n == 1); (void)n; + alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), v_); + } + + BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n) const + { + BOOST_ASSERT(n == 1); (void)n; + *p = v_; + } + + const value_type &v_; +}; + + +template +struct insert_move_proxy +{ + typedef boost::container::allocator_traits alloc_traits; + typedef typename alloc_traits::value_type value_type; + + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_move_proxy(value_type &v) + : v_(v) + {} + + BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) const + { + BOOST_ASSERT(n == 1); (void)n; + alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), ::boost::move(v_) ); + } + + BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator p, std::size_t n) const + { + BOOST_ASSERT(n == 1); (void)n; + *p = ::boost::move(v_); + } + + value_type &v_; +}; + +template +BOOST_CONTAINER_FORCEINLINE insert_move_proxy get_insert_value_proxy(BOOST_RV_REF(typename boost::container::iterator_traits::value_type) v) +{ + return insert_move_proxy(v); +} + +template +BOOST_CONTAINER_FORCEINLINE insert_copy_proxy get_insert_value_proxy(const typename boost::container::iterator_traits::value_type &v) +{ + return insert_copy_proxy(v); +} + +}}} //namespace boost { namespace container { namespace dtl { + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#include +#include + +namespace boost { +namespace container { +namespace dtl { + +template +struct insert_nonmovable_emplace_proxy +{ + typedef boost::container::allocator_traits alloc_traits; + typedef typename alloc_traits::value_type value_type; + typedef typename build_number_seq::type index_tuple_t; + + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_nonmovable_emplace_proxy(BOOST_FWD_REF(Args)... args) + : args_(args...) + {} + + BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n) + { this->priv_uninitialized_copy_some_and_update(a, index_tuple_t(), p, n); } + + private: + template + BOOST_CONTAINER_FORCEINLINE void priv_uninitialized_copy_some_and_update(Allocator &a, const index_tuple&, Iterator p, std::size_t n) + { + BOOST_ASSERT(n == 1); (void)n; + alloc_traits::construct( a, boost::movelib::iterator_to_raw_pointer(p), ::boost::forward(get(this->args_))... ); + } + + protected: + tuple args_; +}; + +template +struct insert_emplace_proxy + : public insert_nonmovable_emplace_proxy +{ + typedef insert_nonmovable_emplace_proxy base_t; + typedef boost::container::allocator_traits alloc_traits; + typedef typename base_t::value_type value_type; + typedef typename base_t::index_tuple_t index_tuple_t; + + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy(BOOST_FWD_REF(Args)... args) + : base_t(::boost::forward(args)...) + {} + + BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &a, Iterator p, std::size_t n) + { this->priv_copy_some_and_update(a, index_tuple_t(), p, n); } + + private: + + template + BOOST_CONTAINER_FORCEINLINE void priv_copy_some_and_update(Allocator &a, const index_tuple&, Iterator p, std::size_t n) + { + BOOST_ASSERT(n ==1); (void)n; + typename dtl::aligned_storage::value>::type v; + alloc_traits::construct(a, move_detail::force_ptr(&v), ::boost::forward(get(this->args_))...); + value_type *vp = move_detail::force_ptr(&v); + BOOST_TRY{ + *p = ::boost::move(*vp); + } + BOOST_CATCH(...){ + alloc_traits::destroy(a, vp); + BOOST_RETHROW + } + BOOST_CATCH_END + alloc_traits::destroy(a, vp); + } +}; + +//Specializations to avoid an unneeded temporary when emplacing from a single argument o type value_type +template +struct insert_emplace_proxy::value_type> + : public insert_move_proxy +{ + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy(typename boost::container::allocator_traits::value_type &&v) + : insert_move_proxy(v) + {} +}; + +//We use "add_const" here as adding "const" only confuses MSVC12(and maybe later) provoking +//compiler error C2752 ("more than one partial specialization matches"). +//Any problem is solvable with an extra layer of indirection? ;-) +template +struct insert_emplace_proxy::value_type>::type + > + : public insert_copy_proxy +{ + + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy(const typename boost::container::allocator_traits::value_type &v) + : insert_copy_proxy(v) + {} +}; + +template +struct insert_emplace_proxy::value_type &> + : public insert_copy_proxy +{ + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy(const typename boost::container::allocator_traits::value_type &v) + : insert_copy_proxy(v) + {} +}; + +template +struct insert_emplace_proxy::value_type>::type & + > + : public insert_copy_proxy +{ + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy(const typename boost::container::allocator_traits::value_type &v) + : insert_copy_proxy(v) + {} +}; + +}}} //namespace boost { namespace container { namespace dtl { + +#else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#include + +namespace boost { +namespace container { +namespace dtl { + +#define BOOST_CONTAINER_ADVANCED_INSERT_INT_CODE(N) \ +template< class Allocator, class Iterator BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ +struct insert_nonmovable_emplace_proxy##N\ +{\ + typedef boost::container::allocator_traits alloc_traits;\ + typedef typename alloc_traits::value_type value_type;\ + \ + static const bool single_value = true;\ + \ + BOOST_CONTAINER_FORCEINLINE explicit insert_nonmovable_emplace_proxy##N(BOOST_MOVE_UREF##N)\ + BOOST_MOVE_COLON##N BOOST_MOVE_FWD_INIT##N {}\ + \ + BOOST_CONTAINER_FORCEINLINE void uninitialized_copy_n_and_update(Allocator &a, Iterator p, std::size_t n)\ + {\ + BOOST_ASSERT(n == 1); (void)n;\ + alloc_traits::construct(a, boost::movelib::iterator_to_raw_pointer(p) BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\ + }\ + \ + BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &, Iterator, std::size_t)\ + { BOOST_ASSERT(false); }\ + \ + protected:\ + BOOST_MOVE_MREF##N\ +};\ +\ +template< class Allocator, class Iterator BOOST_MOVE_I##N BOOST_MOVE_CLASS##N >\ +struct insert_emplace_proxy_arg##N\ + : insert_nonmovable_emplace_proxy##N< Allocator, Iterator BOOST_MOVE_I##N BOOST_MOVE_TARG##N >\ +{\ + typedef insert_nonmovable_emplace_proxy##N\ + < Allocator, Iterator BOOST_MOVE_I##N BOOST_MOVE_TARG##N > base_t;\ + typedef typename base_t::value_type value_type;\ + typedef boost::container::allocator_traits alloc_traits;\ + \ + static const bool single_value = true;\ + \ + BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg##N(BOOST_MOVE_UREF##N)\ + : base_t(BOOST_MOVE_FWD##N){}\ + \ + BOOST_CONTAINER_FORCEINLINE void copy_n_and_update(Allocator &a, Iterator p, std::size_t n)\ + {\ + BOOST_ASSERT(n == 1); (void)n;\ + typename dtl::aligned_storage::value>::type v;\ + alloc_traits::construct(a, move_detail::force_ptr(&v) BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\ + value_type *vp = move_detail::force_ptr(&v);\ + BOOST_TRY{\ + *p = ::boost::move(*vp);\ + }\ + BOOST_CATCH(...){\ + alloc_traits::destroy(a, vp);\ + BOOST_RETHROW\ + }\ + BOOST_CATCH_END\ + alloc_traits::destroy(a, vp);\ + }\ +};\ +// +BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_ADVANCED_INSERT_INT_CODE) +#undef BOOST_CONTAINER_ADVANCED_INSERT_INT_CODE + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + +//Specializations to avoid an unneeded temporary when emplacing from a single argument o type value_type +template +struct insert_emplace_proxy_arg1::value_type> > + : public insert_move_proxy +{ + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg1(typename boost::container::allocator_traits::value_type &v) + : insert_move_proxy(v) + {} +}; + +template +struct insert_emplace_proxy_arg1::value_type> + : public insert_copy_proxy +{ + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits::value_type &v) + : insert_copy_proxy(v) + {} +}; + +#else //e.g. MSVC10 & MSVC11 + +//Specializations to avoid an unneeded temporary when emplacing from a single argument o type value_type +template +struct insert_emplace_proxy_arg1::value_type> + : public insert_move_proxy +{ + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg1(typename boost::container::allocator_traits::value_type &&v) + : insert_move_proxy(v) + {} +}; + +//We use "add_const" here as adding "const" only confuses MSVC10&11 provoking +//compiler error C2752 ("more than one partial specialization matches"). +//Any problem is solvable with an extra layer of indirection? ;-) +template +struct insert_emplace_proxy_arg1::value_type>::type + > + : public insert_copy_proxy +{ + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits::value_type &v) + : insert_copy_proxy(v) + {} +}; + +template +struct insert_emplace_proxy_arg1::value_type &> + : public insert_copy_proxy +{ + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits::value_type &v) + : insert_copy_proxy(v) + {} +}; + +template +struct insert_emplace_proxy_arg1::value_type>::type & + > + : public insert_copy_proxy +{ + static const bool single_value = true; + + BOOST_CONTAINER_FORCEINLINE explicit insert_emplace_proxy_arg1(const typename boost::container::allocator_traits::value_type &v) + : insert_copy_proxy(v) + {} +}; + +#endif + +}}} //namespace boost { namespace container { namespace dtl { + +#endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +namespace boost { namespace container { namespace dtl { + +template +struct has_single_value +{ + private: + struct two {char array_[2];}; + template struct wrapper; + template static two test(int, ...); + template static char test(int, const wrapper*); + public: + static const bool value = sizeof(test(0, 0)) == 1; + void dummy(){} +}; + +template::value> +struct is_single_value_proxy_impl +{ + static const bool value = InsertionProxy::single_value; +}; + +template +struct is_single_value_proxy_impl +{ + static const bool value = false; +}; + +template +struct is_single_value_proxy + : is_single_value_proxy_impl +{}; + +}}} //namespace boost { namespace container { namespace dtl { + +#include + +#endif //#ifndef BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP diff --git a/thirdparty/boost-1_79/boost/container/detail/algorithm.hpp b/thirdparty/boost-1_79/boost/container/detail/algorithm.hpp new file mode 100644 index 00000000..ce5582bc --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/detail/algorithm.hpp @@ -0,0 +1,185 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2014-2014. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_ALGORITHM_HPP +#define BOOST_CONTAINER_DETAIL_ALGORITHM_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include + +namespace boost { +namespace container { + +using boost::intrusive::algo_equal; +using boost::intrusive::algo_lexicographical_compare; + +template +class binder1st +{ + public: + typedef typename Func::second_argument_type argument_type; + typedef typename Func::result_type result_type; + + binder1st(const Func& func, const typename Func::first_argument_type& arg) + : op(func), value(arg) + {} + + result_type operator()(const argument_type& arg) const + { return op(value, arg); } + + result_type operator()(argument_type& arg) const + { return op(value, arg); } + + private: + Func op; + typename Func::first_argument_type value; +}; + +template +inline binder1st bind1st(const Func& func, const T& arg) +{ return boost::container::binder1st(func, arg); } + +template +class binder2nd +{ + public: + typedef typename Func::first_argument_type argument_type; + typedef typename Func::result_type result_type; + + binder2nd(const Func& func, const typename Func::second_argument_type& arg) + : op(func), value(arg) + {} + + result_type operator()(const argument_type& arg) const + { return op(arg, value); } + + result_type operator()(argument_type& arg) const + { return op(arg, value); } + + private: + Func op; + typename Func::second_argument_type value; +}; + +template +inline binder2nd bind2nd(const Func& func, const T& arg) +{ + return (boost::container::binder2nd(func, arg)); +} + +template +class unary_negate +{ + public: + typedef typename Func::argument_type argument_type; + typedef typename Func::result_type result_type; + + explicit unary_negate(const Func& func) + : m_func(func) + {} + + bool operator()(const typename Func::argument_type& arg) const + { return !m_func(arg); } + + private: + Func m_func; +}; + +template inline +unary_negate not1(const Func& func) +{ + return boost::container::unary_negate(func); +} + +template +InputIt find_if(InputIt first, InputIt last, UnaryPredicate p) +{ + for (; first != last; ++first) { + if (p(*first)) { + return first; + } + } + return last; +} + +template + ForwardIt1 find_end (ForwardIt1 first1, ForwardIt1 last1 + ,ForwardIt2 first2, ForwardIt2 last2 + ,BinaryPredicate p) +{ + if (first2==last2) + return last1; // specified in C++11 + + ForwardIt1 ret = last1; + + while (first1!=last1) + { + ForwardIt1 it1 = first1; + ForwardIt2 it2 = first2; + while ( p(*it1, *it2) ) { + ++it1; ++it2; + if (it2==last2) { + ret=first1; + break; + } + if (it1==last1) + return ret; + } + ++first1; + } + return ret; +} + +template +InputIt find_first_of(InputIt first1, InputIt last1, ForwardIt first2, ForwardIt last2, BinaryPredicate p) +{ + for (; first1 != last1; ++first1) { + for (ForwardIt it = first2; it != last2; ++it) { + if (p(*first1, *it)) { + return first1; + } + } + } + return last1; +} + +template +ForwardIt1 search(ForwardIt1 first1, ForwardIt1 last1, + ForwardIt2 first2, ForwardIt2 last2, BinaryPredicate p) +{ + for (; ; ++first1) { + ForwardIt1 it = first1; + for (ForwardIt2 it2 = first2; ; ++it, ++it2) { + if (it2 == last2) { + return first1; + } + if (it == last1) { + return last1; + } + if (!p(*it, *it2)) { + break; + } + } + } +} + +} //namespace container { +} //namespace boost { + +#endif //#ifndef BOOST_CONTAINER_DETAIL_ALGORITHM_HPP diff --git a/thirdparty/boost-1_79/boost/container/detail/alloc_helpers.hpp b/thirdparty/boost-1_79/boost/container/detail/alloc_helpers.hpp new file mode 100644 index 00000000..5ca2ca72 --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/detail/alloc_helpers.hpp @@ -0,0 +1,60 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_DETAIL_ALLOC_TRAITS_HPP +#define BOOST_CONTAINER_DETAIL_ALLOC_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +// move +#include +#include + +namespace boost { +namespace container { +namespace dtl { + +template +BOOST_CONTAINER_FORCEINLINE void swap_alloc(AllocatorType &, AllocatorType &, dtl::false_type) + BOOST_NOEXCEPT_OR_NOTHROW +{} + +template +BOOST_CONTAINER_FORCEINLINE void swap_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) +{ boost::adl_move_swap(l, r); } + +template +BOOST_CONTAINER_FORCEINLINE void assign_alloc(AllocatorType &, const AllocatorType &, dtl::false_type) + BOOST_NOEXCEPT_OR_NOTHROW +{} + +template +BOOST_CONTAINER_FORCEINLINE void assign_alloc(AllocatorType &l, const AllocatorType &r, dtl::true_type) +{ l = r; } + +template +BOOST_CONTAINER_FORCEINLINE void move_alloc(AllocatorType &, AllocatorType &, dtl::false_type) + BOOST_NOEXCEPT_OR_NOTHROW +{} + +template +BOOST_CONTAINER_FORCEINLINE void move_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) +{ l = ::boost::move(r); } + +} //namespace dtl { +} //namespace container { +} //namespace boost { + +#endif //#ifndef BOOST_CONTAINER_DETAIL_ALLOC_TRAITS_HPP diff --git a/thirdparty/boost-1_79/boost/container/detail/allocation_type.hpp b/thirdparty/boost-1_79/boost/container/detail/allocation_type.hpp new file mode 100644 index 00000000..1e8aa673 --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/detail/allocation_type.hpp @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATION_TYPE_HPP +#define BOOST_CONTAINER_ALLOCATION_TYPE_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include + +namespace boost { +namespace container { + +#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED +enum allocation_type_v +{ + // constants for allocation commands + allocate_new_v = 0x01, + expand_fwd_v = 0x02, + expand_bwd_v = 0x04, +// expand_both = expand_fwd | expand_bwd, +// expand_or_new = allocate_new | expand_both, + shrink_in_place_v = 0x08, + nothrow_allocation_v = 0x10, + zero_memory_v = 0x20, + try_shrink_in_place_v = 0x40 +}; + +typedef unsigned int allocation_type; +#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED +static const allocation_type allocate_new = (allocation_type)allocate_new_v; +static const allocation_type expand_fwd = (allocation_type)expand_fwd_v; +static const allocation_type expand_bwd = (allocation_type)expand_bwd_v; +static const allocation_type shrink_in_place = (allocation_type)shrink_in_place_v; +static const allocation_type try_shrink_in_place= (allocation_type)try_shrink_in_place_v; +static const allocation_type nothrow_allocation = (allocation_type)nothrow_allocation_v; +static const allocation_type zero_memory = (allocation_type)zero_memory_v; + +} //namespace container { +} //namespace boost { + +#include + +#endif //BOOST_CONTAINER_ALLOCATION_TYPE_HPP diff --git a/thirdparty/boost-1_79/boost/container/detail/allocator_version_traits.hpp b/thirdparty/boost-1_79/boost/container/detail/allocator_version_traits.hpp new file mode 100644 index 00000000..d037e0e3 --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/detail/allocator_version_traits.hpp @@ -0,0 +1,163 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2013. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_ALLOCATOR_VERSION_TRAITS_HPP +#define BOOST_CONTAINER_DETAIL_ALLOCATOR_VERSION_TRAITS_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include + +#include //allocator_traits +#include +#include //multiallocation_chain +#include //version_type +#include //allocation_type +#include //integral_constant +#include //pointer_traits +#include //BOOST_TRY + +namespace boost { +namespace container { +namespace dtl { + +template::value> +struct allocator_version_traits +{ + typedef ::boost::container::dtl::integral_constant + alloc_version; + + typedef typename Allocator::multiallocation_chain multiallocation_chain; + + typedef typename boost::container::allocator_traits::pointer pointer; + typedef typename boost::container::allocator_traits::size_type size_type; + + //Node allocation interface + static pointer allocate_one(Allocator &a) + { return a.allocate_one(); } + + static void deallocate_one(Allocator &a, const pointer &p) + { a.deallocate_one(p); } + + static void allocate_individual(Allocator &a, size_type n, multiallocation_chain &m) + { return a.allocate_individual(n, m); } + + static void deallocate_individual(Allocator &a, multiallocation_chain &holder) + { a.deallocate_individual(holder); } + + static pointer allocation_command(Allocator &a, allocation_type command, + size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse) + { return a.allocation_command(command, limit_size, prefer_in_recvd_out_size, reuse); } +}; + +template +struct allocator_version_traits +{ + typedef ::boost::container::dtl::integral_constant + alloc_version; + + typedef typename boost::container::allocator_traits::pointer pointer; + typedef typename boost::container::allocator_traits::size_type size_type; + typedef typename boost::container::allocator_traits::value_type value_type; + + typedef typename boost::intrusive::pointer_traits:: + template rebind_pointer::type void_ptr; + typedef dtl::basic_multiallocation_chain + multialloc_cached_counted; + typedef boost::container::dtl:: + transform_multiallocation_chain + < multialloc_cached_counted, value_type> multiallocation_chain; + + //Node allocation interface + static pointer allocate_one(Allocator &a) + { return a.allocate(1); } + + static void deallocate_one(Allocator &a, const pointer &p) + { a.deallocate(p, 1); } + + static void deallocate_individual(Allocator &a, multiallocation_chain &holder) + { + size_type n = holder.size(); + typename multiallocation_chain::iterator it = holder.begin(); + while(n){ + --n; + pointer p = boost::intrusive::pointer_traits::pointer_to(*it); + ++it; + a.deallocate(p, 1); + } + } + + struct allocate_individual_rollback + { + allocate_individual_rollback(Allocator &a, multiallocation_chain &chain) + : mr_a(a), mp_chain(&chain) + {} + + ~allocate_individual_rollback() + { + if(mp_chain) + allocator_version_traits::deallocate_individual(mr_a, *mp_chain); + } + + void release() + { + mp_chain = 0; + } + + Allocator &mr_a; + multiallocation_chain * mp_chain; + }; + + static void allocate_individual(Allocator &a, size_type n, multiallocation_chain &m) + { + allocate_individual_rollback rollback(a, m); + while(n--){ + m.push_front(a.allocate(1)); + } + rollback.release(); + } + + static pointer allocation_command(Allocator &a, allocation_type command, + size_type, size_type &prefer_in_recvd_out_size, pointer &reuse) + { + pointer ret = pointer(); + if(BOOST_UNLIKELY(!(command & allocate_new) && !(command & nothrow_allocation))){ + throw_logic_error("version 1 allocator without allocate_new flag"); + } + else{ + BOOST_TRY{ + ret = a.allocate(prefer_in_recvd_out_size); + } + BOOST_CATCH(...){ + if(!(command & nothrow_allocation)){ + BOOST_RETHROW + } + } + BOOST_CATCH_END + reuse = pointer(); + } + return ret; + } +}; + +} //namespace dtl { +} //namespace container { +} //namespace boost { + +#include + +#endif // ! defined(BOOST_CONTAINER_DETAIL_ALLOCATOR_VERSION_TRAITS_HPP) diff --git a/thirdparty/boost-1_79/boost/container/detail/compare_functors.hpp b/thirdparty/boost-1_79/boost/container/detail/compare_functors.hpp new file mode 100644 index 00000000..6478418b --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/detail/compare_functors.hpp @@ -0,0 +1,131 @@ +/////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2014-2014. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_COMPARE_FUNCTORS_HPP +#define BOOST_CONTAINER_DETAIL_COMPARE_FUNCTORS_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include + +namespace boost { +namespace container { + +template +class equal_to_value +{ + typedef ValueType value_type; + const value_type &t_; + + public: + explicit equal_to_value(const value_type &t) + : t_(t) + {} + + bool operator()(const value_type &t)const + { return t_ == t; } +}; + +template +struct value_to_node_compare + : Pred +{ + typedef Pred predicate_type; + typedef Node node_type; + + value_to_node_compare() + : Pred() + {} + + explicit value_to_node_compare(Pred pred) + : Pred(pred) + {} + + Ret operator()(const Node &a, const Node &b) const + { return static_cast(*this)(a.get_data(), b.get_data()); } + + Ret operator()(const Node &a) const + { return static_cast(*this)(a.get_data()); } + + Ret operator()(const Node &a, const Node &b) + { return static_cast(*this)(a.get_data(), b.get_data()); } + + Ret operator()(const Node &a) + { return static_cast(*this)(a.get_data()); } + + predicate_type & predicate() { return static_cast(*this); } + const predicate_type & predicate() const { return static_cast(*this); } +}; + +template +struct key_node_pred + : public boost::intrusive::detail::ebo_functor_holder +{ + BOOST_CONTAINER_FORCEINLINE explicit key_node_pred(const KeyPred &comp) + : base_t(comp) + {} + + typedef boost::intrusive::detail::ebo_functor_holder base_t; + typedef KeyPred key_predicate; + typedef KeyOfValue key_of_value; + typedef typename KeyOfValue::type key_type; + + + BOOST_CONTAINER_FORCEINLINE static const key_type &key_from(const Node &n) + { + return key_of_value()(n.get_data()); + } + + template + BOOST_CONTAINER_FORCEINLINE static const T & + key_from(const T &t) + { return t; } + + BOOST_CONTAINER_FORCEINLINE const key_predicate &key_pred() const + { return static_cast(*this); } + + BOOST_CONTAINER_FORCEINLINE key_predicate &key_pred() + { return static_cast(*this); } + + BOOST_CONTAINER_FORCEINLINE Ret operator()(const key_type &key) const + { return this->key_pred()(key); } + + template + BOOST_CONTAINER_FORCEINLINE Ret operator()(const U &nonkey) const + { return this->key_pred()(this->key_from(nonkey)); } + + BOOST_CONTAINER_FORCEINLINE bool operator()(const key_type &key1, const key_type &key2) const + { return this->key_pred()(key1, key2); } + + template + BOOST_CONTAINER_FORCEINLINE bool operator()(const key_type &key1, const U &nonkey2) const + { return this->key_pred()(key1, this->key_from(nonkey2)); } + + template + BOOST_CONTAINER_FORCEINLINE bool operator()(const U &nonkey1, const key_type &key2) const + { return this->key_pred()(this->key_from(nonkey1), key2); } + + template + BOOST_CONTAINER_FORCEINLINE bool operator()(const U &nonkey1, const V &nonkey2) const + { return this->key_pred()(this->key_from(nonkey1), this->key_from(nonkey2)); } +}; + + +} //namespace container { +} //namespace boost { + +#endif //BOOST_CONTAINER_DETAIL_COMPARE_FUNCTORS_HPP diff --git a/thirdparty/boost-1_79/boost/container/detail/config_begin.hpp b/thirdparty/boost-1_79/boost/container/detail/config_begin.hpp new file mode 100644 index 00000000..172e685c --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/detail/config_begin.hpp @@ -0,0 +1,50 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED +#define BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED +#ifndef BOOST_CONFIG_HPP +#include +#endif + +#endif //BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED + +#ifdef BOOST_MSVC + #pragma warning (push) + #pragma warning (disable : 4127) // conditional expression is constant + #pragma warning (disable : 4146) // unary minus operator applied to unsigned type, result still unsigned + #pragma warning (disable : 4197) // top-level volatile in cast is ignored + #pragma warning (disable : 4251) // "identifier" : class "type" needs to have dll-interface to be used by clients of class "type2" + #pragma warning (disable : 4275) // non DLL-interface classkey "identifier" used as base for DLL-interface classkey "identifier" + #pragma warning (disable : 4284) // odd return type for operator-> + #pragma warning (disable : 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow) + #pragma warning (disable : 4324) // structure was padded due to __declspec(align( + #pragma warning (disable : 4345) // behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized + #pragma warning (disable : 4355) // "this" : used in base member initializer list + #pragma warning (disable : 4503) // "identifier" : decorated name length exceeded, name was truncated + #pragma warning (disable : 4510) // default constructor could not be generated + #pragma warning (disable : 4511) // copy constructor could not be generated + #pragma warning (disable : 4512) // assignment operator could not be generated + #pragma warning (disable : 4514) // unreferenced inline removed + #pragma warning (disable : 4521) // Disable "multiple copy constructors specified" + #pragma warning (disable : 4522) // "class" : multiple assignment operators specified + #pragma warning (disable : 4541) // 'typeid' used on polymorphic type '' with /GR-; unpredictable behavior may result + #pragma warning (disable : 4584) // X is already a base-class of Y + #pragma warning (disable : 4610) // struct can never be instantiated - user defined constructor required + #pragma warning (disable : 4671) // the copy constructor is inaccessible + #pragma warning (disable : 4673) // throwing '' the following types will not be considered at the catch site + #pragma warning (disable : 4675) // "method" should be declared "static" and have exactly one parameter + #pragma warning (disable : 4706) // assignment within conditional expression + #pragma warning (disable : 4710) // function not inlined + #pragma warning (disable : 4714) // "function": marked as __forceinline not inlined + #pragma warning (disable : 4711) // function selected for automatic inline expansion + #pragma warning (disable : 4786) // identifier truncated in debug info + #pragma warning (disable : 4996) // "function": was declared deprecated + +#endif //BOOST_MSVC diff --git a/thirdparty/boost-1_79/boost/container/detail/config_end.hpp b/thirdparty/boost-1_79/boost/container/detail/config_end.hpp new file mode 100644 index 00000000..f93c8f6f --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/detail/config_end.hpp @@ -0,0 +1,13 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#if defined BOOST_MSVC + #pragma warning (pop) +#endif + diff --git a/thirdparty/boost-1_79/boost/container/detail/construct_in_place.hpp b/thirdparty/boost-1_79/boost/container/detail/construct_in_place.hpp new file mode 100644 index 00000000..d824d814 --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/detail/construct_in_place.hpp @@ -0,0 +1,98 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2014-2014. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP +#define BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include +#include + +namespace boost { +namespace container { + +//In place construction + +struct iterator_arg_t{}; + +template +BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T* dest, InpIt source) +{ boost::container::allocator_traits::construct(a, dest, *source); } + +template +BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, value_init_construct_iterator) +{ + boost::container::allocator_traits::construct(a, dest); +} + +template +class default_init_construct_iterator; + +template +BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, default_init_construct_iterator) +{ + boost::container::allocator_traits::construct(a, dest, default_init); +} + +template +class emplace_iterator; + +template +BOOST_CONTAINER_FORCEINLINE void construct_in_place(Allocator &a, T *dest, emplace_iterator ei) +{ + ei.construct_in_place(a, dest); +} + +//Assignment + +template +BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, InpIt source) +{ *dest = *source; } + +template +BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, value_init_construct_iterator) +{ + dtl::value_init val; + *dest = boost::move(val.get()); +} + +template +class default_init_construct_iterator; + +template +BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, default_init_construct_iterator) +{ + U u; + *dest = boost::move(u); +} + +template +class emplace_iterator; + +template +BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, emplace_iterator ei) +{ + ei.assign_in_place(dest); +} + +} //namespace container { +} //namespace boost { + +#endif //#ifndef BOOST_CONTAINER_DETAIL_CONSTRUCT_IN_PLACE_HPP diff --git a/thirdparty/boost-1_79/boost/container/detail/container_or_allocator_rebind.hpp b/thirdparty/boost-1_79/boost/container/detail/container_or_allocator_rebind.hpp new file mode 100644 index 00000000..1525e41d --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/detail/container_or_allocator_rebind.hpp @@ -0,0 +1,53 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2017-2017. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_OR_ALLOCATOR_REBIND_HPP +#define BOOST_CONTAINER_DETAIL_CONTAINER_OR_ALLOCATOR_REBIND_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include +#include + +namespace boost { +namespace container { +namespace dtl { + +template::value> +struct container_or_allocator_rebind_impl + : container_rebind +{}; + +template +struct container_or_allocator_rebind_impl + : allocator_traits::template portable_rebind_alloc +{}; + +template +struct container_or_allocator_rebind_impl + : real_allocator +{}; + +template +struct container_or_allocator_rebind + : container_or_allocator_rebind_impl +{}; + +} //namespace dtl { +} //namespace container { +} //namespace boost { + +#endif //#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_OR_ALLOCATOR_REBIND_HPP diff --git a/thirdparty/boost-1_79/boost/container/detail/container_rebind.hpp b/thirdparty/boost-1_79/boost/container/detail/container_rebind.hpp new file mode 100644 index 00000000..854291ae --- /dev/null +++ b/thirdparty/boost-1_79/boost/container/detail/container_rebind.hpp @@ -0,0 +1,163 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2017-2017. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP +#define BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include + + +namespace boost { +namespace container { +namespace dtl { + + template + struct container_rebind; + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + template