Apollo  6.0
Open source self driving car software
file_utility.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2019 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 <fcntl.h>
19 #include <sys/stat.h>
20 #include <sys/types.h>
21 #include <unistd.h>
22 #include <cstdio>
23 #include <cstring>
24 #include <fstream>
25 #include <sstream>
26 #include <string>
27 #include <vector>
28 
29 #include "cyber/common/log.h"
30 
31 namespace apollo {
32 namespace localization {
33 namespace msf {
34 
35 class FileUtility {
36  public:
37  static const size_t kUcharMd5Length = 16;
38  static const size_t kCharMd5Lenth = 33;
40  static void ComputeFileMd5(const std::string& file_path,
41  unsigned char res[kUcharMd5Length]);
42  static void ComputeFileMd5(const std::string& file_path,
43  char res[kCharMd5Lenth]);
45  static void ComputeBinaryMd5(const unsigned char* binary, size_t size,
46  unsigned char res[kUcharMd5Length]);
47  static void ComputeBinaryMd5(const unsigned char* binary, size_t size,
48  char res[kCharMd5Lenth]);
49 };
50 
51 } // namespace msf
52 } // namespace localization
53 } // namespace apollo
static void ComputeFileMd5(const std::string &file_path, unsigned char res[kUcharMd5Length])
Compute file md5 given a file path.
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
static const size_t kUcharMd5Length
Definition: file_utility.h:37
static const size_t kCharMd5Lenth
Definition: file_utility.h:38
static void ComputeBinaryMd5(const unsigned char *binary, size_t size, unsigned char res[kUcharMd5Length])
Compute file md5 given a binary chunk.
Definition: file_utility.h:35