Intel clGPU
context.hpp
1 // Copyright (c) 2017-2018 Intel Corporation
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 #include "container.hpp"
17 
18 namespace iclgpu
19 {
20 class dispatcher;
21 struct engine;
22 
25 
27 enum class engine_type
28 {
30  open_cl
31 };
32 
34 class context : public container<context>, public std::enable_shared_from_this<context>
35 {
36  context()
37  : _default_engine_type(engine_type::open_cl) {}
38 
39 public:
41  std::shared_ptr<dispatcher> get_dispatcher();
42 
45  std::shared_ptr<engine> get_engine(engine_type type = engine_type::default_engine);
46 
48  static std::shared_ptr<context> create() { return std::shared_ptr<context>(new context); }
49 private:
50  engine_type _default_engine_type;
51 };
52 
54 } // namespace iclgpu
static std::shared_ptr< context > create()
Create Context instance.
Definition: context.hpp:48
Global library context provides access to all library objects.
Definition: context.hpp:34
Base class for service lookup containers.
Definition: container.hpp:28
engine type registered as default
engine_type
supported engine types
Definition: context.hpp:27