1 /* 2 * Copyright (c) 2023 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 BASE_EVENT_RAW_INCLUDE_VALUE_PARAM_H 17 #define BASE_EVENT_RAW_INCLUDE_VALUE_PARAM_H 18 19 #include <cstdarg> 20 #include <cstddef> 21 #include <cstdint> 22 23 namespace OHOS { 24 namespace HiviewDFX { 25 namespace EventRaw { 26 enum DataCodedType: uint8_t { 27 UNSIGNED_VARINT, 28 UNSIGNED_VARINT_ARRAY, 29 SIGNED_VARINT, 30 SIGNED_VARINT_ARRAY, 31 FLOATING, 32 FLOATING_ARRAY, 33 DSTRING, 34 DSTRING_ARRAY, 35 }; 36 37 class ValueParam { 38 public: 39 virtual bool AsUint64(uint64_t& dest) = 0; 40 virtual bool AsInt64(int64_t& dest) = 0; 41 virtual bool AsDouble(double& dest) = 0; 42 virtual bool AsString(std::string& dest) = 0; 43 virtual bool AsUint64Vec(std::vector<uint64_t>& dest) = 0; 44 virtual bool AsInt64Vec(std::vector<int64_t>& dest) = 0; 45 virtual bool AsDoubleVec(std::vector<double>& dest) = 0; 46 virtual bool AsStringVec(std::vector<std::string>& dest) = 0; 47 virtual DataCodedType GetDataCodedType() = 0; 48 }; 49 } // namespace EventRaw 50 } // namespace HiviewDFX 51 } // namespace OHOS 52 53 #endif // BASE_EVENT_RAW_INCLUDE_VALUE_PARAM_H