Apollo  6.0
Open source self driving car software
raw_message_traits.h
Go to the documentation of this file.
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 
25 
26 namespace apollo {
27 namespace cyber {
28 namespace message {
29 
30 // Template specialization for RawMessage
31 inline bool SerializeToArray(const RawMessage& message, void* data, int size) {
32  return message.SerializeToArray(data, size);
33 }
34 
35 inline bool ParseFromArray(const void* data, int size, RawMessage* message) {
36  return message->ParseFromArray(data, size);
37 }
38 
39 inline int ByteSize(const RawMessage& message) { return message.ByteSize(); }
40 
41 } // namespace message
42 } // namespace cyber
43 } // namespace apollo
44 
45 #endif // CYBER_MESSAGE_RAW_MESSAGE_TRAITS_H_
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::enable_if< HasByteSize< T >::value, int >::type ByteSize(const T &message)
Definition: message_traits.h:123
Definition: raw_message.h:31
std::enable_if< HasParseFromArray< T >::value, bool >::type ParseFromArray(const void *data, int size, T *message)
Definition: message_traits.h:145
std::enable_if< HasSerializeToArray< T >::value, bool >::type SerializeToArray(const T &message, void *data, int size)
Definition: message_traits.h:189
bool ParseFromArray(const void *data, int size)
Definition: raw_message.h:85
bool SerializeToArray(void *data, int size) const
Definition: raw_message.h:68
int ByteSize() const
Definition: raw_message.h:99