Skip to content

Commit e5ef8e6

Browse files
committed
Address the comments
Signed-off-by: Denis Mindolin <[email protected]>
1 parent 89158ad commit e5ef8e6

16 files changed

+891
-422
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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+
25+
namespace Bloomberg {
26+
namespace quantum {
27+
28+
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
29+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>&
30+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>::setBucketCount(size_t bucketCount)
31+
{
32+
_bucketCount = bucketCount;
33+
return *this;
34+
}
35+
36+
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
37+
size_t
38+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>::getBucketCount() const
39+
{
40+
return _bucketCount;
41+
}
42+
43+
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
44+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>&
45+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>::setHash(const Hash& hash)
46+
{
47+
_hash = hash;
48+
return *this;
49+
}
50+
51+
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
52+
const Hash&
53+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>::getHash() const
54+
{
55+
return _hash;
56+
}
57+
58+
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
59+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>&
60+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>::setKeyEqual(const KeyEqual& keyEqual)
61+
{
62+
_keyEqual = keyEqual;
63+
return *this;
64+
}
65+
66+
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
67+
const KeyEqual&
68+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>::getKeyEqual() const
69+
{
70+
return _keyEqual;
71+
}
72+
73+
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
74+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>&
75+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>::setAllocator(const Allocator& allocator)
76+
{
77+
_allocator = allocator;
78+
return *this;
79+
}
80+
81+
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
82+
const Allocator&
83+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>::getAllocator() const
84+
{
85+
return _allocator;
86+
}
87+
88+
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
89+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>&
90+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>::setExceptionCallback(
91+
const ExceptionCallback&
92+
exceptionCallback)
93+
94+
{
95+
_exceptionCallback = exceptionCallback;
96+
return *this;
97+
}
98+
99+
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
100+
const typename SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>::ExceptionCallback&
101+
SequencerConfigurationBase<SequenceKey, Hash, KeyEqual, Allocator>::getExceptionCallback() const
102+
{
103+
return _exceptionCallback;
104+
}
105+
106+
}}

quantum/util/impl/quantum_sequencer_configuration_impl.h

Lines changed: 1 addition & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** Copyright 2018 Bloomberg Finance L.P.
2+
** Copyright 2021 Bloomberg Finance L.P.
33
**
44
** Licensed under the Apache License, Version 2.0 (the "License");
55
** you may not use this file except in compliance with the License.
@@ -83,78 +83,4 @@ SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getControlQueueI
8383
return _controllerQueueId;
8484
}
8585

86-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
87-
SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>&
88-
SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setBucketCount(size_t bucketCount)
89-
{
90-
_bucketCount = bucketCount;
91-
return *this;
92-
}
93-
94-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
95-
size_t
96-
SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getBucketCount() const
97-
{
98-
return _bucketCount;
99-
}
100-
101-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
102-
void
103-
SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setHash(const Hash& hash)
104-
{
105-
_hash = hash;
106-
}
107-
108-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
109-
const Hash&
110-
SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getHash() const
111-
{
112-
return _hash;
113-
}
114-
115-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
116-
void
117-
SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setKeyEqual(const KeyEqual& keyEqual)
118-
{
119-
_keyEqual = keyEqual;
120-
}
121-
122-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
123-
const KeyEqual&
124-
SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getKeyEqual() const
125-
{
126-
return _keyEqual;
127-
}
128-
129-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
130-
void
131-
SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setAllocator(const Allocator& allocator)
132-
{
133-
_allocator = allocator;
134-
}
135-
136-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
137-
const Allocator&
138-
SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getAllocator() const
139-
{
140-
return _allocator;
141-
}
142-
143-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
144-
void
145-
SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setExceptionCallback(
146-
const ExceptionCallback&
147-
exceptionCallback)
148-
149-
{
150-
_exceptionCallback = exceptionCallback;
151-
}
152-
153-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
154-
const typename SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::ExceptionCallback&
155-
SequencerConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getExceptionCallback() const
156-
{
157-
return _exceptionCallback;
158-
}
159-
16086
}}
Lines changed: 1 addition & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** Copyright 2018 Bloomberg Finance L.P.
2+
** Copyright 2021 Bloomberg Finance L.P.
33
**
44
** Licensed under the Apache License, Version 2.0 (the "License");
55
** you may not use this file except in compliance with the License.
@@ -29,44 +29,6 @@
2929
namespace Bloomberg {
3030
namespace quantum {
3131

32-
template <class SequenceKey>
33-
struct SequencerLiteKeyData;
34-
35-
template <class SequenceKey>
36-
struct SequencerLiteTask
37-
{
38-
SequencerLiteTask(std::function<int(VoidContextPtr)>&& func,
39-
bool universal,
40-
void* opaque,
41-
int queueId,
42-
bool isHighPriority) :
43-
_func(std::move(func)),
44-
_pendingKeyCount(0),
45-
_universal(universal),
46-
_opaque(opaque),
47-
_queueId(queueId),
48-
_isHighPriority(isHighPriority)
49-
{}
50-
51-
std::function<int(VoidContextPtr)> _func; // the function to run
52-
std::vector<SequencerLiteKeyData<SequenceKey>*> _keyData; // pointers to the key data of my keys
53-
unsigned int _pendingKeyCount; // number of key queues where I am not at the head
54-
bool _universal; // true of universal tasks
55-
void* _opaque; // opaque pointer passed by user
56-
int _queueId; // the queue to enqueue the task
57-
bool _isHighPriority; // high priority task
58-
};
59-
60-
template <class SequenceKey>
61-
struct SequencerLiteKeyData
62-
{
63-
SequencerLiteKeyData() :
64-
_stats(std::make_shared<SequenceKeyStatisticsWriter>())
65-
{}
66-
std::list<std::shared_ptr<SequencerLiteTask<SequenceKey>>> _tasks; // task queue
67-
std::shared_ptr<SequenceKeyStatisticsWriter> _stats; // stats for all tasks sharing this key
68-
};
69-
7032
inline const std::string&
7133
SequencerLiteConfigurationSchemaProvider::getJsonSchema()
7234
{
@@ -96,78 +58,4 @@ SequencerLiteConfigurationSchemaProvider::getJsonSchemaUri()
9658
return uri;
9759
}
9860

99-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
100-
SequencerLiteConfiguration<SequenceKey, Hash, KeyEqual, Allocator>&
101-
SequencerLiteConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setBucketCount(size_t bucketCount)
102-
{
103-
_bucketCount = bucketCount;
104-
return *this;
105-
}
106-
107-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
108-
size_t
109-
SequencerLiteConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getBucketCount() const
110-
{
111-
return _bucketCount;
112-
}
113-
114-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
115-
void
116-
SequencerLiteConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setHash(const Hash& hash)
117-
{
118-
_hash = hash;
119-
}
120-
121-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
122-
const Hash&
123-
SequencerLiteConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getHash() const
124-
{
125-
return _hash;
126-
}
127-
128-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
129-
void
130-
SequencerLiteConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setKeyEqual(const KeyEqual& keyEqual)
131-
{
132-
_keyEqual = keyEqual;
133-
}
134-
135-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
136-
const KeyEqual&
137-
SequencerLiteConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getKeyEqual() const
138-
{
139-
return _keyEqual;
140-
}
141-
142-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
143-
void
144-
SequencerLiteConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setAllocator(const Allocator& allocator)
145-
{
146-
_allocator = allocator;
147-
}
148-
149-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
150-
const Allocator&
151-
SequencerLiteConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getAllocator() const
152-
{
153-
return _allocator;
154-
}
155-
156-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
157-
void
158-
SequencerLiteConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::setExceptionCallback(
159-
const ExceptionCallback&
160-
exceptionCallback)
161-
162-
{
163-
_exceptionCallback = exceptionCallback;
164-
}
165-
166-
template <class SequenceKey, class Hash, class KeyEqual, class Allocator>
167-
const typename SequencerLiteConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::ExceptionCallback&
168-
SequencerLiteConfiguration<SequenceKey, Hash, KeyEqual, Allocator>::getExceptionCallback() const
169-
{
170-
return _exceptionCallback;
171-
}
172-
17361
}}

0 commit comments

Comments
 (0)