1 /* 2 * Copyright (c) 2024-2025 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 CPP_ABCKIT_CORE_FIELD_H 17 #define CPP_ABCKIT_CORE_FIELD_H 18 19 #include "../base_classes.h" 20 21 namespace abckit::core { 22 23 /** 24 * @brief Field 25 */ 26 class Field : public View<AbckitCoreField *> { 27 // We restrict constructors in order to prevent C/C++ API mix-up by user. 28 /// @brief to access private constructor 29 friend class core::Module; 30 /// @brief to access private constructor 31 friend class core::Namespace; 32 /// @brief abckit::DefaultHash<Field> 33 friend class abckit::DefaultHash<Field>; 34 35 protected: 36 /// @brief Core API View type 37 using CoreViewT = Field; 38 39 public: 40 /** 41 * @brief Construct a new Field object 42 * @param other 43 */ 44 Field(const Field &other) = default; 45 46 /** 47 * @brief Constructor 48 * @param other 49 * @return Field& 50 */ 51 Field &operator=(const Field &other) = default; 52 53 /** 54 * @brief Construct a new Field object 55 * @param other 56 */ 57 Field(Field &&other) = default; 58 59 /** 60 * @brief Constructor 61 * @param other 62 * @return Field& 63 */ 64 Field &operator=(Field &&other) = default; 65 66 /** 67 * @brief Destroy the Field object 68 */ 69 ~Field() override = default; 70 71 private: Field(AbckitCoreField * field,const ApiConfig * conf)72 Field(AbckitCoreField *field, const ApiConfig *conf) : View(field), conf_(conf) {}; 73 const ApiConfig *conf_; 74 75 protected: 76 /** 77 * @brief Get the Api Config object 78 * @return const ApiConfig* 79 */ GetApiConfig()80 const ApiConfig *GetApiConfig() const override 81 { 82 return conf_; 83 } 84 }; 85 86 } // namespace abckit::core 87 88 #endif // CPP_ABCKIT_CORE_FIELD_H 89