QuantumLibrary
quantum_icontext_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_ICONTEXT_BASE_H
17 #define BLOOMBERG_QUANTUM_ICONTEXT_BASE_H
18 
19 #include <exception>
20 #include <memory>
21 
22 namespace Bloomberg {
23 namespace quantum {
24 
25 struct CoroContextTag{};
27 
28 //==============================================================================================
29 // interface IContextBase
30 //==============================================================================================
34 {
35  using Ptr = std::shared_ptr<IContextBase>;
36 
38  virtual ~IContextBase() = default;
39 
43  virtual bool valid() const = 0;
44 
53  virtual bool validAt(int num) const = 0;
54 
61  virtual int setException(std::exception_ptr ex) = 0;
62 };
63 
65 
66 }}
67 
68 #endif //BLOOMBERG_QUANTUM_ICONTEXT_BASE_H
Definition: quantum_buffer_impl.h:22
std::shared_ptr< IContextBase > Ptr
Definition: quantum_icontext_base.h:35
virtual bool validAt(int num) const =0
Determines if the future object associated with the 'num'-th continuation context is still valid.
virtual bool valid() const =0
Determines if the future object associated with this context has a valid shared state with the corres...
IContextBase::Ptr IContextBasePtr
Definition: quantum_icontext_base.h:64
virtual int setException(std::exception_ptr ex)=0
Set an exception in the promise associated with the current IThreadContext or ICoroContext.
This interface exposes shared functionality between IThreadContext and ICoroContext.
Definition: quantum_icontext_base.h:33
Definition: quantum_icontext_base.h:26
virtual ~IContextBase()=default
Virtual destructor.
Definition: quantum_icontext_base.h:25