Apollo 11.0
自动驾驶开放平台
kv_db_tool.cc 文件参考
#include "modules/common/kv_db/kv_db.h"
#include <iostream>
#include "gflags/gflags.h"
#include "cyber/common/log.h"
kv_db_tool.cc 的引用(Include)关系图:

浏览源代码.

函数

 DEFINE_string (op, "get", "Operation to execute, should be put, get or del.")
 
 DEFINE_string (key, "", "The key to query.")
 
 DEFINE_string (value, "", "The value to query.")
 
int main (int32_t argc, char **argv)
 

函数说明

◆ DEFINE_string() [1/3]

DEFINE_string ( key  ,
""  ,
"The key to query."   
)

◆ DEFINE_string() [2/3]

DEFINE_string ( op  ,
"get"  ,
"Operation to  execute,
should be  put,
get or del."   
)

◆ DEFINE_string() [3/3]

DEFINE_string ( value  ,
""  ,
"The value to query."   
)

◆ main()

int main ( int32_t  argc,
char **  argv 
)

在文件 kv_db_tool.cc 第 30 行定义.

30 {
31 google::InitGoogleLogging(argv[0]);
32 google::ParseCommandLineFlags(&argc, &argv, true);
33
34 if (FLAGS_key.empty()) {
35 AFATAL << "Please specify --key.";
36 }
37
38 if (FLAGS_op == "get") {
39 std::cout << KVDB::Get(FLAGS_key).value() << std::endl;
40 } else if (FLAGS_op == "put") {
41 if (FLAGS_value.empty()) {
42 AFATAL << "Please specify --value.";
43 }
44 std::cout << KVDB::Put(FLAGS_key, FLAGS_value) << std::endl;
45 } else if (FLAGS_op == "del") {
46 std::cout << KVDB::Delete(FLAGS_key) << std::endl;
47 } else {
48 AFATAL << "Unknown op: " << FLAGS_op;
49 }
50
51 return 0;
52}
static std::optional< std::string > Get(std::string_view key)
Get value of a key.
Definition kv_db.cc:107
static bool Put(std::string_view key, std::string_view value)
Store {key, value} to DB.
Definition kv_db.cc:94
static bool Delete(std::string_view key)
Delete a key.
Definition kv_db.cc:101
#define AFATAL
Definition log.h:45