• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2022 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 MERGE_ABC_ANNOTATION_H
17 #define MERGE_ABC_ANNOTATION_H
18 
19 #include "annotation.pb.h"
20 #include "arena_allocator.h"
21 #include "assembly-program.h"
22 #include "assemblyTypeProto.h"
23 
24 namespace panda::proto {
25 class AnnotationData {
26 public:
27     static void Serialize(const panda::pandasm::AnnotationData &anno, protoPanda::AnnotationData &protoAnno);
28     static void Deserialize(const protoPanda::AnnotationData &protoAnno, panda::pandasm::AnnotationData &anno,
29                             panda::ArenaAllocator *allocator);
30 };
31 
32 class AnnotationElement {
33 public:
34     static void Serialize(const panda::pandasm::AnnotationElement &element,
35                                         protoPanda::AnnotationElement &protoElement);
36     static panda::pandasm::AnnotationElement &Deserialize(const protoPanda::AnnotationElement &protoElement,
37                                                           panda::ArenaAllocator *allocator);
38 };
39 
40 class ScalarValue {
41 public:
42     static void Serialize(const panda::pandasm::ScalarValue &scalar, protoPanda::ScalarValue &protoScalar);
43     static panda::pandasm::ScalarValue Deserialize(const protoPanda::ScalarValue &protoScalar,
44                                                    panda::ArenaAllocator *allocator);
45     static panda::pandasm::ScalarValue CreateScalarValue(const panda::pandasm::Value::Type &type,
46         std::variant<uint64_t, float, double, std::string, panda::pandasm::Type, panda::pandasm::AnnotationData>
47         &value);
48 };
49 
50 class ArrayValue {
51 public:
52     static void Serialize(const panda::pandasm::ArrayValue &array, protoPanda::ArrayValue &protoArray);
53     static panda::pandasm::ArrayValue &Deserialize(const protoPanda::ArrayValue &protoArray,
54                                                    panda::ArenaAllocator *allocator);
55 };
56 } // panda::proto
57 #endif
58