|
Apollo
6.0
Open source self driving car software
|
Classes | |
| class | GlobalData |
Enumerations | |
| enum | FileType { TYPE_FILE, TYPE_DIR } |
Functions | |
| std::string | GetEnv (const std::string &var_name, const std::string &default_value="") |
| const std::string | WorkRoot () |
| bool | SetProtoToASCIIFile (const google::protobuf::Message &message, int file_descriptor) |
| bool | 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 | 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 | 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 | 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 | 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 | GetContent (const std::string &file_name, std::string *content) |
| Get file content as string. More... | |
| std::string | GetAbsolutePath (const std::string &prefix, const std::string &relative_path) |
| Get absolute path by concatenating prefix and relative_path. More... | |
| bool | PathExists (const std::string &path) |
| Check if the path exists. More... | |
| bool | 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 > | Glob (const std::string &pattern) |
| Expand path pattern to matched paths. More... | |
| bool | CopyFile (const std::string &from, const std::string &to) |
| Copy a file. More... | |
| bool | CopyDir (const std::string &from, const std::string &to) |
| Copy a directory. More... | |
| bool | Copy (const std::string &from, const std::string &to) |
| Copy a file or directory. More... | |
| bool | 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 | 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 > | ListSubPaths (const std::string &directory_path, const unsigned char d_type=DT_DIR) |
| List sub-paths. More... | |
| std::string | GetFileName (const std::string &path, const bool remove_extension=false) |
| std::string | GetCurrentPath () |
| bool | DeleteFile (const std::string &filename) |
| bool | GetType (const std::string &filename, FileType *type) |
| bool | CreateDir (const std::string &dir) |
| template<typename T > | |
| T | UnixToGpsSeconds (T unix_seconds) |
| int64_t | UnixToGpsMicroseconds (int64_t unix_microseconds) |
| int64_t | UnixToGpsNanoseconds (int64_t unix_nanoseconds) |
| template<typename T > | |
| T | GpsToUnixSeconds (T gps_seconds) |
| int64_t | GpsToUnixMicroseconds (int64_t gps_microseconds) |
| int64_t | GpsToUnixNanoseconds (int64_t gps_nanoseconds) |
| uint64_t | GpsToUnixMicroseconds (uint64_t gps_microseconds) |
| uint64_t | GpsToUnixNanoseconds (uint64_t gps_nanoseconds) |
| uint64_t | StringToUnixSeconds (const std::string &time_str, const std::string &format_str="%Y-%m-%d %H:%M:%S") |
| std::string | UnixSecondsToString (uint64_t unix_seconds, const std::string &format_str="%Y-%m-%d-%H:%M:%S") |
| std::size_t | Hash (const std::string &key) |
| template<typename Enum > | |
| auto | ToInt (Enum const value) -> typename std::underlying_type< Enum >::type |
Variables | |
| constexpr int32_t | UNIX_GPS_DIFF = 315964800 |
| constexpr int64_t | ONE_MILLION = 1000000L |
| constexpr int64_t | ONE_BILLION = 1000000000L |
| bool apollo::cyber::common::Copy | ( | const std::string & | from, |
| const std::string & | to | ||
| ) |
Copy a file or directory.
| from | The path to copy from. |
| to | The path to copy to. |
| bool apollo::cyber::common::CopyDir | ( | const std::string & | from, |
| const std::string & | to | ||
| ) |
Copy a directory.
| from | The path to copy from. |
| to | The path to copy to. |
| bool apollo::cyber::common::CopyFile | ( | const std::string & | from, |
| const std::string & | to | ||
| ) |
Copy a file.
| from | The file path to copy from. |
| to | The file path to copy to. |
| bool apollo::cyber::common::CreateDir | ( | const std::string & | dir | ) |
| bool apollo::cyber::common::DeleteFile | ( | const std::string & | filename | ) |
| bool apollo::cyber::common::DirectoryExists | ( | const std::string & | directory_path | ) |
Check if the directory specified by directory_path exists and is indeed a directory.
| directory_path | Directory path. |
| 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).
| directory_path | Directory path. |
| std::string apollo::cyber::common::GetAbsolutePath | ( | const std::string & | prefix, |
| const std::string & | relative_path | ||
| ) |
Get absolute path by concatenating prefix and relative_path.
| bool apollo::cyber::common::GetContent | ( | const std::string & | file_name, |
| std::string * | content | ||
| ) |
Get file content as string.
| file_name | The name of the file to read content. |
| content | The file content. |
| std::string apollo::cyber::common::GetCurrentPath | ( | ) |
|
inline |
| std::string apollo::cyber::common::GetFileName | ( | const std::string & | path, |
| const bool | remove_extension = false |
||
| ) |
| 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.
| file_name | The name of the file to parse whose content. |
| message | The proto to carry the parsed content in the specified file. |
| 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.
| file_name | The name of the file to parse whose content. |
| message | The proto to carry the parsed content in the specified file. |
| 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.
| file_name | The name of the file to parse whose content. |
| message | The proto to carry the parsed content in the specified file. |
| bool apollo::cyber::common::GetType | ( | const std::string & | filename, |
| FileType * | type | ||
| ) |
| std::vector<std::string> apollo::cyber::common::Glob | ( | const std::string & | pattern | ) |
Expand path pattern to matched paths.
| pattern | Path pattern, which may contain wildcards [?*]. |
|
inline |
|
inline |
|
inline |
|
inline |
| T apollo::cyber::common::GpsToUnixSeconds | ( | T | gps_seconds | ) |
|
inline |
| std::vector<std::string> apollo::cyber::common::ListSubPaths | ( | const std::string & | directory_path, |
| const unsigned char | d_type = DT_DIR |
||
| ) |
List sub-paths.
| directory_path | Directory path. |
| d_type | Sub-path type, DT_DIR for directory, or DT_REG for file. |
| bool apollo::cyber::common::PathExists | ( | const std::string & | path | ) |
Check if the path exists.
| path | a file name, such as /a/b/c.txt |
| 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.
| directory_path | Directory path. |
| 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.
| message | The proto to output to the specified file. |
| file_name | The name of the target file to set the content. |
| 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.
| message | The proto to output to the specified file. |
| file_name | The name of the target file to set the content. |
|
inline |
| auto apollo::cyber::common::ToInt | ( | Enum const | value | ) | -> typename std::underlying_type<Enum>::type |
|
inline |
|
inline |
|
inline |
| T apollo::cyber::common::UnixToGpsSeconds | ( | T | unix_seconds | ) |
|
inline |
| constexpr int64_t apollo::cyber::common::ONE_BILLION = 1000000000L |
| constexpr int64_t apollo::cyber::common::ONE_MILLION = 1000000L |
| constexpr int32_t apollo::cyber::common::UNIX_GPS_DIFF = 315964800 |
1.8.13