QuantumLibrary
quantum_sequencer_configuration_impl.h
1 /*
2 ** Copyright 2018 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 
24 namespace Bloomberg {
25 namespace quantum {
26 
27 using StatsPtr = std::shared_ptr<SequenceKeyStatisticsWriter>;
29 {
31  _stats(std::make_shared<SequenceKeyStatisticsWriter>())
32  {}
35 };
36 
37 template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
38 void
40 {
41  _controllerQueueId = controlQueueId;
42 }
43 
44 template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
45 int
47 {
48  return _controllerQueueId;
49 }
50 
51 template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
52 void
54 {
55  _bucketCount = bucketCount;
56 }
57 
58 template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
59 size_t
61 {
62  return _bucketCount;
63 }
64 
65 template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
66 void
68 {
69  _hash = hash;
70 }
71 
72 template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
73 const Hash&
75 {
76  return _hash;
77 }
78 
79 template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
80 void
82 {
83  _keyEqual = keyEqual;
84 }
85 
86 template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
87 const KeyEqual&
89 {
90  return _keyEqual;
91 }
92 
93 template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
94 void
96 {
97  _allocator = allocator;
98 }
99 
100 template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
101 const Allocator&
103 {
104  return _allocator;
105 }
106 
107 template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
108 void
110  const ExceptionCallback&
111  exceptionCallback)
112 
113 {
114  _exceptionCallback = exceptionCallback;
115 }
116 
117 template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
120 {
121  return _exceptionCallback;
122 }
123 
124 }}
SequenceKeyData()
Definition: quantum_sequencer_configuration_impl.h:30
Definition: quantum_buffer_impl.h:22
const KeyEqual & getKeyEqual() const
Gets the comparison function to be used for all SequenceKey comparisons for the context hash map.
Definition: quantum_sequencer_configuration_impl.h:88
void setKeyEqual(const KeyEqual &keyEqual)
Sets the comparison function to be used for all SequenceKey comparisons for the context hash map.
Definition: quantum_sequencer_configuration_impl.h:81
StatsPtr _stats
Definition: quantum_sequencer_configuration_impl.h:34
Definition: quantum_sequence_key_statistics.h:72
Definition: quantum_stl_impl.h:23
Definition: quantum_allocator.h:54
ICoroContextBase::Ptr ICoroContextBasePtr
Definition: quantum_icoro_context_base.h:79
Definition: quantum_sequencer_configuration_impl.h:28
const Allocator & getAllocator() const
Gets the allocator for all SequenceKey comparisons for the context hash map.
Definition: quantum_sequencer_configuration_impl.h:102
const ExceptionCallback & getExceptionCallback() const
Gets the exception callback for Scheduler.
Definition: quantum_sequencer_configuration_impl.h:119
void setAllocator(const Allocator &allocator)
Sets the allocator for all SequenceKey comparisons for the context hash map.
Definition: quantum_sequencer_configuration_impl.h:95
void setHash(const Hash &hash)
Sets the hash function to be used for the context hash map.
Definition: quantum_sequencer_configuration_impl.h:67
std::function< void(std::exception_ptr exception, void *opaque)> ExceptionCallback
Callback for unhandled exceptions in tasks posted to Sequencer.
Definition: quantum_sequencer_configuration.h:48
const Hash & getHash() const
Gets the hash function to be used for the context hash map.
Definition: quantum_sequencer_configuration_impl.h:74
int getControlQueueId() const
Gets the id of the control queue.
Definition: quantum_sequencer_configuration_impl.h:46
std::shared_ptr< SequenceKeyStatisticsWriter > StatsPtr
Definition: quantum_sequencer_configuration_impl.h:27
ICoroContextBasePtr _context
Definition: quantum_sequencer_configuration_impl.h:33
size_t getBucketCount() const
gets the minimal number of buckets to be used for the context hash map
Definition: quantum_sequencer_configuration_impl.h:60
void setControlQueueId(int controlQueueId)
Sets the id of the control queue.
Definition: quantum_sequencer_configuration_impl.h:39
void setBucketCount(size_t bucketCount)
Sets the minimal number of buckets to be used for the context hash map.
Definition: quantum_sequencer_configuration_impl.h:53
void setExceptionCallback(const ExceptionCallback &exceptionCallback)
Sets the exception callback for Scheduler.
Definition: quantum_sequencer_configuration_impl.h:109