You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.2 KiB
48 lines
1.2 KiB
#include "cmdline.h"//命令行解析
|
|
#include <functional>
|
|
#include <unordered_map>
|
|
#include <iostream>
|
|
#include "image_data.h"
|
|
#include "TestAPI_Profile.h"
|
|
|
|
using namespace std;
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
// 映射表
|
|
std::unordered_map<std::string, std::function<void()>> handlerMap = {
|
|
{"sky:Y16", TestAPI_SOT_Sky_Y16},
|
|
{"ground:Y8", TestAPI_SOT_Ground_Y8},
|
|
{"ground:RGB", TestAPI_SOT_Ground_RGB},
|
|
{"ground:Y16", TestAPI_SOT_Ground_Y16},
|
|
{"ground:NV12", TestAPI_SOT_Ground_NV12},
|
|
};
|
|
|
|
cmdline::parser a;
|
|
a.add<string>("scen",'s',"sky or ground",true,"");
|
|
a.add<string>("dataType",'d',"Y8/Y16/RGB/NV12",true,"");
|
|
a.parse_check(argc, argv);
|
|
|
|
cout << "scen:" << a.get<string>("scen")
|
|
<< "datatype:" << a.get<string>("dataType") << endl;
|
|
cout << "------------------ " << endl;
|
|
|
|
|
|
std::string scen = a.get<std::string>("scen");
|
|
std::string dataType = a.get<std::string>("dataType");
|
|
|
|
|
|
|
|
|
|
std::string key = scen + ":" + dataType;
|
|
|
|
// 查找并执行逻辑
|
|
if (handlerMap.find(key) != handlerMap.end()) {
|
|
handlerMap[key]();
|
|
} else {
|
|
std::cout << "Invalid combination of scen and dataType: " << key << std::endl;
|
|
}
|
|
|
|
return 0;
|
|
} |