Apollo 10.0
自动驾驶开放平台
py_message_traits.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
17#ifndef CYBER_MESSAGE_PY_MESSAGE_TRAITS_H_
18#define CYBER_MESSAGE_PY_MESSAGE_TRAITS_H_
19
20#include <cassert>
21#include <memory>
22#include <string>
23
25
26namespace apollo {
27namespace cyber {
28namespace message {
29
30// Template specialization for RawMessage
31inline bool SerializeToArray(const PyMessageWrap& message, void* data,
32 int size) {
33 return message.SerializeToArray(data, size);
34}
35
36inline bool ParseFromArray(const void* data, int size, PyMessageWrap* message) {
37 return message->ParseFromArray(data, size);
38}
39
40inline int ByteSize(const PyMessageWrap& message) { return message.ByteSize(); }
41
42} // namespace message
43} // namespace cyber
44} // namespace apollo
45
46#endif // CYBER_MESSAGE_PY_MESSAGE_TRAITS_H_
bool ParseFromArray(const void *data, int size)
Definition py_message.h:78
bool SerializeToArray(void *data, int size) const
Definition py_message.h:100
std::enable_if< HasSerializeToArray< T >::value, bool >::type SerializeToArray(const T &message, void *data, int size)
std::enable_if< HasByteSize< T >::value, int >::type ByteSize(const T &message)
std::enable_if< HasParseFromArray< T >::value, bool >::type ParseFromArray(const void *data, int size, T *message)
class register implement
Definition arena_queue.h:37