|
| 1 | +/* |
| 2 | +** Copyright 2021 Bloomberg Finance L.P. |
| 3 | +** |
| 4 | +** Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +** you may not use this file except in compliance with the License. |
| 6 | +** You may obtain a copy of the License at |
| 7 | +** |
| 8 | +** http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +** |
| 10 | +** Unless required by applicable law or agreed to in writing, software |
| 11 | +** distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +** See the License for the specific language governing permissions and |
| 14 | +** limitations under the License. |
| 15 | +*/ |
| 16 | +//NOTE: DO NOT INCLUDE DIRECTLY |
| 17 | + |
| 18 | +//############################################################################################## |
| 19 | +//#################################### IMPLEMENTATIONS ######################################### |
| 20 | +//############################################################################################## |
| 21 | + |
| 22 | +#include <quantum/util/quantum_sequence_key_statistics.h> |
| 23 | +#include <quantum/interface/quantum_icoro_context_base.h> |
| 24 | +#include <list> |
| 25 | +#include <vector> |
| 26 | +#include <atomic> |
| 27 | +#include <memory> |
| 28 | + |
| 29 | +namespace Bloomberg { |
| 30 | +namespace quantum { |
| 31 | +namespace experimental { |
| 32 | + |
| 33 | +inline const std::string& |
| 34 | +SequencerConfigurationSchemaProvider::getJsonSchema() |
| 35 | +{ |
| 36 | + static std::string schema = R"JSON( |
| 37 | + { |
| 38 | + "$schema" : "http://json-schema.org/draft-04/schema#", |
| 39 | + "$id" : "bloomberg:sequencer.quantum.json", |
| 40 | + "title": "Quantum sequencer settings", |
| 41 | + "type": "object", |
| 42 | + "properties": { |
| 43 | + "bucketCount": { |
| 44 | + "type": "number", |
| 45 | + "default": 100 |
| 46 | + } |
| 47 | + }, |
| 48 | + "additionalProperties": false, |
| 49 | + "required": [] |
| 50 | + } |
| 51 | + )JSON"; |
| 52 | + return schema; |
| 53 | +} |
| 54 | + |
| 55 | +inline const std::string& |
| 56 | +SequencerConfigurationSchemaProvider::getJsonSchemaUri() |
| 57 | +{ |
| 58 | + static std::string uri = "bloomberg:sequencer.quantum.json"; |
| 59 | + return uri; |
| 60 | +} |
| 61 | + |
| 62 | +template <class SequenceKey, class Hash, class KeyEqual, class Allocator> |
| 63 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>& |
| 64 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setBucketCount(size_t bucketCount) |
| 65 | +{ |
| 66 | + _bucketCount = bucketCount; |
| 67 | + return *this; |
| 68 | +} |
| 69 | + |
| 70 | +template <class SequenceKey, class Hash, class KeyEqual, class Allocator> |
| 71 | +size_t |
| 72 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getBucketCount() const |
| 73 | +{ |
| 74 | + return _bucketCount; |
| 75 | +} |
| 76 | + |
| 77 | +template <class SequenceKey, class Hash, class KeyEqual, class Allocator> |
| 78 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>& |
| 79 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setHash(const Hash& hash) |
| 80 | +{ |
| 81 | + _hash = hash; |
| 82 | + return *this; |
| 83 | +} |
| 84 | + |
| 85 | +template <class SequenceKey, class Hash, class KeyEqual, class Allocator> |
| 86 | +const Hash& |
| 87 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getHash() const |
| 88 | +{ |
| 89 | + return _hash; |
| 90 | +} |
| 91 | + |
| 92 | +template <class SequenceKey, class Hash, class KeyEqual, class Allocator> |
| 93 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>& |
| 94 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setKeyEqual(const KeyEqual& keyEqual) |
| 95 | +{ |
| 96 | + _keyEqual = keyEqual; |
| 97 | + return *this; |
| 98 | +} |
| 99 | + |
| 100 | +template <class SequenceKey, class Hash, class KeyEqual, class Allocator> |
| 101 | +const KeyEqual& |
| 102 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getKeyEqual() const |
| 103 | +{ |
| 104 | + return _keyEqual; |
| 105 | +} |
| 106 | + |
| 107 | +template <class SequenceKey, class Hash, class KeyEqual, class Allocator> |
| 108 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>& |
| 109 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setAllocator(const Allocator& allocator) |
| 110 | +{ |
| 111 | + _allocator = allocator; |
| 112 | + return *this; |
| 113 | +} |
| 114 | + |
| 115 | +template <class SequenceKey, class Hash, class KeyEqual, class Allocator> |
| 116 | +const Allocator& |
| 117 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getAllocator() const |
| 118 | +{ |
| 119 | + return _allocator; |
| 120 | +} |
| 121 | + |
| 122 | +template <class SequenceKey, class Hash, class KeyEqual, class Allocator> |
| 123 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>& |
| 124 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setExceptionCallback( |
| 125 | + const ExceptionCallback& |
| 126 | + exceptionCallback) |
| 127 | + |
| 128 | +{ |
| 129 | + _exceptionCallback = exceptionCallback; |
| 130 | + return *this; |
| 131 | +} |
| 132 | + |
| 133 | +template <class SequenceKey, class Hash, class KeyEqual, class Allocator> |
| 134 | +const typename SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::ExceptionCallback& |
| 135 | +SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getExceptionCallback() const |
| 136 | +{ |
| 137 | + return _exceptionCallback; |
| 138 | +} |
| 139 | + |
| 140 | +}}} |
0 commit comments