Apollo  6.0
Open source self driving car software
binary_data.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 #pragma once
17 
18 #include <limits>
19 #include <map>
20 #include <memory>
21 #include <string>
22 
24 
25 namespace apollo {
26 namespace perception {
27 namespace inference {
28 
29 constexpr size_t kMaxStrLen = 64;
30 constexpr int kMinDim = 1;
31 constexpr int kMaxDim = std::numeric_limits<int>::max();
32 
33 size_t BinaryReadString(FILE *fp, char *name);
34 size_t BinaryWriteString(FILE *fp, const std::string &str);
35 
36 template <typename Dtype>
37 std::shared_ptr<base::Blob<Dtype>> BinaryReadBlob(FILE *fp);
38 template <typename Dtype>
39 void BinaryWriteBlob(FILE *fp, const base::Blob<Dtype> &blob);
40 
41 template <typename Dtype>
42 std::map<std::string, std::shared_ptr<base::Blob<Dtype>>> BinaryReadFile(
43  const char *file_path);
44 template <typename Btype>
45 bool BinaryWriteFile(const char *file_path,
46  const std::map<std::string, Btype> &data_dict);
47 
48 } // namespace inference
49 } // namespace perception
50 } // namespace apollo
bool BinaryWriteFile(const char *file_path, const std::map< std::string, Btype > &data_dict)
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
std::shared_ptr< base::Blob< Dtype > > BinaryReadBlob(FILE *fp)
std::map< std::string, std::shared_ptr< base::Blob< Dtype > > > BinaryReadFile(const char *file_path)
size_t BinaryWriteString(FILE *fp, const std::string &str)
constexpr int kMaxDim
Definition: binary_data.h:31
constexpr size_t kMaxStrLen
Definition: binary_data.h:29
void BinaryWriteBlob(FILE *fp, const base::Blob< Dtype > &blob)
A wrapper around SyncedMemory holders serving as the basic computational unit for images...
Definition: blob.h:88
size_t BinaryReadString(FILE *fp, char *name)
constexpr int kMinDim
Definition: binary_data.h:30