1 /*
2  * Copyright (c) 2024 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 #ifndef RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_INTERACTIVE_IMPLICT_ANIMATOR_MAP_H
16 #define RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_INTERACTIVE_IMPLICT_ANIMATOR_MAP_H
17 
18 #include <unordered_map>
19 
20 #include "common/rs_common_def.h"
21 #include "common/rs_macros.h"
22 
23 namespace OHOS {
24 namespace Rosen {
25 class RSRenderInteractiveImplictAnimator;
26 class RSB_EXPORT RSRenderInteractiveImplictAnimatorMap final {
27 public:
28     bool RegisterInteractiveImplictAnimator(const std::shared_ptr<RSRenderInteractiveImplictAnimator>& animatorPtr);
29     void UnregisterInteractiveImplictAnimator(InteractiveImplictAnimatorId id);
30     std::shared_ptr<RSRenderInteractiveImplictAnimator> GetInteractiveImplictAnimator(
31         InteractiveImplictAnimatorId id);
32 
33 private:
34     explicit RSRenderInteractiveImplictAnimatorMap();
35     ~RSRenderInteractiveImplictAnimatorMap() = default;
36     RSRenderInteractiveImplictAnimatorMap(const RSRenderInteractiveImplictAnimatorMap&) = delete;
37     RSRenderInteractiveImplictAnimatorMap(const RSRenderInteractiveImplictAnimatorMap&&) = delete;
38     RSRenderInteractiveImplictAnimatorMap& operator=(const RSRenderInteractiveImplictAnimatorMap&) = delete;
39     RSRenderInteractiveImplictAnimatorMap& operator=(const RSRenderInteractiveImplictAnimatorMap&&) = delete;
40 
41 private:
42     std::unordered_map<InteractiveImplictAnimatorId,
43         std::shared_ptr<RSRenderInteractiveImplictAnimator>> interactiveImplictAnimatorMap_;
44 
45     friend class RSContext;
46     friend class RSMainThread;
47 };
48 } // namespace Rosen
49 } // namespace OHOS
50 
51 #endif // RENDER_SERVICE_CLIENT_CORE_ANIMATION_RS_RENDER_INTERACTIVE_IMPLICT_ANIMATOR_MAP_H
52