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 HDI_SAMPLE_CPP_INF_H 17 #define HDI_SAMPLE_CPP_INF_H 18 19 #include <list> 20 #include <map> 21 #include <string> 22 #include <vector> 23 24 namespace OHOS { 25 namespace HDI { 26 namespace Sample { 27 namespace V1_0 { 28 struct StructSample { 29 int8_t first; 30 int16_t second; 31 }; 32 33 enum EnumSample { 34 MEM_FIRST, 35 MEM_SECOND, 36 MEM_THIRD, 37 }; 38 39 enum { 40 CMD_BOOLEAN_TYPE_TEST, 41 CMD_BYTE_TYPE_TEST, 42 CMD_SHORT_TYPE_TEST, 43 CMD_INT_TYPE_TEST, 44 CMD_LONG_TYPE_TEST, 45 CMD_FLOAT_TYPE_TEST, 46 CMD_DOUBLE_TYPE_TEST, 47 CMD_STRING_TYPE_TEST, 48 CMD_UCHAR_TYPE_TEST, 49 CMD_USHORT_TYPE_TEST, 50 CMD_UINT_TYPE_TEST, 51 CMD_ULONG_TYPE_TEST, 52 CMD_LIST_TYPE_TEST, 53 CMD_MAP_TYPE_TEST, 54 CMD_ARRAY_TYPE_TEST, 55 CMD_STRUCT_TYPE_TEST, 56 CMD_ENUM_TYPE_TEST, 57 }; 58 59 class ISample { 60 public: ~ISample()61 virtual ~ISample(){} 62 63 virtual int32_t BooleanTypeTest(const bool input, bool& output) const = 0; 64 65 virtual int32_t ByteTypeTest(const int8_t input, int8_t& output) const = 0; 66 67 virtual int32_t ShortTypeTest(const int16_t input, int16_t& output) const = 0; 68 69 virtual int32_t IntTypeTest(const int32_t input, int32_t& output) const = 0; 70 71 virtual int32_t LongTypeTest(const int64_t input, int64_t& output) const = 0; 72 73 virtual int32_t FloatTypeTest(const float input, float& output) const = 0; 74 75 virtual int32_t DoubleTypeTest(const double input, double& output) const = 0; 76 77 virtual int32_t StringTypeTest(const std::string& input, std::string& output) const = 0; 78 79 virtual int32_t UcharTypeTest(const uint8_t input, uint8_t& output) const = 0; 80 81 virtual int32_t UshortTypeTest(const uint16_t input, uint16_t& output) const = 0; 82 83 virtual int32_t UintTypeTest(const uint32_t input, uint32_t& output) const = 0; 84 85 virtual int32_t UlongTypeTest(const uint64_t input, uint64_t& output) const = 0; 86 87 virtual int32_t ListTypeTest(const std::list<int8_t>& input, std::list<int8_t>& output) const = 0; 88 89 virtual int32_t MapTypeTest(const std::map<int8_t, int8_t>& input, std::map<int8_t, int8_t>& output) const = 0; 90 91 virtual int32_t ArrayTypeTest(const std::vector<int8_t>& input, std::vector<int8_t>& output) const = 0; 92 93 virtual int32_t StructTypeTest(const StructSample& input, StructSample& output) const = 0; 94 95 virtual int32_t EnumTypeTest(const EnumSample& input, EnumSample& output) const = 0; 96 }; 97 } // namespace V1_0 98 } // namespace Sample 99 } // namespace HDI 100 } // namespace OHOS 101 102 #endif // HDI_SAMPLE_CPP_INF_H