Apollo  6.0
Open source self driving car software
Namespaces | Enumerations | Functions
file.h File Reference
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <cstdio>
#include <fstream>
#include <string>
#include <vector>
#include "google/protobuf/io/zero_copy_stream_impl.h"
#include "google/protobuf/text_format.h"
#include "cyber/common/log.h"
Include dependency graph for file.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 apollo::common::util
 apollo::common::util
 
 apollo
 PlanningContext is the runtime context in planning. It is persistent across multiple frames.
 
 apollo::cyber
 
 apollo::cyber::common
 

Enumerations

enum  apollo::cyber::common::FileType { apollo::cyber::common::TYPE_FILE, apollo::cyber::common::TYPE_DIR }
 

Functions

bool apollo::cyber::common::SetProtoToASCIIFile (const google::protobuf::Message &message, int file_descriptor)
 
bool apollo::cyber::common::SetProtoToASCIIFile (const google::protobuf::Message &message, const std::string &file_name)
 Sets the content of the file specified by the file_name to be the ascii representation of the input protobuf. More...
 
bool apollo::cyber::common::GetProtoFromASCIIFile (const std::string &file_name, google::protobuf::Message *message)
 Parses the content of the file specified by the file_name as ascii representation of protobufs, and merges the parsed content to the proto. More...
 
bool apollo::cyber::common::SetProtoToBinaryFile (const google::protobuf::Message &message, const std::string &file_name)
 Sets the content of the file specified by the file_name to be the binary representation of the input protobuf. More...
 
bool apollo::cyber::common::GetProtoFromBinaryFile (const std::string &file_name, google::protobuf::Message *message)
 Parses the content of the file specified by the file_name as binary representation of protobufs, and merges the parsed content to the proto. More...
 
bool apollo::cyber::common::GetProtoFromFile (const std::string &file_name, google::protobuf::Message *message)
 Parses the content of the file specified by the file_name as a representation of protobufs, and merges the parsed content to the proto. More...
 
bool apollo::cyber::common::GetContent (const std::string &file_name, std::string *content)
 Get file content as string. More...
 
std::string apollo::cyber::common::GetAbsolutePath (const std::string &prefix, const std::string &relative_path)
 Get absolute path by concatenating prefix and relative_path. More...
 
bool apollo::cyber::common::PathExists (const std::string &path)
 Check if the path exists. More...
 
bool apollo::cyber::common::DirectoryExists (const std::string &directory_path)
 Check if the directory specified by directory_path exists and is indeed a directory. More...
 
std::vector< std::string > apollo::cyber::common::Glob (const std::string &pattern)
 Expand path pattern to matched paths. More...
 
bool apollo::cyber::common::CopyFile (const std::string &from, const std::string &to)
 Copy a file. More...
 
bool apollo::cyber::common::CopyDir (const std::string &from, const std::string &to)
 Copy a directory. More...
 
bool apollo::cyber::common::Copy (const std::string &from, const std::string &to)
 Copy a file or directory. More...
 
bool apollo::cyber::common::EnsureDirectory (const std::string &directory_path)
 Check if a specified directory specified by directory_path exists. If not, recursively create the directory (and its parents). More...
 
bool apollo::cyber::common::RemoveAllFiles (const std::string &directory_path)
 Remove all the files under a specified directory. Note that sub-directories are NOT affected. More...
 
std::vector< std::string > apollo::cyber::common::ListSubPaths (const std::string &directory_path, const unsigned char d_type=DT_DIR)
 List sub-paths. More...
 
std::string apollo::cyber::common::GetFileName (const std::string &path, const bool remove_extension=false)
 
std::string apollo::cyber::common::GetCurrentPath ()
 
bool apollo::cyber::common::DeleteFile (const std::string &filename)
 
bool apollo::cyber::common::GetType (const std::string &filename, FileType *type)
 
bool apollo::cyber::common::CreateDir (const std::string &dir)