• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
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 
16 #ifndef COMPILER_COMPILER_TASK_RUNNER_H
17 #define COMPILER_COMPILER_TASK_RUNNER_H
18 
19 #include <type_traits>
20 
21 namespace panda::compiler {
22 class InPlaceCompilerContext;
23 class BackgroundCompilerContext;
24 class InPlaceCompilerTaskRunner;
25 class BackgroundCompilerTaskRunner;
26 
27 enum TaskRunnerMode { INPLACE_MODE, BACKGROUND_MODE };
28 
29 template <TaskRunnerMode RUNNER_MODE>
30 using CompilerContext =
31     std::conditional_t<RUNNER_MODE == BACKGROUND_MODE, BackgroundCompilerContext, InPlaceCompilerContext>;
32 
33 template <TaskRunnerMode RUNNER_MODE>
34 using CompilerTaskRunner =
35     std::conditional_t<RUNNER_MODE == BACKGROUND_MODE, BackgroundCompilerTaskRunner, InPlaceCompilerTaskRunner>;
36 
37 }  // namespace panda::compiler
38 
39 #endif  // COMPILER_COMPILER_TASK_RUNNER_H
40