Apollo 11.0
自动驾驶开放平台
binary_data.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#pragma once
17
18#include <limits>
19#include <map>
20#include <memory>
21#include <string>
22
24
25namespace apollo {
26namespace perception {
27namespace inference {
28
29constexpr size_t kMaxStrLen = 64;
30constexpr int kMinDim = 1;
31constexpr int kMaxDim = std::numeric_limits<int>::max();
32
33size_t BinaryReadString(FILE *fp, char *name);
34size_t BinaryWriteString(FILE *fp, const std::string &str);
35
36template <typename Dtype>
37std::shared_ptr<base::Blob<Dtype>> BinaryReadBlob(FILE *fp);
38template <typename Dtype>
39void BinaryWriteBlob(FILE *fp, const base::Blob<Dtype> &blob);
40
41template <typename Dtype>
42std::map<std::string, std::shared_ptr<base::Blob<Dtype>>> BinaryReadFile(
43 const char *file_path);
44template <typename Btype>
45bool BinaryWriteFile(const char *file_path,
46 const std::map<std::string, Btype> &data_dict);
47
48} // namespace inference
49} // namespace perception
50} // namespace apollo
A wrapper around SyncedMemory holders serving as the basic computational unit for images,...
Definition blob.h:88
size_t BinaryWriteString(FILE *fp, const std::string &str)
size_t BinaryReadString(FILE *fp, char *name)
void BinaryWriteBlob(FILE *fp, const base::Blob< Dtype > &blob)
std::shared_ptr< base::Blob< Dtype > > BinaryReadBlob(FILE *fp)
bool BinaryWriteFile(const char *file_path, const std::map< std::string, Btype > &data_dict)
constexpr size_t kMaxStrLen
Definition binary_data.h:29
std::map< std::string, std::shared_ptr< base::Blob< Dtype > > > BinaryReadFile(const char *file_path)
class register implement
Definition arena_queue.h:37