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 #include "assemblyTypeProto.h"
17
18 namespace panda::proto {
Serialize(const panda::pandasm::Type type,protoPanda::Type & protoType)19 void Type::Serialize(const panda::pandasm::Type type, protoPanda::Type &protoType)
20 {
21 protoType.set_componentname(type.GetComponentName());
22 protoType.set_rank(type.GetRank());
23 protoType.set_name(type.GetName());
24 protoType.set_typeid_(static_cast<uint32_t>(type.GetId()));
25 }
26
Deserialize(const protoPanda::Type & protoType,panda::ArenaAllocator * allocator)27 panda::pandasm::Type &Type::Deserialize(const protoPanda::Type &protoType,
28 panda::ArenaAllocator *allocator)
29 {
30 auto *type = allocator->New<panda::pandasm::Type>(protoType.componentname(), protoType.rank());
31 return *type;
32 }
33 } // panda::proto
34