• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (C) 2019 The Android Open Source Project
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 #ifndef COMPUTEPIPE_RUNNER_EVENT_GENERATOR_H
16 #define COMPUTEPIPE_RUNNER_EVENT_GENERATOR_H
17 
18 #include "RunnerComponent.h"
19 
20 namespace android {
21 namespace automotive {
22 namespace computepipe {
23 namespace runner {
24 namespace generator {
25 
26 /**
27  * Generate default events for different phases
28  */
29 class DefaultEvent : public RunnerEvent {
30   public:
31     enum Phase {
32         RESET = 0,
33         RUN,
34         STOP_WITH_FLUSH,
35         STOP_IMMEDIATE,
36     };
37     /**
38      * Override runner event methods
39      */
40     bool isPhaseEntry() const override;
41     bool isAborted() const override;
42     bool isTransitionComplete() const override;
43     Status dispatchToComponent(const std::shared_ptr<RunnerComponentInterface>& iface) override;
44 
45     /**
46      * generator methods
47      */
48     static DefaultEvent generateEntryEvent(Phase p);
49     static DefaultEvent generateAbortEvent(Phase p);
50     static DefaultEvent generateTransitionCompleteEvent(Phase p);
51 
52   private:
DefaultEvent(int type,Phase p)53     explicit DefaultEvent(int type, Phase p) : mType(type), mPhase(p){};
54     int mType;
55     Phase mPhase;
56 };
57 
58 }  // namespace generator
59 }  // namespace runner
60 }  // namespace computepipe
61 }  // namespace automotive
62 }  // namespace android
63 #endif
64