Apollo  v5.5.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 <map>
19 #include <string>
20 
21 #include "boost/shared_ptr.hpp"
22 
24 
25 namespace apollo {
26 namespace perception {
27 namespace inference {
28 
29 static const int kMaxStrLen = 64;
30 static const int kMinDim = 1;
31 static const int kMaxDim = 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 boost::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, boost::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)
Definition: blob.h:72
size_t BinaryWriteString(FILE *fp, const std::string &str)
void BinaryWriteBlob(FILE *fp, const base::Blob< Dtype > &blob)
std::map< std::string, boost::shared_ptr< base::Blob< Dtype > > > BinaryReadFile(const char *file_path)
size_t BinaryReadString(FILE *fp, char *name)
boost::shared_ptr< base::Blob< Dtype > > BinaryReadBlob(FILE *fp)