Compare commits
100
Commits
master
...
2.17.0_rc6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9bfd33320e | ||
|
|
f7a2693952 | ||
|
|
d573447d64 | ||
|
|
ccd7d29501 | ||
|
|
291699fb9b | ||
|
|
056e0f8aa7 | ||
|
|
45ed583d46 | ||
|
|
54a2131b20 | ||
|
|
a4bbb6c88b | ||
|
|
e6c2ceb931 | ||
|
|
c43ec4a56d | ||
|
|
b871cc4e09 | ||
|
|
6aec729b6a | ||
|
|
025625e0b9 | ||
|
|
5c5bc243d2 | ||
|
|
0d0af32b85 | ||
|
|
46c2d2e916 | ||
|
|
ff6d0f0e1b | ||
|
|
86ca092f18 | ||
|
|
ec3d642cee | ||
|
|
7489d70c95 | ||
|
|
81bb5404cb | ||
|
|
a0155beb83 | ||
|
|
780b74fc56 | ||
|
|
78bc14348d | ||
|
|
52bc0f1a17 | ||
|
|
c52c24c3f2 | ||
|
|
0d9277bf6a | ||
|
|
761797dc24 | ||
|
|
39a560c394 | ||
|
|
b4f01da8d8 | ||
|
|
f7ca1efdb8 | ||
|
|
1b4ed339d6 | ||
|
|
5af89e0124 | ||
|
|
1fddbf1cca | ||
|
|
1cd1a23c80 | ||
|
|
b987ec6a8a | ||
|
|
f509026815 | ||
|
|
557b658146 | ||
|
|
e3c4960622 | ||
|
|
350b4307dc | ||
|
|
762ca47a59 | ||
|
|
79b83ba494 | ||
|
|
51f5155a1a | ||
|
|
d0b3124813 | ||
|
|
29128dd014 | ||
|
|
9e8f5809c3 | ||
|
|
7e2001744c | ||
|
|
f5b83efade | ||
|
|
aedb9d2ae1 | ||
|
|
5ccd28d84d | ||
|
|
3320888fc8 | ||
|
|
456e9bf357 | ||
|
|
275a757eb7 | ||
|
|
d51d170891 | ||
|
|
87d138740f | ||
|
|
625f165a63 | ||
|
|
8421ed0ae9 | ||
|
|
2a03eb323d | ||
|
|
cac6a9cd53 | ||
|
|
a148b8fdcb | ||
|
|
d635e8a978 | ||
|
|
7aadd38934 | ||
|
|
b63b11982b | ||
|
|
88a4d2ed80 | ||
|
|
26bdef7ddd | ||
|
|
faedb0a49e | ||
|
|
d148255917 | ||
|
|
00b1d3c51c | ||
|
|
b68c963b5e | ||
|
|
a43070f812 | ||
|
|
f6b5ab040c | ||
|
|
86ddf3078d | ||
|
|
bc4fe19bdb | ||
|
|
bb259b128a | ||
|
|
1d443531fd | ||
|
|
40956c5335 | ||
|
|
44aba08978 | ||
|
|
9ec1c8fdae | ||
|
|
0508858859 | ||
|
|
e840b9617f | ||
|
|
19ee603413 | ||
|
|
515ed5aabd | ||
|
|
12e068a3d1 | ||
|
|
8268599893 | ||
|
|
6365378947 | ||
|
|
78d238fdfb | ||
|
|
d90fa1a1e8 | ||
|
|
3e817d4fb0 | ||
|
|
aa6d453d5b | ||
|
|
112c78e50b | ||
|
|
41ec7fb668 | ||
|
|
b19bf2fd26 | ||
|
|
c5f7477521 | ||
|
|
14323e7964 | ||
|
|
39db9b1bd7 | ||
|
|
991a199d06 | ||
|
|
9d045f65d2 | ||
|
|
1c0cd176a1 | ||
|
|
1018ae387a |
No files matched your search
@@ -36,7 +36,8 @@ namespace bts {
|
||||
Plugin,
|
||||
Sdk,
|
||||
Http,
|
||||
iLink3
|
||||
Spartan,
|
||||
iLink3
|
||||
// Please keep this list in sync with logging.h/logging.cpp
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
set(sources files/cert_secure_logon.txt;files/futures.coconut.xz;files/onixs_ice/ConnectivityConfiguration.APITest.xml;files/onixs_ice/ConnectivityConfiguration.APITest.xml.orig;files/onixs_ice/ConnectivityConfiguration.PerfTest.xml;files/onixs_ice/ConnectivityConfiguration.Production.xml;files/perf_trace/compiled.css;files/perf_trace/index.html;files/perf_trace/jquery-3.3.1.min.js;files/perf_trace/main.js;files/perf_trace/perf_log.sql;files/perf_trace/perf_trace_analysis.sql;files/perf_trace/plotly-latest.min.js)
|
||||
set(sources files/cert_secure_logon.txt;files/futures.coconut.xz;files/onixs_ice/ConnectivityConfiguration.APITest.xml;files/onixs_ice/ConnectivityConfiguration.APITest.xml.orig;files/onixs_ice/ConnectivityConfiguration.PerfTest.xml;files/onixs_ice/ConnectivityConfiguration.Production.xml;files/perf_trace/compiled.css;files/perf_trace/index.html;files/perf_trace/jquery-3.3.1.min.js;files/perf_trace/main.js;files/perf_trace/perf_log.sql;files/perf_trace/perf_trace_analysis.sql;files/perf_trace/plotly-latest.min.js;files/small_es.pcap.xz)
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/service_helpers/PositionUtilities.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/BasePositionService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/MarketDataService.proto;api/services/MoneyFileService.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/position_cfg.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/AlgoTypes.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/position_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spreader.proto;config/protos/subprocess.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/sod.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;jetfix/codec/FIXArray.cpp;jetfix/common/OutFIX.cpp;jetfix/connection/AsyncReader.cpp;jetfix/connection/IConnection.cpp;jetfix/connection/SocketConnection.cpp;jetfix/gateway/CoreGateway.cpp;jetfix/gateway/JetFIXGateway.cpp;jetfix/gateway/Session.cpp;jetfix/store/FIXFileStore.cpp;jetfix/store/session_name.cpp;jetfix/tests/async_reader_tests.cpp;jetfix/tests/decoding_tests.cpp;jetfix/tests/fix_encoding_stream_tests.cpp;jetfix/tests/fix_fragment_tests.cpp;jetfix/tests/jetfix_performance_tests.cpp;jetfix/tests/sample_fix.cpp;jetfix/tests/store_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MBOProcessor.cpp;md/MBOServiceServer.cpp;md/MDClient.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/Product.cpp;md/SecurityCache.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SecurityMapper.cpp;md/SecurityOracle.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/ice/ICEUtils.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/service/MarketDataServiceServer.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/mbo_tests.cpp;md/test/md2_tests.cpp;md/test/md_test_utils.cpp;md/test/synthetic_book_merge_tests.cpp;md/vendor/OnixsUtils.cpp;mercury/actors/IPollableActor.cpp;mercury/broker/Broker.cpp;mercury/broker/BrokerProxy.cpp;mercury/broker/ILocalBroker.cpp;mercury/broker/IRemoteBroker.cpp;mercury/common/mercury_common.cpp;mercury/events/TimerEvent.cpp;mercury/executor/Executor.cpp;mercury/topics/Topic.cLine truncated
|
||||
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/service_helpers/PositionUtilities.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/BasePositionService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/MarketDataService.proto;api/services/MoneyFileService.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/position_cfg.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/AlgoTypes.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/position_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spartan.proto;config/protos/spreader.proto;config/protos/subprocess.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/sod.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;jetfix/codec/FIXArray.cpp;jetfix/common/OutFIX.cpp;jetfix/connection/AsyncReader.cpp;jetfix/connection/IConnection.cpp;jetfix/connection/SocketConnection.cpp;jetfix/gateway/CoreGateway.cpp;jetfix/gateway/JetFIXGateway.cpp;jetfix/gateway/Session.cpp;jetfix/store/FIXFileStore.cpp;jetfix/store/session_name.cpp;jetfix/tests/async_reader_tests.cpp;jetfix/tests/decoding_tests.cpp;jetfix/tests/fix_encoding_stream_tests.cpp;jetfix/tests/fix_fragment_tests.cpp;jetfix/tests/jetfix_performance_tests.cpp;jetfix/tests/sample_fix.cpp;jetfix/tests/store_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MBOProcessor.cpp;md/MBOServiceServer.cpp;md/MDClient.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/Product.cpp;md/SecurityCache.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SecurityMapper.cpp;md/SecurityOracle.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/ice/ICEUtils.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/service/MarketDataServiceServer.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/mbo_tests.cpp;md/test/md2_tests.cpp;md/test/md_test_utils.cpp;md/test/synthetic_book_merge_tests.cpp;md/vendor/OnixsUtils.cpp;mercury/actors/IPollableActor.cpp;mercury/broker/Broker.cpp;mercury/broker/BrokerProxy.cpp;mercury/broker/ILocalBroker.cpp;mercury/broker/IRemoteBroker.cpp;mercury/common/mercury_common.cpp;mercury/events/TimerEvent.cpp;mercury/executor/ExecutoLine truncated
|
||||
@@ -1 +1 @@
|
||||
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/service_helpers/PositionUtilities.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/BasePositionService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/MarketDataService.proto;api/services/MoneyFileService.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/position_cfg.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/AlgoTypes.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/position_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spreader.proto;config/protos/subprocess.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/sod.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MBOProcessor.cpp;md/MBOServiceServer.cpp;md/MDClient.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/Product.cpp;md/SecurityCache.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SecurityMapper.cpp;md/SecurityOracle.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/ice/ICEUtils.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/service/MarketDataServiceServer.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/mbo_tests.cpp;md/test/md2_tests.cpp;md/test/md_test_utils.cpp;md/test/synthetic_book_merge_tests.cpp;md/vendor/OnixsUtils.cpp;os/os.cpp;os/tests/os_tests.cpp;quickbus/core/LocalNode.cpp;quickbus/core/Quickbus.cpp;quickbus/core/SubscriptionID.cpp;quickbus/core/TableID.cpp;quickbus/message_model/Update.cpp;quickbus/message_model/merge_updates.cpp;quickbus/network/QBConnection.cpp;quickbus/network/QBConnectionManager.cpp;quickbus/network/endpoint_description.cpp;quickbus/network/quickbus_msgs.proto;quickbus/pubsub/TablePublisher.cpp;quickbus/pubsub/TableSubscriber.cpp;quickbus/pubsub/tests/qb_pubsub_tests.cpp;quickbus/routing/INode.cpp;quickbus/routing/NodeID.cpp;quickbus/routing/Router.cpp;quickbus/rpc/RPCClient.cpp;quickbus/rpc/RPCServer.cpp;quickbus/rpc/RPCSessionID.cpp;quickbus/rpc/rpc_utils.cpp;quickbus/rpc/tests/qb_rpc_tests.cpp;quickbus/tests/quickbus_tests.cpp;sparkproto/SparkProtos.proto;testing/catch_test_runner.cpp;utils/AuthSessioLine truncated
|
||||
set(sources api/apicore.proto;api/apigateway.proto;api/apioptions.proto;api/core/ApiClientInterop.cpp;api/core/ApiServerInterop.cpp;api/public/ApiServer.cpp;api/public/ClientChannel.cpp;api/public/QuickbusClientChannel.cpp;api/public/ServerChannel.cpp;api/public/ServiceContext.cpp;api/service_helpers/AdminServiceUtils.cpp;api/service_helpers/AlgoServiceUtils.cpp;api/service_helpers/PositionUtilities.cpp;api/services/AdminService.proto;api/services/AlgoDefinitionService.proto;api/services/AlgoService.proto;api/services/ApiUnitTestService.proto;api/services/AuthService.proto;api/services/BasePositionService.proto;api/services/ErrorReportService.proto;api/services/HelloService.proto;api/services/MBOService.proto;api/services/MarginService.proto;api/services/MarketDataAuxiliaryService.proto;api/services/MarketDataRelay.proto;api/services/MarketDataService.proto;api/services/MoneyFileService.proto;api/services/OrderService.proto;api/services/OutOfProcessURLListener.proto;api/services/PersistenceService.proto;api/services/PositionService.proto;api/services/ShellDiagnosticService.proto;api/services/ShellLatencyService.proto;api/services/SyntheticSecurityService.proto;api/test/ApiTests.cpp;api/test/HelloServiceServer.cpp;config/ConfigCheck.cpp;config/ConfigDownloader.cpp;config/ConfigErrorCollector.cpp;config/ConfigLog.cpp;config/ConfigPropertyEvaluator.cpp;config/ConfigValueQueue.cpp;config/ConfigurationException.cpp;config/ConfigurationState.cpp;config/PreprocessInputStream.cpp;config/config.cpp;config/defaults/MarketData.conf;config/defaults/Ports.conf;config/defaults/Symbols.conf;config/defaults/cme_reference_data.conf;config/defaults/edge.conf;config/defaults/jetfix.conf;config/defaults/keycode.conf;config/defaults/logging.conf;config/defaults/orderman_cfg.conf;config/defaults/orders_fills_cleanup.conf;config/defaults/position_cfg.conf;config/defaults/span.conf;config/defaults/spreader.conf;config/defaults/testkeys.conf;config/defaults/threads.conf;config/defaults/toggles.conf;config/extensions/extensions.proto;config/invalid/invalid.proto;config/protos/AlgoTypes.proto;config/protos/ExchangeSimCfg.proto;config/protos/MarketData.proto;config/protos/Ports.proto;config/protos/Symbols.proto;config/protos/UI.proto;config/protos/cme_reference_data.proto;config/protos/jetfix.proto;config/protos/keycode.proto;config/protos/logging.proto;config/protos/mercury_cfg.proto;config/protos/orderman_cfg.proto;config/protos/orders_fills_cleanup.proto;config/protos/perflog_cfg.proto;config/protos/position_cfg.proto;config/protos/quickbus_cfg.proto;config/protos/span.proto;config/protos/spartan.proto;config/protos/spreader.proto;config/protos/subprocess.proto;config/protos/system.proto;config/protos/testkeys.proto;config/protos/threads.proto;config/protos/toggles.proto;config/tests/HTTPServer.cpp;config/tests/config_ref_tests.cpp;config/tests/config_tests.cpp;config/text_format/text_format.cpp;domain_model/Security.cpp;domain_model/Security.proto;domain_model/SecurityTests.cpp;domain_model/sod.cpp;domain_model/tests/domain_tests.cpp;expression/BooleanGrammar.cpp;expression/ExpressionEvaluator.cpp;expression/ParserExceptions.cpp;expression/Value.cpp;expression/tests/expression_parser_tests.cpp;logging/LoggerHub.cpp;logging/Sink.cpp;logging/logging.cpp;logging/tests/logging_tests.cpp;md/Diag/MDPeriodicDumper.cpp;md/Diag/ShmDumper.cpp;md/MBOProcessor.cpp;md/MBOServiceServer.cpp;md/MDClient.cpp;md/MDConsumer.cpp;md/MDConsumerHandle.cpp;md/MDConsumerInterop.cpp;md/MDProducer.cpp;md/MDProducerHandle.cpp;md/MemorySegmentUtils.cpp;md/PlatformLoader.cpp;md/PriceSize.cpp;md/Product.cpp;md/SecurityCache.cpp;md/SecurityDB.cpp;md/SecurityIDRecorder.cpp;md/SecurityMapper.cpp;md/SecurityOracle.cpp;md/SettlementRecorder.cpp;md/Shm/FixedSecurity.cpp;md/SyntheticSecurityService.cpp;md/cme/MDP3Utils.cpp;md/common.cpp;md/ice/ICEUtils.cpp;md/protos/co2.proto;md/relay/QueryServer.cpp;md/relay/RelayClient.cpp;md/relay/RelayRecorder.cpp;md/service/MarketDataServiceServer.cpp;md/test/Co2ManagedTestHelper.cpp;md/test/Co2TestInstrument.cpp;md/test/mbo_tests.cpp;md/test/md2_tests.cpp;md/test/md_test_utils.cpp;md/test/synthetic_book_merge_tests.cpp;md/vendor/OnixsUtils.cpp;os/os.cpp;os/tests/os_tests.cpp;quickbus/core/LocalNode.cpp;quickbus/core/Quickbus.cpp;quickbus/core/SubscriptionID.cpp;quickbus/core/TableID.cpp;quickbus/message_model/Update.cpp;quickbus/message_model/merge_updates.cpp;quickbus/network/QBConnection.cpp;quickbus/network/QBConnectionManager.cpp;quickbus/network/endpoint_description.cpp;quickbus/network/quickbus_msgs.proto;quickbus/pubsub/TablePublisher.cpp;quickbus/pubsub/TableSubscriber.cpp;quickbus/pubsub/tests/qb_pubsub_tests.cpp;quickbus/routing/INode.cpp;quickbus/routing/NodeID.cpp;quickbus/routing/Router.cpp;quickbus/rpc/RPCClient.cpp;quickbus/rpc/RPCServer.cpp;quickbus/rpc/RPCSessionID.cpp;quickbus/rpc/rpc_utils.cpp;quickbus/rpc/tests/qb_rpc_tests.cpp;quickbus/tests/quickbus_tests.cpp;sparkproto/SparkProtos.proto;testing/catch_testLine truncated
|
||||
@@ -130,9 +130,13 @@ else ()
|
||||
cryptopp
|
||||
pugixml
|
||||
lttng-ust
|
||||
Pcap++
|
||||
Packet++
|
||||
Common++
|
||||
ssh2
|
||||
-lrt
|
||||
-ldl
|
||||
-lpcap
|
||||
-static-libgcc
|
||||
-static-libstdc++
|
||||
-pthread)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
syntax='proto2';
|
||||
package bts.config;
|
||||
|
||||
message SpartanTASCfg {
|
||||
message TASSide {
|
||||
required uint32 quantity = 2;
|
||||
required int32 ticks_away = 3;
|
||||
}
|
||||
message TASTrigger {
|
||||
required string security = 1;
|
||||
required TASSide buy = 3;
|
||||
required TASSide sell = 4;
|
||||
}
|
||||
|
||||
required string user = 1;
|
||||
required string account = 2;
|
||||
|
||||
repeated TASTrigger tas_trigger = 3;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,18 @@ std::string descriptor(api::Security const &sec) {
|
||||
return "No descriptor for non glbx / ice exchange";
|
||||
}
|
||||
|
||||
api::SecurityType security_type(api::Security const&sec) {
|
||||
if (sec.has_future())
|
||||
return api::SecurityType::SECURITYTYPE_FUTURE;
|
||||
else if (sec.has_option())
|
||||
return api::SecurityType::SECURITYTYPE_OPTION;
|
||||
else if (sec.has_spread())
|
||||
return api::SecurityType::SECURITYTYPE_SPREAD;
|
||||
else if (sec.has_synthetic())
|
||||
return api::SecurityType::SECURITYTYPE_SYNTHETIC;
|
||||
else
|
||||
return api::SecurityType::SECURITYTYPE_UNSET;
|
||||
}
|
||||
|
||||
boost::gregorian::date smallest_leg(
|
||||
::google::protobuf::RepeatedPtrField<::bts::api::ContractLeg> const &l) {
|
||||
|
||||
@@ -26,6 +26,7 @@ SecurityKey security_key(api::Security const &);
|
||||
std::string to_str(api::Security const &);
|
||||
std::pair<bool, api::Security> from_str(std::string const &);
|
||||
std::string descriptor(api::Security const &);
|
||||
api::SecurityType security_type(api::Security const&);
|
||||
|
||||
inline std::string const &side_name(api::Side side) {
|
||||
return api::Side_Name(side);
|
||||
@@ -41,6 +42,30 @@ inline api::Side other_side(api::Side side) {
|
||||
return side;
|
||||
}
|
||||
}
|
||||
template <class V> class TwoSided {
|
||||
public:
|
||||
TwoSided() : buy(), sell() {}
|
||||
|
||||
TwoSided(V const &buy, V const &sell) : buy(buy), sell(sell) {}
|
||||
|
||||
V const &get(api::Side side) const {
|
||||
if (side == api::SIDE_BUY)
|
||||
return buy;
|
||||
else
|
||||
return sell;
|
||||
}
|
||||
|
||||
void set(api::Side side, V const &v) {
|
||||
if (side == api::SIDE_BUY)
|
||||
buy = v;
|
||||
else
|
||||
sell = v;
|
||||
}
|
||||
|
||||
private:
|
||||
V buy;
|
||||
V sell;
|
||||
};
|
||||
|
||||
inline double market_epsilon() { return 1e-10; }
|
||||
|
||||
@@ -90,6 +115,25 @@ inline Price better_price(api::Side side, Price p1, Price p2) {
|
||||
return is_equal_or_better(side, p1, p2) ? p1 : p2;
|
||||
}
|
||||
|
||||
// Returns the worst possible price representable in the Price data type for the side in question
|
||||
inline Price worst_price(api::Side side) {
|
||||
switch (side) {
|
||||
case api::SIDE_BUY:
|
||||
return Price {std::numeric_limits<double>::min()};
|
||||
case api::SIDE_SELL:
|
||||
return Price {std::numeric_limits<double>::max()};
|
||||
default:
|
||||
bts_assert(false);
|
||||
break;
|
||||
}
|
||||
bts_assert(false);
|
||||
return Price(0);
|
||||
}
|
||||
|
||||
inline Price best_price(api::Side side) {
|
||||
return worst_price(other_side(side));
|
||||
}
|
||||
|
||||
inline Price decode_exchange_price(api::Security const &sec, Price in) {
|
||||
return Price(in.value() * sec.contract_spec().price_multiplier());
|
||||
}
|
||||
@@ -180,17 +224,15 @@ inline int price_diff_to_ticks(double price_1, double price_2,
|
||||
}
|
||||
// returns the difference (in ticks) bw and order and a market.
|
||||
// if the order has crossed the market, returns -ve ticks
|
||||
// (ie the buy order price > market_price or
|
||||
// (ie the buy order price > market_price or
|
||||
// sell_order_price < market_price)
|
||||
inline int order_diff_market(double order_price,
|
||||
double market_price,
|
||||
api::Side side,
|
||||
double tick_size){
|
||||
inline int order_diff_market(double order_price, double market_price,
|
||||
api::Side side, double tick_size) {
|
||||
switch (side) {
|
||||
case api::SIDE_BUY:
|
||||
return price_diff_to_ticks(order_price,market_price,tick_size);
|
||||
return price_diff_to_ticks(order_price, market_price, tick_size);
|
||||
case api::SIDE_SELL:
|
||||
return price_diff_to_ticks(market_price,order_price,tick_size);
|
||||
return price_diff_to_ticks(market_price, order_price, tick_size);
|
||||
default:
|
||||
bts_assert(false);
|
||||
break;
|
||||
|
||||
@@ -50,6 +50,12 @@ public:
|
||||
std::vector<jetfix::FIXEncodingStream> fix;
|
||||
|
||||
jetfix::FIXEncodingStream& first_stream() {bts_assert (fix.size()); return fix[0];}
|
||||
|
||||
void close_all() {
|
||||
for (auto &s : fix)
|
||||
s.close();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -144,6 +144,8 @@ CoreGateway::~CoreGateway() {
|
||||
me->timer_thread.join();
|
||||
}
|
||||
|
||||
config::JetFIX::Connection const &CoreGateway::cfg() {return me->cfg;}
|
||||
|
||||
void CoreGateway::send(OutFIXPtr const &fix, trace::CorID trace) {
|
||||
me->event_queue.push(EventData(&CoreGateway::sync_send, trace, fix));
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ public:
|
||||
trace::PerfLog &);
|
||||
|
||||
~CoreGateway();
|
||||
config::JetFIX::Connection const &cfg();
|
||||
|
||||
void start ();
|
||||
void stop ();
|
||||
void send (OutFIXPtr const &msgs, trace::CorID trace);
|
||||
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
void stop () {_core.stop ();}
|
||||
void send (OutFIXPtr const &msgs,trace::CorID trace ) {_core.send (msgs,trace);}
|
||||
void dispatch_events () {_core.dispatch_events ();}
|
||||
|
||||
config::JetFIX::Connection const&cfg () {return _core.cfg();}
|
||||
|
||||
std::function<void()> &on_ready () {return _on_ready;}
|
||||
std::function<void()> &on_disconnect () {return _on_disconnect;}
|
||||
|
||||
+50
-61
@@ -2,85 +2,79 @@
|
||||
|
||||
#include "lib/logging/logging.h"
|
||||
#include "lib/os/os.h"
|
||||
#include "lib/utils/bts_assert.h"
|
||||
#include "lib/utils/datetime.h"
|
||||
#include "lib/utils/file_utils.h"
|
||||
#include "lib/utils/bts_assert.h"
|
||||
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <fmt/ostream.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
|
||||
namespace bts {
|
||||
namespace log {
|
||||
|
||||
|
||||
struct InitSysLog {
|
||||
InitSysLog() {
|
||||
#ifndef WIN32
|
||||
openlog("spark",0,LOG_USER);
|
||||
openlog("spark", 0, LOG_USER);
|
||||
#endif
|
||||
|
||||
}
|
||||
} init;
|
||||
} init;
|
||||
|
||||
|
||||
auto formatter(LoggingConfig const&cfg) {
|
||||
return [cfg] (LogMsg const&m) {
|
||||
auto formatter(LoggingConfig const &cfg) {
|
||||
return [cfg](LogMsg const &m) {
|
||||
auto iso_date = datetime::iso_date_time_string(datetime::local_now());
|
||||
iso_date[sizeof("YYYY-MM-DD")-1] = ' ';
|
||||
iso_date[sizeof("YYYY-MM-DD") - 1] = ' ';
|
||||
#ifdef _WIN32
|
||||
return fmt::format("{}|{}|{:<8}|{:<5}|{:<3}|{:<4}|{:<35}|{}|{} ",
|
||||
iso_date,
|
||||
m.ts,
|
||||
m.subsystem_name,
|
||||
m.level_name,
|
||||
m.tid,
|
||||
//m.thread_name,
|
||||
os::process_id(),
|
||||
fmt::format("{}:{}",boost::filesystem::path(m.file).filename().string() , m.line),
|
||||
cfg.deployment_type,
|
||||
m.msg);
|
||||
return fmt::format(
|
||||
"{}|{}|{:<8}|{:<5}|{:<3}|{:<4}|{:<35}|{}|{} ", iso_date, m.ts,
|
||||
m.subsystem_name, m.level_name, m.tid,
|
||||
// m.thread_name,
|
||||
os::process_id(),
|
||||
fmt::format("{}:{}",
|
||||
boost::filesystem::path(m.file).filename().string(),
|
||||
m.line),
|
||||
cfg.deployment_type, m.msg);
|
||||
#else
|
||||
return fmt::format("{}|{}|{:<8}|{:<5}|{:<3}|{:<16}|{:<4}|{:<35}|{}|{} ",
|
||||
iso_date,
|
||||
m.ts,
|
||||
m.subsystem_name,
|
||||
m.level_name,
|
||||
m.tid,
|
||||
m.thread_name,
|
||||
os::process_id(),
|
||||
fmt::format("{}:{}",boost::filesystem::path(m.file).filename().string() , m.line),
|
||||
cfg.deployment_type,
|
||||
m.msg);
|
||||
return fmt::format(
|
||||
"{}|{}|{:<8}|{:<5}|{:<3}|{:<16}|{:<4}|{:<35}|{}|{} ", iso_date, m.ts,
|
||||
m.subsystem_name, m.level_name, m.tid, m.thread_name,
|
||||
os::process_id(),
|
||||
fmt::format("{}:{}",
|
||||
boost::filesystem::path(m.file).filename().string(),
|
||||
m.line),
|
||||
cfg.deployment_type, m.msg);
|
||||
#endif
|
||||
};
|
||||
}
|
||||
|
||||
Sink console_sink(LoggingConfig const&cfg) {
|
||||
auto f = formatter(cfg);
|
||||
return [f] (LogMsg const &m) {std::cout << f(m) << std::endl;};
|
||||
Sink console_sink(LoggingConfig const &) {
|
||||
return [](LogMsg const &m) {
|
||||
std::cout << fmt::format("{:<8} | {}", m.subsystem_name, m.msg)
|
||||
<< std::endl;
|
||||
};
|
||||
}
|
||||
|
||||
Sink syslog_sink(LoggingConfig const&cfg) {
|
||||
Sink syslog_sink(LoggingConfig const &cfg) {
|
||||
#ifdef WIN32
|
||||
return null_sink();
|
||||
#else
|
||||
auto f = formatter(cfg);
|
||||
return [f] (LogMsg const &m) {syslog (LOG_INFO | LOG_USER,"%s",f(m).c_str ());};
|
||||
return [f](LogMsg const &m) {
|
||||
syslog(LOG_INFO | LOG_USER, "%s", f(m).c_str());
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
std::ifstream::pos_type filesize(std::string const&filename)
|
||||
{
|
||||
if(!boost::filesystem::exists(filename))
|
||||
std::ifstream::pos_type filesize(std::string const &filename) {
|
||||
if (!boost::filesystem::exists(filename))
|
||||
return 0;
|
||||
else {
|
||||
std::ifstream in(filename, std::ifstream::ate | std::ifstream::binary);
|
||||
@@ -88,24 +82,21 @@ std::ifstream::pos_type filesize(std::string const&filename)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Sink file_sink(LoggingConfig const&cfg) {
|
||||
Sink file_sink(LoggingConfig const &cfg) {
|
||||
static std::ofstream stream;
|
||||
static uint64_t bytes_written = 0;
|
||||
static uint64_t bytes_written = 0;
|
||||
const auto max_sz = 120 * 1024 * 1024;
|
||||
|
||||
auto f= formatter(cfg);
|
||||
|
||||
auto f = formatter(cfg);
|
||||
auto path = log_path();
|
||||
path /= "log";
|
||||
|
||||
|
||||
auto parent = path.parent_path();
|
||||
|
||||
|
||||
if (!boost::filesystem::is_directory(parent))
|
||||
if (!boost::filesystem::is_directory(parent))
|
||||
bts_assert(boost::filesystem::create_directories(parent));
|
||||
|
||||
if(boost::filesystem::exists(path)) {
|
||||
if (boost::filesystem::exists(path)) {
|
||||
auto sz = boost::filesystem::file_size(path);
|
||||
if (sz > max_sz) {
|
||||
auto backup = boost::filesystem::path(path.string() + ".old");
|
||||
@@ -113,10 +104,9 @@ Sink file_sink(LoggingConfig const&cfg) {
|
||||
}
|
||||
}
|
||||
|
||||
stream = std::ofstream(path.string(),std::ofstream::app);
|
||||
|
||||
return [=] (LogMsg const &m) {
|
||||
stream = std::ofstream(path.string(), std::ofstream::app);
|
||||
|
||||
return [=](LogMsg const &m) {
|
||||
auto msg = f(m);
|
||||
bytes_written += msg.size();
|
||||
if (bytes_written >= max_sz) {
|
||||
@@ -124,16 +114,15 @@ Sink file_sink(LoggingConfig const&cfg) {
|
||||
stream.close();
|
||||
auto backup = boost::filesystem::path(path.string() + ".old");
|
||||
boost::filesystem::rename(path, backup);
|
||||
stream = std::ofstream(path.string(),std::ofstream::app);
|
||||
stream = std::ofstream(path.string(), std::ofstream::app);
|
||||
}
|
||||
stream << f(m) << std::endl;
|
||||
};
|
||||
}
|
||||
|
||||
Sink null_sink() {
|
||||
return [](const LogMsg&) {};
|
||||
return [](const LogMsg &) {};
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
|
||||
} // namespace log
|
||||
} // namespace bts
|
||||
@@ -120,7 +120,8 @@ void configure_logging(bts::config::Logging const&cfg, bts::config::ThreadGroupC
|
||||
{log::Plugin,"Plugin"},
|
||||
{log::Sdk,"Sdk"},
|
||||
{log::Http,"Http"},
|
||||
{log::iLink3,"ilink3"},
|
||||
{log::Spartan,"Spartan"},
|
||||
{log::iLink3,"ilink3"},
|
||||
};
|
||||
|
||||
real_cfg.sinks["console"] =
|
||||
|
||||
@@ -45,8 +45,9 @@ constexpr log::Subsystem Latency {Testing.ordinal+1 };
|
||||
constexpr log::Subsystem DataFlow {Latency.ordinal+1 };
|
||||
constexpr log::Subsystem Plugin {DataFlow.ordinal+1 };
|
||||
constexpr log::Subsystem Sdk {Plugin.ordinal+1 };
|
||||
constexpr log::Subsystem Http {Sdk.ordinal+1 };
|
||||
constexpr log::Subsystem iLink3 {Http.ordinal+1 };
|
||||
constexpr log::Subsystem Http {Sdk.ordinal+1 };
|
||||
constexpr log::Subsystem Spartan {Http.ordinal+1 };
|
||||
constexpr log::Subsystem iLink3 {Spartan.ordinal+1 };
|
||||
|
||||
struct LoggerHandle {
|
||||
LoggerHandle(LoggerHandle const&) = delete;
|
||||
|
||||
@@ -60,10 +60,10 @@ class IntPrice {
|
||||
return delta.mantissa() < 0;
|
||||
}
|
||||
}
|
||||
bool operator <=(const IntPrice& other) {
|
||||
bool operator <=(const IntPrice& other) const {
|
||||
return *this == other || *this < other;
|
||||
}
|
||||
bool operator >=(const IntPrice& other) {
|
||||
bool operator >=(const IntPrice& other) const {
|
||||
return !(*this < other);
|
||||
}
|
||||
IntPrice operator - (const IntPrice& o) const {
|
||||
|
||||
@@ -75,7 +75,7 @@ void apply_compatibilit_mutations(Security& security) {
|
||||
}
|
||||
|
||||
size_t load_securities(
|
||||
const std::set<UserSymbol>& symbols,
|
||||
std::function<bool(const UserSymbol &symbo)> const&sym_filter,
|
||||
const std::function<void(const api::Security&)>& callback) {
|
||||
|
||||
size_t count = 0;
|
||||
@@ -92,7 +92,7 @@ size_t load_securities(
|
||||
api::Venue venue = (api::Venue)(int) select_stmt.getColumn("venue");
|
||||
auto type = (api::SecurityType)(int) select_stmt.getColumn("type");
|
||||
UserSymbol us(symbol, venue, type);
|
||||
if (symbols.find(us) != symbols.end()) {
|
||||
if (sym_filter(us)) {
|
||||
auto blob = select_stmt.getColumn("security_blob");
|
||||
if (security.ParseFromArray(blob, blob.getBytes())) {
|
||||
apply_compatibilit_mutations(security);
|
||||
@@ -109,6 +109,14 @@ size_t load_securities(
|
||||
return count;
|
||||
}
|
||||
|
||||
size_t load_securities(
|
||||
const std::set<UserSymbol>& symbols,
|
||||
const std::function<void(const api::Security&)>& callback) {
|
||||
return load_securities([&symbols] (UserSymbol const&symbol) {
|
||||
return symbols.find(symbol) != symbols.end();
|
||||
},callback);
|
||||
}
|
||||
|
||||
SecurityPtr find_security(SecurityKey key) {
|
||||
try {
|
||||
auto db = open_db();
|
||||
|
||||
@@ -28,6 +28,10 @@ size_t load_securities(
|
||||
const std::set<UserSymbol>& symbols,
|
||||
const std::function<void(const api::Security&)>& callback);
|
||||
|
||||
size_t load_securities(
|
||||
std::function<bool(const UserSymbol &symbo)> const&sym_filter,
|
||||
const std::function<void(const api::Security&)>& callback) ;
|
||||
|
||||
SecurityPtr find_security(SecurityKey);
|
||||
|
||||
Result insert_or_replace(const std::vector<SecurityPtr>&);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <pugixml/pugixml.hpp>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
|
||||
|
||||
@@ -22,6 +23,27 @@ using namespace bts::api;
|
||||
namespace bts {
|
||||
namespace md {
|
||||
|
||||
std::ostream& operator<<(std::ostream&out, md::CMEConnection const&c)
|
||||
{
|
||||
out << "feed_type: " << c.feed_type
|
||||
<< " ip: " << c.ip
|
||||
<< " port: " << c.port
|
||||
<< " feed: " << c.feed;
|
||||
return out;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream&out, md::CMEChannel const &ch) {
|
||||
out << "id: " << ch.id << "\n";
|
||||
out << "symbols: \n";
|
||||
for (auto s : ch.symbols)
|
||||
out << "\t" << s.symbol() << ":" << api::SecurityType_Name(s.type()) << "\n" ;
|
||||
out << "Connections:\n";
|
||||
for (auto const &[st,c] : ch.connections)
|
||||
out << "\t" << st << " -> {" << c << "}\n";
|
||||
out << "\n";
|
||||
return out;
|
||||
}
|
||||
|
||||
string data_path() {
|
||||
auto p = config::get<config::System>().data_path() + "cme_mdp3/";
|
||||
#ifdef _WIN32
|
||||
@@ -169,4 +191,4 @@ const vector<CMEChannel> parse_channels(const vector<UserSymbol>& symbols) {
|
||||
|
||||
|
||||
}} //namespace
|
||||
#endif
|
||||
#endif
|
||||
@@ -6,7 +6,6 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace bts {
|
||||
namespace md {
|
||||
|
||||
@@ -23,6 +22,9 @@ struct CMEChannel {
|
||||
std::map<std::string, CMEConnection> connections;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream&out, md::CMEConnection const&c);
|
||||
std::ostream& operator<<(std::ostream&out, md::CMEChannel const &ch);
|
||||
|
||||
void await_cme_config();
|
||||
const std::vector<CMEChannel> get_configured_cme_channels();
|
||||
const std::vector<CMEChannel> parse_channels(const std::vector<UserSymbol>& symbols);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "ICEExecutionGateway.h"
|
||||
#include "lib/api/services/AdminService.pb.h"
|
||||
#include "lib/jetfix/codec/MessageDefinitions.h"
|
||||
#include "lib/jetfix/codec/i32_toa.h"
|
||||
#include "lib/jetfix/common/OutFIX.h"
|
||||
@@ -6,19 +7,18 @@
|
||||
#include "lib/logging/logging.h"
|
||||
#include "lib/orderman/events/CancelRejectEvent.h"
|
||||
#include "lib/orderman/events/GatewayStatusChangeEvent.h"
|
||||
#include "lib/orderman/events/NewAdminDataEvent.h"
|
||||
#include "lib/orderman/events/NewExecutionReportEvent.h"
|
||||
#include "lib/orderman/events/NewSecuritiesEvent.h"
|
||||
#include "lib/orderman/orderman_utils/fix_order_codec.h"
|
||||
#include "lib/api/services/AdminService.pb.h"
|
||||
#include "lib/orderman/events/NewAdminDataEvent.h"
|
||||
#include "lib/tracing/bts_trace.h"
|
||||
#include "lib/utils/TimeStamp.h"
|
||||
#include "lib/utils/helper_macros.h"
|
||||
#include "lib/utils/Dispatcher.h"
|
||||
#include "lib/utils/TimeStamp.h"
|
||||
#include "lib/utils/bts_chrono.h"
|
||||
#include "lib/utils/helper_macros.h"
|
||||
|
||||
#include <boost/pool/object_pool.hpp>
|
||||
#include <atomic>
|
||||
#include <boost/pool/object_pool.hpp>
|
||||
#include <set>
|
||||
|
||||
namespace bts {
|
||||
@@ -26,20 +26,19 @@ namespace orderman {
|
||||
|
||||
using namespace jetfix;
|
||||
|
||||
using JFGw = JetFIXGateway<fix::ICEExecutionReportMsg, fix::BusinessMessageRejectMsg, fix::RejectMsg,
|
||||
fix::ICECancelRejectMsg, fix::ICETraderLoginResponseMsg, fix::ICETraderLogoutResponseMsg>;
|
||||
using JFGw =
|
||||
JetFIXGateway<fix::ICEExecutionReportMsg, fix::BusinessMessageRejectMsg,
|
||||
fix::RejectMsg, fix::ICECancelRejectMsg,
|
||||
fix::ICETraderLoginResponseMsg,
|
||||
fix::ICETraderLogoutResponseMsg>;
|
||||
|
||||
|
||||
|
||||
struct ICEExecutionGateway::PImpl
|
||||
{
|
||||
struct ICEExecutionGateway::PImpl {
|
||||
PImpl(const config::JetFIX::Connection &cfg, trace::PerfLog &l,
|
||||
md::SecurityOracle o)
|
||||
: gw(cfg, l), exe_report_pool(), state(State::WAITING_FOR_SECURITIES),
|
||||
securities(), securities_by_exchange_id(), gw_name(cfg.name()),
|
||||
cfg(cfg), perf_log(l), admin_data(), nusers(-1), connection_time(), exec_id_to_memo(),
|
||||
sec_oracle(o)
|
||||
{}
|
||||
cfg(cfg), perf_log(l), admin_data(), nusers(-1), connection_time(),
|
||||
exec_id_to_memo(), sec_oracle(o) {}
|
||||
|
||||
JFGw gw;
|
||||
boost::object_pool<ExecutionReport> exe_report_pool;
|
||||
@@ -55,287 +54,285 @@ struct ICEExecutionGateway::PImpl
|
||||
api::admin::AdminData admin_data;
|
||||
std::atomic<int> nusers;
|
||||
TimeStamp connection_time;
|
||||
std::unordered_map<std::string, std::string> exec_id_to_memo; //for the bullshit adjusts
|
||||
std::unordered_map<std::string, std::string>
|
||||
exec_id_to_memo; // for the bullshit adjusts
|
||||
md::SecurityOracle sec_oracle;
|
||||
};
|
||||
|
||||
ICEExecutionGateway::ICEExecutionGateway(const config::JetFIX::Connection &cfg, trace::PerfLog &log, md::SecurityOracle o)
|
||||
: IExecutionGateway(), me(new PImpl(cfg, log, o))
|
||||
{
|
||||
ICEExecutionGateway::ICEExecutionGateway(const config::JetFIX::Connection &cfg,
|
||||
trace::PerfLog &log,
|
||||
md::SecurityOracle o)
|
||||
: IExecutionGateway(), me(new PImpl(cfg, log, o)) {
|
||||
me->state = State::WAITING_FOR_ADMIN;
|
||||
}
|
||||
|
||||
ICEExecutionGateway::~ICEExecutionGateway() {}
|
||||
|
||||
void ICEExecutionGateway::on_admin_data(const mercury::Update<NewAdminDataEvent>& update)
|
||||
{
|
||||
if (update.events)
|
||||
{
|
||||
for (auto const &ev : *(update.events))
|
||||
void ICEExecutionGateway::on_admin_data(
|
||||
const mercury::Update<NewAdminDataEvent> &update) {
|
||||
if (update.events) {
|
||||
for (auto const &ev : *(update.events))
|
||||
me->admin_data.CopyFrom(*ev.admin_data);
|
||||
|
||||
if (me->state == State::WAITING_FOR_ADMIN)
|
||||
{
|
||||
LOG(OrderMan, Warn, "Received admin data. Waiting for securities {}", me->gw_name.value());
|
||||
if (me->state == State::WAITING_FOR_ADMIN) {
|
||||
LOG(OrderMan, Warn, "Received admin data. Waiting for securities {}",
|
||||
me->gw_name.value());
|
||||
me->state = State::WAITING_FOR_SECURITIES;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ICEExecutionGateway::on_securities(const mercury::Update<NewSecuritiesEvent> &update)
|
||||
{
|
||||
if (update.events)
|
||||
{
|
||||
for (auto const &ev : *(update.events))
|
||||
{
|
||||
void ICEExecutionGateway::on_securities(
|
||||
const mercury::Update<NewSecuritiesEvent> &update) {
|
||||
if (update.events) {
|
||||
for (auto const &ev : *(update.events)) {
|
||||
auto sec_ptr = ev.security;
|
||||
me->securities[sec_ptr->id()] = sec_ptr;
|
||||
if(sec_ptr->has_ice())
|
||||
me->securities_by_exchange_id[sec_ptr->ice().exchange_id()] = sec_ptr;
|
||||
if (sec_ptr->has_ice())
|
||||
me->securities_by_exchange_id[sec_ptr->ice().exchange_id()] =
|
||||
sec_ptr;
|
||||
}
|
||||
|
||||
if (me->state == State::WAITING_FOR_SECURITIES)
|
||||
{
|
||||
LOG(OrderMan, Warn, "Received first set of {} securities. Beginning wait 2s for trader login {}",
|
||||
update.events->size(), me->gw_name.value());
|
||||
if (me->state == State::WAITING_FOR_SECURITIES) {
|
||||
LOG(OrderMan, Warn,
|
||||
"Received first set of {} securities. Beginning wait 2s for "
|
||||
"trader login {}",
|
||||
update.events->size(), me->gw_name.value());
|
||||
// got our security synopsis, ready to start the GW
|
||||
me->state = State::READY_TO_START_GW;
|
||||
|
||||
|
||||
// subscribe to gateway events
|
||||
me->gw.on<fix::ICEExecutionReportMsg>() = [this](auto const &msg)
|
||||
{
|
||||
me->gw.on<fix::ICEExecutionReportMsg>() = [this](auto const &msg) {
|
||||
this->on_exe_report(msg);
|
||||
};
|
||||
me->gw.on<fix::ICECancelRejectMsg>() = [this](auto const &msg)
|
||||
{
|
||||
me->gw.on<fix::ICECancelRejectMsg>() = [this](auto const &msg) {
|
||||
this->on_cancel_reject(msg);
|
||||
};
|
||||
me->gw.on_ready() = [this]()
|
||||
{
|
||||
me->gw.on_ready() = [this]() {
|
||||
this->on_connection_status_change(true);
|
||||
};
|
||||
me->gw.on_disconnect() = [this]()
|
||||
{
|
||||
me->gw.on_disconnect() = [this]() {
|
||||
this->on_connection_status_change(false);
|
||||
};
|
||||
me->gw.on<fix::BusinessMessageRejectMsg>() = [this](auto const &m)
|
||||
{
|
||||
me->gw.on<fix::BusinessMessageRejectMsg>() = [this](auto const &m) {
|
||||
this->on_business_reject(m);
|
||||
};
|
||||
me->gw.on<fix::RejectMsg>() = [this](auto const &m)
|
||||
{
|
||||
me->gw.on<fix::RejectMsg>() = [this](auto const &m) {
|
||||
this->on_session_reject(m);
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ICEExecutionGateway::start()
|
||||
{
|
||||
me->gw.start();
|
||||
bts_assert_msg(me->state == State::READY_TO_START_GW, "ICEExecutionGateway statemachine failure");
|
||||
void ICEExecutionGateway::start() {
|
||||
me->gw.start();
|
||||
bts_assert_msg(me->state == State::READY_TO_START_GW,
|
||||
"ICEExecutionGateway statemachine failure");
|
||||
}
|
||||
|
||||
void ICEExecutionGateway::on_connection_status_change(bool is_connected)
|
||||
{
|
||||
void ICEExecutionGateway::on_connection_status_change(bool is_connected) {
|
||||
LOG(OrderMan, Info, "Connection state of {} changed to {}",
|
||||
me->gw_name.value(), is_connected ? std::string("connected") : std::string("disconnected"));
|
||||
|
||||
if(is_connected && me->state == State::READY_TO_START_GW)
|
||||
{
|
||||
me->gw_name.value(),
|
||||
is_connected ? std::string("connected") : std::string("disconnected"));
|
||||
|
||||
if (is_connected && me->state == State::READY_TO_START_GW) {
|
||||
me->state = State::TRADER_LOGIN_TIMEOUT;
|
||||
me->connection_time = Timer::now();
|
||||
}
|
||||
|
||||
if(me->state == State::READY)
|
||||
{
|
||||
me->on_gw_status_change(is_connected);
|
||||
if(!is_connected) //if we disconnect, set state so we log in again
|
||||
}
|
||||
|
||||
if (me->state == State::READY) {
|
||||
me->on_gw_status_change(is_connected);
|
||||
if (!is_connected) // if we disconnect, set state so we log in again
|
||||
me->state = State::READY_TO_START_GW;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ICEExecutionGateway::on_trader_login_timeout_expired()
|
||||
{
|
||||
if (me->state == State::TRADER_LOGIN_TIMEOUT)
|
||||
{
|
||||
LOG(OrderMan, Warn, "Done waiting for login timeout, logging on traders {}", me->gw_name.value());
|
||||
void ICEExecutionGateway::on_trader_login_timeout_expired() {
|
||||
if (me->state == State::TRADER_LOGIN_TIMEOUT) {
|
||||
LOG(OrderMan, Warn,
|
||||
"Done waiting for login timeout, logging on traders {}",
|
||||
me->gw_name.value());
|
||||
|
||||
// got our security synopsis, ready to start the GW
|
||||
me->state = State::LOGIN_TIMEOUT_COMPLETE;
|
||||
me->gw.on<fix::ICETraderLoginResponseMsg>() = [&](const fix::ICETraderLoginResponseMsg& lmsg)
|
||||
{
|
||||
std::string u = lmsg.get<fix::UserName>();
|
||||
std::string m;
|
||||
if(lmsg.has<fix::Text>())
|
||||
m = lmsg.get<fix::Text>();
|
||||
LOG(OrderMan, Info, "Successfully logging trader {} into ICE {} {}", u, m, me->gw_name.value());
|
||||
if(--me->nusers == 0)
|
||||
this->on_login();
|
||||
};
|
||||
|
||||
me->gw.on<fix::ICETraderLogoutResponseMsg>() = [&](const fix::ICETraderLogoutResponseMsg& lmsg)
|
||||
{
|
||||
std::string u = lmsg.get<fix::UserName>();
|
||||
std::string m;
|
||||
if(lmsg.has<fix::Text>())
|
||||
m = lmsg.get<fix::Text>();
|
||||
|
||||
LOG(OrderMan, Error, "Error logging trader {} into ICE {} {}", u, m, me->gw_name.value());
|
||||
if(--me->nusers == 0)
|
||||
this->on_login();
|
||||
};
|
||||
|
||||
me->state = State::LOGIN_TIMEOUT_COMPLETE;
|
||||
me->gw.on<fix::ICETraderLoginResponseMsg>() =
|
||||
[&](const fix::ICETraderLoginResponseMsg &lmsg) {
|
||||
std::string u = lmsg.get<fix::UserName>();
|
||||
std::string m;
|
||||
if (lmsg.has<fix::Text>())
|
||||
m = lmsg.get<fix::Text>();
|
||||
LOG(OrderMan, Info,
|
||||
"Successfully logging trader {} into ICE {} {}", u, m,
|
||||
me->gw_name.value());
|
||||
if (--me->nusers == 0)
|
||||
this->on_login();
|
||||
};
|
||||
|
||||
me->gw.on<fix::ICETraderLogoutResponseMsg>() =
|
||||
[&](const fix::ICETraderLogoutResponseMsg &lmsg) {
|
||||
std::string u = lmsg.get<fix::UserName>();
|
||||
std::string m;
|
||||
if (lmsg.has<fix::Text>())
|
||||
m = lmsg.get<fix::Text>();
|
||||
|
||||
LOG(OrderMan, Error, "Error logging trader {} into ICE {} {}", u,
|
||||
m, me->gw_name.value());
|
||||
if (--me->nusers == 0)
|
||||
this->on_login();
|
||||
};
|
||||
|
||||
std::set<std::string> auth_traders;
|
||||
for(const auto& u : me->admin_data.users())
|
||||
{
|
||||
if(u.has_user_data() && u.user_data().has_exchange_user_data() && u.user_data().exchange_user_data().has_ice_data())
|
||||
{
|
||||
if(!u.is_present())
|
||||
for (const auto &u : me->admin_data.users()) {
|
||||
if (u.has_user_data() && u.user_data().has_exchange_user_data() &&
|
||||
u.user_data().exchange_user_data().has_ice_data()) {
|
||||
if (!u.is_present())
|
||||
continue;
|
||||
if(!u.is_active())
|
||||
if (!u.is_active())
|
||||
continue;
|
||||
const auto& ice = u.user_data().exchange_user_data().ice_data();
|
||||
if(auth_traders.find(ice.authorized_trader()) == auth_traders.end())
|
||||
{
|
||||
if(ice.authorized_trader() == "")
|
||||
const auto &ice = u.user_data().exchange_user_data().ice_data();
|
||||
if (auth_traders.find(ice.authorized_trader()) ==
|
||||
auth_traders.end()) {
|
||||
if (ice.authorized_trader() == "")
|
||||
continue;
|
||||
if(ice.company_id() <= 0)
|
||||
if (ice.company_id() <= 0)
|
||||
continue;
|
||||
if(me->nusers == -1)
|
||||
if (me->nusers == -1)
|
||||
me->nusers = 0;
|
||||
me->nusers++;
|
||||
|
||||
|
||||
auto result = std::make_shared<OutFIX>(me->cfg);
|
||||
auto &stream = result->fix.back();
|
||||
auto &buffer = stream.new_msg(MessageTypes::ICETraderLogin);
|
||||
buffer.add<fix::CompanyID>(ice.company_id());
|
||||
buffer.add<fix::UserName>(ice.authorized_trader());
|
||||
buffer.add<fix::RawData>(ice.password());
|
||||
|
||||
if(ice.mifid_direct_electronic_access() >= 0)
|
||||
buffer.add<fix::MifidDirectElectronicAccess>(ice.mifid_direct_electronic_access());
|
||||
if(ice.mifid_trading_capacity() >= 0)
|
||||
buffer.add<fix::MifidTradingCapacity>(ice.mifid_trading_capacity());
|
||||
if(ice.mifid_liquidity_provision() >= 0)
|
||||
buffer.add<fix::MifidLiquidityProvision>(ice.mifid_liquidity_provision());
|
||||
if(ice.mifid_commodity_deriv_indicator() >= 0)
|
||||
buffer.add<fix::MifidCommodityDerivIndicator>(ice.mifid_commodity_deriv_indicator());
|
||||
if(ice.mifid_investment_decision() > 0)
|
||||
buffer.add<fix::MifidInvestmentDecision>(ice.mifid_investment_decision());
|
||||
if(ice.mifid_execution_decision() > 0)
|
||||
buffer.add<fix::MifidExecutionDecision>(ice.mifid_execution_decision());
|
||||
if(ice.mifid_client_id_code() > 0)
|
||||
buffer.add<fix::MifidClientIDCode>(ice.mifid_client_id_code());
|
||||
if(ice.mifid_id() > 0)
|
||||
buffer.add<fix::MifidId>(ice.mifid_id());
|
||||
auto &buffer = stream.new_msg(MessageTypes::ICETraderLogin);
|
||||
buffer.add<fix::CompanyID>(ice.company_id());
|
||||
buffer.add<fix::UserName>(ice.authorized_trader());
|
||||
buffer.add<fix::RawData>(ice.password());
|
||||
|
||||
if (ice.mifid_direct_electronic_access() >= 0)
|
||||
buffer.add<fix::MifidDirectElectronicAccess>(
|
||||
ice.mifid_direct_electronic_access());
|
||||
if (ice.mifid_trading_capacity() >= 0)
|
||||
buffer.add<fix::MifidTradingCapacity>(
|
||||
ice.mifid_trading_capacity());
|
||||
if (ice.mifid_liquidity_provision() >= 0)
|
||||
buffer.add<fix::MifidLiquidityProvision>(
|
||||
ice.mifid_liquidity_provision());
|
||||
if (ice.mifid_commodity_deriv_indicator() >= 0)
|
||||
buffer.add<fix::MifidCommodityDerivIndicator>(
|
||||
ice.mifid_commodity_deriv_indicator());
|
||||
if (ice.mifid_investment_decision() > 0)
|
||||
buffer.add<fix::MifidInvestmentDecision>(
|
||||
ice.mifid_investment_decision());
|
||||
if (ice.mifid_execution_decision() > 0)
|
||||
buffer.add<fix::MifidExecutionDecision>(
|
||||
ice.mifid_execution_decision());
|
||||
if (ice.mifid_client_id_code() > 0)
|
||||
buffer.add<fix::MifidClientIDCode>(
|
||||
ice.mifid_client_id_code());
|
||||
if (ice.mifid_id() > 0)
|
||||
buffer.add<fix::MifidId>(ice.mifid_id());
|
||||
stream.close();
|
||||
|
||||
trace::CorID trace;
|
||||
|
||||
trace::CorID trace;
|
||||
send_fix(result, trace);
|
||||
auth_traders.insert(ice.authorized_trader());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
LOG(OrderMan, Warn, "{} traders identified as ICE traders {}", auth_traders.size(), me->gw_name.value());
|
||||
LOG(OrderMan, Warn, "{} traders identified as ICE traders {}",
|
||||
auth_traders.size(), me->gw_name.value());
|
||||
}
|
||||
}
|
||||
|
||||
void ICEExecutionGateway::on_login()
|
||||
{
|
||||
if (me->state == State::LOGIN_TIMEOUT_COMPLETE)
|
||||
{
|
||||
void ICEExecutionGateway::on_login() {
|
||||
if (me->state == State::LOGIN_TIMEOUT_COMPLETE) {
|
||||
LOG(OrderMan, Warn, "Successful login traders {}", me->gw_name.value());
|
||||
me->state = State::READY;
|
||||
me->on_gw_status_change(true);
|
||||
}
|
||||
me->state = State::READY;
|
||||
me->on_gw_status_change(true);
|
||||
}
|
||||
}
|
||||
|
||||
OnExeReport &ICEExecutionGateway::on_exe_report() { return me->on_exe_report; }
|
||||
|
||||
OnGwStatusChange &ICEExecutionGateway::on_gw_status_change()
|
||||
{
|
||||
OnGwStatusChange &ICEExecutionGateway::on_gw_status_change() {
|
||||
return me->on_gw_status_change;
|
||||
}
|
||||
|
||||
OnCancelReject &ICEExecutionGateway::on_cancel_reject()
|
||||
{
|
||||
OnCancelReject &ICEExecutionGateway::on_cancel_reject() {
|
||||
return me->on_cancel_reject;
|
||||
}
|
||||
|
||||
bool ICEExecutionGateway::process_memo(const jetfix::fix::ICEExecutionReportMsg &msg, OrderKey* ok, SecurityKey* sk)
|
||||
{
|
||||
if(msg.has<fix::Memo>())
|
||||
{
|
||||
decode_memo(msg.get<fix::Memo>(), ok, sk);
|
||||
bool ICEExecutionGateway::process_memo(
|
||||
const jetfix::fix::ICEExecutionReportMsg &msg, OrderKey *ok,
|
||||
SecurityKey *sk) {
|
||||
if (msg.has<fix::Memo>()) {
|
||||
decode_memo(msg.get<fix::Memo>(), ok, sk);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (msg.get<fix::ExecType>() == api::orderman::EXEC_TYPE_TRADE_CORRECT && msg.has<fix::ExecRefID>())
|
||||
{
|
||||
} else {
|
||||
if (msg.get<fix::ExecType>() == api::orderman::EXEC_TYPE_TRADE_CORRECT &&
|
||||
msg.has<fix::ExecRefID>()) {
|
||||
std::string ref_exec_id = msg.get<fix::ExecRefID>();
|
||||
auto found = me->exec_id_to_memo.find(ref_exec_id);
|
||||
if(found == me->exec_id_to_memo.end())
|
||||
{
|
||||
if (found == me->exec_id_to_memo.end()) {
|
||||
auto new_price = Price(0);
|
||||
if(msg.has<fix::LastPx>())
|
||||
if (msg.has<fix::LastPx>())
|
||||
new_price = Price(msg.get<fix::LastPx>());
|
||||
|
||||
|
||||
LOG(OrderMan, Error,
|
||||
"Received unsupported trade correction msg. This correction will not be forwarded. The trader should be alerted. "
|
||||
"Partial original fill id: {}. New price: {}", ref_exec_id, new_price.value());
|
||||
"Received unsupported trade correction msg. This correction "
|
||||
"will not be forwarded. The trader should be alerted. "
|
||||
"Partial original fill id: {}. New price: {}",
|
||||
ref_exec_id, new_price.value());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
decode_memo(found->second, ok, sk);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
void ICEExecutionGateway::on_exe_report(const jetfix::fix::ICEExecutionReportMsg &msg)
|
||||
{
|
||||
void ICEExecutionGateway::on_exe_report(
|
||||
const jetfix::fix::ICEExecutionReportMsg &msg) {
|
||||
OrderKey ok;
|
||||
SecurityKey sk;
|
||||
if(!process_memo(msg, &ok, &sk))
|
||||
{
|
||||
if (!process_memo(msg, &ok, &sk)) {
|
||||
std::string execid = "";
|
||||
if(msg.has<fix::ExecID>())
|
||||
if (msg.has<fix::ExecID>())
|
||||
execid = msg.get<fix::ExecID>();
|
||||
LOG(OrderMan, Error,
|
||||
"Received execution report with no memo execid: {}. Will not be able to process this report. This is likely a bug that could lead "
|
||||
"to lost fills. Please investigate.", execid);
|
||||
return;
|
||||
"Received execution report with no memo execid: {}. Will not be able "
|
||||
"to process this report. This is likely a bug that could lead "
|
||||
"to lost fills. Please investigate.",
|
||||
execid);
|
||||
return;
|
||||
}
|
||||
auto scoped_log = trace::log_scope(me->perf_log, msg.trace(), "ICEExecutionGateway::on_exe_report", ok.value());
|
||||
auto scoped_log =
|
||||
trace::log_scope(me->perf_log, msg.trace(),
|
||||
"ICEExecutionGateway::on_exe_report", ok.value());
|
||||
|
||||
LOG(Latency, Info, "Started handling of execution report for order {}", ok.value());
|
||||
LOG(Latency, Info, "Started handling of execution report for order {}",
|
||||
ok.value());
|
||||
auto &sec = me->securities[sk.value()];
|
||||
if (!sec)
|
||||
{
|
||||
if (!sec) {
|
||||
sec = me->sec_oracle.get_security(SecurityKey(sk.value()));
|
||||
}
|
||||
}
|
||||
if (!sec)
|
||||
LOG(OrderMan, Error,
|
||||
"Received execution report for an unknown security {}. Will not be able to process this report. This is likely a bug that could lead "
|
||||
"Received execution report for an unknown security {}. Will not be "
|
||||
"able to process this report. This is likely a bug that could lead "
|
||||
"to lost fills. Please investigate.",
|
||||
sk.value());
|
||||
else
|
||||
{
|
||||
if(sec->has_ice())
|
||||
else {
|
||||
if (sec->has_ice())
|
||||
me->securities_by_exchange_id[sec->ice().exchange_id()] = sec;
|
||||
|
||||
|
||||
api::Security const *leg_security = nullptr;
|
||||
if (msg.has<fix::MultiLegReportingType>() && msg.get<fix::MultiLegReportingType>() == 2)
|
||||
{
|
||||
auto it = me->securities_by_exchange_id.find(msg.get<fix::Int_Symbol>());
|
||||
if (it == me->securities_by_exchange_id.end())
|
||||
{
|
||||
if (msg.has<fix::MultiLegReportingType>() &&
|
||||
msg.get<fix::MultiLegReportingType>() == 2) {
|
||||
auto it =
|
||||
me->securities_by_exchange_id.find(msg.get<fix::Int_Symbol>());
|
||||
if (it == me->securities_by_exchange_id.end()) {
|
||||
LOG(OrderMan, Error,
|
||||
"Received execution report for an unknown spread leg"
|
||||
"security {}. Will not be able to process this report. "
|
||||
@@ -346,20 +343,22 @@ void ICEExecutionGateway::on_exe_report(const jetfix::fix::ICEExecutionReportMsg
|
||||
return;
|
||||
}
|
||||
leg_security = it->second;
|
||||
}
|
||||
}
|
||||
std::string text_msg;
|
||||
if (msg.has<fix::Text>())
|
||||
text_msg = msg.get<fix::Text>();
|
||||
if (msg.has<fix::OrdRejReason>())
|
||||
text_msg += " Rejected OrdRejReason: " + std::to_string(msg.get<fix::OrdRejReason>());
|
||||
|
||||
text_msg += " Rejected OrdRejReason: " +
|
||||
std::to_string(msg.get<fix::OrdRejReason>());
|
||||
|
||||
if (msg.has<fix::DeleteReason>())
|
||||
text_msg += " Cancelled DeleteReason: " + std::to_string(msg.get<fix::DeleteReason>());
|
||||
text_msg += " Cancelled DeleteReason: " +
|
||||
std::to_string(msg.get<fix::DeleteReason>());
|
||||
|
||||
// allocate from our pool
|
||||
auto data = me->exe_report_pool.construct();
|
||||
|
||||
if(msg.has<fix::Memo>())
|
||||
if (msg.has<fix::Memo>())
|
||||
data->memo = msg.get<fix::Memo>();
|
||||
data->exec_type = api::orderman::ExecType(msg.get<fix::ExecType>());
|
||||
data->msg_seq_num = msg.get<fix::MsgSeqNum>();
|
||||
@@ -370,47 +369,52 @@ void ICEExecutionGateway::on_exe_report(const jetfix::fix::ICEExecutionReportMsg
|
||||
if (msg.has<fix::TargetSubID>())
|
||||
str_to(msg.get<fix::TargetSubID>(), &data->operator_id);
|
||||
if (msg.has<fix::CompanyID>())
|
||||
data->ice_company_id = msg.get<fix::CompanyID>();
|
||||
data->ice_company_id = msg.get<fix::CompanyID>();
|
||||
|
||||
data->order_key = ok;
|
||||
data->security = sec;
|
||||
data->leg_security = leg_security;
|
||||
data->side = api::Side(msg.get<fix::Side>());
|
||||
if (msg.has<fix::TimeInForce>())
|
||||
data->time_in_force = api::orderman::TimeInForce(msg.get<fix::TimeInForce>());
|
||||
data->time_in_force =
|
||||
api::orderman::TimeInForce(msg.get<fix::TimeInForce>());
|
||||
else
|
||||
data->time_in_force = api::orderman::TIME_IN_FORCE_UNDEFINED;
|
||||
|
||||
if (msg.has<fix::OrdType>())
|
||||
data->order_type = api::orderman::NativeOrderType(msg.get<fix::OrdType>());
|
||||
data->order_type =
|
||||
api::orderman::NativeOrderType(msg.get<fix::OrdType>());
|
||||
else
|
||||
data->order_type = api::orderman::NATIVE_ORDER_TYPE_UNDEFINED;
|
||||
|
||||
data->order_status = api::orderman::NativeOrderStatus(msg.get<fix::OrdStatus>());
|
||||
|
||||
data->order_status =
|
||||
api::orderman::NativeOrderStatus(msg.get<fix::OrdStatus>());
|
||||
data->manual_order_indicator = api::orderman::MANUAL_ORDER_INDICATOR_NO;
|
||||
|
||||
|
||||
std::string oid_string = get_ice_order_id_string(msg);
|
||||
str_to(oid_string,
|
||||
& std::get<ExchangeOrderID>(
|
||||
data->exchange_order_id));
|
||||
data->ice_cl_ord_id = 0;
|
||||
if(msg.has<fix::Int_ClOrdID>())
|
||||
if (msg.has<fix::Int_ClOrdID>())
|
||||
data->ice_cl_ord_id = msg.get<fix::Int_ClOrdID>();
|
||||
|
||||
|
||||
if (msg.has<fix::Price>())
|
||||
data->price = securities::decode_exchange_price(*sec, Price(msg.get<fix::Price>()));
|
||||
data->price = securities::decode_exchange_price(
|
||||
*sec, Price(msg.get<fix::Price>()));
|
||||
else
|
||||
data->price = Price(os::nan());
|
||||
|
||||
if (msg.has<fix::StopPx>())
|
||||
data->stop_price = securities::decode_exchange_price(*sec, Price(msg.get<fix::StopPx>()));
|
||||
data->stop_price = securities::decode_exchange_price(
|
||||
*sec, Price(msg.get<fix::StopPx>()));
|
||||
else
|
||||
data->stop_price = Price(os::nan());
|
||||
|
||||
|
||||
if (msg.has<fix::MaxShow>())
|
||||
data->max_show = Quantity(msg.get<fix::MaxShow>());
|
||||
else
|
||||
data->max_show = Quantity(0);
|
||||
data->max_show = Quantity(0);
|
||||
|
||||
if (msg.has<fix::OrderQty>())
|
||||
data->quantity = Quantity(msg.get<fix::OrderQty>());
|
||||
@@ -418,27 +422,27 @@ void ICEExecutionGateway::on_exe_report(const jetfix::fix::ICEExecutionReportMsg
|
||||
data->quantity = Quantity(0);
|
||||
|
||||
data->filled_quantity = Quantity(msg.get<fix::CumQty>());
|
||||
|
||||
|
||||
data->last_shares = msg.has<fix::LastShares>()
|
||||
? Quantity(msg.get<fix::LastShares>())
|
||||
: Quantity(0);
|
||||
auto last_px_sec = data->leg_security ? data->leg_security : sec;
|
||||
data->last_price = msg.has<fix::LastPx>()
|
||||
? securities::decode_exchange_price(*last_px_sec, Price(msg.get<fix::LastPx>()))
|
||||
? securities::decode_exchange_price(
|
||||
*last_px_sec, Price(msg.get<fix::LastPx>()))
|
||||
: Price(0);
|
||||
data->avg_price = msg.has<fix::AvgPx>()
|
||||
? securities::decode_exchange_price(*last_px_sec, Price(msg.get<fix::AvgPx>()))
|
||||
? securities::decode_exchange_price(
|
||||
*last_px_sec, Price(msg.get<fix::AvgPx>()))
|
||||
: Price(0);
|
||||
if (msg.has<fix::ExecID>())
|
||||
{
|
||||
if (msg.has<fix::ExecID>()) {
|
||||
auto execid = msg.get<fix::ExecID>();
|
||||
str_to(execid, &data->exchange_fill_id);
|
||||
if(msg.has<fix::Memo>())
|
||||
if (msg.has<fix::Memo>())
|
||||
me->exec_id_to_memo[execid] = msg.get<fix::Memo>();
|
||||
}
|
||||
|
||||
if (msg.has<fix::TransactTimeStr>())
|
||||
{
|
||||
|
||||
if (msg.has<fix::TransactTimeStr>()) {
|
||||
std::string stamp = msg.get<fix::TransactTimeStr>();
|
||||
stamp.resize(sizeof(orderman::ExchangeTimeStampStr));
|
||||
orderman::ExchangeTimeStampStr t;
|
||||
@@ -452,8 +456,8 @@ void ICEExecutionGateway::on_exe_report(const jetfix::fix::ICEExecutionReportMsg
|
||||
}
|
||||
}
|
||||
|
||||
void ICEExecutionGateway::on_cancel_reject(const jetfix::fix::ICECancelRejectMsg &msg)
|
||||
{
|
||||
void ICEExecutionGateway::on_cancel_reject(
|
||||
const jetfix::fix::ICECancelRejectMsg &msg) {
|
||||
OrderKey ok(msg.get<fix::Int_ClOrdID>());
|
||||
|
||||
std::string reject_msg;
|
||||
@@ -465,36 +469,36 @@ void ICEExecutionGateway::on_cancel_reject(const jetfix::fix::ICECancelRejectMsg
|
||||
me->on_cancel_reject(CancelReject {ok, CancelRejectReason::Other,reject_msg});
|
||||
}
|
||||
|
||||
|
||||
void ICEExecutionGateway::on_business_reject(const jetfix::fix::BusinessMessageRejectMsg& m)
|
||||
{
|
||||
void ICEExecutionGateway::on_business_reject(
|
||||
const jetfix::fix::BusinessMessageRejectMsg &m) {
|
||||
LOG(OrderMan, Error,
|
||||
"Unexpected business reject in {} gateway . Reason: {}. This should be investigated",
|
||||
"Unexpected business reject in {} gateway . Reason: {}. This should be "
|
||||
"investigated",
|
||||
me->gw_name.value(),
|
||||
m.has<fix::Text>() ? m.get<fix::Text>() : std::string("Unknown"));
|
||||
}
|
||||
|
||||
void ICEExecutionGateway::on_session_reject(const jetfix::fix::RejectMsg& m)
|
||||
{
|
||||
void ICEExecutionGateway::on_session_reject(const jetfix::fix::RejectMsg &m) {
|
||||
LOG(OrderMan, Error,
|
||||
"Unexpected reject message in {} gateway . Reason: {}. This should be investigated",
|
||||
"Unexpected reject message in {} gateway . Reason: {}. This should be "
|
||||
"investigated",
|
||||
me->gw_name.value(),
|
||||
m.has<fix::Text>() ? m.get<fix::Text>() : std::string("Unknown"));
|
||||
}
|
||||
|
||||
void ICEExecutionGateway::dispatch_incoming_fix_messages()
|
||||
{
|
||||
me->gw.dispatch_events();
|
||||
if(me->state == State::TRADER_LOGIN_TIMEOUT && ms_diff(Timer::now(), me->connection_time) >= 2000)
|
||||
{
|
||||
void ICEExecutionGateway::dispatch_incoming_fix_messages() {
|
||||
me->gw.dispatch_events();
|
||||
if (me->state == State::TRADER_LOGIN_TIMEOUT &&
|
||||
ms_diff(Timer::now(), me->connection_time) >= 2000) {
|
||||
on_trader_login_timeout_expired();
|
||||
}
|
||||
}
|
||||
|
||||
void ICEExecutionGateway::send_fix(const jetfix::OutFIXPtr& fix, trace::CorID trace)
|
||||
{
|
||||
auto scoped_log = trace::log_scope(me->perf_log,trace,"ICEExecutionGateway::send_fix");
|
||||
me->gw.send(fix,trace);
|
||||
void ICEExecutionGateway::send_fix(const jetfix::OutFIXPtr &fix,
|
||||
trace::CorID trace) {
|
||||
auto scoped_log =
|
||||
trace::log_scope(me->perf_log, trace, "ICEExecutionGateway::send_fix");
|
||||
me->gw.send(fix, trace);
|
||||
me->gw.dispatch_events();
|
||||
}
|
||||
|
||||
|
||||
@@ -53,5 +53,7 @@ class OrderFactory : public IOrderFactory {
|
||||
std::unique_ptr<PImpl> me;
|
||||
};
|
||||
|
||||
OrderKey gen_order_id();
|
||||
|
||||
} // namespace orderman
|
||||
} // namespace bts
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "lib/orderman/orders/spreader_orders/tests/tests_common.h"
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <boost/container/flat_set.hpp>
|
||||
|
||||
namespace bts {
|
||||
namespace orderman {
|
||||
@@ -4194,5 +4194,69 @@ TEST_CASE ("scratch_pad_2", "[spreader]"){
|
||||
struct tm* ptm = gmtime (&rawtime);
|
||||
LOG(OrderMan, Info, "hrs:{} mins:{} sec:{}", ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
|
||||
}
|
||||
// vector insert //////////////////////////////////////
|
||||
///////////////////////////////////////////////////////
|
||||
class Elem{
|
||||
public:
|
||||
int i;
|
||||
Elem()
|
||||
:
|
||||
i(-1)
|
||||
{}
|
||||
Elem (int i_arg)
|
||||
:
|
||||
i(i_arg)
|
||||
{}
|
||||
Elem(const Elem& other){
|
||||
i = other.i;
|
||||
}
|
||||
Elem (Elem&& other){
|
||||
i=other.i;
|
||||
}
|
||||
Elem& operator=(const Elem& other){
|
||||
i=other.i;
|
||||
return *this;
|
||||
}
|
||||
Elem& operator=(Elem &&src){
|
||||
i = src.i;
|
||||
return *this;
|
||||
}
|
||||
bool operator==(const Elem& e) const {return i == e.i;}
|
||||
bool operator!=(const Elem& e) const {return i != e.i;}
|
||||
bool operator<(const Elem& e) const {return i < e.i;}
|
||||
bool operator>(const Elem& e) const {return i > e.i;}
|
||||
};
|
||||
TEST_CASE ("scratch_pad_3", "[spreader]"){
|
||||
std::vector<Elem> v;
|
||||
for(int i=1;i<10;i++)
|
||||
v.emplace_back(i);
|
||||
Elem e(0);
|
||||
// move op= is called when inserting or erasing
|
||||
v.insert(v.begin()+2,e);
|
||||
v.erase(v.begin()+2);
|
||||
std::random_shuffle(v.begin(),v.end());
|
||||
// flat set
|
||||
boost::container::flat_set<Elem> fs;
|
||||
for(int i=0;i<20;i+=2){
|
||||
Elem e(i);
|
||||
fs.insert(e);
|
||||
}
|
||||
Elem e9(9);
|
||||
// move op is called when inserting
|
||||
fs.insert(e9);
|
||||
for (const auto& e : fs)
|
||||
std::cout << e.i << std::endl;
|
||||
// vector assignment vs move assignment
|
||||
std::vector<Elem> vs;
|
||||
int n_elems = 10;
|
||||
for(int i=1;i<n_elems;i++)
|
||||
vs.emplace_back(i);
|
||||
std::vector<Elem> vt;
|
||||
// new elems are cresated in vt from the elem's in vs,
|
||||
// with their copy cons
|
||||
vt = vs;
|
||||
std::vector<Elem> vt_2;
|
||||
vt_2 = std::move(vs);
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -9,6 +9,41 @@
|
||||
namespace bts {
|
||||
namespace meta {
|
||||
|
||||
// Instantiate a template with a list of types
|
||||
template <class... Ts> struct meta_type_pack {
|
||||
template<template <typename...> class T, class... T2s>
|
||||
using type = T<T2s...,Ts...>;
|
||||
};
|
||||
|
||||
// Type List Support
|
||||
template <class... T> struct list;
|
||||
|
||||
template <typename Elem, typename List> struct cons;
|
||||
|
||||
template <typename Elem, typename... Ts> struct cons<Elem, list<Ts...>> {
|
||||
using type = list<Elem, Ts...>;
|
||||
};
|
||||
|
||||
template <template <typename> class Pred, typename List> struct filter;
|
||||
|
||||
template <template <typename> class Pred> struct filter<Pred, list<>> {
|
||||
using type = list<>;
|
||||
};
|
||||
|
||||
template <template <typename> class Pred, typename Head, typename... TailTs>
|
||||
struct filter<Pred, list<Head, TailTs...>> {
|
||||
using Tail = filter<Pred, list<TailTs...>>;
|
||||
using type = typename std::conditional<
|
||||
Pred<Head>::value, cons<Head, typename Tail::type>, Tail>::type::type;
|
||||
};
|
||||
|
||||
template <template <typename...> class Elem, class List> struct with_type_list;
|
||||
|
||||
template <template <typename...> class T, typename... Ts>
|
||||
struct with_type_list<T, list<Ts...>> {
|
||||
using type = T<Ts...>;
|
||||
};
|
||||
// End Type List Support
|
||||
|
||||
template<typename T> constexpr size_t max(T v) {return v;}
|
||||
|
||||
|
||||
@@ -11,6 +11,56 @@ double min(std::vector<double> const&v);
|
||||
double max(std::vector<double> const&v);
|
||||
double sum(std::vector<double> const&v);
|
||||
double avg(std::vector<double> const&v);
|
||||
|
||||
inline double med(std::vector<double> const&v) {
|
||||
return percentile(v,0.5);
|
||||
}
|
||||
|
||||
template <class C, class E>
|
||||
std::vector<double> extract(C const&ts, E const &e) {
|
||||
std::vector<double> result;
|
||||
result.reserve(ts.size());
|
||||
for (auto const&t :ts)
|
||||
result.push_back(e(t));
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class C, class E>
|
||||
double stdev(C const&ts, E const&e) {
|
||||
return stddev(extract(ts,e));
|
||||
}
|
||||
|
||||
template <class C, class E>
|
||||
double percentile(C const&ts,E const&e,double p) {
|
||||
return percentile(extract(ts,e),p);
|
||||
}
|
||||
|
||||
template <class C, class E>
|
||||
double med(C const&ts,E const&e) {
|
||||
return med(extract(ts,e));
|
||||
}
|
||||
template <class C, class E>
|
||||
double min(C const&ts, E const&e) {
|
||||
return min(extract(ts,e));
|
||||
}
|
||||
|
||||
template <class C, class E>
|
||||
double max(C const&ts, E const&e) {
|
||||
return max(extract(ts,e));
|
||||
}
|
||||
|
||||
template <class C, class E>
|
||||
double sum(C const&ts, E const&e) {
|
||||
return sum(extract(ts,e));
|
||||
}
|
||||
|
||||
template <class C, class E>
|
||||
double avg(C const&ts, E const&e) {
|
||||
return avg(extract(ts,e));
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
set(sources algo/AlgoDefinitionServiceServer.cpp;cmds/AdminReport.cpp;cmds/AutoCert.cpp;cmds/Benchmark.cpp;cmds/CMECertCmd.cpp;cmds/CmdRegistry.cpp;cmds/ConfigCheck.cpp;cmds/FIXSim.cpp;cmds/Help.cpp;cmds/KeyCode.cpp;cmds/Md.cpp;cmds/ParseHistoricalFIX.cpp;cmds/PrintHedgeOrders.cpp;cmds/QuickTest.cpp;cmds/Run.cpp;cmds/RunSim.cpp;cmds/Span.cpp;cmds/Test.cpp;cmds/Web.cpp;dspark/mirage/quick_queue/quick_queue.cpp;exchange_sim/ExchangeSim.cpp;exchange_sim/ExchangeSimApplication.cpp;exchange_sim/book/Book.cpp;exchange_sim/book/ExchangeSim.proto;exchange_sim/book/Order.cpp;exchange_sim/book/OrderMatcher.cpp;exchange_sim/book/book_transform.cpp;exchange_sim/tests/test_book_transform.cpp;http/ApiGateway.cpp;http/MultipartFormDecoder.cpp;http/WebServer.cpp;http/tests/MultiPartFormTests.cpp;main.cpp;md/ChannelVolume.cpp;md/MarketDataAuxiliaryServiceServer.cpp;md/VolumeAtPriceState.cpp;md/platforms/IMDPlatform.cpp;md/platforms/ice_onixs/ICEListener.cpp;md/platforms/ice_onixs/ICEMain.cpp;md/platforms/ice_onixs/tests/ice_tests.cpp;md/platforms/mdp3_onixs/MDP3Listener.cpp;md/platforms/mdp3_onixs/MDP3Main.cpp;md/platforms/mdp3_onixs/tests/mdp3_tests.cpp;md/run_md.cpp;position/IPositionObserver.cpp;position/MarginServiceCore.cpp;position/MarginServiceServer.cpp;position/PositionAggregator.cpp;position/PositionMap.cpp;position/PositionServicePNLHelper.cpp;position/PositionServiceServer.cpp;position/import/BasePositionServiceServer.cpp;position/import/DownloadCommonStateMachine.cpp;position/import/DownloadWindow.cpp;position/import/MoneyFileServiceServer.cpp;position/import/parsing/gmi_parser.cpp;position/import/parsing/money_parser.cpp;position/import/parsing/parser_common.cpp;position/tests/PositionTests.cpp;position/tests/position_tests_internal.cpp;subprocess/SubProcessRunner.cpp;support/ErrorReportService.cpp;support/ShellLatencyServer.cpp;user/AdminServiceServer.cpp;user/AuthServiceServer.cpp;user/tests/admin_service_tests.cpp)
|
||||
set(sources algo/AlgoDefinitionServiceServer.cpp;cmds/AdminReport.cpp;cmds/AutoCert.cpp;cmds/Benchmark.cpp;cmds/CMECertCmd.cpp;cmds/CmdRegistry.cpp;cmds/ConfigCheck.cpp;cmds/FIXSim.cpp;cmds/Help.cpp;cmds/KeyCode.cpp;cmds/Md.cpp;cmds/ParseHistoricalFIX.cpp;cmds/PrintHedgeOrders.cpp;cmds/QuickTest.cpp;cmds/Run.cpp;cmds/Span.cpp;cmds/Spartan.cpp;cmds/Test.cpp;cmds/Web.cpp;cmds/spartan/algo/RunTAS.cpp;cmds/spartan/algo/TASOrderReactor.cpp;cmds/spartan/algo/TASTriggerDef.cpp;cmds/spartan/md/mdp3/back_testing/FifoPriceLevelMatcher.cpp;cmds/spartan/md/mdp3/back_testing/FifoSecurityMatcher.cpp;cmds/spartan/md/mdp3/common/InstrumentSnapshot.cpp;cmds/spartan/md/mdp3/feed_control/IFeedController.cpp;cmds/spartan/md/mdp3/handler/ChannelHandler.cpp;cmds/spartan/md/mdp3/parsing/MDP3MsgBox.cpp;cmds/spartan/md/mdp3/realtime/RealTimeHandler.cpp;cmds/spartan/md/mdp3/recovery/BookSnapshot.cpp;cmds/spartan/md/mdp3/recovery/DefinitionSnapshot.cpp;cmds/spartan/md/mdp3/recovery/IncrementalQueue.cpp;cmds/spartan/md/mdp3/recovery/RecoveryHandler.cpp;cmds/spartan/md/mdp3/tests/spartan_md_tests.cpp;cmds/spartan/md/mdp3/utils/mdp3_utils.cpp;cmds/spartan/util/MCastReceiver.cpp;cmds/spartan/util/PCapReader.cpp;cmds/spartan/util/SecurityDB.cpp;dspark/mirage/quick_queue/quick_queue.cpp;exchange_sim/ExchangeSim.cpp;exchange_sim/ExchangeSimApplication.cpp;exchange_sim/book/Book.cpp;exchange_sim/book/ExchangeSim.proto;exchange_sim/book/Order.cpp;exchange_sim/book/OrderMatcher.cpp;exchange_sim/book/book_transform.cpp;exchange_sim/tests/test_book_transform.cpp;http/ApiGateway.cpp;http/MultipartFormDecoder.cpp;http/WebServer.cpp;http/tests/MultiPartFormTests.cpp;main.cpp;md/ChannelVolume.cpp;md/MarketDataAuxiliaryServiceServer.cpp;md/VolumeAtPriceState.cpp;md/platforms/IMDPlatform.cpp;md/platforms/ice_onixs/ICEListener.cpp;md/platforms/ice_onixs/ICEMain.cpp;md/platforms/ice_onixs/tests/ice_tests.cpp;md/platforms/mdp3_onixs/MDP3Listener.cpp;md/platforms/mdp3_onixs/MDP3Main.cpp;md/platforms/mdp3_onixs/tests/mdp3_tests.cpp;md/run_md.cpp;position/IPositionObserver.cpp;position/MarginServiceCore.cpp;position/MarginServiceServer.cpp;position/PositionAggregator.cpp;position/PositionMap.cpp;position/PositionServicePNLHelper.cpp;position/PositionServiceServer.cpp;position/import/BasePositionServiceServer.cpp;position/import/DownloadCommonStateMachine.cpp;position/import/DownloadWindow.cpp;position/import/MoneyFileServiceServer.cpp;position/import/parsing/gmi_parser.cpp;position/import/parsing/money_parser.cpp;position/import/parsing/parser_common.cpp;position/tests/PositionTests.cpp;position/tests/position_tests_internal.cpp;subprocess/SubProcessRunner.cpp;support/ErrorReportService.cpp;support/ShellLatencyServer.cpp;user/AdminServiceDB.cpp;user/AdminServiceServer.cpp;user/AuthServiceServer.cpp;user/tests/admin_service_tests.cpp)
|
||||
@@ -30,7 +30,11 @@ target_link_libraries( sparkd
|
||||
ACE
|
||||
quickfix
|
||||
benchmark
|
||||
Common++
|
||||
Packet++
|
||||
Pcap++
|
||||
lttng-ust
|
||||
-lpcap
|
||||
-static-libgcc
|
||||
-static-libstdc++
|
||||
-pthread)
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace bts {
|
||||
namespace cmd {
|
||||
|
||||
int FIXSim::execute(std::vector<std::string> const &) {
|
||||
bts::sim::start_exchange_sim(bts::api::Venue::VENUE_GLBX);
|
||||
bts::sim::start_exchange_sim(bts::api::Venue::VENUE_SIM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,20 @@
|
||||
#include "lib/tracing/PerfLog.h"
|
||||
#include "lib/utils/datetime.h"
|
||||
|
||||
#include "lib/config/protos/logging.pb.h"
|
||||
#include "lib/domain_model/sod.h"
|
||||
#include "lib/logging/logging.h"
|
||||
#include "lib/utils/datetime.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/common/InstrumentSnapshot.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/common/mdp3_common.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/feed_control/AB_Arbitrageur.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/feed_control/IFeedController.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/handler/ChannelHandler.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/handler/IChannelObserver.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/parsing/MDP3Parser.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/utils/mdp3_utils.h"
|
||||
#include "server/sparkd/cmds/spartan/util/PCapReader.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/date_time/gregorian/gregorian.hpp>
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
@@ -16,26 +28,78 @@
|
||||
|
||||
namespace bts {
|
||||
namespace cmd {
|
||||
using namespace bts::orderman;
|
||||
|
||||
int QuickTest::execute(std::vector<std::string> const &) {
|
||||
int QuickTest::execute(std::vector<std::string> const &args) {
|
||||
|
||||
auto sftp_file_name = std::string("2019-08-05.adatmny.csv");
|
||||
std::regex rx("(\\d\\d\\d\\d)");
|
||||
std::smatch matches;
|
||||
if (!std::regex_match(sftp_file_name, matches, rx))
|
||||
return {};
|
||||
auto y = std::stoi(matches[0]);
|
||||
auto m = std::stoi(matches[1]);
|
||||
auto d = std::stoi(matches[2]);
|
||||
auto cfg = config::get<config::Logging>();
|
||||
cfg.mutable_console()->set_default_level("Fatal");
|
||||
log::configure_logging(cfg);
|
||||
|
||||
const auto &sod = config::get<config::SODTime>();
|
||||
std::cout << datetime::make_ptime(y, m, d, sod.sod_hh(), sod.has_sod_mm(), 0, 0) << "\n";
|
||||
return 1;
|
||||
auto file = args[0];
|
||||
using namespace bts::spartan::mdp3;
|
||||
|
||||
struct Obs : IChannelObserver {
|
||||
|
||||
Orders previous_orders;
|
||||
size_t event_id = 0;
|
||||
|
||||
void on_recovery_complete(
|
||||
std::vector<InstrumentSnapshot const *> const &secs) override {
|
||||
previous_orders.clear();
|
||||
|
||||
for (auto s : secs)
|
||||
for (auto const &o : s->orders())
|
||||
previous_orders[o.first] = o.second;
|
||||
}
|
||||
|
||||
void on_real_time_event(MDP3Event const &ev) override {
|
||||
event_id++;
|
||||
|
||||
for (auto s : ev.affected_securities) {
|
||||
if (s->trading_status() ==
|
||||
::mdp3::SecurityTradingStatus::ReadyToTrade) {
|
||||
for (auto f : s->fills()) {
|
||||
if (f.aggressor != MDP3Fill::THIS_BUY &&
|
||||
f.aggressor != MDP3Fill::THIS_SELL) {
|
||||
auto it = previous_orders.find(f.key);
|
||||
bts_assert(it != previous_orders.end());
|
||||
it->second.quantity.value() -= f.quantity.value();
|
||||
if (it->second.quantity.value() < 0) {
|
||||
std::cout << " Hidden sizes in order. "
|
||||
<< " eid: " << event_id
|
||||
<< " Event: " << ev
|
||||
<< " Order: " << it->first
|
||||
<< " Fill tid: " << f.trade_entry_id
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto const &ch : s->order_changes()) {
|
||||
switch (ch.change) {
|
||||
case OrderChange::added:
|
||||
case OrderChange::updated:
|
||||
previous_orders[ch.order.key] = ch.order;
|
||||
break;
|
||||
case OrderChange::removed:
|
||||
previous_orders.erase(ch.order.key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void on_real_time_channel_loss() override {
|
||||
std::cout << "Observed loss, resetting\n";
|
||||
}
|
||||
} obs;
|
||||
|
||||
spartan::mdp3::observe_channel(file, obs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string QuickTest::help() {
|
||||
return "This is a place holder to make it easy to quickly write discardable "
|
||||
return "This is a place holder to make it easy to quickly write "
|
||||
"discardable "
|
||||
"test code";
|
||||
}
|
||||
} // namespace cmd
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#include "RunSim.h"
|
||||
#include "server/sparkd/exchange_sim/ExchangeSim.h"
|
||||
|
||||
namespace bts {
|
||||
namespace cmd {
|
||||
|
||||
int RunSim::execute(std::vector<std::string> const &)
|
||||
{
|
||||
sim::start_exchange_sim(api::Venue::VENUE_SIM, nullptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string RunSim::help () {return "\t run exchange simulator";}
|
||||
|
||||
}}
|
||||
@@ -1,17 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "ICmd.h"
|
||||
|
||||
namespace bts {
|
||||
namespace cmd {
|
||||
|
||||
class RunSim : public ICmd
|
||||
{
|
||||
public:
|
||||
int execute(std::vector<std::string> const &args);
|
||||
std::string help ();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
#include "Spartan.h"
|
||||
#include "server/sparkd/cmds/spartan/algo/RunTAS.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/common/InstrumentSnapshot.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/feed_control/AB_Arbitrageur.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/feed_control/IFeedController.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/feed_control/PickedFeed.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/handler/ChannelHandler.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/handler/IChannelObserver.h"
|
||||
#include "server/sparkd/cmds/spartan/md/mdp3/utils/mdp3_utils.h"
|
||||
#include "server/sparkd/cmds/spartan/util/PCapReader.h"
|
||||
|
||||
#include <Pcap++/PcapFileDevice.h>
|
||||
#include <fmt/format.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
namespace bts {
|
||||
namespace cmd {
|
||||
|
||||
int Spartan::execute(std::vector<std::string> const &args) {
|
||||
auto error = 1;
|
||||
if (args.size() > 0) {
|
||||
if (args[0] == "json" && args.size() == 2)
|
||||
error = spartan::mdp3::to_json(args[1]);
|
||||
else if (args[0] == "compress" && args.size() == 3)
|
||||
error = spartan::mdp3::compress(args[1],args[2]);
|
||||
else if (args[0] == "csv" && args.size() == 3)
|
||||
error = spartan::mdp3::to_csv(args[1], args[2]);
|
||||
}
|
||||
if (error)
|
||||
std::cout << help();
|
||||
return error;
|
||||
}
|
||||
|
||||
std::string Spartan::help() {
|
||||
return fmt::format("\tjson <pcap>\n"
|
||||
"\tcompress <pcap> <out-pcap>\n"
|
||||
"\tcsv <pcap> <out-dir>\n");
|
||||
}
|
||||
|
||||
} // namespace cmd
|
||||
} // namespace bts
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "ICmd.h"
|
||||
|
||||
namespace bts {
|
||||
namespace cmd {
|
||||
|
||||
class Spartan : public ICmd
|
||||
{
|
||||
public:
|
||||
int execute(std::vector<std::string> const &args);
|
||||
std::string help ();
|
||||
private:
|
||||
int run_from_pcap(std::vector<std::string> const &);
|
||||
int run_from_mcast(std::vector<std::string> const &);
|
||||
int parse_pcap(std::vector<std::string> const &);
|
||||
int analyze_pcap(std::vector<std::string> const &);
|
||||
void run(std::vector<std::string> const &);
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
// #include "RunTAS.h"
|
||||
// #include "server/sparkd/cmds/Run.h"
|
||||
|
||||
// #include "../analysis/ActionableEventAnalyzer.h"
|
||||
// #include "../md/mdp3/parsing/MDP3Parser.h"
|
||||
// #include "../util/MCastReceiver.h"
|
||||
// #include "../util/PCapReader.h"
|
||||
// #include "../util/SecurityDB.h"
|
||||
// #include "TASOrderReactor.h"
|
||||
// #include "TASTriggerDef.h"
|
||||
// #include "lib/api/service_helpers/AdminServiceUtils.h"
|
||||
// #include "lib/config/config.h"
|
||||
// #include "lib/config/protos/spartan.pb.h"
|
||||
// #include "lib/logging/logging.h"
|
||||
// #include "lib/md/cme/MDP3Utils.h"
|
||||
// #include "lib/utils/bts_chrono.h"
|
||||
// #include "server/sparkd/cmds/Run.h"
|
||||
// #include "server/sparkd/user/AdminServiceDB.h"
|
||||
|
||||
// #include <boost/asio.hpp>
|
||||
// #include <variant>
|
||||
|
||||
// namespace bts {
|
||||
// namespace spartan {
|
||||
|
||||
// // Resolve securities and routing records to go from config to a set
|
||||
// // of trigger definitions, one per security group needed.
|
||||
// std::vector<TASTriggerDef>
|
||||
// build_trigger_defs(SecurityDB &db, config::SpartanTASCfg const &cfg) {
|
||||
// auto user_name = cfg.user();
|
||||
// auto account = cfg.account();
|
||||
// auto admin = admin::AdminServiceDB().retrieve();
|
||||
// bts_assert(admin.has_value());
|
||||
|
||||
// std::vector<TASTriggerDef> result;
|
||||
// auto get_or_make_group_trigger_def =
|
||||
// [&result](std::string const &group_symbol) {
|
||||
// for (auto &t : result)
|
||||
// if (t.group_symbol == group_symbol)
|
||||
// return &t;
|
||||
// result.push_back(TASTriggerDef{group_symbol, {}});
|
||||
// return &result.back();
|
||||
// };
|
||||
|
||||
// for (auto const &t : cfg.tas_trigger()) {
|
||||
|
||||
// // Resolve symbol to security object
|
||||
// auto sec = db.query_single([t](auto const &sec) {
|
||||
// return sec.has_glbx() &&
|
||||
// securities::security_type(sec) == t.security_type() &&
|
||||
// securities::descriptor(sec) == t.security();
|
||||
// });
|
||||
|
||||
// bts_assert(sec);
|
||||
|
||||
// // Get routing record for this user and account
|
||||
// admin::AdminServiceOperationResult result;
|
||||
// auto rr = admin::AdminServiceUtils::get_routing_record(
|
||||
// admin.value(), account, user_name, *sec, result);
|
||||
// bts_assert_msg(result.is_success(), result.error_text());
|
||||
|
||||
// // Build a trigger definition with the resolved information
|
||||
// // (security and routing record)
|
||||
// auto sec_trigger = TASTriggerDef::SecTrigger{*sec, rr, {}};
|
||||
// sec_trigger.side.set(
|
||||
// api::Side::SIDE_BUY,
|
||||
// TASTriggerDef::Side{t.buy().quantity(), t.buy().ticks_away()});
|
||||
// sec_trigger.side.set(
|
||||
// api::Side::SIDE_SELL,
|
||||
// TASTriggerDef::Side{t.sell().quantity(), t.sell().ticks_away()});
|
||||
// auto trigger = get_or_make_group_trigger_def(sec->glbx().cme_symbol());
|
||||
// trigger->sec_triggers.push_back(sec_trigger);
|
||||
// }
|
||||
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// std::variant<bool, std::string>
|
||||
// validate_trigger_defs(std::vector<TASTriggerDef> const &defs) {
|
||||
// if (defs.empty())
|
||||
// return fmt::format("No triggers defined");
|
||||
|
||||
// std::set<std::string> groups;
|
||||
// std::set<SecurityKey> securities;
|
||||
// for (auto const &td : defs) {
|
||||
// if (!groups.insert(td.group_symbol).second)
|
||||
// return fmt::format("Duplicate entry for security group: {}",
|
||||
// td.group_symbol);
|
||||
// else
|
||||
// groups.insert(td.group_symbol);
|
||||
|
||||
// for (auto const &st : td.sec_triggers) {
|
||||
// if (!securities.insert(SecurityKey(st.security.id())).second)
|
||||
// return fmt::format("Duplicate entry for security: {}",
|
||||
// securities::descriptor(st.security));
|
||||
|
||||
// if (st.side.get(api::Side::SIDE_BUY).quantity != 1 ||
|
||||
// st.side.get(api::Side::SIDE_SELL).quantity != 1)
|
||||
// return fmt::format("Quantities must be 1 in {}",
|
||||
// securities::descriptor(st.security));
|
||||
|
||||
// if (st.side.get(api::Side::SIDE_BUY).ticks_away > 0)
|
||||
// return fmt::format("Buy Price must be <= 0 in {}",
|
||||
// securities::descriptor(st.security));
|
||||
|
||||
// if (st.side.get(api::Side::SIDE_SELL).ticks_away <= 0)
|
||||
// return fmt::format("Sell Price must be > 0 in {}",
|
||||
// securities::descriptor(st.security));
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
// std::vector<TASTriggerDef> build_and_validate_triggers(SecurityDB &db) {
|
||||
// auto triggers = build_trigger_defs(db, config::get<config::SpartanTASCfg>());
|
||||
// LOG(Spartan, Info,
|
||||
// "TAS Trigger layout: \n"
|
||||
// "-----------------------------------------------------------"
|
||||
// "---------------------");
|
||||
// for (auto const &t : triggers)
|
||||
// LOG(Spartan, Info, "{}", t);
|
||||
|
||||
// LOG(Spartan, Info,
|
||||
// "-----------------------------------------------------------"
|
||||
// "---------------------");
|
||||
|
||||
// auto valid = validate_trigger_defs(triggers);
|
||||
// if (std::holds_alternative<std::string>(valid)) {
|
||||
// LOG(Spartan, Error, "Invalid TAS trigger definition in config: {}",
|
||||
// std::get<std::string>(valid));
|
||||
// std::exit(-1);
|
||||
// }
|
||||
// return triggers;
|
||||
// }
|
||||
|
||||
// std::set<bts::md::UserSymbol> get_symbols(SecurityDB &db,
|
||||
// config::SpartanTASCfg const &cfg) {
|
||||
// std::set<bts::md::UserSymbol> result;
|
||||
// for (auto const &t : cfg.tas_trigger()) {
|
||||
// auto sec = db.query_single([&t](auto const &sec) {
|
||||
// return sec.has_glbx() &&
|
||||
// securities::security_type(sec) == t.security_type() &&
|
||||
// securities::descriptor(sec) == t.security();
|
||||
// });
|
||||
// bts_assert(sec);
|
||||
|
||||
// result.insert({sec->symbol(), api::Venue::VENUE_GLBX,
|
||||
// api::SecurityType::SECURITYTYPE_FUTURE});
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// std::vector<bts::md::CMEConnection> get_connections(SecurityDB &db) {
|
||||
// auto cfg = config::get<config::SpartanTASCfg>();
|
||||
// auto cme_symbols = get_symbols(db, cfg);
|
||||
|
||||
// std::vector<bts::md::CMEConnection> result;
|
||||
// auto find_inc_feed_connection =
|
||||
// [](std::map<std::string, bts::md::CMEConnection> const &m)
|
||||
// -> bts::md::CMEConnection {
|
||||
// for (auto const &p : m) {
|
||||
// if (p.second.feed_type == "I" && p.second.feed == 'A')
|
||||
// return p.second;
|
||||
// }
|
||||
// bts_assert(false);
|
||||
// return {};
|
||||
// };
|
||||
|
||||
// auto channels = bts::md::get_configured_cme_channels();
|
||||
// for (auto const &c : channels) {
|
||||
// for (auto const &sym : cme_symbols) {
|
||||
// if (c.symbols.count(sym))
|
||||
// result.push_back(find_inc_feed_connection(c.connections));
|
||||
// }
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
// int run_tas_from_mcast() {
|
||||
// SecurityDB db;
|
||||
// auto triggers = build_and_validate_triggers(db);
|
||||
// auto connections = get_connections(db);
|
||||
// if (connections.empty()) {
|
||||
// LOG(Spartan, Error,
|
||||
// "Could not find connections for selected TAS symbols");
|
||||
// std::exit(1);
|
||||
// }
|
||||
// boost::asio::io_service io;
|
||||
// mdp3::MDP3Parser parser;
|
||||
// TASOrderReactor reactor(triggers);
|
||||
// mdp3::bind<TASOrderReactor, ::mdp3::SecurityStatus30>(parser, reactor);
|
||||
|
||||
// std::vector<std::unique_ptr<MCastReceiver>> mc_receivers;
|
||||
// for (auto const &c : connections) {
|
||||
// auto receiver =
|
||||
// std::make_unique<MCastReceiver>(io, "0.0.0.0", c.ip, c.port);
|
||||
// receiver->on_receive() = [&parser](auto const &bytes) {
|
||||
// parser.on_bytes(bytes);
|
||||
// };
|
||||
// mc_receivers.push_back(std::move(receiver));
|
||||
// }
|
||||
|
||||
// LOG(Spartan, Warn, "Starting Spartan TAS Algo now");
|
||||
// for (auto &c : connections) {
|
||||
// LOG(Spartan, Info, "Listening on {}", c);
|
||||
// }
|
||||
|
||||
// for (;;) {
|
||||
// io.poll();
|
||||
// if (!reactor.do_work())
|
||||
// break;
|
||||
// }
|
||||
|
||||
// LOG(Spartan, Warn, "Spartan TAS algo concluded. Starting normal system");
|
||||
// return cmd::Run{}.execute({});
|
||||
// }
|
||||
|
||||
// int run_tas_from_pcap(std::string const &pcap_path) {
|
||||
// SecurityDB db;
|
||||
// auto triggers = build_and_validate_triggers(db);
|
||||
// TASOrderReactor reactor(triggers);
|
||||
|
||||
// PCapReader pcap_reader(pcap_path);
|
||||
// mdp3::MDP3Parser parser;
|
||||
// mdp3::bind<TASOrderReactor, ::mdp3::SecurityStatus30>(parser, reactor);
|
||||
|
||||
// pcap_reader.on_packet() = [&parser](auto const&, auto const &bytes) {
|
||||
// parser.on_bytes(bytes);
|
||||
// return true;
|
||||
// };
|
||||
|
||||
// while (pcap_reader.read_next())
|
||||
// if (!reactor.do_work())
|
||||
// break;
|
||||
|
||||
// // this is to allow a little bit of time for FIX and other logs to
|
||||
// // be written to disk
|
||||
// std::this_thread::sleep_for(1s);
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
// } // namespace spartan
|
||||
// } // namespace bts
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace bts {
|
||||
namespace spartan {
|
||||
|
||||
inline int run_tas_from_pcap(std::string const&) {return -1;}
|
||||
inline int run_tas_from_mcast() {return -1;}
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,182 @@
|
||||
#include "TASOrderReactor.h"
|
||||
|
||||
#include "TASTriggerDef.h"
|
||||
#include "lib/config/config.h"
|
||||
#include "lib/domain_model/SecurityKey.h"
|
||||
#include "lib/jetfix/common/OutFIX.h"
|
||||
#include "lib/jetfix/common/OutFIXPtr.h"
|
||||
#include "lib/jetfix/gateway/JetFIXGateway.h"
|
||||
#include "lib/orderman/order_factory/OrderFactory.h"
|
||||
#include "lib/orderman/orderman_utils/fix_order_codec.h"
|
||||
|
||||
#include "../md/mdp3/parsing/MDP3Parser.h"
|
||||
#include "../md/mdp3/gen/SecurityStatus30.h"
|
||||
|
||||
#include <boost/container/small_vector.hpp>
|
||||
|
||||
namespace bts::spartan {
|
||||
|
||||
using JFGW = jetfix::JetFIXGateway<>;
|
||||
|
||||
struct TASOrderReactor::GatewayReactor {
|
||||
jetfix::OutFIXPtr fix;
|
||||
JFGW *gw;
|
||||
};
|
||||
|
||||
struct TASOrderReactor::GroupReactor {
|
||||
std::string group;
|
||||
boost::container::small_vector<GatewayReactor, 4> gw_reactors;
|
||||
};
|
||||
|
||||
struct TASOrderReactor::PImpl {
|
||||
trace::PerfLog perf_log;
|
||||
std::vector<std::unique_ptr<JFGW>> gw;
|
||||
int pending_logins = 0;
|
||||
int pending_reactions = 0;
|
||||
int pending_logouts = 0;
|
||||
std::vector<GroupReactor> group_reactors;
|
||||
};
|
||||
|
||||
TASOrderReactor::TASOrderReactor(std::vector<TASTriggerDef> const &triggers)
|
||||
: me(new PImpl()) {
|
||||
// Organize our reactors by group->gw
|
||||
for (auto &group_trigger : triggers) {
|
||||
for (auto &sec_trigger : group_trigger.sec_triggers) {
|
||||
auto &group_reactor = get_group_reactor(group_trigger.group_symbol);
|
||||
auto &gw_reactor = get_gw_reactor(
|
||||
group_reactor, sec_trigger.routing_record.session());
|
||||
prepare_side(api::Side::SIDE_BUY, sec_trigger, &gw_reactor);
|
||||
prepare_side(api::Side::SIDE_SELL, sec_trigger, &gw_reactor);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto &group_r : me->group_reactors)
|
||||
for (auto &gw_r : group_r.gw_reactors)
|
||||
gw_r.fix->close_all();
|
||||
|
||||
me->pending_logins = me->gw.size();
|
||||
me->pending_reactions = me->group_reactors.size();
|
||||
for (auto &p : me->gw) {
|
||||
p->on_ready() = [this] { me->pending_logins--; };
|
||||
p->on_disconnect() = [] { bts_assert(false); };
|
||||
p->start();
|
||||
}
|
||||
while (me->pending_logins)
|
||||
do_work();
|
||||
}
|
||||
|
||||
TASOrderReactor::~TASOrderReactor() {
|
||||
me->pending_logouts = me->gw.size();
|
||||
for (auto &p : me->gw) {
|
||||
p->on_disconnect() = [this] { me->pending_logouts--; };
|
||||
p->stop();
|
||||
}
|
||||
while (me->pending_logouts)
|
||||
do_work();
|
||||
}
|
||||
|
||||
bool TASOrderReactor::do_work() {
|
||||
for (auto &p : me->gw)
|
||||
p->dispatch_events();
|
||||
return me->pending_reactions;
|
||||
}
|
||||
|
||||
void TASOrderReactor::operator()(mdp3::MDP3PacketView const &,
|
||||
::mdp3::SecurityStatus30 const &status) {
|
||||
for (auto &r : me->group_reactors) {
|
||||
if (status.getSecurityGroupAsStringView() == r.group) {
|
||||
for (auto &gr : r.gw_reactors) {
|
||||
gr.gw->send(gr.fix, {});
|
||||
}
|
||||
r.group.clear();
|
||||
me->pending_reactions--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JFGW &TASOrderReactor::get_gw(std::string const &session_name) {
|
||||
for (auto &p : me->gw)
|
||||
if (p->cfg().name() == session_name)
|
||||
return *p;
|
||||
|
||||
me->gw.push_back(
|
||||
std::make_unique<JFGW>(get_connection(session_name), me->perf_log));
|
||||
return *me->gw.back();
|
||||
}
|
||||
|
||||
TASOrderReactor::GroupReactor &
|
||||
TASOrderReactor::get_group_reactor(std::string const &group) {
|
||||
for (auto &group_r : me->group_reactors)
|
||||
if (group_r.group == group)
|
||||
return group_r;
|
||||
|
||||
me->group_reactors.push_back({group, {}});
|
||||
return me->group_reactors.back();
|
||||
}
|
||||
|
||||
TASOrderReactor::GatewayReactor &
|
||||
TASOrderReactor::get_gw_reactor(GroupReactor &in_group,
|
||||
std::string const &session_name) {
|
||||
for (auto &gw_r : in_group.gw_reactors)
|
||||
if (gw_r.gw->cfg().name() == session_name)
|
||||
return gw_r;
|
||||
auto &gw = get_gw(session_name);
|
||||
auto fix = std::make_shared<jetfix::OutFIX>(gw.cfg());
|
||||
in_group.gw_reactors.push_back({fix, &gw});
|
||||
return in_group.gw_reactors.back();
|
||||
}
|
||||
|
||||
void TASOrderReactor::prepare_side(api::Side side,
|
||||
TASTriggerDef::SecTrigger const &sec_trigger,
|
||||
GatewayReactor *out) {
|
||||
|
||||
auto &sec = sec_trigger.security;
|
||||
auto &rr = sec_trigger.routing_record;
|
||||
|
||||
auto &fix =
|
||||
out->fix->first_stream().new_msg(jetfix::MessageTypes::NewOrderSingle);
|
||||
|
||||
using namespace jetfix;
|
||||
|
||||
fix.add<fix::SenderSubID>(rr.operator_id());
|
||||
fix.add<fix::SenderLocationID>(rr.location());
|
||||
fix.add<fix::Account>(rr.account());
|
||||
fix.add<fix::Side>(side);
|
||||
fix.add<fix::TimeInForce>(api::orderman::TimeInForce::TIME_IN_FORCE_DAY);
|
||||
fix.add<fix::ManualOrderIndicator>(false);
|
||||
fix.add<fix::CustomerOrFirm>(
|
||||
api::orderman::CustomerOrFirm::CUSTOMER_OR_FIRM_CUSTOMER);
|
||||
fix.add<fix::CtiCode>(api::orderman::CTICode::CTI_CODE_CTI_CODE1);
|
||||
fix.add<fix::SecurityDesc>(sec.glbx().security_desc());
|
||||
|
||||
auto k = orderman::gen_order_id();
|
||||
std::string clordid(orderman::clordid_sz(), ' ');
|
||||
orderman::encode_clorid(k, SecurityKey(sec.id()), &clordid);
|
||||
fix.add<fix::ClOrdID>(clordid);
|
||||
|
||||
fix.add<fix::CustOrderHandlingInst>(std::string_view{"Y"});
|
||||
if (rr.smp_id().size()) {
|
||||
fix.add<fix::SelfMatchPreventionID>(rr.smp_id());
|
||||
if (rr.smp_instruction() !=
|
||||
api::orderman::SELF_MATCH_PREVENTION_INSTRUCTION_UNDEFINED)
|
||||
fix.add<fix::SelfMatchPreventionInstruction>(rr.smp_instruction());
|
||||
}
|
||||
|
||||
fix.add<fix::TransactTimeStr>(datetime::FIX_timestamp(datetime::now()));
|
||||
fix.add<fix::OrderQty>(sec_trigger.side.get(side).quantity);
|
||||
fix.add<fix::OrdType>(
|
||||
api::orderman::NativeOrderType::NATIVE_ORDER_TYPE_LIMIT);
|
||||
fix.add<fix::Price>(sec_trigger.side.get(side).ticks_away, 7, -1);
|
||||
}
|
||||
|
||||
config::JetFIX::Connection
|
||||
TASOrderReactor::get_connection(std::string const &session_name) {
|
||||
for (auto const &cfg : config::get<config::JetFIX>().connection())
|
||||
if (cfg.name() == session_name)
|
||||
return cfg;
|
||||
|
||||
bts_assert(false);
|
||||
return config::JetFIX::Connection{};
|
||||
}
|
||||
|
||||
} // namespace bts::spartan
|
||||
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include "lib/config/protos/jetfix.pb.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "TASTriggerDef.h"
|
||||
|
||||
namespace mdp3 {
|
||||
class SecurityStatus30;
|
||||
}
|
||||
namespace bts {
|
||||
namespace jetfix {
|
||||
template <class...> class JetFIXGateway;
|
||||
}
|
||||
} // namespace bts
|
||||
|
||||
namespace bts::spartan {
|
||||
|
||||
namespace mdp3 {class MDP3PacketView;}
|
||||
|
||||
class TASOrderReactor {
|
||||
public:
|
||||
TASOrderReactor(std::vector<TASTriggerDef> const &);
|
||||
~TASOrderReactor();
|
||||
bool do_work();
|
||||
void operator()(mdp3::MDP3PacketView const &packet,
|
||||
::mdp3::SecurityStatus30 const &status);
|
||||
|
||||
private:
|
||||
struct PImpl;
|
||||
struct GatewayReactor;
|
||||
struct GroupReactor;
|
||||
using JFGW = jetfix::JetFIXGateway<>;
|
||||
std::unique_ptr<PImpl> me;
|
||||
|
||||
GroupReactor &get_group_reactor(std::string const &group);
|
||||
GatewayReactor &get_gw_reactor(GroupReactor &,
|
||||
std::string const &session_name);
|
||||
void prepare_side(api::Side side, TASTriggerDef::SecTrigger const &,
|
||||
GatewayReactor *);
|
||||
JFGW &get_gw(std::string const &);
|
||||
config::JetFIX::Connection get_connection(std::string const &session_name);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#include "TASTriggerDef.h"
|
||||
|
||||
namespace bts {
|
||||
namespace spartan {
|
||||
|
||||
std::ostream& operator<<(std::ostream&out, TASTriggerDef const&def) {
|
||||
out << "group: " << def.group_symbol << "\n";
|
||||
for (auto const &st : def.sec_triggers) {
|
||||
out << "\tsec: " << securities::descriptor(st.security) << "\n"
|
||||
<< "\tbuy: " << st.side.get(api::Side::SIDE_BUY).quantity << "@"
|
||||
<< st.side.get(api::Side::SIDE_BUY).ticks_away << "\n"
|
||||
<< "\tsell: " << st.side.get(api::Side::SIDE_SELL).quantity << "@"
|
||||
<< st.side.get(api::Side::SIDE_SELL).ticks_away << "\n\n";
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "lib/domain_model/Security.pb.h"
|
||||
#include "lib/api/services/OrderService.pb.h"
|
||||
#include "lib/domain_model/Security.h"
|
||||
|
||||
namespace bts {
|
||||
namespace spartan {
|
||||
|
||||
struct TASTriggerDef {
|
||||
std::string group_symbol;
|
||||
struct Side {
|
||||
uint32_t quantity;
|
||||
int32_t ticks_away;
|
||||
};
|
||||
struct SecTrigger {
|
||||
api::Security security;
|
||||
api::orderman::RoutingRecord routing_record;
|
||||
securities::TwoSided<Side> side;
|
||||
};
|
||||
std::vector<SecTrigger> sec_triggers;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream&, TASTriggerDef const&);
|
||||
|
||||
}}
|
||||
@@ -0,0 +1,135 @@
|
||||
#include "FifoPriceLevelMatcher.h"
|
||||
#include "../common/InstrumentSnapshot.h"
|
||||
|
||||
namespace bts::spartan::mdp3 {
|
||||
|
||||
// private helpers ////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void FifoPriceLevelMatcher::_compress(){
|
||||
_orders.erase(
|
||||
std::remove_if(_orders.begin(),
|
||||
_orders.end(),
|
||||
[](const Order& o) { return !o.is_active; }),
|
||||
_orders.end());
|
||||
}
|
||||
|
||||
FifoPriceLevelMatcher::Order*
|
||||
FifoPriceLevelMatcher::_find(MDP3OrderKey key){
|
||||
for(auto& o : _orders)
|
||||
if(o.key == key)
|
||||
return &o;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void FifoPriceLevelMatcher::_logically_delete(Order& o){
|
||||
o.is_active = false;
|
||||
}
|
||||
void FifoPriceLevelMatcher::_add_order(MDP3OrderKey key,
|
||||
MDP3OrderPriority priority,
|
||||
MDP3Quantity quantity){
|
||||
// assert for this priority to be higher than last element
|
||||
//bts_assert(priority.value() > _lowest_priority.value());
|
||||
_orders.emplace_back(key, priority, quantity);
|
||||
_lowest_priority = priority;
|
||||
}
|
||||
FifoPriceLevelMatcher::FifoPriceLevelMatcher (
|
||||
md::IntPrice price,
|
||||
api::Side side)
|
||||
:
|
||||
_price(price),
|
||||
_side(side),
|
||||
_lowest_priority(0),
|
||||
_orders()
|
||||
{}
|
||||
|
||||
// constructors ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
FifoPriceLevelMatcher::FifoPriceLevelMatcher (
|
||||
const FifoPriceLevelMatcher& o){
|
||||
*this = o;
|
||||
}
|
||||
FifoPriceLevelMatcher::FifoPriceLevelMatcher (FifoPriceLevelMatcher&& o){
|
||||
*this = std::move(o);
|
||||
}
|
||||
// operator overloads /////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
FifoPriceLevelMatcher& FifoPriceLevelMatcher::operator=(
|
||||
const FifoPriceLevelMatcher& o){
|
||||
_price = o._price;
|
||||
_side = o._side;
|
||||
_lowest_priority = o._lowest_priority;
|
||||
_orders = o._orders;
|
||||
return *this;
|
||||
}
|
||||
FifoPriceLevelMatcher& FifoPriceLevelMatcher::operator=(
|
||||
FifoPriceLevelMatcher&& o){
|
||||
_price = std::move(o._price);
|
||||
_side = std::move(o._side);
|
||||
_lowest_priority = std::move(o._lowest_priority);
|
||||
_orders = std::move(o._orders);
|
||||
return *this;
|
||||
}
|
||||
bool FifoPriceLevelMatcher::operator<(const FifoPriceLevelMatcher& o) const {
|
||||
bts_assert(_side == o._side);
|
||||
// bid book is sorted high to low (since highest is the top of the book)
|
||||
return _side == api::Side::SIDE_SELL ? _price < o._price :
|
||||
o._price < _price;
|
||||
|
||||
}
|
||||
// order interactions //////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
void FifoPriceLevelMatcher::on_new_same_side_order(const MDP3Order& new_ord){
|
||||
bts_assert(new_ord.price == _price);
|
||||
bts_assert(new_ord.side == _side);
|
||||
_add_order(new_ord.key, new_ord.priority, new_ord.quantity);
|
||||
}
|
||||
void FifoPriceLevelMatcher::on_order_update(const MDP3Order& upd_ord){
|
||||
bts_assert(upd_ord.side == _side);
|
||||
bts_assert(upd_ord.price == _price);
|
||||
FifoPriceLevelMatcher::Order* ord_p = _find(upd_ord.key);
|
||||
bts_assert(ord_p != nullptr);
|
||||
if(upd_ord.quantity.value() > ord_p->quantity.value()){
|
||||
// remove it from the current location and add it to
|
||||
// the end
|
||||
_logically_delete(*ord_p);
|
||||
_add_order(upd_ord.key, upd_ord.priority, upd_ord.quantity);
|
||||
}
|
||||
else
|
||||
ord_p->quantity = upd_ord.quantity;
|
||||
_compress();
|
||||
}
|
||||
void FifoPriceLevelMatcher::on_order_remove(MDP3OrderKey k){
|
||||
FifoPriceLevelMatcher::Order* ord_p = _find(k);
|
||||
bts_assert(ord_p != nullptr);
|
||||
_logically_delete(*ord_p);
|
||||
_compress();
|
||||
}
|
||||
MDP3Quantity FifoPriceLevelMatcher::on_new_opp_order(MDP3Quantity opp_ord_qty){
|
||||
auto rem = opp_ord_qty.value();
|
||||
// go through all the orders and see which ones get filled
|
||||
// (orders are sorted by priority)
|
||||
for(auto& o : _orders){
|
||||
if(o.is_active){
|
||||
if(rem >= o.quantity.value()){
|
||||
// existing order gets completely crossed
|
||||
_logically_delete(o);
|
||||
rem -= o.quantity.value();
|
||||
}
|
||||
else{
|
||||
// the remaining qty of the order
|
||||
// gets completely crossed now
|
||||
bts_assert(o.quantity.value() > rem);
|
||||
o.quantity = MDP3Quantity(o.quantity.value() - rem);
|
||||
rem = 0;
|
||||
}
|
||||
}
|
||||
if(rem == 0)
|
||||
break;
|
||||
}
|
||||
_compress();
|
||||
bts_assert(rem <= opp_ord_qty.value());
|
||||
return MDP3Quantity(rem);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
#pragma once
|
||||
|
||||
// did not want to fwd decl everything specially
|
||||
// the templated classes (will fix later)
|
||||
#include "../common/InstrumentSnapshot.h"
|
||||
|
||||
namespace bts::spartan::mdp3 {
|
||||
|
||||
// Builds the order state for all orders correponding to one
|
||||
// price level for one security
|
||||
class FifoPriceLevelMatcher{
|
||||
public:
|
||||
struct Order{
|
||||
MDP3OrderKey key;
|
||||
MDP3OrderPriority priority;
|
||||
MDP3Quantity quantity;
|
||||
bool is_active=true;
|
||||
Order (MDP3OrderKey key_arg,
|
||||
MDP3OrderPriority priority_arg,
|
||||
MDP3Quantity quantity_arg)
|
||||
:
|
||||
key(key_arg),
|
||||
priority(priority_arg),
|
||||
quantity(quantity_arg)
|
||||
{}
|
||||
};
|
||||
private:
|
||||
md::IntPrice _price;
|
||||
api::Side _side;
|
||||
MDP3OrderPriority _lowest_priority;
|
||||
std::vector<FifoPriceLevelMatcher::Order> _orders;
|
||||
private:
|
||||
// helpers /////////////////////////////////////////////////////////////////
|
||||
void _compress();
|
||||
Order* _find(MDP3OrderKey key);
|
||||
void _logically_delete(Order& o);
|
||||
void _add_order(MDP3OrderKey key,
|
||||
MDP3OrderPriority priority,
|
||||
MDP3Quantity quantity);
|
||||
public:
|
||||
// constructors ////////////////////////////////////////////////////////////
|
||||
FifoPriceLevelMatcher (md::IntPrice price,
|
||||
api::Side side);
|
||||
FifoPriceLevelMatcher (const FifoPriceLevelMatcher&);
|
||||
FifoPriceLevelMatcher (FifoPriceLevelMatcher&&);
|
||||
// operator overloads //////////////////////////////////////////////////////
|
||||
FifoPriceLevelMatcher& operator=(const FifoPriceLevelMatcher& o);
|
||||
FifoPriceLevelMatcher& operator=(FifoPriceLevelMatcher&& o);
|
||||
bool operator==(const FifoPriceLevelMatcher& o) const {return _price == o._price;}
|
||||
bool operator!=(const FifoPriceLevelMatcher& o) const {return _price != o._price;}
|
||||
bool operator<(const FifoPriceLevelMatcher& o) const;
|
||||
// simple accessors ////////////////////////////////////////////////////////
|
||||
std::tuple<uint32_t,uint32_t> n_orders_qty() const{
|
||||
uint32_t n_orders = 0, tot_qty = 0;
|
||||
for(const auto& o : _orders)
|
||||
if(o.is_active){
|
||||
n_orders++;
|
||||
tot_qty += o.quantity.value();
|
||||
}
|
||||
return std::make_tuple(n_orders,tot_qty);
|
||||
}
|
||||
MDP3Quantity quantity() const{
|
||||
return MDP3Quantity(std::get<1>(n_orders_qty()));
|
||||
}
|
||||
uint32_t n_orders() const{
|
||||
return std::get<0>(n_orders_qty());
|
||||
}
|
||||
bool populated() const{
|
||||
return quantity().value()>0;
|
||||
}
|
||||
md::IntPrice price() const{
|
||||
return _price;
|
||||
}
|
||||
api::Side side() const{
|
||||
return _side;
|
||||
}
|
||||
Order* find_order (MDP3OrderKey key){
|
||||
return _find(key);
|
||||
}
|
||||
BookLevel book_level() const{
|
||||
return BookLevel{_price, quantity(), static_cast<int>(n_orders())};
|
||||
}
|
||||
// mutators (silly reason) /////////////////////////////////////////////////
|
||||
void set_price(md::IntPrice p){
|
||||
_price = p;
|
||||
}
|
||||
const std::vector<Order>& orders(){
|
||||
return _orders;
|
||||
}
|
||||
// order interactions //////////////////////////////////////////////////////
|
||||
// order with the same side and price as this price level
|
||||
void on_new_same_side_order(const MDP3Order& new_ord);
|
||||
// order update such that only the qty changed (other changes
|
||||
// are handled at a higher level)
|
||||
void on_order_update(const MDP3Order& upd_ord);
|
||||
void on_order_remove(MDP3OrderKey k);
|
||||
// new order such that it crosses this price level
|
||||
MDP3Quantity on_new_opp_order(MDP3Quantity opp_ord_qty);
|
||||
};
|
||||
|
||||
} // namespace bts::spartan::mdp3
|
||||
@@ -0,0 +1,159 @@
|
||||
#include "FifoSecurityMatcher.h"
|
||||
#include "../common/InstrumentSnapshot.h"
|
||||
|
||||
namespace bts::spartan::mdp3 {
|
||||
|
||||
// helpers ////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
inline bool _is_cross (
|
||||
const MDP3Order& ord,
|
||||
const FifoPriceLevelMatcher& price_level){
|
||||
return ord.side != price_level.side() &&
|
||||
(
|
||||
(
|
||||
ord.side == api::Side::SIDE_BUY &&
|
||||
ord.price >= price_level.price()
|
||||
)
|
||||
||
|
||||
(
|
||||
ord.side == api::Side::SIDE_SELL &&
|
||||
ord.price <= price_level.price()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
inline api::Side _opp_side(api::Side side){
|
||||
return side == api::Side::SIDE_BUY ? api::Side::SIDE_SELL :
|
||||
api::Side::SIDE_BUY;
|
||||
}
|
||||
|
||||
inline FifoPriceLevelMatcher* FifoSecurityMatcher::_top(api::Side side){
|
||||
auto& bk = _book(side);
|
||||
auto it = bk.begin();
|
||||
return it != bk.end() ? &*it : nullptr;
|
||||
}
|
||||
|
||||
FifoPriceLevelMatcher* FifoSecurityMatcher::_find_price_level(
|
||||
api::Side side,
|
||||
md::IntPrice price){
|
||||
auto& bk = _book(side);
|
||||
_search_tok.set_price(price);
|
||||
auto it = bk.find (_search_tok);
|
||||
return it != bk.end() ? &*it : nullptr;
|
||||
}
|
||||
|
||||
std::tuple<FifoPriceLevelMatcher*,FifoPriceLevelMatcher::Order*>
|
||||
FifoSecurityMatcher::_find_order (MDP3OrderKey key){
|
||||
for (auto& p_level : _bid_book){
|
||||
auto o_ptr = p_level.find_order(key);
|
||||
if (o_ptr != nullptr)
|
||||
return std::make_tuple(&p_level,o_ptr);
|
||||
}
|
||||
for (auto& p_level : _ask_book){
|
||||
auto o_ptr = p_level.find_order(key);
|
||||
if (o_ptr != nullptr)
|
||||
return std::make_tuple(&p_level,o_ptr);
|
||||
}
|
||||
return std::tuple<FifoPriceLevelMatcher*,FifoPriceLevelMatcher::Order*>
|
||||
(nullptr,nullptr);
|
||||
}
|
||||
|
||||
void FifoSecurityMatcher::_remove_empty_price_levels(){
|
||||
auto rem_if = [](const auto& p_lev) { return !p_lev.populated(); };
|
||||
_bid_book.erase(
|
||||
std::remove_if(_bid_book.begin(),_bid_book.end(),rem_if),
|
||||
_bid_book.end());
|
||||
_bid_book.erase(
|
||||
std::remove_if(_ask_book.begin(), _ask_book.end(), rem_if),
|
||||
_ask_book.end());
|
||||
}
|
||||
// constructors ///////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
FifoSecurityMatcher::FifoSecurityMatcher(const InstrumentSnapshot& snp)
|
||||
:
|
||||
_bid_book(),
|
||||
_ask_book(),
|
||||
_search_tok(md::IntPrice(),
|
||||
api::Side::SIDE_BUY)
|
||||
{
|
||||
for (const auto& kv : snp.orders())
|
||||
on_new_order(kv.second);
|
||||
}
|
||||
// accessors //////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
Book FifoSecurityMatcher::book(api::Side side) const{
|
||||
auto i = 0;
|
||||
Book rv;
|
||||
for (const auto& p_level : _book(side)){
|
||||
if(i < MDP3_MAX_BOOK_DEPTH)
|
||||
rv[i++] = p_level.book_level();
|
||||
else
|
||||
break;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
// order interactions /////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void FifoSecurityMatcher::on_new_order(const MDP3Order& ord){
|
||||
auto& opp_book = _book(_opp_side(ord.side));
|
||||
uint32_t rem = ord.quantity.value();
|
||||
for (FifoPriceLevelMatcher& pl : opp_book){
|
||||
if(_is_cross(ord, pl))
|
||||
rem = pl.on_new_opp_order(MDP3Quantity(rem)).value();
|
||||
else
|
||||
break;
|
||||
if(rem == 0)
|
||||
break;
|
||||
bts_assert(pl.quantity().value()==0);
|
||||
// stops crossing when the price level is not a cross or there
|
||||
// no qty left
|
||||
}
|
||||
_remove_empty_price_levels();
|
||||
if(rem != 0){
|
||||
// either the price did not cross into the opp market
|
||||
// or it cleared out the entire opposite side
|
||||
// in either case, it becomes a resting order
|
||||
FifoPriceLevelMatcher* price_level = _find_price_level(ord.side,ord.price);
|
||||
if(price_level == nullptr){
|
||||
auto& same_side_book = _book(ord.side);
|
||||
auto p = same_side_book.emplace(ord.price,ord.side);
|
||||
bts_assert(std::get<1>(p));
|
||||
price_level = &*std::get<0>(p);
|
||||
}
|
||||
MDP3Order ord_corrected = ord;
|
||||
ord_corrected.quantity = MDP3Quantity(rem);
|
||||
price_level->on_new_same_side_order(ord);
|
||||
}
|
||||
}
|
||||
|
||||
void FifoSecurityMatcher::on_order_update(const MDP3Order& ord){
|
||||
auto t = _find_order(ord.key);
|
||||
FifoPriceLevelMatcher* price_level = std::get<0>(t);
|
||||
FifoPriceLevelMatcher::Order* ex_ord = std::get<1>(t);
|
||||
bts_assert(price_level != nullptr);
|
||||
bts_assert(ex_ord != nullptr);
|
||||
// side can not be changed (or can it?)
|
||||
bts_assert(price_level->side() == ord.side);
|
||||
// check for price change
|
||||
if(price_level->price() != ord.price){
|
||||
// remove from current level and add to another
|
||||
on_order_remove(ord.key);
|
||||
on_new_order(ord);
|
||||
}
|
||||
else{
|
||||
// qty change - price_level will handle it
|
||||
price_level->on_order_update(ord);
|
||||
}
|
||||
}
|
||||
|
||||
void FifoSecurityMatcher::on_order_remove(MDP3OrderKey key){
|
||||
auto t = _find_order(key);
|
||||
FifoPriceLevelMatcher* price_level = std::get<0>(t);
|
||||
FifoPriceLevelMatcher::Order* ex_ord = std::get<1>(t);
|
||||
bts_assert(price_level != nullptr);
|
||||
bts_assert(ex_ord != nullptr);
|
||||
bts_assert(key == ex_ord->key);
|
||||
price_level->on_order_remove(key);
|
||||
_remove_empty_price_levels();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
// did not want to fwd decl everything specially
|
||||
// the templated classes (will fix later)
|
||||
#include "../common/InstrumentSnapshot.h"
|
||||
#include "FifoPriceLevelMatcher.h"
|
||||
#include <boost/container/flat_set.hpp>
|
||||
|
||||
namespace bts::spartan::mdp3 {
|
||||
|
||||
class FifoSecurityMatcher {
|
||||
private:
|
||||
// ask prices are sorted lowest to highets and and bid prices
|
||||
// are sorted lowest to highest
|
||||
boost::container::flat_set<FifoPriceLevelMatcher> _bid_book,
|
||||
_ask_book;
|
||||
FifoPriceLevelMatcher _search_tok;
|
||||
private:
|
||||
// helpers /////////////////////////////////////////////////////////////////
|
||||
// returns the top of the side in the arg; nullptr
|
||||
// if the side does not have any prices. complexity is
|
||||
// O(1)
|
||||
FifoPriceLevelMatcher* _top(api::Side);
|
||||
// complexity: O(lg(n))
|
||||
FifoPriceLevelMatcher* _find_price_level(api::Side, md::IntPrice price);
|
||||
boost::container::flat_set<FifoPriceLevelMatcher>& _book(api::Side side){
|
||||
return side == api::Side::SIDE_BUY ? _bid_book : _ask_book;
|
||||
}
|
||||
const boost::container::flat_set<FifoPriceLevelMatcher>& _book(
|
||||
api::Side side) const{
|
||||
return side == api::Side::SIDE_BUY ? _bid_book : _ask_book;
|
||||
}
|
||||
// returns the price level and the order within that level.
|
||||
// complexity: O(n^2) (searching through each price level
|
||||
// and within a price level searching through the orders)
|
||||
// this could be improved to O(lg(n)), if order keys are stored
|
||||
// in a boost::flat_set pointing to their PriceLevel
|
||||
std::tuple<FifoPriceLevelMatcher*,FifoPriceLevelMatcher::Order*>
|
||||
_find_order (MDP3OrderKey key);
|
||||
// for performance reasons we should reuse empty price levels
|
||||
// (right now, for simplcity, we just remove)
|
||||
void _remove_empty_price_levels();
|
||||
public:
|
||||
// cons ////////////////////////////////////////////////////////////////////
|
||||
FifoSecurityMatcher(const InstrumentSnapshot&);
|
||||
// accessors ///////////////////////////////////////////////////////////////
|
||||
Book book(api::Side) const;
|
||||
// order interactions //////////////////////////////////////////////////////
|
||||
void on_new_order(const MDP3Order&);
|
||||
void on_order_update(const MDP3Order&);
|
||||
void on_order_remove(MDP3OrderKey);
|
||||
};
|
||||
} // namespace bts::spartan::mdp3
|
||||
@@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
|
||||
#include "../gen/MDInstrumentDefinitionFuture54.h"
|
||||
#include "../gen/MDInstrumentDefinitionOption55.h"
|
||||
#include "../gen/MDInstrumentDefinitionSpread56.h"
|
||||
#include "../parsing/MDP3MsgBox.h"
|
||||
#include "mdp3_common.h"
|
||||
|
||||
namespace bts::spartan::mdp3 {
|
||||
|
||||
// A simple abstraction for a instrument definition, which can be one of:
|
||||
// ::mdp3::MDInstrumentDefinitionFuture54
|
||||
// ::mdp3::MDInstrumentDefinitionOption55
|
||||
// ::mdp3::MDInstrumentDefinitionSpread56
|
||||
// To get the actual definition type use the visit() method.
|
||||
|
||||
class InstrumentDefinition {
|
||||
public:
|
||||
InstrumentDefinition(InstrumentDefinition &&d) = default;
|
||||
InstrumentDefinition(InstrumentDefinition const &d) = default;
|
||||
InstrumentDefinition &operator=(InstrumentDefinition &&other) = default;
|
||||
InstrumentDefinition &operator=(InstrumentDefinition const &other) = default;
|
||||
|
||||
template <class M>
|
||||
InstrumentDefinition(M const &d) : _def(MDP3MsgBox<M>(d)) {}
|
||||
|
||||
// Visit specific type in this definition
|
||||
template <class Visitor> void visit(Visitor v) const {
|
||||
std::visit([&v](auto &m) { v(*m); }, _def);
|
||||
}
|
||||
|
||||
// Query the specific type contained in this definition and return
|
||||
// something about it
|
||||
template <class Getter> auto get(Getter g) const {
|
||||
return std::visit([g](auto &m) { return g(*m); }, _def);
|
||||
}
|
||||
|
||||
// Helpers
|
||||
MDP3TimeStamp last_update_time() const {
|
||||
return MDP3TimeStamp{
|
||||
get([](auto const &m) { return m.lastUpdateTime(); })};
|
||||
}
|
||||
size_t tot_num_reports() const {
|
||||
return get([](auto const &m) { return m.totNumReports(); });
|
||||
}
|
||||
MDP3SecurityID security_id() const {
|
||||
return MDP3SecurityID{get([](auto const &m) { return m.securityID(); })};
|
||||
}
|
||||
const char *symbol() const {
|
||||
return get([](auto const &m) { return m.symbol(); });
|
||||
}
|
||||
|
||||
::mdp3::MatchEventIndicator match_event_indicator() const {
|
||||
// matchEventIndicator() is not marked as const so we cannot use
|
||||
// the get() method
|
||||
return std::visit([](auto &box) { return box->matchEventIndicator(); },
|
||||
_def);
|
||||
}
|
||||
|
||||
const char *security_group() const {
|
||||
return get([](auto const &m) { return m.securityGroup(); });
|
||||
}
|
||||
|
||||
const char *asset() const {
|
||||
return get([](auto const &m) { return m.asset(); });
|
||||
}
|
||||
|
||||
::mdp3::SecurityTradingStatus::Value trading_status() const {
|
||||
return get([](auto const &m) { return m.mDSecurityTradingStatus(); });
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
using DefVar =
|
||||
std::variant<MDP3MsgBox<::mdp3::MDInstrumentDefinitionFuture54>,
|
||||
MDP3MsgBox<::mdp3::MDInstrumentDefinitionOption55>,
|
||||
MDP3MsgBox<::mdp3::MDInstrumentDefinitionSpread56>>;
|
||||
mutable DefVar _def;
|
||||
};
|
||||
|
||||
using MaybeInstrumentDefinition = std::optional<InstrumentDefinition>;
|
||||
|
||||
} // namespace bts::spartan::mdp3
|
||||
@@ -0,0 +1,418 @@
|
||||
#include "InstrumentSnapshot.h"
|
||||
|
||||
namespace bts::spartan::mdp3 {
|
||||
|
||||
struct InstrumentSnapshot::PImpl {
|
||||
PImpl(InstrumentDefinition const &def)
|
||||
: security_id(def.security_id()), books(), implied_books(), orders(),
|
||||
order_changes(), last_processed_sn(0), fills(), high_limit_price(),
|
||||
low_limit_price(), max_price_variation(), cleared_volume(),
|
||||
electronic_volume(), fixing_price(), open_interest(), open_price(),
|
||||
high_bid(), low_offer(), settlement_price(), high_trade_price(),
|
||||
low_trade_price(), definition(def),
|
||||
trading_status(definition.trading_status()) {}
|
||||
|
||||
PImpl(InstrumentDefinition &&def)
|
||||
: security_id(def.security_id()), books(), implied_books(), orders(),
|
||||
order_changes(), last_processed_sn(0), fills(), high_limit_price(),
|
||||
low_limit_price(), max_price_variation(), cleared_volume(),
|
||||
electronic_volume(), fixing_price(), open_interest(), open_price(),
|
||||
high_bid(), low_offer(), settlement_price(), high_trade_price(),
|
||||
low_trade_price(), definition(std::move(def)),
|
||||
trading_status(definition.trading_status()) {}
|
||||
|
||||
// Books
|
||||
const MDP3SecurityID security_id;
|
||||
std::array<Book, 2> books;
|
||||
std::array<ImpliedBook, 2> implied_books;
|
||||
// Orders
|
||||
Orders orders;
|
||||
OrderChanges order_changes;
|
||||
|
||||
// Last packet that affected this security
|
||||
size_t last_processed_sn;
|
||||
|
||||
// Fills
|
||||
Fills fills;
|
||||
|
||||
// stats
|
||||
md::IntPrice high_limit_price;
|
||||
md::IntPrice low_limit_price;
|
||||
md::IntPrice max_price_variation;
|
||||
MDP3Quantity cleared_volume;
|
||||
MDP3Quantity electronic_volume;
|
||||
md::IntPrice fixing_price;
|
||||
MDP3Quantity open_interest;
|
||||
md::IntPrice open_price;
|
||||
md::IntPrice high_bid;
|
||||
md::IntPrice low_offer;
|
||||
md::IntPrice settlement_price;
|
||||
md::IntPrice high_trade_price;
|
||||
md::IntPrice low_trade_price;
|
||||
InstrumentDefinition definition;
|
||||
|
||||
::mdp3::SecurityTradingStatus::Value trading_status;
|
||||
};
|
||||
|
||||
InstrumentSnapshot::InstrumentSnapshot(InstrumentDefinition const &def)
|
||||
: me(new PImpl(def)) {}
|
||||
|
||||
InstrumentSnapshot::InstrumentSnapshot(InstrumentDefinition &&def)
|
||||
: me(new PImpl(std::move(def))) {}
|
||||
|
||||
InstrumentSnapshot::~InstrumentSnapshot() {}
|
||||
|
||||
MDP3SecurityID InstrumentSnapshot::security_id() const {
|
||||
return me->security_id;
|
||||
}
|
||||
|
||||
InstrumentDefinition InstrumentSnapshot::definition() const {
|
||||
return me->definition;
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::set_definition(InstrumentDefinition const &def) {
|
||||
me->definition = def;
|
||||
}
|
||||
|
||||
size_t InstrumentSnapshot::last_processed_sn() const {
|
||||
return me->last_processed_sn;
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::set_last_msg_processed_sn(size_t n) {
|
||||
me->last_processed_sn = n;
|
||||
}
|
||||
|
||||
::mdp3::SecurityTradingStatus::Value
|
||||
InstrumentSnapshot::trading_status() const {
|
||||
return me->trading_status;
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::set_trading_status(
|
||||
::mdp3::SecurityTradingStatus::Value t) const {
|
||||
me->trading_status = t;
|
||||
}
|
||||
|
||||
md::IntPrice InstrumentSnapshot::high_limit_price() const {
|
||||
return me->high_limit_price;
|
||||
}
|
||||
void InstrumentSnapshot::set_high_limit_price(md::IntPrice v) {
|
||||
me->high_limit_price = v;
|
||||
}
|
||||
|
||||
md::IntPrice InstrumentSnapshot::low_limit_price() const {
|
||||
return me->low_limit_price;
|
||||
}
|
||||
void InstrumentSnapshot::set_low_limit_price(md::IntPrice v) {
|
||||
me->low_limit_price = v;
|
||||
}
|
||||
|
||||
md::IntPrice InstrumentSnapshot::max_price_variation() const {
|
||||
return me->max_price_variation;
|
||||
}
|
||||
void InstrumentSnapshot::set_max_price_variation(md::IntPrice v) {
|
||||
me->max_price_variation = v;
|
||||
}
|
||||
|
||||
MDP3Quantity InstrumentSnapshot::cleared_volume() const {
|
||||
return me->cleared_volume;
|
||||
}
|
||||
void InstrumentSnapshot::set_cleared_volume(MDP3Quantity v) {
|
||||
me->cleared_volume = v;
|
||||
}
|
||||
|
||||
MDP3Quantity InstrumentSnapshot::electronic_volume() const {
|
||||
return me->electronic_volume;
|
||||
}
|
||||
void InstrumentSnapshot::set_electronic_volume(MDP3Quantity v) {
|
||||
me->electronic_volume = v;
|
||||
}
|
||||
|
||||
md::IntPrice InstrumentSnapshot::fixing_price() const {
|
||||
return me->fixing_price;
|
||||
}
|
||||
void InstrumentSnapshot::set_fixing_price(md::IntPrice v) {
|
||||
me->fixing_price = v;
|
||||
}
|
||||
|
||||
MDP3Quantity InstrumentSnapshot::open_interest() const {
|
||||
return me->open_interest;
|
||||
}
|
||||
void InstrumentSnapshot::set_open_interest(MDP3Quantity v) {
|
||||
me->open_interest = v;
|
||||
}
|
||||
|
||||
md::IntPrice InstrumentSnapshot::open_price() const { return me->open_price; }
|
||||
void InstrumentSnapshot::set_open_price(md::IntPrice v) { me->open_price = v; }
|
||||
|
||||
md::IntPrice InstrumentSnapshot::high_bid() const { return me->high_bid; }
|
||||
void InstrumentSnapshot::set_high_bid(md::IntPrice v) { me->high_bid = v; }
|
||||
|
||||
md::IntPrice InstrumentSnapshot::low_offer() const { return me->low_offer; }
|
||||
void InstrumentSnapshot::set_low_offer(md::IntPrice v) { me->low_offer = v; }
|
||||
|
||||
md::IntPrice InstrumentSnapshot::settlement_price() const {
|
||||
return me->settlement_price;
|
||||
}
|
||||
void InstrumentSnapshot::set_settlement_price(md::IntPrice v) {
|
||||
me->settlement_price = v;
|
||||
}
|
||||
|
||||
md::IntPrice InstrumentSnapshot::high_trade_price() const {
|
||||
return me->high_trade_price;
|
||||
}
|
||||
void InstrumentSnapshot::set_high_trade_price(md::IntPrice v) {
|
||||
me->high_trade_price = v;
|
||||
}
|
||||
|
||||
md::IntPrice InstrumentSnapshot::low_trade_price() const {
|
||||
return me->low_trade_price;
|
||||
}
|
||||
void InstrumentSnapshot::set_low_trade_price(md::IntPrice v) {
|
||||
me->low_trade_price = v;
|
||||
}
|
||||
|
||||
Book const &InstrumentSnapshot::book(api::Side s) const {
|
||||
return me->books[s - api::SIDE_BUY];
|
||||
}
|
||||
|
||||
ImpliedBook const &InstrumentSnapshot::implied_book(api::Side s) const {
|
||||
return me->implied_books[s - api::SIDE_BUY];
|
||||
}
|
||||
|
||||
template <class A>
|
||||
void InstrumentSnapshot::insert(api::Side s, std::array<A, 2> &books,
|
||||
size_t idx, BookLevel const &level) {
|
||||
auto &book = books[s - api::SIDE_BUY];
|
||||
int zidx = (int)(idx - 1);
|
||||
bts_assert_d(zidx < (int)book.size());
|
||||
for (int i = book.size() - 2; i >= zidx; i--)
|
||||
book[i + 1] = book[i];
|
||||
book[zidx] = level;
|
||||
}
|
||||
|
||||
template <class A>
|
||||
void InstrumentSnapshot::update(api::Side s, std::array<A, 2> &books,
|
||||
size_t idx, BookLevel const &level) {
|
||||
auto &book = books[s - api::SIDE_BUY];
|
||||
int zidx = (int)idx - 1;
|
||||
bts_assert_d(zidx < (int)book.size());
|
||||
book[zidx] = level;
|
||||
}
|
||||
|
||||
template <class A>
|
||||
void InstrumentSnapshot::remove(api::Side s, std::array<A, 2> &books,
|
||||
size_t idx) {
|
||||
auto &book = books[s - api::SIDE_BUY];
|
||||
int zidx = (int)(idx - 1);
|
||||
bts_assert_d(zidx < (int)book.size());
|
||||
for (int i = zidx; i < (int)book.size() - 1; i++)
|
||||
book[i] = book[i + 1];
|
||||
book[book.size() - 1] = {};
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::insert_book_level(api::Side s, size_t idx,
|
||||
BookLevel const &level) {
|
||||
insert(s, me->books, idx, level);
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::update_book_level(api::Side s, size_t idx,
|
||||
BookLevel const &level) {
|
||||
update(s, me->books, idx, level);
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::remove_book_level(api::Side s, size_t idx) {
|
||||
remove(s, me->books, idx);
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::insert_implied_book_level(api::Side s, size_t idx,
|
||||
BookLevel const &level) {
|
||||
insert(s, me->implied_books, idx, level);
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::update_implied_book_level(api::Side s, size_t idx,
|
||||
BookLevel const &level) {
|
||||
update(s, me->implied_books, idx, level);
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::remove_implied_book_level(api::Side s, size_t idx) {
|
||||
remove(s, me->implied_books, idx);
|
||||
}
|
||||
|
||||
Orders const &InstrumentSnapshot::orders() const { return me->orders; }
|
||||
|
||||
OrderChanges const &InstrumentSnapshot::order_changes() const {
|
||||
return me->order_changes;
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::clear_order_changes() { me->order_changes.clear(); }
|
||||
|
||||
void InstrumentSnapshot::insert_order(MDP3Order const &order) {
|
||||
bts_assert_d(me->orders.count(order.key) == 0);
|
||||
me->orders.insert({order.key, order});
|
||||
me->order_changes.emplace_back(OrderChange{order, OrderChange::added});
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::update_order(MDP3Order const &order) {
|
||||
auto it = me->orders.find(order.key);
|
||||
bts_assert_d(it != me->orders.end());
|
||||
it->second = order;
|
||||
me->order_changes.emplace_back(OrderChange{order, OrderChange::updated});
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::remove_order(MDP3OrderKey id) {
|
||||
auto it = me->orders.find(id);
|
||||
bts_assert(it != me->orders.end());
|
||||
me->order_changes.emplace_back(
|
||||
OrderChange{it->second, OrderChange::removed});
|
||||
me->orders.erase(it);
|
||||
}
|
||||
|
||||
Book InstrumentSnapshot::build_book_from_orders(api::Side side) const {
|
||||
auto invert = side == api::SIDE_BUY ? -1 : 1;
|
||||
auto book_idx = std::map<int64_t, BookLevel>();
|
||||
for (auto &o : orders())
|
||||
if (o.second.side == side) {
|
||||
auto &order = o.second;
|
||||
auto &level = book_idx[invert * order.price.mantissa()];
|
||||
level.n_orders++;
|
||||
level.price = order.price;
|
||||
level.quantity.value() += order.quantity.value();
|
||||
}
|
||||
|
||||
Book mbo_book;
|
||||
size_t i = 0;
|
||||
for (auto &p : book_idx)
|
||||
if (i < mbo_book.size())
|
||||
mbo_book[i++] = p.second;
|
||||
return mbo_book;
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::set_books_from_orders() {
|
||||
me->books[0] = build_book_from_orders(api::SIDE_BUY);
|
||||
me->books[1] = build_book_from_orders(api::SIDE_SELL);
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::reset_books() {
|
||||
for (auto &b : me->books)
|
||||
for (auto &l : b)
|
||||
l = {};
|
||||
|
||||
for (auto &b : me->implied_books)
|
||||
for (auto &l : b)
|
||||
l = {};
|
||||
|
||||
me->orders.clear();
|
||||
me->fills.clear();
|
||||
}
|
||||
|
||||
Fills const &InstrumentSnapshot::fills() const { return me->fills; }
|
||||
|
||||
void InstrumentSnapshot::add_fill(MDP3Fill const &f) {
|
||||
me->fills.emplace_back(f);
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::update_fill(MDP3Fill const &f) {
|
||||
for (auto &ff : me->fills)
|
||||
if (ff.key == f.key && ff.trade_entry_id == f.trade_entry_id) {
|
||||
ff = f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::remove_fill(MDP3TradeEntryID tid, MDP3OrderKey oid) {
|
||||
auto it = std::find_if(me->fills.begin(), me->fills.end(),
|
||||
[tid, oid](auto const &f) {
|
||||
return f.key == oid && f.trade_entry_id == tid;
|
||||
});
|
||||
if (it != me->fills.end())
|
||||
me->fills.erase(it);
|
||||
}
|
||||
|
||||
void InstrumentSnapshot::clear_fills() { me->fills.clear(); }
|
||||
|
||||
MaybeOrderChange InstrumentSnapshot::deduced_order_change() const {
|
||||
if (fills().empty() || trading_status() != ::mdp3::SecurityTradingStatus::ReadyToTrade )
|
||||
return {};
|
||||
|
||||
Fills aggressor_fills;
|
||||
std::copy_if(fills().begin(), fills().end(),
|
||||
std::back_inserter(aggressor_fills), [](auto const &f) {
|
||||
return f.aggressor == MDP3Fill::THIS_BUY ||
|
||||
f.aggressor == MDP3Fill::THIS_SELL;
|
||||
});
|
||||
|
||||
if (aggressor_fills.empty())
|
||||
return {};
|
||||
|
||||
OrderChange result;
|
||||
result.order.key = aggressor_fills[0].key;
|
||||
result.order.security = security_id();
|
||||
result.order.side = aggressor_fills[0].aggressor == MDP3Fill::THIS_BUY
|
||||
? api::SIDE_BUY
|
||||
: api::SIDE_SELL;
|
||||
result.order.priority = {};
|
||||
result.order.price = aggressor_fills[0].price;
|
||||
result.order.quantity = MDP3Quantity{0};
|
||||
|
||||
for (auto &f : aggressor_fills) {
|
||||
if (securities::is_better(result.order.side,
|
||||
Price(result.order.price.price()),
|
||||
Price(f.price.price())))
|
||||
result.order.price = f.price;
|
||||
result.order.quantity.value() += f.quantity.value();
|
||||
}
|
||||
|
||||
// Lets find out if this is a new or existing order. If it was an
|
||||
// existing order then we must have a delete or replace in our list
|
||||
// of order changes. If we do not then this must be a new order.
|
||||
result.change = OrderChange::added;
|
||||
for (auto &o : order_changes())
|
||||
if (o.order.key == result.order.key) {
|
||||
result.change = OrderChange::updated;
|
||||
break;
|
||||
}
|
||||
|
||||
// Now lets find out if this was a full fill or a partial fill. A
|
||||
// partial fill would have left the order in the books. In that
|
||||
// case we can use the information in the book to correct our
|
||||
// estimated quantity and prices from above.
|
||||
auto it = orders().find(result.order.key);
|
||||
if (it != orders().end()) {
|
||||
result.order.quantity.value() += it->second.quantity.value();
|
||||
result.order.price = it->second.price;
|
||||
}
|
||||
return {result};
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, InstrumentSnapshot const &snap) {
|
||||
out << "Snapshot --------------------------------------\n"
|
||||
<< "Symbol: " << snap.definition().symbol() << "\n"
|
||||
<< "Security ID: " << snap.security_id().value() << "\n"
|
||||
<< "Trading Status: " << snap.trading_status() << "\n"
|
||||
<< "Seq Number: " << snap.last_processed_sn() << "\n"
|
||||
<< "MBP Bid ---------------------------------------\n"
|
||||
<< snap.book(api::SIDE_BUY)
|
||||
<< "MBP Ask ---------------------------------------\n"
|
||||
<< snap.book(api::SIDE_SELL)
|
||||
<< "Implied Bid -----------------------------------\n"
|
||||
<< snap.implied_book(api::SIDE_BUY)
|
||||
<< "Implied Ask -----------------------------------\n"
|
||||
<< snap.implied_book(api::SIDE_SELL);
|
||||
out << "Order Changes -----------------------------------\n";
|
||||
for (auto &change : snap.order_changes())
|
||||
out << change << "\n";
|
||||
auto orders = sort_orders(snap.orders(), api::SIDE_BUY);
|
||||
out << "Buy Orders -----------------------------------\n";
|
||||
for (auto &order : orders)
|
||||
out << order << "\n";
|
||||
orders = sort_orders(snap.orders(), api::SIDE_SELL);
|
||||
out << "Sell Orders ----------------------------------\n";
|
||||
for (auto &order : orders)
|
||||
out << order << "\n";
|
||||
out << "Fills ----------------------------------------\n";
|
||||
for (auto &f : snap.fills())
|
||||
out << f << "\n";
|
||||
return out;
|
||||
}
|
||||
|
||||
} // namespace bts::spartan::mdp3
|
||||
@@ -0,0 +1,104 @@
|
||||
#pragma once
|
||||
|
||||
#include "InstrumentDefinition.h"
|
||||
#include "mdp3_common.h"
|
||||
|
||||
#include "lib/domain_model/Security.pb.h"
|
||||
#include <memory>
|
||||
|
||||
namespace mdp3 {
|
||||
class SnapshotFullRefresh52;
|
||||
}
|
||||
|
||||
namespace bts::spartan::mdp3 {
|
||||
|
||||
// Describes the state of the exchange at a specific time with respect
|
||||
// to a single instrument. Several kinds of information are available:
|
||||
// - The instrument's definition
|
||||
// - Price books (implied and customer)
|
||||
// - Resting orders
|
||||
// - Fills generated by the last event
|
||||
// - Order changes generated in the last event
|
||||
// - The deduced order for the last event
|
||||
// - Market statistics
|
||||
|
||||
class InstrumentSnapshot {
|
||||
public:
|
||||
InstrumentSnapshot(InstrumentDefinition const &);
|
||||
InstrumentSnapshot(InstrumentDefinition &&);
|
||||
~InstrumentSnapshot();
|
||||
|
||||
// Queries ------------------------------------------------------------
|
||||
MDP3SecurityID security_id() const;
|
||||
InstrumentDefinition definition() const;
|
||||
const char *symbol() const { return definition().symbol(); }
|
||||
::mdp3::SecurityTradingStatus::Value trading_status() const;
|
||||
size_t last_processed_sn() const;
|
||||
Book const &book(api::Side) const;
|
||||
ImpliedBook const &implied_book(api::Side) const;
|
||||
Orders const &orders() const;
|
||||
OrderChanges const &order_changes() const;
|
||||
MaybeOrderChange deduced_order_change() const;
|
||||
Fills const &fills() const;
|
||||
md::IntPrice high_limit_price() const;
|
||||
md::IntPrice low_limit_price() const;
|
||||
md::IntPrice max_price_variation() const;
|
||||
MDP3Quantity electronic_volume() const;
|
||||
MDP3Quantity cleared_volume() const;
|
||||
md::IntPrice fixing_price() const;
|
||||
MDP3Quantity open_interest() const;
|
||||
md::IntPrice open_price() const;
|
||||
md::IntPrice high_bid() const;
|
||||
md::IntPrice low_offer() const;
|
||||
md::IntPrice settlement_price() const;
|
||||
md::IntPrice high_trade_price() const;
|
||||
md::IntPrice low_trade_price() const;
|
||||
|
||||
// Mutators ------------------------------------------------------------
|
||||
void set_definition(InstrumentDefinition const &);
|
||||
void set_last_msg_processed_sn(size_t);
|
||||
void set_trading_status(::mdp3::SecurityTradingStatus::Value) const;
|
||||
void insert_book_level(api::Side, size_t idx, BookLevel const &);
|
||||
void update_book_level(api::Side, size_t idx, BookLevel const &);
|
||||
void remove_book_level(api::Side, size_t idx);
|
||||
void insert_implied_book_level(api::Side, size_t idx, BookLevel const &);
|
||||
void update_implied_book_level(api::Side, size_t idx, BookLevel const &);
|
||||
void remove_implied_book_level(api::Side, size_t idx);
|
||||
void clear_order_changes();
|
||||
void insert_order(MDP3Order const &);
|
||||
void update_order(MDP3Order const &);
|
||||
void remove_order(MDP3OrderKey);
|
||||
Book build_book_from_orders(api::Side) const;
|
||||
void set_books_from_orders();
|
||||
void reset_books();
|
||||
void add_fill(MDP3Fill const &);
|
||||
void update_fill(MDP3Fill const &);
|
||||
void remove_fill(MDP3TradeEntryID, MDP3OrderKey);
|
||||
void clear_fills();
|
||||
void set_high_limit_price(md::IntPrice);
|
||||
void set_low_limit_price(md::IntPrice);
|
||||
void set_max_price_variation(md::IntPrice);
|
||||
void set_cleared_volume(MDP3Quantity);
|
||||
void set_electronic_volume(MDP3Quantity);
|
||||
void set_fixing_price(md::IntPrice);
|
||||
void set_open_interest(MDP3Quantity);
|
||||
void set_open_price(md::IntPrice);
|
||||
void set_high_bid(md::IntPrice);
|
||||
void set_low_offer(md::IntPrice);
|
||||
void set_settlement_price(md::IntPrice);
|
||||
void set_high_trade_price(md::IntPrice);
|
||||
void set_low_trade_price(md::IntPrice);
|
||||
|
||||
private:
|
||||
template <class A>
|
||||
void insert(api::Side, std::array<A, 2> &, size_t idx, BookLevel const &);
|
||||
template <class A>
|
||||
void update(api::Side, std::array<A, 2> &, size_t idx, BookLevel const &);
|
||||
template <class A> void remove(api::Side, std::array<A, 2> &, size_t idx);
|
||||
struct PImpl;
|
||||
std::unique_ptr<PImpl> me;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &, InstrumentSnapshot const &);
|
||||
|
||||
} // namespace bts::spartan::mdp3
|
||||
@@ -0,0 +1,211 @@
|
||||
#pragma once
|
||||
|
||||
#include "lib/domain_model/Security.h"
|
||||
#include "lib/domain_model/Security.pb.h"
|
||||
#include "lib/md/IntPrice.h"
|
||||
#include "lib/utils/ValueWrapper.h"
|
||||
|
||||
#include "lib/utils/overloaded.h"
|
||||
|
||||
#include <boost/container/small_vector.hpp>
|
||||
#include <variant>
|
||||
|
||||
namespace bts::spartan::mdp3 {
|
||||
|
||||
using MDP3TimeStamp = utils::ValueWrapper<struct MDP3TimeStampTag, uint64_t>;
|
||||
using MDP3OrderKey = utils::ValueWrapper<struct ExchangeOrderKeyTag, uint64_t>;
|
||||
using MDP3SecurityID =
|
||||
utils::ValueWrapper<struct ExchangeSecurityIDTag, int32_t>;
|
||||
|
||||
class InstrumentSnapshot;
|
||||
using InstrumentSnapshotPtr = std::unique_ptr<InstrumentSnapshot>;
|
||||
|
||||
class MDP3Event {
|
||||
public:
|
||||
MDP3TimeStamp transact_time = MDP3TimeStamp{0};
|
||||
|
||||
MDP3TimeStamp first_packet_send_time;
|
||||
MDP3TimeStamp last_packet_send_time;
|
||||
uint32_t first_packet_sn;
|
||||
uint32_t last_packet_sn;
|
||||
std::vector<InstrumentSnapshot const *> affected_securities;
|
||||
void reset() {
|
||||
transact_time = MDP3TimeStamp{0};
|
||||
affected_securities.clear();
|
||||
}
|
||||
};
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &s, MDP3Event const &ev) {
|
||||
s << " transact_time: " << ev.transact_time.value()
|
||||
<< " packets: " << ev.first_packet_sn
|
||||
<< " to " << ev.last_packet_sn;
|
||||
return s;
|
||||
}
|
||||
|
||||
using MDP3Quantity = utils::ValueWrapper<struct MDP3QuantityTag, int32_t>;
|
||||
using MDP3OrderPriority =
|
||||
utils::ValueWrapper<struct MDP3OrderPriorityTag, uint64_t>;
|
||||
|
||||
class BookLevel {
|
||||
public:
|
||||
md::IntPrice price;
|
||||
MDP3Quantity quantity = MDP3Quantity{0};
|
||||
int32_t n_orders = 0;
|
||||
bool operator==(BookLevel const &other) const {
|
||||
return price == other.price &&
|
||||
quantity.value() == other.quantity.value() &&
|
||||
n_orders == other.n_orders;
|
||||
}
|
||||
};
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &s, BookLevel const &l) {
|
||||
s << " " << l.quantity.value() << " @ " << l.price.price() << " ("
|
||||
<< l.n_orders << " orders)";
|
||||
return s;
|
||||
}
|
||||
|
||||
struct MDP3Order {
|
||||
public:
|
||||
MDP3OrderKey key;
|
||||
MDP3SecurityID security;
|
||||
api::Side side;
|
||||
MDP3OrderPriority priority;
|
||||
md::IntPrice price;
|
||||
MDP3Quantity quantity;
|
||||
};
|
||||
|
||||
|
||||
struct OrderChange {
|
||||
MDP3Order order;
|
||||
enum ChangeType { added, removed, updated } change;
|
||||
};
|
||||
using MaybeOrderChange = std::optional<OrderChange>;
|
||||
|
||||
inline const char*change_name (OrderChange::ChangeType ct) {
|
||||
switch(ct) {
|
||||
case OrderChange::added:
|
||||
return "added";
|
||||
case OrderChange::removed:
|
||||
return "removed";
|
||||
case OrderChange::updated:
|
||||
return "updated";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
using OrderChanges = std::vector<OrderChange>;
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &s, MDP3Order const &order) {
|
||||
s << " price: " << order.price.price() << " "
|
||||
<< "k: " << order.key.value() << " "
|
||||
<< "sk: " << order.security.value() << " "
|
||||
<< "side: " << securities::side_name(order.side) << " "
|
||||
<< "pri: " << order.priority.value() << " "
|
||||
<< "qty: " << order.quantity.value();
|
||||
return s;
|
||||
}
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &s, OrderChange const &ch) {
|
||||
s << " "
|
||||
<< (ch.change == OrderChange::added
|
||||
? "create"
|
||||
: (ch.change == OrderChange::updated ? "update" : "delete"))
|
||||
<< ch.order;
|
||||
return s;
|
||||
}
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &s, OrderChanges const &changes) {
|
||||
for (auto c : changes)
|
||||
s << " " << c << "\n";
|
||||
return s;
|
||||
}
|
||||
|
||||
using Orders = std::unordered_map<MDP3OrderKey, MDP3Order>;
|
||||
|
||||
|
||||
using MDP3TradeEntryID =
|
||||
utils::ValueWrapper<struct MDP3TradeEntryIDTag, uint32_t>;
|
||||
struct MDP3Fill {
|
||||
MDP3OrderKey key;
|
||||
md::IntPrice price;
|
||||
MDP3Quantity quantity;
|
||||
MDP3Quantity summary_quantity;
|
||||
MDP3TradeEntryID trade_entry_id;
|
||||
enum Aggressor {THIS_BUY, THIS_SELL, OTHER, IMPLIED } aggressor;
|
||||
};
|
||||
|
||||
inline const char*aggressor_name (MDP3Fill::Aggressor ag) {
|
||||
switch(ag) {
|
||||
case MDP3Fill::THIS_BUY:
|
||||
return "yes_buy";
|
||||
case MDP3Fill::THIS_SELL:
|
||||
return "yes_sell";
|
||||
case MDP3Fill::OTHER:
|
||||
return "no";
|
||||
case MDP3Fill::IMPLIED:
|
||||
return "implied";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
inline std::vector<MDP3Order> sort_orders(Orders const &orders, api::Side side) {
|
||||
std::vector<MDP3Order> result;
|
||||
for (auto &o : orders) {
|
||||
auto &order = o.second;
|
||||
if (order.side == side)
|
||||
result.push_back(order);
|
||||
}
|
||||
std::sort(result.begin(), result.end(),
|
||||
[side](auto const &o1, auto const &o2) {
|
||||
if (o1.price.price() != o2.price.price()) {
|
||||
if (side == api::SIDE_BUY)
|
||||
return o2.price.price() < o1.price.price();
|
||||
else
|
||||
return o1.price.price() < o2.price.price();
|
||||
} else
|
||||
return o1.priority.value() < o2.priority.value();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &out, Orders const &orders) {
|
||||
auto sorted = sort_orders(orders, api::SIDE_BUY);
|
||||
for (auto &o : sorted)
|
||||
out << o << std::endl;
|
||||
return out;
|
||||
}
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &s, MDP3Fill const &fill) {
|
||||
s << " ok: " << fill.key.value() << " "
|
||||
<< "price: " << fill.price.price() << " "
|
||||
<< "qty: " << fill.quantity.value() << " "
|
||||
<< "tid: " << fill.trade_entry_id.value() << " "
|
||||
<< "agg: " << (int)fill.aggressor;
|
||||
return s;
|
||||
}
|
||||
|
||||
using Fills = std::vector<MDP3Fill>;
|
||||
inline std::ostream &operator<<(std::ostream &s, Fills const &fills) {
|
||||
for (auto f : fills)
|
||||
s << " " << f << "\n";
|
||||
return s;
|
||||
}
|
||||
|
||||
const auto MDP3_MAX_BOOK_DEPTH = 10;
|
||||
const auto MDP3_MAX_IMPLIED_BOOK_DEPTH = 2;
|
||||
using Book = std::array<BookLevel, MDP3_MAX_BOOK_DEPTH>;
|
||||
|
||||
inline std::ostream &operator<<(std::ostream &s, Book const &b) {
|
||||
for (auto const &l : b)
|
||||
s << l << "\n";
|
||||
return s;
|
||||
}
|
||||
|
||||
using ImpliedBook = std::array<BookLevel, MDP3_MAX_IMPLIED_BOOK_DEPTH>;
|
||||
inline std::ostream &operator<<(std::ostream &s, ImpliedBook const &b) {
|
||||
for (auto const &l : b)
|
||||
s << l << "\n";
|
||||
return s;
|
||||
}
|
||||
} // namespace bts::spartan::mdp3
|
||||
@@ -0,0 +1,93 @@
|
||||
#pragma once
|
||||
#include "../parsing/MDP3Parser.h"
|
||||
#include "../feed_control/PickedFeed.h"
|
||||
|
||||
#include "lib/utils/bts_assert.h"
|
||||
|
||||
namespace bts::spartan::mdp3 {
|
||||
|
||||
// Arbitrage between two identical MDP3 feeds, picking the next
|
||||
// message from whatever feed sees it first. Additionally provide a
|
||||
// small level of redundancy by using one feed to recover gaps from
|
||||
// another one.
|
||||
|
||||
class AB_Arbitrageur {
|
||||
public:
|
||||
AB_Arbitrageur() : _last_seqn(0) {}
|
||||
|
||||
enum ActionCode { APPLY, IGNORE, RECOVER };
|
||||
|
||||
struct Action {
|
||||
ActionCode action;
|
||||
PickedFeed picked;
|
||||
MDP3PacketView const packet;
|
||||
};
|
||||
|
||||
size_t expected_next_sn() const { return _last_seqn + 1; }
|
||||
|
||||
Action operator()(MDP3PacketView const &a, MDP3PacketView const &b) {
|
||||
bts_assert_d(!a.empty() || !b.empty());
|
||||
|
||||
auto action_a = try_one(a);
|
||||
if (action_a == ActionCode::APPLY) {
|
||||
_last_seqn = a.seq_num();
|
||||
return {action_a, PickedFeed::A, a};
|
||||
}
|
||||
|
||||
auto action_b = try_one(b);
|
||||
if (action_b == ActionCode::APPLY) {
|
||||
_last_seqn = b.seq_num();
|
||||
return {action_b, PickedFeed::B, b};
|
||||
}
|
||||
|
||||
// the first packet defines our starting sequence number, rather
|
||||
// than continue from the previous one, so we handle that
|
||||
// separately
|
||||
if (_last_seqn == 0) {
|
||||
if (!a.empty()) {
|
||||
_last_seqn = a.seq_num();
|
||||
return {ActionCode::APPLY, PickedFeed::A, a};
|
||||
} else {
|
||||
_last_seqn = b.seq_num();
|
||||
return {ActionCode::APPLY, PickedFeed::B,b};
|
||||
}
|
||||
}
|
||||
|
||||
// Both feeds are either ahead or behind, if they are ahead we
|
||||
// return RECOVER, otherwise we return IGNORE.
|
||||
if (action_a == action_b)
|
||||
return {action_a, PickedFeed::None, a};
|
||||
|
||||
// One of the feeds is ahead of us and the other is behind. Its
|
||||
// possible that we will recover eventually, that is the feed
|
||||
// that is behind might catch up, but its also possible that
|
||||
// that feed died and it will never move forward. We could start
|
||||
// a timer to limit how much we are willing to wait but its
|
||||
// simpler to just cap how much ahead the advanced feed can be
|
||||
// before we give up entirely.
|
||||
auto how_far_ahead = 0;
|
||||
if (action_a == ActionCode::RECOVER)
|
||||
how_far_ahead = a.seq_num() - _last_seqn;
|
||||
else
|
||||
how_far_ahead = b.seq_num() - _last_seqn;
|
||||
|
||||
if (how_far_ahead > 10)
|
||||
return {ActionCode::RECOVER, PickedFeed::None, a};
|
||||
else
|
||||
return {ActionCode::IGNORE, PickedFeed::None, a};
|
||||
}
|
||||
|
||||
private:
|
||||
size_t _last_seqn;
|
||||
|
||||
ActionCode try_one(MDP3PacketView const &packet) {
|
||||
if (_last_seqn + 1 == packet.seq_num())
|
||||
return ActionCode::APPLY;
|
||||
else if (_last_seqn + 1 > packet.seq_num())
|
||||
return ActionCode::IGNORE;
|
||||
else
|
||||
return ActionCode::RECOVER;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace bts::spartan::mdp3
|
||||
@@ -0,0 +1,7 @@
|
||||
#include "IFeedController.h"
|
||||
|
||||
namespace bts::spartan::mdp3 {
|
||||
|
||||
IFeedController::~IFeedController() {}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
namespace bts::spartan::mdp3 {
|
||||
class IFeedController {
|
||||
public:
|
||||
virtual ~IFeedController() ;
|
||||
virtual void start_instrument_feed() = 0;
|
||||
virtual void stop_instrument_feed() = 0;
|
||||
|
||||
virtual void start_snapshot_feed() = 0;
|
||||
virtual void stop_snapshot_feed() = 0;
|
||||
|
||||
virtual void start_incremental_feed() = 0;
|
||||
virtual void stop_incremental_feed() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
namespace bts::spartan {
|
||||
enum class PickedFeed { A, B, None };
|
||||
}
|
||||
@@ -0,0 +1,312 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_ADMINHEARTBEAT12_H_
|
||||
#define _MDP3_ADMINHEARTBEAT12_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
#include "MDEntryTypeBook.h"
|
||||
#include "OpenCloseSettlFlag.h"
|
||||
#include "MatchEventIndicator.h"
|
||||
#include "MaturityMonthYear.h"
|
||||
#include "FLOAT.h"
|
||||
#include "MDEntryTypeDailyStatistics.h"
|
||||
#include "EventType.h"
|
||||
#include "DecimalQty.h"
|
||||
#include "MDUpdateAction.h"
|
||||
#include "PRICENULL9.h"
|
||||
#include "GroupSize8Byte.h"
|
||||
#include "HaltReason.h"
|
||||
#include "PRICE9.h"
|
||||
#include "MDEntryType.h"
|
||||
#include "PRICENULL.h"
|
||||
#include "SecurityTradingStatus.h"
|
||||
#include "LegSide.h"
|
||||
#include "MessageHeader.h"
|
||||
#include "PRICE.h"
|
||||
#include "OrderUpdateAction.h"
|
||||
#include "PutOrCall.h"
|
||||
#include "SecurityUpdateAction.h"
|
||||
#include "SecurityTradingEvent.h"
|
||||
#include "Decimal9.h"
|
||||
#include "MDEntryTypeStatistics.h"
|
||||
#include "InstAttribValue.h"
|
||||
#include "AggressorSide.h"
|
||||
#include "GroupSize.h"
|
||||
#include "SettlPriceType.h"
|
||||
#include "Decimal9NULL.h"
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class AdminHeartbeat12
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_position = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
inline std::uint64_t *sbePositionPtr() SBE_NOEXCEPT
|
||||
{
|
||||
return &m_position;
|
||||
}
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
AdminHeartbeat12() = default;
|
||||
|
||||
AdminHeartbeat12(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingBlockLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_position(sbeCheckPosition(offset + actingBlockLength)),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
AdminHeartbeat12(char *buffer, const std::uint64_t bufferLength) :
|
||||
AdminHeartbeat12(buffer, 0, bufferLength, sbeBlockLength(), sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
AdminHeartbeat12(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingBlockLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
AdminHeartbeat12(buffer, 0, bufferLength, actingBlockLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeBlockLength() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeTemplateId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)12;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR const char * sbeSemanticType() SBE_NOEXCEPT
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
AdminHeartbeat12 &wrapForEncode(char *buffer, const std::uint64_t offset, const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = AdminHeartbeat12(buffer, offset, bufferLength, sbeBlockLength(), sbeSchemaVersion());
|
||||
}
|
||||
|
||||
AdminHeartbeat12 &wrapAndApplyHeader(char *buffer, const std::uint64_t offset, const std::uint64_t bufferLength)
|
||||
{
|
||||
MessageHeader hdr(buffer, offset, bufferLength, sbeSchemaVersion());
|
||||
|
||||
hdr
|
||||
.blockLength(sbeBlockLength())
|
||||
.templateId(sbeTemplateId())
|
||||
.schemaId(sbeSchemaId())
|
||||
.version(sbeSchemaVersion());
|
||||
|
||||
return *this = AdminHeartbeat12(
|
||||
buffer,
|
||||
offset + MessageHeader::encodedLength(),
|
||||
bufferLength,
|
||||
sbeBlockLength(),
|
||||
sbeSchemaVersion());
|
||||
}
|
||||
|
||||
AdminHeartbeat12 &wrapForDecode(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingBlockLength,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = AdminHeartbeat12(buffer, offset, bufferLength, actingBlockLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t sbePosition() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
|
||||
std::uint64_t sbeCheckPosition(const std::uint64_t position)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT((position > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short [E100]");
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
void sbePosition(const std::uint64_t position)
|
||||
{
|
||||
m_position = sbeCheckPosition(position);
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t encodedLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return sbePosition() - m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, AdminHeartbeat12 _writer)
|
||||
{
|
||||
AdminHeartbeat12 writer(_writer.m_buffer, _writer.m_offset,
|
||||
_writer.m_bufferLength, _writer.sbeBlockLength(), _writer.m_actingVersion);
|
||||
builder << '{';
|
||||
builder << R"("Name": "AdminHeartbeat12", )";
|
||||
builder << R"("sbeTemplateId": )";
|
||||
builder << writer.sbeTemplateId();
|
||||
builder << ", ";
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,386 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_ADMINLOGIN15_H_
|
||||
#define _MDP3_ADMINLOGIN15_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
#include "MDEntryTypeBook.h"
|
||||
#include "OpenCloseSettlFlag.h"
|
||||
#include "MatchEventIndicator.h"
|
||||
#include "MaturityMonthYear.h"
|
||||
#include "FLOAT.h"
|
||||
#include "MDEntryTypeDailyStatistics.h"
|
||||
#include "EventType.h"
|
||||
#include "DecimalQty.h"
|
||||
#include "MDUpdateAction.h"
|
||||
#include "PRICENULL9.h"
|
||||
#include "GroupSize8Byte.h"
|
||||
#include "HaltReason.h"
|
||||
#include "PRICE9.h"
|
||||
#include "MDEntryType.h"
|
||||
#include "PRICENULL.h"
|
||||
#include "SecurityTradingStatus.h"
|
||||
#include "LegSide.h"
|
||||
#include "MessageHeader.h"
|
||||
#include "PRICE.h"
|
||||
#include "OrderUpdateAction.h"
|
||||
#include "PutOrCall.h"
|
||||
#include "SecurityUpdateAction.h"
|
||||
#include "SecurityTradingEvent.h"
|
||||
#include "Decimal9.h"
|
||||
#include "MDEntryTypeStatistics.h"
|
||||
#include "InstAttribValue.h"
|
||||
#include "AggressorSide.h"
|
||||
#include "GroupSize.h"
|
||||
#include "SettlPriceType.h"
|
||||
#include "Decimal9NULL.h"
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class AdminLogin15
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_position = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
inline std::uint64_t *sbePositionPtr() SBE_NOEXCEPT
|
||||
{
|
||||
return &m_position;
|
||||
}
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
AdminLogin15() = default;
|
||||
|
||||
AdminLogin15(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingBlockLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_position(sbeCheckPosition(offset + actingBlockLength)),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
AdminLogin15(char *buffer, const std::uint64_t bufferLength) :
|
||||
AdminLogin15(buffer, 0, bufferLength, sbeBlockLength(), sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
AdminLogin15(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingBlockLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
AdminLogin15(buffer, 0, bufferLength, actingBlockLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeBlockLength() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeTemplateId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)15;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR const char * sbeSemanticType() SBE_NOEXCEPT
|
||||
{
|
||||
return "A";
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
AdminLogin15 &wrapForEncode(char *buffer, const std::uint64_t offset, const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = AdminLogin15(buffer, offset, bufferLength, sbeBlockLength(), sbeSchemaVersion());
|
||||
}
|
||||
|
||||
AdminLogin15 &wrapAndApplyHeader(char *buffer, const std::uint64_t offset, const std::uint64_t bufferLength)
|
||||
{
|
||||
MessageHeader hdr(buffer, offset, bufferLength, sbeSchemaVersion());
|
||||
|
||||
hdr
|
||||
.blockLength(sbeBlockLength())
|
||||
.templateId(sbeTemplateId())
|
||||
.schemaId(sbeSchemaId())
|
||||
.version(sbeSchemaVersion());
|
||||
|
||||
return *this = AdminLogin15(
|
||||
buffer,
|
||||
offset + MessageHeader::encodedLength(),
|
||||
bufferLength,
|
||||
sbeBlockLength(),
|
||||
sbeSchemaVersion());
|
||||
}
|
||||
|
||||
AdminLogin15 &wrapForDecode(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingBlockLength,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = AdminLogin15(buffer, offset, bufferLength, actingBlockLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t sbePosition() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
|
||||
std::uint64_t sbeCheckPosition(const std::uint64_t position)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT((position > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short [E100]");
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
void sbePosition(const std::uint64_t position)
|
||||
{
|
||||
m_position = sbeCheckPosition(position);
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t encodedLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return sbePosition() - m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * HeartBtIntMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::SEMANTIC_TYPE: return "int";
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t heartBtIntId() SBE_NOEXCEPT
|
||||
{
|
||||
return 108;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t heartBtIntSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool heartBtIntInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= heartBtIntSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t heartBtIntEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t heartBtIntNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t heartBtIntMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t heartBtIntMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t heartBtIntEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::int8_t heartBtInt() const SBE_NOEXCEPT
|
||||
{
|
||||
std::int8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::int8_t));
|
||||
return (val);
|
||||
}
|
||||
|
||||
AdminLogin15 &heartBtInt(const std::int8_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::int8_t val = (value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::int8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, AdminLogin15 _writer)
|
||||
{
|
||||
AdminLogin15 writer(_writer.m_buffer, _writer.m_offset,
|
||||
_writer.m_bufferLength, _writer.sbeBlockLength(), _writer.m_actingVersion);
|
||||
builder << '{';
|
||||
builder << R"("Name": "AdminLogin15", )";
|
||||
builder << R"("sbeTemplateId": )";
|
||||
builder << writer.sbeTemplateId();
|
||||
builder << ", ";
|
||||
|
||||
builder << R"("HeartBtInt": )";
|
||||
builder << +writer.heartBtInt();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,522 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_ADMINLOGOUT16_H_
|
||||
#define _MDP3_ADMINLOGOUT16_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
#include "MDEntryTypeBook.h"
|
||||
#include "OpenCloseSettlFlag.h"
|
||||
#include "MatchEventIndicator.h"
|
||||
#include "MaturityMonthYear.h"
|
||||
#include "FLOAT.h"
|
||||
#include "MDEntryTypeDailyStatistics.h"
|
||||
#include "EventType.h"
|
||||
#include "DecimalQty.h"
|
||||
#include "MDUpdateAction.h"
|
||||
#include "PRICENULL9.h"
|
||||
#include "GroupSize8Byte.h"
|
||||
#include "HaltReason.h"
|
||||
#include "PRICE9.h"
|
||||
#include "MDEntryType.h"
|
||||
#include "PRICENULL.h"
|
||||
#include "SecurityTradingStatus.h"
|
||||
#include "LegSide.h"
|
||||
#include "MessageHeader.h"
|
||||
#include "PRICE.h"
|
||||
#include "OrderUpdateAction.h"
|
||||
#include "PutOrCall.h"
|
||||
#include "SecurityUpdateAction.h"
|
||||
#include "SecurityTradingEvent.h"
|
||||
#include "Decimal9.h"
|
||||
#include "MDEntryTypeStatistics.h"
|
||||
#include "InstAttribValue.h"
|
||||
#include "AggressorSide.h"
|
||||
#include "GroupSize.h"
|
||||
#include "SettlPriceType.h"
|
||||
#include "Decimal9NULL.h"
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class AdminLogout16
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_position = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
inline std::uint64_t *sbePositionPtr() SBE_NOEXCEPT
|
||||
{
|
||||
return &m_position;
|
||||
}
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
AdminLogout16() = default;
|
||||
|
||||
AdminLogout16(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingBlockLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_position(sbeCheckPosition(offset + actingBlockLength)),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
AdminLogout16(char *buffer, const std::uint64_t bufferLength) :
|
||||
AdminLogout16(buffer, 0, bufferLength, sbeBlockLength(), sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
AdminLogout16(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingBlockLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
AdminLogout16(buffer, 0, bufferLength, actingBlockLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeBlockLength() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)180;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeTemplateId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)16;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR const char * sbeSemanticType() SBE_NOEXCEPT
|
||||
{
|
||||
return "5";
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
AdminLogout16 &wrapForEncode(char *buffer, const std::uint64_t offset, const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = AdminLogout16(buffer, offset, bufferLength, sbeBlockLength(), sbeSchemaVersion());
|
||||
}
|
||||
|
||||
AdminLogout16 &wrapAndApplyHeader(char *buffer, const std::uint64_t offset, const std::uint64_t bufferLength)
|
||||
{
|
||||
MessageHeader hdr(buffer, offset, bufferLength, sbeSchemaVersion());
|
||||
|
||||
hdr
|
||||
.blockLength(sbeBlockLength())
|
||||
.templateId(sbeTemplateId())
|
||||
.schemaId(sbeSchemaId())
|
||||
.version(sbeSchemaVersion());
|
||||
|
||||
return *this = AdminLogout16(
|
||||
buffer,
|
||||
offset + MessageHeader::encodedLength(),
|
||||
bufferLength,
|
||||
sbeBlockLength(),
|
||||
sbeSchemaVersion());
|
||||
}
|
||||
|
||||
AdminLogout16 &wrapForDecode(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingBlockLength,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = AdminLogout16(buffer, offset, bufferLength, actingBlockLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t sbePosition() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
|
||||
std::uint64_t sbeCheckPosition(const std::uint64_t position)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT((position > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short [E100]");
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
void sbePosition(const std::uint64_t position)
|
||||
{
|
||||
m_position = sbeCheckPosition(position);
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t encodedLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return sbePosition() - m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * TextMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::SEMANTIC_TYPE: return "String";
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t textId() SBE_NOEXCEPT
|
||||
{
|
||||
return 58;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t textSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool textInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= textSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t textEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR char textNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (char)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR char textMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (char)32;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR char textMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (char)126;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t textEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 180;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint64_t textLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 180;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char *text() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer + m_offset + 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char *text() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer + m_offset + 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char text(const std::uint64_t index) const
|
||||
{
|
||||
if (index >= 180)
|
||||
{
|
||||
throw std::runtime_error("index out of range for text [E104]");
|
||||
}
|
||||
|
||||
char val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0 + (index * 1), sizeof(char));
|
||||
return (val);
|
||||
}
|
||||
|
||||
AdminLogout16 &text(const std::uint64_t index, const char value)
|
||||
{
|
||||
if (index >= 180)
|
||||
{
|
||||
throw std::runtime_error("index out of range for text [E105]");
|
||||
}
|
||||
|
||||
char val = (value);
|
||||
std::memcpy(m_buffer + m_offset + 0 + (index * 1), &val, sizeof(char));
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::uint64_t getText(char *const dst, const std::uint64_t length) const
|
||||
{
|
||||
if (length > 180)
|
||||
{
|
||||
throw std::runtime_error("length too large for getText [E106]");
|
||||
}
|
||||
|
||||
std::memcpy(dst, m_buffer + m_offset + 0, sizeof(char) * static_cast<size_t>(length));
|
||||
return length;
|
||||
}
|
||||
|
||||
AdminLogout16 &putText(const char *const src) SBE_NOEXCEPT
|
||||
{
|
||||
std::memcpy(m_buffer + m_offset + 0, src, sizeof(char) * 180);
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string getTextAsString() const
|
||||
{
|
||||
const char *buffer = m_buffer + m_offset + 0;
|
||||
size_t length = 0;
|
||||
|
||||
for (; length < 180 && *(buffer + length) != '\0'; ++length);
|
||||
std::string result(buffer, length);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string getTextAsJsonEscapedString()
|
||||
{
|
||||
std::ostringstream oss;
|
||||
std::string s = getTextAsString();
|
||||
|
||||
for (auto c = s.cbegin(); c != s.cend(); c++)
|
||||
{
|
||||
switch (*c)
|
||||
{
|
||||
case '"': oss << "\\\""; break;
|
||||
case '\\': oss << "\\\\"; break;
|
||||
case '\b': oss << "\\b"; break;
|
||||
case '\f': oss << "\\f"; break;
|
||||
case '\n': oss << "\\n"; break;
|
||||
case '\r': oss << "\\r"; break;
|
||||
case '\t': oss << "\\t"; break;
|
||||
|
||||
default:
|
||||
if ('\x00' <= *c && *c <= '\x1f')
|
||||
{
|
||||
oss << "\\u" << std::hex << std::setw(4)
|
||||
<< std::setfill('0') << (int)(*c);
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << *c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
std::string_view getTextAsStringView() const SBE_NOEXCEPT
|
||||
{
|
||||
const char *buffer = m_buffer + m_offset + 0;
|
||||
size_t length = 0;
|
||||
|
||||
for (; length < 180 && *(buffer + length) != '\0'; ++length);
|
||||
std::string_view result(buffer, length);
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
AdminLogout16 &putText(const std::string_view str)
|
||||
{
|
||||
const size_t srcLength = str.length();
|
||||
if (srcLength > 180)
|
||||
{
|
||||
throw std::runtime_error("string too large for putText [E106]");
|
||||
}
|
||||
|
||||
std::memcpy(m_buffer + m_offset + 0, str.data(), srcLength);
|
||||
for (size_t start = srcLength; start < 180; ++start)
|
||||
{
|
||||
m_buffer[m_offset + 0 + start] = 0;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
#else
|
||||
AdminLogout16 &putText(const std::string& str)
|
||||
{
|
||||
const size_t srcLength = str.length();
|
||||
if (srcLength > 180)
|
||||
{
|
||||
throw std::runtime_error("string too large for putText [E106]");
|
||||
}
|
||||
|
||||
std::memcpy(m_buffer + m_offset + 0, str.c_str(), srcLength);
|
||||
for (size_t start = srcLength; start < 180; ++start)
|
||||
{
|
||||
m_buffer[m_offset + 0 + start] = 0;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, AdminLogout16 _writer)
|
||||
{
|
||||
AdminLogout16 writer(_writer.m_buffer, _writer.m_offset,
|
||||
_writer.m_bufferLength, _writer.sbeBlockLength(), _writer.m_actingVersion);
|
||||
builder << '{';
|
||||
builder << R"("Name": "AdminLogout16", )";
|
||||
builder << R"("sbeTemplateId": )";
|
||||
builder << writer.sbeTemplateId();
|
||||
builder << ", ";
|
||||
|
||||
builder << R"("Text": )";
|
||||
builder << '"' <<
|
||||
writer.getTextAsJsonEscapedString().c_str() << '"';
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,141 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_AGGRESSORSIDE_H_
|
||||
#define _MDP3_AGGRESSORSIDE_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class AggressorSide
|
||||
{
|
||||
public:
|
||||
enum Value
|
||||
{
|
||||
NoAggressor = (std::uint8_t)0,
|
||||
Buy = (std::uint8_t)1,
|
||||
Sell = (std::uint8_t)2,
|
||||
NULL_VALUE = (std::uint8_t)255
|
||||
};
|
||||
|
||||
static AggressorSide::Value get(const std::uint8_t value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0: return NoAggressor;
|
||||
case 1: return Buy;
|
||||
case 2: return Sell;
|
||||
case 255: return NULL_VALUE;
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum AggressorSide [E103]");
|
||||
}
|
||||
|
||||
static const char* c_str(const AggressorSide::Value value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case NoAggressor: return "NoAggressor";
|
||||
case Buy: return "Buy";
|
||||
case Sell: return "Sell";
|
||||
case NULL_VALUE: return "NULL_VALUE";
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum AggressorSide [E103]:");
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& os, AggressorSide::Value m)
|
||||
{
|
||||
return os << AggressorSide::c_str(m);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,928 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_CHANNELRESET4_H_
|
||||
#define _MDP3_CHANNELRESET4_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
#include "MDEntryTypeBook.h"
|
||||
#include "OpenCloseSettlFlag.h"
|
||||
#include "MatchEventIndicator.h"
|
||||
#include "MaturityMonthYear.h"
|
||||
#include "FLOAT.h"
|
||||
#include "MDEntryTypeDailyStatistics.h"
|
||||
#include "EventType.h"
|
||||
#include "DecimalQty.h"
|
||||
#include "MDUpdateAction.h"
|
||||
#include "PRICENULL9.h"
|
||||
#include "GroupSize8Byte.h"
|
||||
#include "HaltReason.h"
|
||||
#include "PRICE9.h"
|
||||
#include "MDEntryType.h"
|
||||
#include "PRICENULL.h"
|
||||
#include "SecurityTradingStatus.h"
|
||||
#include "LegSide.h"
|
||||
#include "MessageHeader.h"
|
||||
#include "PRICE.h"
|
||||
#include "OrderUpdateAction.h"
|
||||
#include "PutOrCall.h"
|
||||
#include "SecurityUpdateAction.h"
|
||||
#include "SecurityTradingEvent.h"
|
||||
#include "Decimal9.h"
|
||||
#include "MDEntryTypeStatistics.h"
|
||||
#include "InstAttribValue.h"
|
||||
#include "AggressorSide.h"
|
||||
#include "GroupSize.h"
|
||||
#include "SettlPriceType.h"
|
||||
#include "Decimal9NULL.h"
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class ChannelReset4
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_position = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
inline std::uint64_t *sbePositionPtr() SBE_NOEXCEPT
|
||||
{
|
||||
return &m_position;
|
||||
}
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
ChannelReset4() = default;
|
||||
|
||||
ChannelReset4(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingBlockLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_position(sbeCheckPosition(offset + actingBlockLength)),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
ChannelReset4(char *buffer, const std::uint64_t bufferLength) :
|
||||
ChannelReset4(buffer, 0, bufferLength, sbeBlockLength(), sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
ChannelReset4(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingBlockLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
ChannelReset4(buffer, 0, bufferLength, actingBlockLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeBlockLength() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeTemplateId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)4;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR const char * sbeSemanticType() SBE_NOEXCEPT
|
||||
{
|
||||
return "X";
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
ChannelReset4 &wrapForEncode(char *buffer, const std::uint64_t offset, const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = ChannelReset4(buffer, offset, bufferLength, sbeBlockLength(), sbeSchemaVersion());
|
||||
}
|
||||
|
||||
ChannelReset4 &wrapAndApplyHeader(char *buffer, const std::uint64_t offset, const std::uint64_t bufferLength)
|
||||
{
|
||||
MessageHeader hdr(buffer, offset, bufferLength, sbeSchemaVersion());
|
||||
|
||||
hdr
|
||||
.blockLength(sbeBlockLength())
|
||||
.templateId(sbeTemplateId())
|
||||
.schemaId(sbeSchemaId())
|
||||
.version(sbeSchemaVersion());
|
||||
|
||||
return *this = ChannelReset4(
|
||||
buffer,
|
||||
offset + MessageHeader::encodedLength(),
|
||||
bufferLength,
|
||||
sbeBlockLength(),
|
||||
sbeSchemaVersion());
|
||||
}
|
||||
|
||||
ChannelReset4 &wrapForDecode(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingBlockLength,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = ChannelReset4(buffer, offset, bufferLength, actingBlockLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t sbePosition() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_position;
|
||||
}
|
||||
|
||||
std::uint64_t sbeCheckPosition(const std::uint64_t position)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT((position > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short [E100]");
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
void sbePosition(const std::uint64_t position)
|
||||
{
|
||||
m_position = sbeCheckPosition(position);
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t encodedLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return sbePosition() - m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * TransactTimeMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::SEMANTIC_TYPE: return "UTCTimestamp";
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t transactTimeId() SBE_NOEXCEPT
|
||||
{
|
||||
return 60;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t transactTimeSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool transactTimeInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= transactTimeSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t transactTimeEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint64_t transactTimeNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_UINT64;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint64_t transactTimeMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 0x0L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint64_t transactTimeMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 0xfffffffffffffffeL;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t transactTimeEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t transactTime() const SBE_NOEXCEPT
|
||||
{
|
||||
std::uint64_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::uint64_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_64(val);
|
||||
}
|
||||
|
||||
ChannelReset4 &transactTime(const std::uint64_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::uint64_t val = SBE_LITTLE_ENDIAN_ENCODE_64(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::uint64_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * MatchEventIndicatorMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::SEMANTIC_TYPE: return "MultipleCharValue";
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t matchEventIndicatorId() SBE_NOEXCEPT
|
||||
{
|
||||
return 5799;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t matchEventIndicatorSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool matchEventIndicatorInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= matchEventIndicatorSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t matchEventIndicatorEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
private:
|
||||
MatchEventIndicator m_matchEventIndicator;
|
||||
|
||||
public:
|
||||
SBE_NODISCARD MatchEventIndicator &matchEventIndicator()
|
||||
{
|
||||
m_matchEventIndicator.wrap(m_buffer, m_offset + 8, m_actingVersion, m_bufferLength);
|
||||
return m_matchEventIndicator;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t matchEventIndicatorEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
class NoMDEntries
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_initialPosition = 0;
|
||||
std::uint64_t *m_positionPtr = nullptr;
|
||||
std::uint64_t m_blockLength = 0;
|
||||
std::uint64_t m_count = 0;
|
||||
std::uint64_t m_index = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
SBE_NODISCARD std::uint64_t *sbePositionPtr() SBE_NOEXCEPT
|
||||
{
|
||||
return m_positionPtr;
|
||||
}
|
||||
|
||||
public:
|
||||
inline void wrapForDecode(
|
||||
char *buffer,
|
||||
std::uint64_t *pos,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
GroupSize dimensions(buffer, *pos, bufferLength, actingVersion);
|
||||
m_buffer = buffer;
|
||||
m_bufferLength = bufferLength;
|
||||
m_blockLength = dimensions.blockLength();
|
||||
m_count = dimensions.numInGroup();
|
||||
m_index = 0;
|
||||
m_actingVersion = actingVersion;
|
||||
m_initialPosition = *pos;
|
||||
m_positionPtr = pos;
|
||||
*m_positionPtr = *m_positionPtr + 3;
|
||||
}
|
||||
|
||||
inline void wrapForEncode(
|
||||
char *buffer,
|
||||
const std::uint8_t count,
|
||||
std::uint64_t *pos,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
#if defined(__GNUG__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
#endif
|
||||
if (count > 254)
|
||||
{
|
||||
throw std::runtime_error("count outside of allowed range [E110]");
|
||||
}
|
||||
#if defined(__GNUG__) && !defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
m_buffer = buffer;
|
||||
m_bufferLength = bufferLength;
|
||||
GroupSize dimensions(buffer, *pos, bufferLength, actingVersion);
|
||||
dimensions.blockLength((std::uint16_t)2);
|
||||
dimensions.numInGroup((std::uint8_t)count);
|
||||
m_index = 0;
|
||||
m_count = count;
|
||||
m_blockLength = 2;
|
||||
m_actingVersion = actingVersion;
|
||||
m_initialPosition = *pos;
|
||||
m_positionPtr = pos;
|
||||
*m_positionPtr = *m_positionPtr + 3;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint64_t sbeHeaderSize() SBE_NOEXCEPT
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint64_t sbeBlockLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t sbePosition() const
|
||||
{
|
||||
return *m_positionPtr;
|
||||
}
|
||||
|
||||
std::uint64_t sbeCheckPosition(const std::uint64_t position)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT((position > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short [E100]");
|
||||
}
|
||||
return position;
|
||||
}
|
||||
|
||||
void sbePosition(const std::uint64_t position)
|
||||
{
|
||||
*m_positionPtr = sbeCheckPosition(position);
|
||||
}
|
||||
|
||||
SBE_NODISCARD inline std::uint64_t count() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_count;
|
||||
}
|
||||
|
||||
SBE_NODISCARD inline bool hasNext() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_index < m_count;
|
||||
}
|
||||
|
||||
inline NoMDEntries &next()
|
||||
{
|
||||
if (m_index >= m_count)
|
||||
{
|
||||
throw std::runtime_error("index >= count [E108]");
|
||||
}
|
||||
m_offset = *m_positionPtr;
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + m_blockLength) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for next group index [E108]");
|
||||
}
|
||||
*m_positionPtr = m_offset + m_blockLength;
|
||||
++m_index;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline std::uint64_t resetCountToIndex() SBE_NOEXCEPT
|
||||
{
|
||||
m_count = m_index;
|
||||
GroupSize dimensions(m_buffer, m_initialPosition, m_bufferLength, m_actingVersion);
|
||||
dimensions.numInGroup((std::uint8_t)m_count);
|
||||
return m_count;
|
||||
}
|
||||
|
||||
#if __cplusplus < 201103L
|
||||
template<class Func> inline void forEach(Func& func)
|
||||
{
|
||||
while (hasNext())
|
||||
{
|
||||
next();
|
||||
func(*this);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
template<class Func> inline void forEach(Func&& func)
|
||||
{
|
||||
while (hasNext())
|
||||
{
|
||||
next();
|
||||
func(*this);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
SBE_NODISCARD static const char * MDUpdateActionMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::SEMANTIC_TYPE: return "int";
|
||||
case MetaAttribute::PRESENCE: return "constant";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t mDUpdateActionId() SBE_NOEXCEPT
|
||||
{
|
||||
return 279;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t mDUpdateActionSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool mDUpdateActionInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= mDUpdateActionSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t mDUpdateActionEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t mDUpdateActionNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t mDUpdateActionMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t mDUpdateActionMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t mDUpdateActionEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::int8_t mDUpdateAction() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * MDEntryTypeMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::SEMANTIC_TYPE: return "char";
|
||||
case MetaAttribute::PRESENCE: return "constant";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t mDEntryTypeId() SBE_NOEXCEPT
|
||||
{
|
||||
return 269;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t mDEntryTypeSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool mDEntryTypeInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= mDEntryTypeSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t mDEntryTypeEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR char mDEntryTypeNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (char)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR char mDEntryTypeMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (char)32;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR char mDEntryTypeMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (char)126;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t mDEntryTypeEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint64_t mDEntryTypeLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char *mDEntryType() const
|
||||
{
|
||||
static const std::uint8_t mDEntryTypeValues[] = { 74 };
|
||||
|
||||
return (const char *)mDEntryTypeValues;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char mDEntryType(const std::uint64_t index) const
|
||||
{
|
||||
static const std::uint8_t mDEntryTypeValues[] = { 74 };
|
||||
|
||||
return (char)mDEntryTypeValues[index];
|
||||
}
|
||||
|
||||
std::uint64_t getMDEntryType(char *dst, const std::uint64_t length) const
|
||||
{
|
||||
static std::uint8_t mDEntryTypeValues[] = { 74 };
|
||||
std::uint64_t bytesToCopy = length < sizeof(mDEntryTypeValues) ? length : sizeof(mDEntryTypeValues);
|
||||
|
||||
std::memcpy(dst, mDEntryTypeValues, static_cast<size_t>(bytesToCopy));
|
||||
return bytesToCopy;
|
||||
}
|
||||
|
||||
std::string getMDEntryTypeAsString() const
|
||||
{
|
||||
static const std::uint8_t MDEntryTypeValues[] = { 74 };
|
||||
|
||||
return std::string((const char *)MDEntryTypeValues, 1);
|
||||
}
|
||||
|
||||
std::string getMDEntryTypeAsJsonEscapedString()
|
||||
{
|
||||
std::ostringstream oss;
|
||||
std::string s = getMDEntryTypeAsString();
|
||||
|
||||
for (auto c = s.cbegin(); c != s.cend(); c++)
|
||||
{
|
||||
switch (*c)
|
||||
{
|
||||
case '"': oss << "\\\""; break;
|
||||
case '\\': oss << "\\\\"; break;
|
||||
case '\b': oss << "\\b"; break;
|
||||
case '\f': oss << "\\f"; break;
|
||||
case '\n': oss << "\\n"; break;
|
||||
case '\r': oss << "\\r"; break;
|
||||
case '\t': oss << "\\t"; break;
|
||||
|
||||
default:
|
||||
if ('\x00' <= *c && *c <= '\x1f')
|
||||
{
|
||||
oss << "\\u" << std::hex << std::setw(4)
|
||||
<< std::setfill('0') << (int)(*c);
|
||||
}
|
||||
else
|
||||
{
|
||||
oss << *c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return oss.str();
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * ApplIDMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::SEMANTIC_TYPE: return "int";
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t applIDId() SBE_NOEXCEPT
|
||||
{
|
||||
return 1180;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t applIDSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool applIDInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= applIDSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t applIDEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int16_t applIDNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT16;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int16_t applIDMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int16_t)-32767;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int16_t applIDMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int16_t)32767;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t applIDEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::int16_t applID() const SBE_NOEXCEPT
|
||||
{
|
||||
if (m_actingVersion < 3)
|
||||
{
|
||||
return (std::int16_t)-32768;
|
||||
}
|
||||
|
||||
std::int16_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::int16_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_16(val);
|
||||
}
|
||||
|
||||
NoMDEntries &applID(const std::int16_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::int16_t val = SBE_LITTLE_ENDIAN_ENCODE_16(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::int16_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, NoMDEntries writer)
|
||||
{
|
||||
builder << '{';
|
||||
builder << R"("ApplID": )";
|
||||
builder << +writer.applID();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
NoMDEntries m_noMDEntries;
|
||||
|
||||
public:
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t NoMDEntriesId() SBE_NOEXCEPT
|
||||
{
|
||||
return 268;
|
||||
}
|
||||
|
||||
SBE_NODISCARD inline NoMDEntries &noMDEntries()
|
||||
{
|
||||
m_noMDEntries.wrapForDecode(m_buffer, sbePositionPtr(), m_actingVersion, m_bufferLength);
|
||||
return m_noMDEntries;
|
||||
}
|
||||
|
||||
NoMDEntries &noMDEntriesCount(const std::uint8_t count)
|
||||
{
|
||||
m_noMDEntries.wrapForEncode(m_buffer, count, sbePositionPtr(), m_actingVersion, m_bufferLength);
|
||||
return m_noMDEntries;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t noMDEntriesSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool noMDEntriesInActingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= noMDEntriesSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, ChannelReset4 _writer)
|
||||
{
|
||||
ChannelReset4 writer(_writer.m_buffer, _writer.m_offset,
|
||||
_writer.m_bufferLength, _writer.sbeBlockLength(), _writer.m_actingVersion);
|
||||
builder << '{';
|
||||
builder << R"("Name": "ChannelReset4", )";
|
||||
builder << R"("sbeTemplateId": )";
|
||||
builder << writer.sbeTemplateId();
|
||||
builder << ", ";
|
||||
|
||||
builder << R"("TransactTime": )";
|
||||
builder << +writer.transactTime();
|
||||
|
||||
builder << ", ";
|
||||
builder << R"("MatchEventIndicator": )";
|
||||
builder << writer.matchEventIndicator();
|
||||
|
||||
builder << ", ";
|
||||
{
|
||||
bool atLeastOne = false;
|
||||
builder << R"("NoMDEntries": [)";
|
||||
writer.noMDEntries().forEach([&](NoMDEntries& noMDEntries)
|
||||
{
|
||||
if (atLeastOne)
|
||||
{
|
||||
builder << ", ";
|
||||
}
|
||||
atLeastOne = true;
|
||||
builder << noMDEntries;
|
||||
});
|
||||
builder << ']';
|
||||
}
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,340 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_DECIMAL9_H_
|
||||
#define _MDP3_DECIMAL9_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class Decimal9
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
Decimal9() = default;
|
||||
|
||||
Decimal9(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + 8) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for flyweight [E107]");
|
||||
}
|
||||
}
|
||||
|
||||
Decimal9(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
Decimal9(buffer, 0, bufferLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
Decimal9(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength) :
|
||||
Decimal9(buffer, 0, bufferLength, sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
Decimal9 &wrap(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = Decimal9(buffer, offset, bufferLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t encodedLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * mantissaMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t mantissaSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool mantissaInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= mantissaSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t mantissaEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT64;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return -9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t mantissaEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::int64_t mantissa() const SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::int64_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_64(val);
|
||||
}
|
||||
|
||||
Decimal9 &mantissa(const std::int64_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val = SBE_LITTLE_ENDIAN_ENCODE_64(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::int64_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * exponentMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "constant";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t exponentSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool exponentInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= exponentSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t exponentEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t exponentEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::int8_t exponent() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-9;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, Decimal9 writer)
|
||||
{
|
||||
builder << '{';
|
||||
builder << R"("mantissa": )";
|
||||
builder << +writer.mantissa();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,340 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_DECIMAL9NULL_H_
|
||||
#define _MDP3_DECIMAL9NULL_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class Decimal9NULL
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
Decimal9NULL() = default;
|
||||
|
||||
Decimal9NULL(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + 8) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for flyweight [E107]");
|
||||
}
|
||||
}
|
||||
|
||||
Decimal9NULL(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
Decimal9NULL(buffer, 0, bufferLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
Decimal9NULL(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength) :
|
||||
Decimal9NULL(buffer, 0, bufferLength, sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
Decimal9NULL &wrap(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = Decimal9NULL(buffer, offset, bufferLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t encodedLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * mantissaMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "optional";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t mantissaSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool mantissaInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= mantissaSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t mantissaEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return -9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t mantissaEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::int64_t mantissa() const SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::int64_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_64(val);
|
||||
}
|
||||
|
||||
Decimal9NULL &mantissa(const std::int64_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val = SBE_LITTLE_ENDIAN_ENCODE_64(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::int64_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * exponentMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "constant";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t exponentSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool exponentInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= exponentSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t exponentEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t exponentEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::int8_t exponent() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-9;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, Decimal9NULL writer)
|
||||
{
|
||||
builder << '{';
|
||||
builder << R"("mantissa": )";
|
||||
builder << +writer.mantissa();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,340 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_DECIMALQTY_H_
|
||||
#define _MDP3_DECIMALQTY_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class DecimalQty
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
DecimalQty() = default;
|
||||
|
||||
DecimalQty(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + 4) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for flyweight [E107]");
|
||||
}
|
||||
}
|
||||
|
||||
DecimalQty(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
DecimalQty(buffer, 0, bufferLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
DecimalQty(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength) :
|
||||
DecimalQty(buffer, 0, bufferLength, sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
DecimalQty &wrap(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = DecimalQty(buffer, offset, bufferLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t encodedLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * mantissaMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "optional";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t mantissaSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool mantissaInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= mantissaSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t mantissaEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int32_t mantissaNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 2147483647;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int32_t mantissaMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return -2147483647;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int32_t mantissaMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 2147483647;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t mantissaEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::int32_t mantissa() const SBE_NOEXCEPT
|
||||
{
|
||||
std::int32_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::int32_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_32(val);
|
||||
}
|
||||
|
||||
DecimalQty &mantissa(const std::int32_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::int32_t val = SBE_LITTLE_ENDIAN_ENCODE_32(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::int32_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * exponentMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "constant";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t exponentSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool exponentInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= exponentSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t exponentEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t exponentEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::int8_t exponent() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-4;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, DecimalQty writer)
|
||||
{
|
||||
builder << '{';
|
||||
builder << R"("mantissa": )";
|
||||
builder << +writer.mantissa();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,138 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_EVENTTYPE_H_
|
||||
#define _MDP3_EVENTTYPE_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class EventType
|
||||
{
|
||||
public:
|
||||
enum Value
|
||||
{
|
||||
Activation = (std::uint8_t)5,
|
||||
LastEligibleTradeDate = (std::uint8_t)7,
|
||||
NULL_VALUE = (std::uint8_t)255
|
||||
};
|
||||
|
||||
static EventType::Value get(const std::uint8_t value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 5: return Activation;
|
||||
case 7: return LastEligibleTradeDate;
|
||||
case 255: return NULL_VALUE;
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum EventType [E103]");
|
||||
}
|
||||
|
||||
static const char* c_str(const EventType::Value value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case Activation: return "Activation";
|
||||
case LastEligibleTradeDate: return "LastEligibleTradeDate";
|
||||
case NULL_VALUE: return "NULL_VALUE";
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum EventType [E103]:");
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& os, EventType::Value m)
|
||||
{
|
||||
return os << EventType::c_str(m);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,340 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_FLOAT_H_
|
||||
#define _MDP3_FLOAT_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class FLOAT
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
FLOAT() = default;
|
||||
|
||||
FLOAT(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + 8) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for flyweight [E107]");
|
||||
}
|
||||
}
|
||||
|
||||
FLOAT(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
FLOAT(buffer, 0, bufferLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
FLOAT(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength) :
|
||||
FLOAT(buffer, 0, bufferLength, sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
FLOAT &wrap(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = FLOAT(buffer, offset, bufferLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t encodedLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * mantissaMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t mantissaSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool mantissaInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= mantissaSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t mantissaEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT64;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return -9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t mantissaEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::int64_t mantissa() const SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::int64_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_64(val);
|
||||
}
|
||||
|
||||
FLOAT &mantissa(const std::int64_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val = SBE_LITTLE_ENDIAN_ENCODE_64(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::int64_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * exponentMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "constant";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t exponentSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool exponentInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= exponentSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t exponentEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t exponentEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::int8_t exponent() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-7;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, FLOAT writer)
|
||||
{
|
||||
builder << '{';
|
||||
builder << R"("mantissa": )";
|
||||
builder << +writer.mantissa();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,353 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_GROUPSIZE_H_
|
||||
#define _MDP3_GROUPSIZE_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class GroupSize
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
GroupSize() = default;
|
||||
|
||||
GroupSize(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + 3) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for flyweight [E107]");
|
||||
}
|
||||
}
|
||||
|
||||
GroupSize(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
GroupSize(buffer, 0, bufferLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
GroupSize(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength) :
|
||||
GroupSize(buffer, 0, bufferLength, sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
GroupSize &wrap(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = GroupSize(buffer, offset, bufferLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t encodedLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * blockLengthMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t blockLengthSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool blockLengthInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= blockLengthSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t blockLengthEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t blockLengthNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_UINT16;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t blockLengthMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t blockLengthMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)65534;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t blockLengthEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint16_t blockLength() const SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::uint16_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_16(val);
|
||||
}
|
||||
|
||||
GroupSize &blockLength(const std::uint16_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val = SBE_LITTLE_ENDIAN_ENCODE_16(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::uint16_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * numInGroupMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t numInGroupSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool numInGroupInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= numInGroupSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t numInGroupEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t numInGroupNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_UINT8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t numInGroupMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint8_t)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t numInGroupMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint8_t)254;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t numInGroupEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint8_t numInGroup() const SBE_NOEXCEPT
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 2, sizeof(std::uint8_t));
|
||||
return (val);
|
||||
}
|
||||
|
||||
GroupSize &numInGroup(const std::uint8_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::uint8_t val = (value);
|
||||
std::memcpy(m_buffer + m_offset + 2, &val, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, GroupSize writer)
|
||||
{
|
||||
builder << '{';
|
||||
builder << R"("blockLength": )";
|
||||
builder << +writer.blockLength();
|
||||
|
||||
builder << ", ";
|
||||
builder << R"("numInGroup": )";
|
||||
builder << +writer.numInGroup();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,353 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_GROUPSIZE8BYTE_H_
|
||||
#define _MDP3_GROUPSIZE8BYTE_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class GroupSize8Byte
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
GroupSize8Byte() = default;
|
||||
|
||||
GroupSize8Byte(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + 8) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for flyweight [E107]");
|
||||
}
|
||||
}
|
||||
|
||||
GroupSize8Byte(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
GroupSize8Byte(buffer, 0, bufferLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
GroupSize8Byte(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength) :
|
||||
GroupSize8Byte(buffer, 0, bufferLength, sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
GroupSize8Byte &wrap(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = GroupSize8Byte(buffer, offset, bufferLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t encodedLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * blockLengthMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t blockLengthSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool blockLengthInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= blockLengthSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t blockLengthEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t blockLengthNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_UINT16;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t blockLengthMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t blockLengthMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)65534;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t blockLengthEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint16_t blockLength() const SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::uint16_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_16(val);
|
||||
}
|
||||
|
||||
GroupSize8Byte &blockLength(const std::uint16_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val = SBE_LITTLE_ENDIAN_ENCODE_16(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::uint16_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * numInGroupMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t numInGroupSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool numInGroupInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= numInGroupSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t numInGroupEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t numInGroupNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_UINT8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t numInGroupMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint8_t)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t numInGroupMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint8_t)254;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t numInGroupEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint8_t numInGroup() const SBE_NOEXCEPT
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 7, sizeof(std::uint8_t));
|
||||
return (val);
|
||||
}
|
||||
|
||||
GroupSize8Byte &numInGroup(const std::uint8_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::uint8_t val = (value);
|
||||
std::memcpy(m_buffer + m_offset + 7, &val, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, GroupSize8Byte writer)
|
||||
{
|
||||
builder << '{';
|
||||
builder << R"("blockLength": )";
|
||||
builder << +writer.blockLength();
|
||||
|
||||
builder << ", ";
|
||||
builder << R"("numInGroup": )";
|
||||
builder << +writer.numInGroup();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,153 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_HALTREASON_H_
|
||||
#define _MDP3_HALTREASON_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class HaltReason
|
||||
{
|
||||
public:
|
||||
enum Value
|
||||
{
|
||||
GroupSchedule = (std::uint8_t)0,
|
||||
SurveillanceIntervention = (std::uint8_t)1,
|
||||
MarketEvent = (std::uint8_t)2,
|
||||
InstrumentActivation = (std::uint8_t)3,
|
||||
InstrumentExpiration = (std::uint8_t)4,
|
||||
Unknown = (std::uint8_t)5,
|
||||
RecoveryInProcess = (std::uint8_t)6,
|
||||
NULL_VALUE = (std::uint8_t)255
|
||||
};
|
||||
|
||||
static HaltReason::Value get(const std::uint8_t value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0: return GroupSchedule;
|
||||
case 1: return SurveillanceIntervention;
|
||||
case 2: return MarketEvent;
|
||||
case 3: return InstrumentActivation;
|
||||
case 4: return InstrumentExpiration;
|
||||
case 5: return Unknown;
|
||||
case 6: return RecoveryInProcess;
|
||||
case 255: return NULL_VALUE;
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum HaltReason [E103]");
|
||||
}
|
||||
|
||||
static const char* c_str(const HaltReason::Value value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case GroupSchedule: return "GroupSchedule";
|
||||
case SurveillanceIntervention: return "SurveillanceIntervention";
|
||||
case MarketEvent: return "MarketEvent";
|
||||
case InstrumentActivation: return "InstrumentActivation";
|
||||
case InstrumentExpiration: return "InstrumentExpiration";
|
||||
case Unknown: return "Unknown";
|
||||
case RecoveryInProcess: return "RecoveryInProcess";
|
||||
case NULL_VALUE: return "NULL_VALUE";
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum HaltReason [E103]:");
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& os, HaltReason::Value m)
|
||||
{
|
||||
return os << HaltReason::c_str(m);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,138 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_LEGSIDE_H_
|
||||
#define _MDP3_LEGSIDE_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class LegSide
|
||||
{
|
||||
public:
|
||||
enum Value
|
||||
{
|
||||
BuySide = (std::uint8_t)1,
|
||||
SellSide = (std::uint8_t)2,
|
||||
NULL_VALUE = (std::uint8_t)255
|
||||
};
|
||||
|
||||
static LegSide::Value get(const std::uint8_t value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 1: return BuySide;
|
||||
case 2: return SellSide;
|
||||
case 255: return NULL_VALUE;
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum LegSide [E103]");
|
||||
}
|
||||
|
||||
static const char* c_str(const LegSide::Value value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case BuySide: return "BuySide";
|
||||
case SellSide: return "SellSide";
|
||||
case NULL_VALUE: return "NULL_VALUE";
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum LegSide [E103]:");
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& os, LegSide::Value m)
|
||||
{
|
||||
return os << LegSide::c_str(m);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,183 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_MDENTRYTYPE_H_
|
||||
#define _MDP3_MDENTRYTYPE_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class MDEntryType
|
||||
{
|
||||
public:
|
||||
enum Value
|
||||
{
|
||||
Bid = (char)48,
|
||||
Offer = (char)49,
|
||||
Trade = (char)50,
|
||||
OpenPrice = (char)52,
|
||||
SettlementPrice = (char)54,
|
||||
TradingSessionHighPrice = (char)55,
|
||||
TradingSessionLowPrice = (char)56,
|
||||
ClearedVolume = (char)66,
|
||||
OpenInterest = (char)67,
|
||||
ImpliedBid = (char)69,
|
||||
ImpliedOffer = (char)70,
|
||||
BookReset = (char)74,
|
||||
SessionHighBid = (char)78,
|
||||
SessionLowOffer = (char)79,
|
||||
FixingPrice = (char)87,
|
||||
ElectronicVolume = (char)101,
|
||||
ThresholdLimitsandPriceBandVariation = (char)103,
|
||||
NULL_VALUE = (char)0
|
||||
};
|
||||
|
||||
static MDEntryType::Value get(const char value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 48: return Bid;
|
||||
case 49: return Offer;
|
||||
case 50: return Trade;
|
||||
case 52: return OpenPrice;
|
||||
case 54: return SettlementPrice;
|
||||
case 55: return TradingSessionHighPrice;
|
||||
case 56: return TradingSessionLowPrice;
|
||||
case 66: return ClearedVolume;
|
||||
case 67: return OpenInterest;
|
||||
case 69: return ImpliedBid;
|
||||
case 70: return ImpliedOffer;
|
||||
case 74: return BookReset;
|
||||
case 78: return SessionHighBid;
|
||||
case 79: return SessionLowOffer;
|
||||
case 87: return FixingPrice;
|
||||
case 101: return ElectronicVolume;
|
||||
case 103: return ThresholdLimitsandPriceBandVariation;
|
||||
case 0: return NULL_VALUE;
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum MDEntryType [E103]");
|
||||
}
|
||||
|
||||
static const char* c_str(const MDEntryType::Value value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case Bid: return "Bid";
|
||||
case Offer: return "Offer";
|
||||
case Trade: return "Trade";
|
||||
case OpenPrice: return "OpenPrice";
|
||||
case SettlementPrice: return "SettlementPrice";
|
||||
case TradingSessionHighPrice: return "TradingSessionHighPrice";
|
||||
case TradingSessionLowPrice: return "TradingSessionLowPrice";
|
||||
case ClearedVolume: return "ClearedVolume";
|
||||
case OpenInterest: return "OpenInterest";
|
||||
case ImpliedBid: return "ImpliedBid";
|
||||
case ImpliedOffer: return "ImpliedOffer";
|
||||
case BookReset: return "BookReset";
|
||||
case SessionHighBid: return "SessionHighBid";
|
||||
case SessionLowOffer: return "SessionLowOffer";
|
||||
case FixingPrice: return "FixingPrice";
|
||||
case ElectronicVolume: return "ElectronicVolume";
|
||||
case ThresholdLimitsandPriceBandVariation: return "ThresholdLimitsandPriceBandVariation";
|
||||
case NULL_VALUE: return "NULL_VALUE";
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum MDEntryType [E103]:");
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& os, MDEntryType::Value m)
|
||||
{
|
||||
return os << MDEntryType::c_str(m);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,147 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_MDENTRYTYPEBOOK_H_
|
||||
#define _MDP3_MDENTRYTYPEBOOK_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class MDEntryTypeBook
|
||||
{
|
||||
public:
|
||||
enum Value
|
||||
{
|
||||
Bid = (char)48,
|
||||
Offer = (char)49,
|
||||
ImpliedBid = (char)69,
|
||||
ImpliedOffer = (char)70,
|
||||
BookReset = (char)74,
|
||||
NULL_VALUE = (char)0
|
||||
};
|
||||
|
||||
static MDEntryTypeBook::Value get(const char value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 48: return Bid;
|
||||
case 49: return Offer;
|
||||
case 69: return ImpliedBid;
|
||||
case 70: return ImpliedOffer;
|
||||
case 74: return BookReset;
|
||||
case 0: return NULL_VALUE;
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum MDEntryTypeBook [E103]");
|
||||
}
|
||||
|
||||
static const char* c_str(const MDEntryTypeBook::Value value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case Bid: return "Bid";
|
||||
case Offer: return "Offer";
|
||||
case ImpliedBid: return "ImpliedBid";
|
||||
case ImpliedOffer: return "ImpliedOffer";
|
||||
case BookReset: return "BookReset";
|
||||
case NULL_VALUE: return "NULL_VALUE";
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum MDEntryTypeBook [E103]:");
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& os, MDEntryTypeBook::Value m)
|
||||
{
|
||||
return os << MDEntryTypeBook::c_str(m);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,144 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_MDENTRYTYPEDAILYSTATISTICS_H_
|
||||
#define _MDP3_MDENTRYTYPEDAILYSTATISTICS_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class MDEntryTypeDailyStatistics
|
||||
{
|
||||
public:
|
||||
enum Value
|
||||
{
|
||||
SettlementPrice = (char)54,
|
||||
ClearedVolume = (char)66,
|
||||
OpenInterest = (char)67,
|
||||
FixingPrice = (char)87,
|
||||
NULL_VALUE = (char)0
|
||||
};
|
||||
|
||||
static MDEntryTypeDailyStatistics::Value get(const char value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 54: return SettlementPrice;
|
||||
case 66: return ClearedVolume;
|
||||
case 67: return OpenInterest;
|
||||
case 87: return FixingPrice;
|
||||
case 0: return NULL_VALUE;
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum MDEntryTypeDailyStatistics [E103]");
|
||||
}
|
||||
|
||||
static const char* c_str(const MDEntryTypeDailyStatistics::Value value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case SettlementPrice: return "SettlementPrice";
|
||||
case ClearedVolume: return "ClearedVolume";
|
||||
case OpenInterest: return "OpenInterest";
|
||||
case FixingPrice: return "FixingPrice";
|
||||
case NULL_VALUE: return "NULL_VALUE";
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum MDEntryTypeDailyStatistics [E103]:");
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& os, MDEntryTypeDailyStatistics::Value m)
|
||||
{
|
||||
return os << MDEntryTypeDailyStatistics::c_str(m);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,147 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_MDENTRYTYPESTATISTICS_H_
|
||||
#define _MDP3_MDENTRYTYPESTATISTICS_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class MDEntryTypeStatistics
|
||||
{
|
||||
public:
|
||||
enum Value
|
||||
{
|
||||
OpenPrice = (char)52,
|
||||
HighTrade = (char)55,
|
||||
LowTrade = (char)56,
|
||||
HighestBid = (char)78,
|
||||
LowestOffer = (char)79,
|
||||
NULL_VALUE = (char)0
|
||||
};
|
||||
|
||||
static MDEntryTypeStatistics::Value get(const char value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 52: return OpenPrice;
|
||||
case 55: return HighTrade;
|
||||
case 56: return LowTrade;
|
||||
case 78: return HighestBid;
|
||||
case 79: return LowestOffer;
|
||||
case 0: return NULL_VALUE;
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum MDEntryTypeStatistics [E103]");
|
||||
}
|
||||
|
||||
static const char* c_str(const MDEntryTypeStatistics::Value value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case OpenPrice: return "OpenPrice";
|
||||
case HighTrade: return "HighTrade";
|
||||
case LowTrade: return "LowTrade";
|
||||
case HighestBid: return "HighestBid";
|
||||
case LowestOffer: return "LowestOffer";
|
||||
case NULL_VALUE: return "NULL_VALUE";
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum MDEntryTypeStatistics [E103]:");
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& os, MDEntryTypeStatistics::Value m)
|
||||
{
|
||||
return os << MDEntryTypeStatistics::c_str(m);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+1122
File diff suppressed because it is too large.
Load diff
+1117
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,150 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_MDUPDATEACTION_H_
|
||||
#define _MDP3_MDUPDATEACTION_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class MDUpdateAction
|
||||
{
|
||||
public:
|
||||
enum Value
|
||||
{
|
||||
New = (std::uint8_t)0,
|
||||
Change = (std::uint8_t)1,
|
||||
Delete = (std::uint8_t)2,
|
||||
DeleteThru = (std::uint8_t)3,
|
||||
DeleteFrom = (std::uint8_t)4,
|
||||
Overlay = (std::uint8_t)5,
|
||||
NULL_VALUE = (std::uint8_t)255
|
||||
};
|
||||
|
||||
static MDUpdateAction::Value get(const std::uint8_t value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0: return New;
|
||||
case 1: return Change;
|
||||
case 2: return Delete;
|
||||
case 3: return DeleteThru;
|
||||
case 4: return DeleteFrom;
|
||||
case 5: return Overlay;
|
||||
case 255: return NULL_VALUE;
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum MDUpdateAction [E103]");
|
||||
}
|
||||
|
||||
static const char* c_str(const MDUpdateAction::Value value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case New: return "New";
|
||||
case Change: return "Change";
|
||||
case Delete: return "Delete";
|
||||
case DeleteThru: return "DeleteThru";
|
||||
case DeleteFrom: return "DeleteFrom";
|
||||
case Overlay: return "Overlay";
|
||||
case NULL_VALUE: return "NULL_VALUE";
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum MDUpdateAction [E103]:");
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& os, MDUpdateAction::Value m)
|
||||
{
|
||||
return os << MDUpdateAction::c_str(m);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,515 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_MATCHEVENTINDICATOR_H_
|
||||
#define _MDP3_MATCHEVENTINDICATOR_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class MatchEventIndicator
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
MatchEventIndicator() = default;
|
||||
|
||||
MatchEventIndicator(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + 1) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for flyweight [E107]");
|
||||
}
|
||||
}
|
||||
|
||||
MatchEventIndicator(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
MatchEventIndicator(buffer, 0, bufferLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
MatchEventIndicator(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength) :
|
||||
MatchEventIndicator(buffer, 0, bufferLength, sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
MatchEventIndicator &wrap(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = MatchEventIndicator(buffer, offset, bufferLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t encodedLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
MatchEventIndicator &clear()
|
||||
{
|
||||
std::uint8_t zero = 0;
|
||||
std::memcpy(m_buffer + m_offset, &zero, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool isEmpty() const
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
return 0 == val;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint8_t rawValue() const
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
return val;
|
||||
}
|
||||
|
||||
MatchEventIndicator &rawValue(std::uint8_t value)
|
||||
{
|
||||
std::memcpy(m_buffer + m_offset, &value, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
static bool lastTradeMsg(const std::uint8_t bits)
|
||||
{
|
||||
return (bits & (1u << 0u)) != 0;
|
||||
}
|
||||
|
||||
static std::uint8_t lastTradeMsg(const std::uint8_t bits, const bool value)
|
||||
{
|
||||
return value ? static_cast<std::uint8_t>(bits | (1u << 0u)) : static_cast<std::uint8_t>(bits & ~(1u << 0u));
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool lastTradeMsg() const
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
return ((val) & (1u << 0u)) != 0;
|
||||
}
|
||||
|
||||
MatchEventIndicator &lastTradeMsg(const bool value)
|
||||
{
|
||||
std::uint8_t bits;
|
||||
std::memcpy(&bits, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
bits = (value ? static_cast<std::uint8_t>((bits) | (1u << 0u)) : static_cast<std::uint8_t>((bits) & ~(1u << 0u)));
|
||||
std::memcpy(m_buffer + m_offset, &bits, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
static bool lastVolumeMsg(const std::uint8_t bits)
|
||||
{
|
||||
return (bits & (1u << 1u)) != 0;
|
||||
}
|
||||
|
||||
static std::uint8_t lastVolumeMsg(const std::uint8_t bits, const bool value)
|
||||
{
|
||||
return value ? static_cast<std::uint8_t>(bits | (1u << 1u)) : static_cast<std::uint8_t>(bits & ~(1u << 1u));
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool lastVolumeMsg() const
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
return ((val) & (1u << 1u)) != 0;
|
||||
}
|
||||
|
||||
MatchEventIndicator &lastVolumeMsg(const bool value)
|
||||
{
|
||||
std::uint8_t bits;
|
||||
std::memcpy(&bits, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
bits = (value ? static_cast<std::uint8_t>((bits) | (1u << 1u)) : static_cast<std::uint8_t>((bits) & ~(1u << 1u)));
|
||||
std::memcpy(m_buffer + m_offset, &bits, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
static bool lastQuoteMsg(const std::uint8_t bits)
|
||||
{
|
||||
return (bits & (1u << 2u)) != 0;
|
||||
}
|
||||
|
||||
static std::uint8_t lastQuoteMsg(const std::uint8_t bits, const bool value)
|
||||
{
|
||||
return value ? static_cast<std::uint8_t>(bits | (1u << 2u)) : static_cast<std::uint8_t>(bits & ~(1u << 2u));
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool lastQuoteMsg() const
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
return ((val) & (1u << 2u)) != 0;
|
||||
}
|
||||
|
||||
MatchEventIndicator &lastQuoteMsg(const bool value)
|
||||
{
|
||||
std::uint8_t bits;
|
||||
std::memcpy(&bits, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
bits = (value ? static_cast<std::uint8_t>((bits) | (1u << 2u)) : static_cast<std::uint8_t>((bits) & ~(1u << 2u)));
|
||||
std::memcpy(m_buffer + m_offset, &bits, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
static bool lastStatsMsg(const std::uint8_t bits)
|
||||
{
|
||||
return (bits & (1u << 3u)) != 0;
|
||||
}
|
||||
|
||||
static std::uint8_t lastStatsMsg(const std::uint8_t bits, const bool value)
|
||||
{
|
||||
return value ? static_cast<std::uint8_t>(bits | (1u << 3u)) : static_cast<std::uint8_t>(bits & ~(1u << 3u));
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool lastStatsMsg() const
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
return ((val) & (1u << 3u)) != 0;
|
||||
}
|
||||
|
||||
MatchEventIndicator &lastStatsMsg(const bool value)
|
||||
{
|
||||
std::uint8_t bits;
|
||||
std::memcpy(&bits, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
bits = (value ? static_cast<std::uint8_t>((bits) | (1u << 3u)) : static_cast<std::uint8_t>((bits) & ~(1u << 3u)));
|
||||
std::memcpy(m_buffer + m_offset, &bits, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
static bool lastImpliedMsg(const std::uint8_t bits)
|
||||
{
|
||||
return (bits & (1u << 4u)) != 0;
|
||||
}
|
||||
|
||||
static std::uint8_t lastImpliedMsg(const std::uint8_t bits, const bool value)
|
||||
{
|
||||
return value ? static_cast<std::uint8_t>(bits | (1u << 4u)) : static_cast<std::uint8_t>(bits & ~(1u << 4u));
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool lastImpliedMsg() const
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
return ((val) & (1u << 4u)) != 0;
|
||||
}
|
||||
|
||||
MatchEventIndicator &lastImpliedMsg(const bool value)
|
||||
{
|
||||
std::uint8_t bits;
|
||||
std::memcpy(&bits, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
bits = (value ? static_cast<std::uint8_t>((bits) | (1u << 4u)) : static_cast<std::uint8_t>((bits) & ~(1u << 4u)));
|
||||
std::memcpy(m_buffer + m_offset, &bits, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
static bool recoveryMsg(const std::uint8_t bits)
|
||||
{
|
||||
return (bits & (1u << 5u)) != 0;
|
||||
}
|
||||
|
||||
static std::uint8_t recoveryMsg(const std::uint8_t bits, const bool value)
|
||||
{
|
||||
return value ? static_cast<std::uint8_t>(bits | (1u << 5u)) : static_cast<std::uint8_t>(bits & ~(1u << 5u));
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool recoveryMsg() const
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
return ((val) & (1u << 5u)) != 0;
|
||||
}
|
||||
|
||||
MatchEventIndicator &recoveryMsg(const bool value)
|
||||
{
|
||||
std::uint8_t bits;
|
||||
std::memcpy(&bits, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
bits = (value ? static_cast<std::uint8_t>((bits) | (1u << 5u)) : static_cast<std::uint8_t>((bits) & ~(1u << 5u)));
|
||||
std::memcpy(m_buffer + m_offset, &bits, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
static bool reserved(const std::uint8_t bits)
|
||||
{
|
||||
return (bits & (1u << 6u)) != 0;
|
||||
}
|
||||
|
||||
static std::uint8_t reserved(const std::uint8_t bits, const bool value)
|
||||
{
|
||||
return value ? static_cast<std::uint8_t>(bits | (1u << 6u)) : static_cast<std::uint8_t>(bits & ~(1u << 6u));
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool reserved() const
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
return ((val) & (1u << 6u)) != 0;
|
||||
}
|
||||
|
||||
MatchEventIndicator &reserved(const bool value)
|
||||
{
|
||||
std::uint8_t bits;
|
||||
std::memcpy(&bits, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
bits = (value ? static_cast<std::uint8_t>((bits) | (1u << 6u)) : static_cast<std::uint8_t>((bits) & ~(1u << 6u)));
|
||||
std::memcpy(m_buffer + m_offset, &bits, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
static bool endOfEvent(const std::uint8_t bits)
|
||||
{
|
||||
return (bits & (1u << 7u)) != 0;
|
||||
}
|
||||
|
||||
static std::uint8_t endOfEvent(const std::uint8_t bits, const bool value)
|
||||
{
|
||||
return value ? static_cast<std::uint8_t>(bits | (1u << 7u)) : static_cast<std::uint8_t>(bits & ~(1u << 7u));
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool endOfEvent() const
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
return ((val) & (1u << 7u)) != 0;
|
||||
}
|
||||
|
||||
MatchEventIndicator &endOfEvent(const bool value)
|
||||
{
|
||||
std::uint8_t bits;
|
||||
std::memcpy(&bits, m_buffer + m_offset, sizeof(std::uint8_t));
|
||||
bits = (value ? static_cast<std::uint8_t>((bits) | (1u << 7u)) : static_cast<std::uint8_t>((bits) & ~(1u << 7u)));
|
||||
std::memcpy(m_buffer + m_offset, &bits, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, MatchEventIndicator writer)
|
||||
{
|
||||
builder << '[';
|
||||
bool atLeastOne = false;
|
||||
if (writer.lastTradeMsg())
|
||||
{
|
||||
builder << R"("lastTradeMsg")";
|
||||
atLeastOne = true;
|
||||
}
|
||||
if (writer.lastVolumeMsg())
|
||||
{
|
||||
if (atLeastOne)
|
||||
{
|
||||
builder << ",";
|
||||
}
|
||||
builder << R"("lastVolumeMsg")";
|
||||
atLeastOne = true;
|
||||
}
|
||||
if (writer.lastQuoteMsg())
|
||||
{
|
||||
if (atLeastOne)
|
||||
{
|
||||
builder << ",";
|
||||
}
|
||||
builder << R"("lastQuoteMsg")";
|
||||
atLeastOne = true;
|
||||
}
|
||||
if (writer.lastStatsMsg())
|
||||
{
|
||||
if (atLeastOne)
|
||||
{
|
||||
builder << ",";
|
||||
}
|
||||
builder << R"("lastStatsMsg")";
|
||||
atLeastOne = true;
|
||||
}
|
||||
if (writer.lastImpliedMsg())
|
||||
{
|
||||
if (atLeastOne)
|
||||
{
|
||||
builder << ",";
|
||||
}
|
||||
builder << R"("lastImpliedMsg")";
|
||||
atLeastOne = true;
|
||||
}
|
||||
if (writer.recoveryMsg())
|
||||
{
|
||||
if (atLeastOne)
|
||||
{
|
||||
builder << ",";
|
||||
}
|
||||
builder << R"("recoveryMsg")";
|
||||
atLeastOne = true;
|
||||
}
|
||||
if (writer.reserved())
|
||||
{
|
||||
if (atLeastOne)
|
||||
{
|
||||
builder << ",";
|
||||
}
|
||||
builder << R"("reserved")";
|
||||
atLeastOne = true;
|
||||
}
|
||||
if (writer.endOfEvent())
|
||||
{
|
||||
if (atLeastOne)
|
||||
{
|
||||
builder << ",";
|
||||
}
|
||||
builder << R"("endOfEvent")";
|
||||
}
|
||||
builder << ']';
|
||||
return builder;
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,491 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_MATURITYMONTHYEAR_H_
|
||||
#define _MDP3_MATURITYMONTHYEAR_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class MaturityMonthYear
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
MaturityMonthYear() = default;
|
||||
|
||||
MaturityMonthYear(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + 5) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for flyweight [E107]");
|
||||
}
|
||||
}
|
||||
|
||||
MaturityMonthYear(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
MaturityMonthYear(buffer, 0, bufferLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
MaturityMonthYear(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength) :
|
||||
MaturityMonthYear(buffer, 0, bufferLength, sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
MaturityMonthYear &wrap(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = MaturityMonthYear(buffer, offset, bufferLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t encodedLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * yearMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "optional";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t yearSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool yearInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= yearSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t yearEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t yearNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)65535;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t yearMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t yearMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)65534;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t yearEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint16_t year() const SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::uint16_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_16(val);
|
||||
}
|
||||
|
||||
MaturityMonthYear &year(const std::uint16_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val = SBE_LITTLE_ENDIAN_ENCODE_16(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::uint16_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * monthMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "optional";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t monthSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool monthInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= monthSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t monthEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t monthNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint8_t)255;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t monthMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint8_t)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t monthMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint8_t)254;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t monthEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint8_t month() const SBE_NOEXCEPT
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 2, sizeof(std::uint8_t));
|
||||
return (val);
|
||||
}
|
||||
|
||||
MaturityMonthYear &month(const std::uint8_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::uint8_t val = (value);
|
||||
std::memcpy(m_buffer + m_offset + 2, &val, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * dayMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "optional";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t daySinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool dayInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= daySinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t dayEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t dayNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint8_t)255;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t dayMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint8_t)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t dayMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint8_t)254;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t dayEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint8_t day() const SBE_NOEXCEPT
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 3, sizeof(std::uint8_t));
|
||||
return (val);
|
||||
}
|
||||
|
||||
MaturityMonthYear &day(const std::uint8_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::uint8_t val = (value);
|
||||
std::memcpy(m_buffer + m_offset + 3, &val, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * weekMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "optional";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t weekSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool weekInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= weekSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t weekEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t weekNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint8_t)255;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t weekMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint8_t)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint8_t weekMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint8_t)254;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t weekEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint8_t week() const SBE_NOEXCEPT
|
||||
{
|
||||
std::uint8_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 4, sizeof(std::uint8_t));
|
||||
return (val);
|
||||
}
|
||||
|
||||
MaturityMonthYear &week(const std::uint8_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::uint8_t val = (value);
|
||||
std::memcpy(m_buffer + m_offset + 4, &val, sizeof(std::uint8_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, MaturityMonthYear writer)
|
||||
{
|
||||
builder << '{';
|
||||
builder << R"("year": )";
|
||||
builder << +writer.year();
|
||||
|
||||
builder << ", ";
|
||||
builder << R"("month": )";
|
||||
builder << +writer.month();
|
||||
|
||||
builder << ", ";
|
||||
builder << R"("day": )";
|
||||
builder << +writer.day();
|
||||
|
||||
builder << ", ";
|
||||
builder << R"("week": )";
|
||||
builder << +writer.week();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,491 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_MESSAGEHEADER_H_
|
||||
#define _MDP3_MESSAGEHEADER_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class MessageHeader
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
MessageHeader() = default;
|
||||
|
||||
MessageHeader(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + 8) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for flyweight [E107]");
|
||||
}
|
||||
}
|
||||
|
||||
MessageHeader(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
MessageHeader(buffer, 0, bufferLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
MessageHeader(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength) :
|
||||
MessageHeader(buffer, 0, bufferLength, sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
MessageHeader &wrap(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = MessageHeader(buffer, offset, bufferLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t encodedLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * blockLengthMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t blockLengthSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool blockLengthInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= blockLengthSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t blockLengthEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t blockLengthNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_UINT16;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t blockLengthMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t blockLengthMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)65534;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t blockLengthEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint16_t blockLength() const SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::uint16_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_16(val);
|
||||
}
|
||||
|
||||
MessageHeader &blockLength(const std::uint16_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val = SBE_LITTLE_ENDIAN_ENCODE_16(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::uint16_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * templateIdMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t templateIdSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool templateIdInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= templateIdSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t templateIdEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t templateIdNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_UINT16;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t templateIdMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t templateIdMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)65534;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t templateIdEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint16_t templateId() const SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 2, sizeof(std::uint16_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_16(val);
|
||||
}
|
||||
|
||||
MessageHeader &templateId(const std::uint16_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val = SBE_LITTLE_ENDIAN_ENCODE_16(value);
|
||||
std::memcpy(m_buffer + m_offset + 2, &val, sizeof(std::uint16_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * schemaIdMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t schemaIdSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool schemaIdInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= schemaIdSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t schemaIdEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t schemaIdNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_UINT16;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t schemaIdMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t schemaIdMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)65534;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t schemaIdEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint16_t schemaId() const SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 4, sizeof(std::uint16_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_16(val);
|
||||
}
|
||||
|
||||
MessageHeader &schemaId(const std::uint16_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val = SBE_LITTLE_ENDIAN_ENCODE_16(value);
|
||||
std::memcpy(m_buffer + m_offset + 4, &val, sizeof(std::uint16_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * versionMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t versionSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool versionInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= versionSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t versionEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 6;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t versionNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_UINT16;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t versionMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::uint16_t versionMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)65534;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t versionEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint16_t version() const SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 6, sizeof(std::uint16_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_16(val);
|
||||
}
|
||||
|
||||
MessageHeader &version(const std::uint16_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::uint16_t val = SBE_LITTLE_ENDIAN_ENCODE_16(value);
|
||||
std::memcpy(m_buffer + m_offset + 6, &val, sizeof(std::uint16_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, MessageHeader writer)
|
||||
{
|
||||
builder << '{';
|
||||
builder << R"("blockLength": )";
|
||||
builder << +writer.blockLength();
|
||||
|
||||
builder << ", ";
|
||||
builder << R"("templateId": )";
|
||||
builder << +writer.templateId();
|
||||
|
||||
builder << ", ";
|
||||
builder << R"("schemaId": )";
|
||||
builder << +writer.schemaId();
|
||||
|
||||
builder << ", ";
|
||||
builder << R"("version": )";
|
||||
builder << +writer.version();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,138 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_OPENCLOSESETTLFLAG_H_
|
||||
#define _MDP3_OPENCLOSESETTLFLAG_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class OpenCloseSettlFlag
|
||||
{
|
||||
public:
|
||||
enum Value
|
||||
{
|
||||
DailyOpenPrice = (std::uint8_t)0,
|
||||
IndicativeOpeningPrice = (std::uint8_t)5,
|
||||
NULL_VALUE = (std::uint8_t)255
|
||||
};
|
||||
|
||||
static OpenCloseSettlFlag::Value get(const std::uint8_t value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0: return DailyOpenPrice;
|
||||
case 5: return IndicativeOpeningPrice;
|
||||
case 255: return NULL_VALUE;
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum OpenCloseSettlFlag [E103]");
|
||||
}
|
||||
|
||||
static const char* c_str(const OpenCloseSettlFlag::Value value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case DailyOpenPrice: return "DailyOpenPrice";
|
||||
case IndicativeOpeningPrice: return "IndicativeOpeningPrice";
|
||||
case NULL_VALUE: return "NULL_VALUE";
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum OpenCloseSettlFlag [E103]:");
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& os, OpenCloseSettlFlag::Value m)
|
||||
{
|
||||
return os << OpenCloseSettlFlag::c_str(m);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,141 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_ORDERUPDATEACTION_H_
|
||||
#define _MDP3_ORDERUPDATEACTION_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class OrderUpdateAction
|
||||
{
|
||||
public:
|
||||
enum Value
|
||||
{
|
||||
New = (std::uint8_t)0,
|
||||
Update = (std::uint8_t)1,
|
||||
Delete = (std::uint8_t)2,
|
||||
NULL_VALUE = (std::uint8_t)255
|
||||
};
|
||||
|
||||
static OrderUpdateAction::Value get(const std::uint8_t value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0: return New;
|
||||
case 1: return Update;
|
||||
case 2: return Delete;
|
||||
case 255: return NULL_VALUE;
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum OrderUpdateAction [E103]");
|
||||
}
|
||||
|
||||
static const char* c_str(const OrderUpdateAction::Value value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case New: return "New";
|
||||
case Update: return "Update";
|
||||
case Delete: return "Delete";
|
||||
case NULL_VALUE: return "NULL_VALUE";
|
||||
}
|
||||
|
||||
throw std::runtime_error("unknown value for enum OrderUpdateAction [E103]:");
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& os, OrderUpdateAction::Value m)
|
||||
{
|
||||
return os << OrderUpdateAction::c_str(m);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,340 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_PRICE_H_
|
||||
#define _MDP3_PRICE_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class PRICE
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
PRICE() = default;
|
||||
|
||||
PRICE(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + 8) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for flyweight [E107]");
|
||||
}
|
||||
}
|
||||
|
||||
PRICE(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
PRICE(buffer, 0, bufferLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
PRICE(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength) :
|
||||
PRICE(buffer, 0, bufferLength, sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
PRICE &wrap(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = PRICE(buffer, offset, bufferLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t encodedLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * mantissaMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t mantissaSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool mantissaInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= mantissaSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t mantissaEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT64;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return -9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t mantissaEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::int64_t mantissa() const SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::int64_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_64(val);
|
||||
}
|
||||
|
||||
PRICE &mantissa(const std::int64_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val = SBE_LITTLE_ENDIAN_ENCODE_64(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::int64_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * exponentMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "constant";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t exponentSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool exponentInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= exponentSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t exponentEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t exponentEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::int8_t exponent() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-7;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, PRICE writer)
|
||||
{
|
||||
builder << '{';
|
||||
builder << R"("mantissa": )";
|
||||
builder << +writer.mantissa();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,340 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_PRICE9_H_
|
||||
#define _MDP3_PRICE9_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class PRICE9
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
PRICE9() = default;
|
||||
|
||||
PRICE9(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + 8) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for flyweight [E107]");
|
||||
}
|
||||
}
|
||||
|
||||
PRICE9(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
PRICE9(buffer, 0, bufferLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
PRICE9(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength) :
|
||||
PRICE9(buffer, 0, bufferLength, sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
PRICE9 &wrap(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = PRICE9(buffer, offset, bufferLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t encodedLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * mantissaMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "required";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t mantissaSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool mantissaInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= mantissaSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t mantissaEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT64;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return -9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t mantissaEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::int64_t mantissa() const SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::int64_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_64(val);
|
||||
}
|
||||
|
||||
PRICE9 &mantissa(const std::int64_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val = SBE_LITTLE_ENDIAN_ENCODE_64(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::int64_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * exponentMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "constant";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t exponentSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool exponentInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= exponentSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t exponentEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t exponentEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::int8_t exponent() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-9;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, PRICE9 writer)
|
||||
{
|
||||
builder << '{';
|
||||
builder << R"("mantissa": )";
|
||||
builder << +writer.mantissa();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,340 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_PRICENULL_H_
|
||||
#define _MDP3_PRICENULL_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class PRICENULL
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
PRICENULL() = default;
|
||||
|
||||
PRICENULL(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + 8) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for flyweight [E107]");
|
||||
}
|
||||
}
|
||||
|
||||
PRICENULL(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
PRICENULL(buffer, 0, bufferLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
PRICENULL(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength) :
|
||||
PRICENULL(buffer, 0, bufferLength, sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
PRICENULL &wrap(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = PRICENULL(buffer, offset, bufferLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t encodedLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * mantissaMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "optional";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t mantissaSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool mantissaInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= mantissaSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t mantissaEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return -9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t mantissaEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::int64_t mantissa() const SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::int64_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_64(val);
|
||||
}
|
||||
|
||||
PRICENULL &mantissa(const std::int64_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val = SBE_LITTLE_ENDIAN_ENCODE_64(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::int64_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * exponentMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "constant";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t exponentSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool exponentInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= exponentSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t exponentEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t exponentEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::int8_t exponent() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-7;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, PRICENULL writer)
|
||||
{
|
||||
builder << '{';
|
||||
builder << R"("mantissa": )";
|
||||
builder << +writer.mantissa();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,340 @@
|
||||
/* Generated SBE (Simple Binary Encoding) message codec */
|
||||
#ifndef _MDP3_PRICENULL9_H_
|
||||
#define _MDP3_PRICENULL9_H_
|
||||
|
||||
#if defined(SBE_HAVE_CMATH)
|
||||
/* cmath needed for std::numeric_limits<double>::quiet_NaN() */
|
||||
# include <cmath>
|
||||
# define SBE_FLOAT_NAN std::numeric_limits<float>::quiet_NaN()
|
||||
# define SBE_DOUBLE_NAN std::numeric_limits<double>::quiet_NaN()
|
||||
#else
|
||||
/* math.h needed for NAN */
|
||||
# include <math.h>
|
||||
# define SBE_FLOAT_NAN NAN
|
||||
# define SBE_DOUBLE_NAN NAN
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# include <cstdint>
|
||||
# include <string>
|
||||
# include <cstring>
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
# define SBE_CONSTEXPR constexpr
|
||||
# define SBE_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SBE_CONSTEXPR
|
||||
# define SBE_NOEXCEPT
|
||||
#endif
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
# define SBE_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
# define SBE_NODISCARD
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS 1
|
||||
#endif
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) _byteswap_ushort(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) _byteswap_ulong(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) _byteswap_uint64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) (v)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_16(v) __builtin_bswap16(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_32(v) __builtin_bswap32(v)
|
||||
# define SBE_LITTLE_ENDIAN_ENCODE_64(v) __builtin_bswap64(v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_16(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_32(v) (v)
|
||||
# define SBE_BIG_ENDIAN_ENCODE_64(v) (v)
|
||||
#else
|
||||
# error "Byte Ordering of platform not determined. Set __BYTE_ORDER__ manually before including this file."
|
||||
#endif
|
||||
|
||||
#if defined(SBE_NO_BOUNDS_CHECK)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (false)
|
||||
#elif defined(_MSC_VER)
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (exp)
|
||||
#else
|
||||
# define SBE_BOUNDS_CHECK_EXPECT(exp,c) (__builtin_expect(exp,c))
|
||||
#endif
|
||||
|
||||
#define SBE_NULLVALUE_INT8 (std::numeric_limits<std::int8_t>::min)()
|
||||
#define SBE_NULLVALUE_INT16 (std::numeric_limits<std::int16_t>::min)()
|
||||
#define SBE_NULLVALUE_INT32 (std::numeric_limits<std::int32_t>::min)()
|
||||
#define SBE_NULLVALUE_INT64 (std::numeric_limits<std::int64_t>::min)()
|
||||
#define SBE_NULLVALUE_UINT8 (std::numeric_limits<std::uint8_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT16 (std::numeric_limits<std::uint16_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT32 (std::numeric_limits<std::uint32_t>::max)()
|
||||
#define SBE_NULLVALUE_UINT64 (std::numeric_limits<std::uint64_t>::max)()
|
||||
|
||||
|
||||
namespace mdp3 {
|
||||
|
||||
class PRICENULL9
|
||||
{
|
||||
private:
|
||||
char *m_buffer = nullptr;
|
||||
std::uint64_t m_bufferLength = 0;
|
||||
std::uint64_t m_offset = 0;
|
||||
std::uint64_t m_actingVersion = 0;
|
||||
|
||||
public:
|
||||
enum MetaAttribute
|
||||
{
|
||||
EPOCH, TIME_UNIT, SEMANTIC_TYPE, PRESENCE
|
||||
};
|
||||
|
||||
union sbe_float_as_uint_u
|
||||
{
|
||||
float fp_value;
|
||||
std::uint32_t uint_value;
|
||||
};
|
||||
|
||||
union sbe_double_as_uint_u
|
||||
{
|
||||
double fp_value;
|
||||
std::uint64_t uint_value;
|
||||
};
|
||||
|
||||
PRICENULL9() = default;
|
||||
|
||||
PRICENULL9(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
m_buffer(buffer),
|
||||
m_bufferLength(bufferLength),
|
||||
m_offset(offset),
|
||||
m_actingVersion(actingVersion)
|
||||
{
|
||||
if (SBE_BOUNDS_CHECK_EXPECT(((m_offset + 8) > m_bufferLength), false))
|
||||
{
|
||||
throw std::runtime_error("buffer too short for flyweight [E107]");
|
||||
}
|
||||
}
|
||||
|
||||
PRICENULL9(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength,
|
||||
const std::uint64_t actingVersion) :
|
||||
PRICENULL9(buffer, 0, bufferLength, actingVersion)
|
||||
{
|
||||
}
|
||||
|
||||
PRICENULL9(
|
||||
char *buffer,
|
||||
const std::uint64_t bufferLength) :
|
||||
PRICENULL9(buffer, 0, bufferLength, sbeSchemaVersion())
|
||||
{
|
||||
}
|
||||
|
||||
PRICENULL9 &wrap(
|
||||
char *buffer,
|
||||
const std::uint64_t offset,
|
||||
const std::uint64_t actingVersion,
|
||||
const std::uint64_t bufferLength)
|
||||
{
|
||||
return *this = PRICENULL9(buffer, offset, bufferLength, actingVersion);
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t encodedLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t offset() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
SBE_NODISCARD const char * buffer() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD char * buffer() SBE_NOEXCEPT
|
||||
{
|
||||
return m_buffer;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t bufferLength() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_bufferLength;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::uint64_t actingVersion() const SBE_NOEXCEPT
|
||||
{
|
||||
return m_actingVersion;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaId() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)1;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint16_t sbeSchemaVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::uint16_t)9;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * mantissaMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "optional";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t mantissaSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool mantissaInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= mantissaSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t mantissaEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return -9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int64_t mantissaMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return 9223372036854775807L;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t mantissaEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
SBE_NODISCARD std::int64_t mantissa() const SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val;
|
||||
std::memcpy(&val, m_buffer + m_offset + 0, sizeof(std::int64_t));
|
||||
return SBE_LITTLE_ENDIAN_ENCODE_64(val);
|
||||
}
|
||||
|
||||
PRICENULL9 &mantissa(const std::int64_t value) SBE_NOEXCEPT
|
||||
{
|
||||
std::int64_t val = SBE_LITTLE_ENDIAN_ENCODE_64(value);
|
||||
std::memcpy(m_buffer + m_offset + 0, &val, sizeof(std::int64_t));
|
||||
return *this;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static const char * exponentMetaAttribute(const MetaAttribute metaAttribute) SBE_NOEXCEPT
|
||||
{
|
||||
switch (metaAttribute)
|
||||
{
|
||||
case MetaAttribute::PRESENCE: return "constant";
|
||||
default: return "";
|
||||
}
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::uint64_t exponentSinceVersion() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD bool exponentInActingVersion() SBE_NOEXCEPT
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wtautological-compare"
|
||||
#endif
|
||||
return m_actingVersion >= exponentSinceVersion();
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::size_t exponentEncodingOffset() SBE_NOEXCEPT
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentNullValue() SBE_NOEXCEPT
|
||||
{
|
||||
return SBE_NULLVALUE_INT8;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMinValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::int8_t exponentMaxValue() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)127;
|
||||
}
|
||||
|
||||
static SBE_CONSTEXPR std::size_t exponentEncodingLength() SBE_NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
SBE_NODISCARD static SBE_CONSTEXPR std::int8_t exponent() SBE_NOEXCEPT
|
||||
{
|
||||
return (std::int8_t)-9;
|
||||
}
|
||||
|
||||
template<typename CharT, typename Traits>
|
||||
friend std::basic_ostream<CharT, Traits>& operator<<(
|
||||
std::basic_ostream<CharT, Traits>& builder, PRICENULL9 writer)
|
||||
{
|
||||
builder << '{';
|
||||
builder << R"("mantissa": )";
|
||||
builder << +writer.mantissa();
|
||||
|
||||
builder << '}';
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Loaded 100 of 151 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user