QuantumLibrary
quantum_ithread_future.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 #ifndef BLOOMBERG_QUANTUM_ITHREAD_FUTURE_H
17 #define BLOOMBERG_QUANTUM_ITHREAD_FUTURE_H
18 
19 #include <quantum/interface/quantum_icontext_base.h>
20 #include <quantum/interface/quantum_icoro_future_base.h>
21 #include <quantum/quantum_traits.h>
22 
23 namespace Bloomberg {
24 namespace quantum {
25 
26 template <class T>
27 class Future;
28 
29 //==============================================================================================
30 // interface IThreadFuture
31 //==============================================================================================
34 template <class T>
36 {
38  using Ptr = std::shared_ptr<IThreadFuture<T>>;
39  using Impl = Future<T>;
40 
45  template <class V = T>
47 
52  template <class V = T>
53  const NonBufferRetType<V>& getRef() const;
54 
61  template <class V = T>
62  BufferRetType<V> pull(bool& isBufferClosed);
63 };
64 
65 template <class T>
67 
68 template <class T>
70 
71 }}
72 
73 #endif //BLOOMBERG_QUANTUM_ITHREAD_FUTURE_H
std::shared_ptr< IThreadFuture< T > > Ptr
Definition: quantum_ithread_future.h:38
Definition: quantum_buffer_impl.h:22
BufferRetType< V > pull(bool &isBufferClosed)
Pull a single value from the future buffer.
Definition: quantum_future_impl.h:58
std::enable_if_t<!Traits::IsBuffer< T >::value, typename Traits::IsBuffer< T >::Type > NonBufferRetType
Definition: quantum_traits.h:95
Class representing a promised future. Can only be instantiated via a Promise object.
Definition: quantum_icoro_future.h:27
const NonBufferRetType< V > & getRef() const
Get a reference the future value.
Definition: quantum_future_impl.h:51
Definition: quantum_icontext_base.h:26
Definition: quantum_ithread_future_base.h:32
typename IThreadFuture< T >::Ptr ThreadFuturePtr
Definition: quantum_ithread_future.h:69
std::enable_if_t< Traits::IsBuffer< T >::value, typename Traits::IsBuffer< T >::Type > BufferRetType
Definition: quantum_traits.h:93
Definition: quantum_ithread_future.h:35
NonBufferRetType< V > get()
Get the future value.
Definition: quantum_future_impl.h:44