QuantumLibrary
quantum_ithread_future_base.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_BASE_H
17 #define BLOOMBERG_QUANTUM_ITHREAD_FUTURE_BASE_H
18 
19 #include <memory>
20 #include <future>
21 #include <chrono>
22 #include <quantum/interface/quantum_icoro_sync.h>
23 
24 namespace Bloomberg {
25 namespace quantum {
26 
27 //==============================================================================================
28 // interface IThreadFutureBase
29 //==============================================================================================
33 {
34  using Ptr = std::shared_ptr<IThreadFutureBase>;
35 
37  virtual ~IThreadFutureBase() = default;
38 
41  virtual bool valid() const = 0;
42 
45  virtual void wait() const = 0;
46 
51  virtual std::future_status waitFor(std::chrono::milliseconds timeMs) const = 0;
52 };
53 
55 
56 }}
57 
58 #endif //BLOOMBERG_QUANTUM_ITHREAD_FUTURE_BASE_H
Definition: quantum_buffer_impl.h:22
virtual std::future_status waitFor(std::chrono::milliseconds timeMs) const =0
Waits for the future value up to a maximum 'timeMs' milliseconds.
virtual bool valid() const =0
Determines if this future still has a shared state with the promise object.
virtual ~IThreadFutureBase()=default
Virtual destructor.
virtual void wait() const =0
Waits for the future value.
Definition: quantum_ithread_future_base.h:32
std::shared_ptr< IThreadFutureBase > Ptr
Definition: quantum_ithread_future_base.h:34
IThreadFutureBase::Ptr IThreadFutureBasePtr
Definition: quantum_ithread_future_base.h:54