本文整理汇总了C++中Predicate::Validate_Argv方法的典型用法代码示例。如果您正苦于以下问题:C++ Predicate::Validate_Argv方法的具体用法?C++ Predicate::Validate_Argv怎么用?C++ Predicate::Validate_Argv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Predicate
的用法示例。
在下文中一共展示了Predicate::Validate_Argv方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
//auto t1 = chrono::high_resolution_clock::now();
if (argc < 5)
{
std::cout << "Not enough parameter !!";
return 0;
}
string pred;
string dist;
string pt_file_name;
string poly_file_name;
string out_file_name;
string nthd;
string out_op;
int n_thread;
const string log_file_name = "geofence.log";
if (argc == 5)
{
pred.assign(argv[1]);
dist = "";
pt_file_name.assign(argv[2]);
poly_file_name.assign(argv[3]);
out_file_name.assign(argv[4]);
//get the number of cores of the CPU
n_thread = std::thread::hardware_concurrency();
}
if (argc == 6)
{
pred.assign(argv[1]);
dist.assign(argv[2]);
pt_file_name.assign(argv[3]);
poly_file_name.assign(argv[4]);
out_file_name.assign(argv[5]);
n_thread = std::thread::hardware_concurrency();
}
Predicate* p = new Predicate(pred,dist);
//validate predicate
if (! p->Validate_Argv())
{
std::cout << "Illigal predicate string, please double Check !!";
delete p;
p = NULL;
return 0;
}
try
{
//create utilities
Output_unord out_set(out_file_name);
Polygon_File PF(p);
Polygon_Reader poly_gr(poly_file_name);
Point_Factory pt_f;
Text_File_Reader txt_reader(pt_file_name);
//build up index
poly_gr.Build_Polygon_Index(PF);
txt_reader.Open_file();
//multi-thread part
vector<std::thread> threads;
Point_Processor pt_proc(out_set,txt_reader,pt_f,PF);
for(int i = 0; i < n_thread; ++i){
threads.push_back(thread(pt_proc));
}
//wait until finish
for(int i = 0; i < n_thread; ++i){
threads[i].join();
}
auto t3 = chrono::high_resolution_clock::now();
txt_reader.Close_file();
out_set.Write_to_File();
/*
//write log
ostringstream contents;
contents << pt_file_name << " "<<poly_file_name<< " "<< pred << " "<<dist<<endl; //<< " Result: " <<out_set.Get_Rec_Num() << " records. \n";
contents<< "Time elapsed: " << chrono::duration_cast<chrono::milliseconds>(t3-t1).count() << " milliseconds\n";
Logger log(log_file_name);
log.Write_Out(contents.str());
//write to console
std::cout<<contents.str();
*/
//.........这里部分代码省略.........