• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
16 #ifndef IMAGE_PROCESSING_NATIVE_TEMPLATE_H
17 #define IMAGE_PROCESSING_NATIVE_TEMPLATE_H
18 
19 #include <memory>
20 
21 #include "nocopyable.h"
22 #include "image_processing_native_base.h"
23 
24 #define DEFINE_WITH_DISALLOW_COPY_AND_MOVE(className) \
25     className([[maybe_unused]] Protected mask) \
26         : ImageProcessingNativeTemplate<className>() {} \
27     virtual ~className() = default; \
28     DISALLOW_COPY_AND_MOVE(className)
29 
30 namespace OHOS {
31 namespace Media {
32 namespace VideoProcessingEngine {
33 /**
34  * Base implementaion for image processing.
35  */
36 template <typename T>
37 class ImageProcessingNativeTemplate : public ImageProcessingNativeBase, public std::enable_shared_from_this<T> {
38 public:
Create()39     static inline std::shared_ptr<T> Create()
40     {
41         return std::make_shared<T>(Protected());
42     }
43 
44 protected:
45     struct Protected { explicit Protected() = default; };
46 
ImageProcessingNativeTemplate()47     explicit ImageProcessingNativeTemplate() : ImageProcessingNativeBase() {}
48     virtual ~ImageProcessingNativeTemplate() = default;
49     ImageProcessingNativeTemplate(const ImageProcessingNativeTemplate&) = delete;
50     ImageProcessingNativeTemplate& operator=(const ImageProcessingNativeTemplate&) = delete;
51     ImageProcessingNativeTemplate(ImageProcessingNativeTemplate&&) = delete;
52     ImageProcessingNativeTemplate& operator=(ImageProcessingNativeTemplate&&) = delete;
53 };
54 } // namespace VideoProcessingEngine
55 } // namespace Media
56 } // namespace OHOS
57 
58 #endif // IMAGE_PROCESSING_NATIVE_TEMPLATE_H