void query::end(const render_context& in_context) const { const opengl::gl_core& glapi = in_context.opengl_api(); assert(0 != query_id()); assert(0 != query_type()); glapi.glEndQuery(query_type()); gl_assert(glapi, leaving query::end()); }
bool query::available(const render_context& in_context) const { const opengl::gl_core& glapi = in_context.opengl_api(); assert(0 != query_id()); assert(0 != query_type()); int query_available = GL_FALSE; glapi.glGetQueryObjectiv(query_id(), GL_QUERY_RESULT_AVAILABLE, &query_available); gl_assert(glapi, leaving query::available()); return query_available != GL_FALSE; }
int main(int argc, char* argv[]) { CGAL::Query_choice qchoice = CGAL::FACE; std::string regularization_tag("true"); if (argc > 1) { std::string input_arr_file(argv[1]); if (argc == 2) { std::cout << "NAME TAG PreProTime NQueries TimeQueries TotalTime QAVE TAVE" << std::endl; benchmark_one_class<CGAL::Tag_true>(std::string("T"), CGAL::VERTEX, input_arr_file); benchmark_one_class<CGAL::Tag_true>(std::string("T"), CGAL::EDGE, input_arr_file); benchmark_one_class<CGAL::Tag_true>(std::string("T"), CGAL::FACE, input_arr_file); benchmark_one_class<CGAL::Tag_false>(std::string("T"), CGAL::VERTEX, input_arr_file); benchmark_one_class<CGAL::Tag_false>(std::string("T"), CGAL::EDGE, input_arr_file); benchmark_one_class<CGAL::Tag_false>(std::string("T"), CGAL::FACE, input_arr_file); std::cout << std::endl; benchmark_one_class<CGAL::Tag_true>(std::string("S"), CGAL::VERTEX, input_arr_file); benchmark_one_class<CGAL::Tag_true>(std::string("S"), CGAL::EDGE, input_arr_file); benchmark_one_class<CGAL::Tag_true>(std::string("S"), CGAL::FACE, input_arr_file); benchmark_one_class<CGAL::Tag_false>(std::string("S"), CGAL::VERTEX, input_arr_file); benchmark_one_class<CGAL::Tag_false>(std::string("S"), CGAL::EDGE, input_arr_file); benchmark_one_class<CGAL::Tag_false>(std::string("S"), CGAL::FACE, input_arr_file); std::cout << std::endl; benchmark_one_class<CGAL::Tag_true>(std::string("R"), CGAL::VERTEX, input_arr_file); benchmark_one_class<CGAL::Tag_true>(std::string("R"), CGAL::EDGE, input_arr_file); benchmark_one_class<CGAL::Tag_true>(std::string("R"), CGAL::FACE, input_arr_file); benchmark_one_class<CGAL::Tag_false>(std::string("R"), CGAL::VERTEX, input_arr_file); benchmark_one_class<CGAL::Tag_false>(std::string("R"), CGAL::EDGE, input_arr_file); benchmark_one_class<CGAL::Tag_false>(std::string("R"), CGAL::FACE, input_arr_file); std::cout << std::endl; benchmark_one_class<CGAL::Tag_true>(std::string("PR"), CGAL::VERTEX, input_arr_file); benchmark_one_class<CGAL::Tag_true>(std::string("PR"), CGAL::EDGE, input_arr_file); benchmark_one_class<CGAL::Tag_true>(std::string("PR"), CGAL::FACE, input_arr_file); benchmark_one_class<CGAL::Tag_false>(std::string("PR"), CGAL::VERTEX, input_arr_file); benchmark_one_class<CGAL::Tag_false>(std::string("PR"), CGAL::EDGE, input_arr_file); benchmark_one_class<CGAL::Tag_false>(std::string("PR"), CGAL::FACE, input_arr_file); } else if (argc == 5) { qchoice = CGAL::FACE; std::string query_type(argv[3]); if (query_type == "vertex") qchoice = CGAL::VERTEX; else if (query_type == "edge") qchoice = CGAL::EDGE; else if (query_type == "face") qchoice = CGAL::FACE; else { std::cout<<"query type is not matched.\n"; return 0; } regularization_tag = argv[4]; std::string classname(argv[2]); if (regularization_tag == "true") { benchmark_one_class<CGAL::Tag_true>(classname, qchoice, input_arr_file); } else { benchmark_one_class<CGAL::Tag_false>(classname, qchoice, input_arr_file); } return 0; } else { print_usage(); exit(0); } } else { print_usage(); exit(0); } return 0; }
int main(int argc, char **argv) { char dir[BUFSIZ]; struct sock_cl s; pid_t child_id; int addrlen; int status; struct question *q; /* are we going to recycle the same data structure over and over again */ if(argc != 3) { fprintf(stderr, "USAGE: ./udp_client ip_address port_number\n"); return -1; } if(argv[1]) strcpy(hostname, argv[1]); else strcpy(hostname, HOST); if(argv[2]) s.port = atoi(argv[2]); else s.port = port; while(obtain_req_type(dir) != 0){ fprintf(stderr, "Still no request for client\n"); sleep(2); } populate_sock(&s); addrlen = s.addrlen; ap_debug("====>Client side port = %d", port); /* All transaction are started by client, so it is client which will either ask * 1. server to send the question or * 2. process the question send by the user. * in case 1. the user has already asked the question and waiting for response * in case 2. user pushes a question. server sends it to another client, who wants to answer the question * server waits for the response from the user, as soon as response is available, * the server pushes the question back to first client */ ap_debug("%p\n",&s.sin); while(1) { switch(query_type(dir)) { /* Begin set 1 reqQ-saveA */ case REQ_QUESTION: strcpy(s.buffer, dir); client_req_ques(&s); q = (struct question *)malloc(sizeof(struct question)); populate_ques_ds(question_file, q); strcpy(dir, s.buffer); break; /* set 2 reqA-saveQ End */ case REQ_ANSWER: strcpy(s.buffer, dir); client_req_ans(&s); strcpy(dir, req_type[REQ_STOP]); break; /* Begin set 2 saveQ-reqA */ case SAVE_QUESTION: /* CAUTION dir and s.buffer contain different values */ memset(s.buffer, 0, sizeof(s.buffer)); /* open the question file and populate question data structure */ q = (struct question *)malloc(sizeof(struct question)); populate_ques_ds(question_file, q); create_qbuf(q,s.buffer); client_save_ques(&s, dir); /* dir is populated inside here */ free_question(q); break; /* set 1 saveA-reqQ End */ case SAVE_ANSWER: if( access( answer_file, F_OK ) == -1 ) continue; /* obtain answer in the buffer */ /* open the answer file and fill the buffer */ memset(s.buffer, 0, sizeof(s.buffer)); populate_if_match(q, answer_file); /* obtain data structure for question */ create_abuf(q, s.buffer); client_save_ans(&s, dir); strcpy(dir, req_type[REQ_STOP]); free_question(q); break; case REQ_STOP: /* do any cleanup here? */ return 0; case REQ_LOOP: /* do any cleanup here? */ break; default: case -1: fprintf(stderr, "What the f**k bro?\n"); exit(EXIT_FAILURE); } sleep(1); } return 0; }