Apollo 10.0
自动驾驶开放平台
raw_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_RAW_MESSAGE_TRAITS_H_
18#define CYBER_MESSAGE_RAW_MESSAGE_TRAITS_H_
19
20#include <cassert>
21#include <memory>
22#include <string>
23
26
27namespace apollo {
28namespace cyber {
29namespace message {
30
31// Template specialization for RawMessage
32inline bool SerializeToArray(const RawMessage& message, void* data, int size) {
33 return message.SerializeToArray(data, size);
34}
35
36inline bool ParseFromArray(const void* data, int size, RawMessage* message) {
37 return message->ParseFromArray(data, size);
38}
39
40inline int ByteSize(const RawMessage& message) { return message.ByteSize(); }
41
42inline bool SerializeToArenaMessageWrapper(const RawMessage& message,
43 ArenaMessageWrapper* wrapper) {
44 return false;
45}
46
48 RawMessage* message) {
49 return false;
50}
51
52} // namespace message
53} // namespace cyber
54} // namespace apollo
55
56#endif // CYBER_MESSAGE_RAW_MESSAGE_TRAITS_H_
std::enable_if< HasSerializeToArray< T >::value, bool >::type SerializeToArray(const T &message, void *data, int size)
std::enable_if< HasParseFromArenaMessageWrapper< T >::value, bool >::type ParseFromArenaMessageWrapper(ArenaMessageWrapper *wrapper, T *message, T **message_ptr)
std::enable_if< HasByteSize< T >::value, int >::type ByteSize(const T &message)
std::enable_if< HasSerializeToArenaMessageWrapper< T >::value, bool >::type SerializeToArenaMessageWrapper(const T &message, ArenaMessageWrapper *wrapper, T **message_ptr)
std::enable_if< HasParseFromArray< T >::value, bool >::type ParseFromArray(const void *data, int size, T *message)
class register implement
Definition arena_queue.h:37
bool SerializeToArray(void *data, int size) const
Definition raw_message.h:69
bool ParseFromArray(const void *data, int size)
Definition raw_message.h:90