• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_ORDERED_EVENT_HANDLER_H
17 #define FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_ORDERED_EVENT_HANDLER_H
18 
19 #include "event_handler.h"
20 
21 namespace OHOS {
22 namespace EventFwk {
23 using EventHandler = OHOS::AppExecFwk::EventHandler;
24 using EventRunner = OHOS::AppExecFwk::EventRunner;
25 using InnerEvent = OHOS::AppExecFwk::InnerEvent;
26 
27 class CommonEventControlManager;
28 
29 class OrderedEventHandler : public EventHandler {
30 public:
31     /**
32      * Constructor.
33      *
34      * @param runner Indicates the EventRunner object
35      * @param controlManager Indicates the CommonEventControlManager object
36      */
37     OrderedEventHandler(
38         const std::shared_ptr<EventRunner> &runner, const std::shared_ptr<CommonEventControlManager> &controlManager);
39 
40     virtual ~OrderedEventHandler() override;
41 
42     /**
43      * Processes the event.
44      *
45      * @param event Indicates the event to be handled.
46      */
47     virtual void ProcessEvent(const InnerEvent::Pointer &event) override;
48 
49     enum {
50         ORDERED_EVENT_START = 1,
51         ORDERED_EVENT_TIMEOUT,
52     };
53 
54 private:
55     std::shared_ptr<CommonEventControlManager> controlManager_;
56 };
57 }  // namespace EventFwk
58 }  // namespace OHOS
59 
60 #endif  // FOUNDATION_EVENT_CESFWK_SERVICES_INCLUDE_ORDERED_EVENT_HANDLER_H