iluhttp_Response* server_iluhttp_Resource_GET (iluhttp_Resource http_obj, iluhttp_Request* p_http_req, ILU_C_ENVIRONMENT* ilu_env) { /* log appropriately */ if (DO_LOG_BASIC()) { LOG_ENTER(); g_i_request_count++; fprintf(g_p_logfile, "\n------------------------------------------\n"); fprintf(g_p_logfile, "GET called on %s\n", p_http_req->URI); if (DO_LOG_FULL()) { nglib_print_iluhttp_request (p_http_req, g_p_logfile); } LOG_EXIT(); } else if (DO_LOG_SUMMARY()) { LOG_ENTER(); g_i_request_count++; LOG_EXIT(); } if (g_batcher) /* ensure batching if appropriate */ ILU_C_SetBatcherContext(g_batcher); return server_iluhttp_Resource_GETorHEAD(http_obj, p_http_req, ilu_TRUE, ilu_env); }
void cat_fastqs_pe(marksplit_settings_t *settings, splitterhash_params_t *params, char *ffq_r1, char *ffq_r2) { kstring_t ks1{0, 0, nullptr}; kputsnl("> ", &ks1), kputs(ffq_r1, &ks1); if(settings->gzip_output) kputsnl(".gz", &ks1); // Clear output files. //ksprintf(&ks1, settings->gzip_output ? "> %s.gz" : "> %s", ffq_r1); dlib::check_call(ks1.s); ks1.l = 0; ksprintf(&ks1, settings->gzip_output ? "> %s.gz" : "> %s", ffq_r2); dlib::check_call(ks1.s); ks1.l = 0; kputsnl("/bin/cat ", &ks1); kstring_t ks2{0}; kputsn(ks1.s, ks1.l, &ks2); for(int i(0); i < settings->n_handles; ++i) { if(!dlib::isfile(params->outfnames_r1[i])) LOG_EXIT("Output filename is not a file. Abort! ('%s').\n", params->outfnames_r1[i]); if(!dlib::isfile(params->outfnames_r2[i])) LOG_EXIT("Output filename is not a file. Abort! ('%s').\n", params->outfnames_r2[i]); ksprintf(&ks1, "%s ", params->outfnames_r1[i]); ksprintf(&ks2, "%s ", params->outfnames_r2[i]); } ksprintf(&ks1, " > %s", ffq_r1); ksprintf(&ks2, " > %s", ffq_r2); if(settings->gzip_output) { kputsnl(".gz", &ks1); kputsnl(".gz", &ks2); } FILE *c1_popen(popen(ks1.s, "w")); FILE *c2_popen(popen(ks2.s, "w")); int ret; if((ret = ((pclose(c2_popen) << 8) | pclose(c1_popen)))) { LOG_EXIT("Background cat command(s) failed. (Code: %i, '%s' or %i, '%s').\n", ret >> 8, ks1.s, ret & 0xff, ks2.s); }
/* called to change the state of a DataSource */ static void NgStream_DataSource_change_state(NgStream_DataSource data_source, int i_state) { ilu_Error an_error; DataSourceObjectData* p_object_data = data_source->instanceData; ilu_AcquireMutex(p_object_data->m_access_mutex); if (p_object_data->m_i_state != i_state) { /* a change from current state */ if (DO_LOG_BASIC()) { LOG_ENTER(); fprintf(g_p_logfile, "NgStream_DataSource_change_state from %i to %i\n", p_object_data->m_i_state, i_state); LOG_EXIT(); } p_object_data->m_i_state = i_state; ilu_CondNotify(p_object_data->m_state_change_condition, &an_error); if (ILU_ERRNOK(an_error)) { if (DO_LOG_BASIC()) { LOG_ENTER(); fprintf(g_p_logfile, "Error calling ilu_CondNotify on DataSource - proceeding anyway\n"); LOG_EXIT(); } ILU_HANDLED(an_error); ILU_CLER(an_error); } } ilu_ReleaseMutex(p_object_data->m_access_mutex); return ; }
GBL::CmRetCode_t AverageContourDetector::detect(const GBL::Image_t& inputImage, GBL::KeyPointCollection_t& detectedKeypoints) const { LOG_ENTER("Image = %p, keypoints = %p", &inputImage, &detectedKeypoints); GBL::CmRetCode_t result = GBL::RESULT_FAILURE; std::vector<std::vector<cv::Point> > contours; std::vector<cv::Vec4i> hierarchy; cv::findContours(inputImage, contours, hierarchy, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_NONE); LOG_INFO("Found %d contours", (uint32_t) contours.size()); for(size_t i = 0; i < contours.size(); i++) { // Check for the size of the area if(contours[i].size() > _boundaryLength) { uint32_t x = 0; uint32_t y = 0; for(size_t j = 0; j < contours[i].size(); j++) { x += (contours[i])[j].x; y += (contours[i])[j].y; } float_t x_center = (float_t) x/ (float_t) contours[i].size(); float_t y_center = (float_t) y/ (float_t) contours[i].size(); // TODO: determine scale and angle for more robust keypoints descriptions GBL::KeyPoint_t keypoint(x_center, y_center, 1); detectedKeypoints.push_back(keypoint); } } result = GBL::RESULT_SUCCESS; LOG_EXIT("result = %d", result); return result; }
int main(int argc, char *argv[]) { if(argc < 3) return usage(argv); int c; int is_se{0}; char out_mode[4] = "wb"; opts_t opts; while((c = getopt(argc, argv, "m:l:h?sSn")) > -1) { switch(c) { case 'm': opts.min_trimmed_len = (uint32_t)atoi(optarg); break; case 'l': out_mode[2] = *optarg; break; case 's': is_se = 1; break; case 'S': sprintf(out_mode, "w"); break; case 'n': opts.skip_all_ns = 1; break; case 'h': case '?': return usage(argv, EXIT_SUCCESS); } } if(argc - 2 != optind) LOG_EXIT("Required: precisely two positional arguments (in bam, out bam).\n"); dlib::BamHandle inHandle(argv[optind]); dlib::BamHandle outHandle(argv[optind + 1], inHandle.header, out_mode); is_se ? dlib::abstract_single_iter(inHandle.fp, inHandle.header, outHandle.fp, &trim_ns, (void *)&opts) : dlib::abstract_pair_iter(inHandle.fp, inHandle.header, outHandle.fp, &pe_trim_ns, (void *)&opts); return EXIT_SUCCESS; }
GBL::CmRetCode_t Orb::describe(const GBL::Image_t& image, GBL::KeyPointCollection_t& keypoints, GBL::Descriptor_t& descriptor) const { LOG_ENTER("image = %p", &image); cv::ORB orbDescriptor(_nfeatures, _scaleFactor, _nlevels, _edgeThreshold, _firstLevel, _WTA_K, _scoreType, _patchSize); orbDescriptor(image, cv::Mat(), keypoints, descriptor, false); LOG_EXIT("GBL::RESULT_SUCCESS"); return GBL::RESULT_SUCCESS; }
GBL::CmRetCode_t Brisk::describe(const GBL::Image_t& image, GBL::KeyPointCollection_t& keypoints, GBL::Descriptor_t& descriptor) const { LOG_ENTER("image = %p", &image); cv::BRISK briskDescriptor(_threshold, _octaves, _patternScale); briskDescriptor(image, cv::Mat(), keypoints, descriptor, false); LOG_EXIT("GBL::RESULT_SUCCESS"); return GBL::RESULT_SUCCESS; }
int main(int argc, char **argv) { dlib::BamHandle in = dlib::BamHandle("bed_test.bam"); dlib::ParsedBed bed = dlib::ParsedBed("bed_test.bed", in.header); bam1_t *b = bam_init1(); size_t diffs = 0; void *lh3bed = bed_read("bed_test.bed"); samFile *so = sam_open("disagreed.bam", "wb9"); sam_hdr_write(so, in.header); size_t disagrees = 0, agrees = 0; int dbr = 0, lh3r = 0; while(in.read(b) != -1) { if(b->core.flag & (BAM_FUNMAP)) continue; if((dbr = bed.bam1_test(b)) != (lh3r = bed_overlap(lh3bed, in.header->target_name[b->core.tid], b->core.pos, bam_endpos(b)))) { LOG_EXIT("dbr: %i. lh3r: %i. Contig: %s. Position: %i. endpos; %i\n", dbr, lh3r, in.header->target_name[b->core.tid], b->core.pos, bam_endpos(b)); if(++disagrees % 100 == 0) LOG_DEBUG("disagrees: %lu.\n", disagrees); sam_write1(so, in.header, b); } else { if(++agrees % 500000 == 0) LOG_DEBUG("agrees: %lu.\n", agrees); } } sam_close(so); bam_destroy1(b); bed_destroy(lh3bed); return EXIT_SUCCESS; }
GBL::CmRetCode_t DisplacementBase::calculateDisplacement(const GBL::MatchCollection_t matches, const GBL::KeyPointCollection_t& keypoints1, const GBL::KeyPointCollection_t& keypoints2, GBL::Displacement_t& displacement) const { LOG_ENTER("matches = %p", &matches); displacement.x = 0; displacement.y = 0; float_t x = 0; float_t y = 0; uint32_t nbMovingPoints = 0; const float_t threshold = 2.0f; for(uint32_t i = 0; i < matches.size(); i++) { GBL::KeyPoint_t keypoint1 = keypoints1[matches[i].queryIdx]; GBL::KeyPoint_t keypoint2 = keypoints2[matches[i].trainIdx]; float_t dis_x = keypoint2.pt.x - keypoint1.pt.x; float_t dis_y = keypoint2.pt.y - keypoint1.pt.y; if(abs(dis_x) >= threshold || abs(dis_y) >= threshold) { x += dis_x; y += dis_y; nbMovingPoints++; } } if(nbMovingPoints > 0) { displacement.x = x/(float_t) nbMovingPoints; displacement.y = y/(float_t) nbMovingPoints; } else { displacement.x = 0; displacement.y = 0; } LOG_INFO("X displacement = %d", displacement.x); LOG_INFO("Y displacement = %d", displacement.y); LOG_EXIT("GBL::RESULT_SUCCESS"); return GBL::RESULT_SUCCESS; }
/* * Make sure that no rescaler values are invalid */ void check_rescaler(marksplit_settings_t *settings, int arr_size) { if(settings->rescaler) for(int i(0); i < arr_size; ++i) if(settings->rescaler[i] <= 0) LOG_EXIT("Invalid value in rescaler %i at index %i.\n", settings->rescaler[i], i); }
int ip232_init_conn(modem_config *cfg) { int rc = -1; int port; LOG_ENTER(); LOG(LOG_INFO, "Opening ip232 device"); port = atoi(cfg->dce_data.tty); rc = ip_init_server_conn("", port); if (rc < 0) { ELOG(LOG_FATAL, "Could not initialize ip232 server socket"); exit(-1); } if (-1 == pipe(cfg->dce_data.dp[0])) { ELOG(LOG_FATAL, "ip232 thread incoming IPC pipe could not be created"); exit(-1); } if (-1 == pipe(cfg->dce_data.dp[1])) { ELOG(LOG_FATAL, "ip232 thread outgoing IPC pipe could not be created"); exit(-1); } cfg->dce_data.sSocket = rc; cfg->dce_data.ip232_is_connected = FALSE; cfg->dce_data.fd = cfg->dce_data.dp[0][0]; spawn_ip232_thread(cfg); LOG(LOG_INFO, "ip232 device configured"); LOG_EXIT(); return rc; }
GBL::CmRetCode_t ImageProcBase::fastSubtract(const GBL::Image_t& firstImage, const GBL::Image_t& secondImage, GBL::Image_t& outputImage) const { LOG_ENTER("first image = %p, second image = %p, output image = %p", &firstImage, &secondImage, &outputImage); outputImage = firstImage - secondImage; // Rework to be within the range of 0 - 255 again outputImage = (outputImage+255)/2; LOG_EXIT("GBL::RESULT_SUCCESS"); return GBL::RESULT_SUCCESS; }
/** * Exit the shell. */ void exit_shell(void) { LOG_ENTRY; printf(EXIT_MSG); free(prompt_buffer); free(input_buffer); free_input_tokens(); LOG_EXIT(0); }
/** * Execute input. */ void child_execute_input(char** envp) { LOG_ENTRY; CHILD_OUT_START; execvp(input_tokens[0], input_tokens); // if failure printf(FAILED_TO_EXEC_FMT, input_buffer, strerror(errno)); LOG_EXIT(errno); }
int registryLogAces(PACL pDacl) { int iReturnCode = EDT_OK; DWORD i = 0; LPVOID pAce = NULL; PACE_HEADER pAceheader=NULL; LOG_ENTER(); for(;i<pDacl->AceCount;i++) { GetAce(pDacl,i,&pAce); pAceheader = (PACE_HEADER)pAce; pAceheader->AceType; pAceheader->AceSize; LOG(L"-------------------\n",pAceheader->AceFlags); LOG(L"AceFlags are 0x%.2x\n",pAceheader->AceFlags); RegistryLogAceFlags(pAceheader->AceFlags); LOG(L"AceSize is 0x%.2x\n",pAceheader->AceSize); LOG(L"AceType is 0x%.2x\n",pAceheader->AceType); switch(pAceheader->AceType) { case ACCESS_ALLOWED_ACE_TYPE: case ACCESS_DENIED_ACE_TYPE: case SYSTEM_AUDIT_ACE_TYPE: case SYSTEM_ALARM_ACE_TYPE: //case SYSTEM_MANDATORY_LABEL_ACE: { PACCESS_ALLOWED_ACE pAccessAllowedAce = (PACCESS_ALLOWED_ACE)pAce; LOG(L"AceMask is 0x%.8x, this means access permissions are:\n",pAccessAllowedAce->Mask); RegistryLogAceMask(pAccessAllowedAce->Mask); LOG(L"The above access permissions are given to following SID'S:\n"); RegistryLogAceSidStart( &(pAccessAllowedAce->SidStart)); } break; case ACCESS_ALLOWED_OBJECT_ACE_TYPE: case ACCESS_DENIED_OBJECT_ACE_TYPE: case SYSTEM_AUDIT_OBJECT_ACE_TYPE: case SYSTEM_ALARM_OBJECT_ACE_TYPE: { PACCESS_ALLOWED_OBJECT_ACE pAccessAllowedAce = (PACCESS_ALLOWED_OBJECT_ACE)pAce; LOG(L"AceMask is 0x%.8x, this means access permissions are:\n",pAccessAllowedAce->Mask); RegistryLogAceMask(pAccessAllowedAce->Mask); LOG(L"The above access permissions are given to following SID'S:\n"); RegistryLogAceSidStart( &(pAccessAllowedAce->SidStart)); } break; default: LOG_BASIC(L"AceType unknow\n"); LOG(L"Don't know the ACE type, cannot parse the ACE"); break; }; } LOG_EXIT(iReturnCode); return iReturnCode; }
int main(int argc, char **argv) { if(argc == 1 || strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) LOG_EXIT("Usage: %s <inpath>\n", argv[0]); fputs("#Filename\tCount\n", stdout); for(int i = 1; i < argc; ++i){ gzFile in(gzopen(argv[i], "r")); if(in == nullptr) LOG_EXIT("Could not open file %s.\n", argv[1]); kseq_t *seq(kseq_init(in)); if(seq == nullptr) LOG_EXIT("Could not open file %s as fastq.\n", argv[2]); uint64_t c(0); for(;kseq_read(seq) >= 0; ++c); fprintf(stdout, "%s\t%lu\n", argv[i], c); kseq_destroy(seq); gzclose(in); } return 0; }
void *ip232_thread(void *arg) { modem_config *cfg = (modem_config *) arg; int accept_pending = FALSE; int rc; int res = 0; char buf[256]; fd_set readfs; int max_fd = 0; int cSocket; LOG_ENTER(); for (;;) { FD_ZERO(&readfs); FD_SET(cfg->dce_data.dp[1][0], &readfs); max_fd = cfg->dce_data.dp[1][0]; if (accept_pending == FALSE) { FD_SET(cfg->dce_data.sSocket, &readfs); max_fd = MAX(max_fd, cfg->dce_data.sSocket); } LOG(LOG_ALL, "Waiting for incoming ip232 connections"); rc = select(max_fd + 1, &readfs, NULL, NULL, NULL); if (rc < 0) { // handle error } else { if (FD_ISSET(cfg->dce_data.dp[1][0], &readfs)) { // pipe res = read(cfg->dce_data.dp[1][0], buf, sizeof(buf) - 1); LOG(LOG_DEBUG, "ip232 thread notified"); accept_pending = FALSE; } if (FD_ISSET(cfg->dce_data.sSocket, &readfs)) { // ip connection if (cfg->dce_data.ip232_is_connected) { LOG(LOG_DEBUG, "Already have ip232 connection, rejecting new"); // already have a connection... accept and close cSocket = ip_accept(cfg->dce_data.sSocket); if (cSocket > -1) { close(cSocket); } } else { LOG(LOG_DEBUG, "Incoming ip232 connection"); writePipe(cfg->dce_data.dp[0][1], MSG_ACCEPT); accept_pending = TRUE; } } } } LOG_EXIT(); }
void matcherHelper(const GBL::DescriptorContainer_t& descriptor1, const GBL::DescriptorContainer_t& descriptor2, GBL::MatchesContainer_t& matches, const Match::MatcherInterface& matcherInterface) { LOG_ENTER("descriptor 1 = %p, descriptor 2 = %p, matches = %p, matchesInterface = %p", &descriptor1, &descriptor2, &matches, &matcherInterface); if(descriptor1.valid == true && descriptor2.valid == true) { matcherInterface.match(descriptor1.descriptor, descriptor2.descriptor, matches.matches); matches.valid = (matches.matches.size() > 0); LOG_INFO("Nb of found matches: %d", (uint32_t) matches.matches.size()); } else { LOG_WARNING("One or both of the descriptors is invalid"); matches.valid = false; } LOG_EXIT("void"); }
static ilu_boolean log_and_clear_if_exception(CORBA_Environment* ilu_env, char* pc_message) { if (ilu_env->_major != CORBA_NO_EXCEPTION) { if (DO_LOG_BASIC()) { LOG_ENTER(); nglib_show_and_clear_if_exception(ilu_env, pc_message, g_p_logfile); LOG_EXIT(); } else nglib_show_and_clear_if_exception(ilu_env, NULL, NULL); return ilu_TRUE; } return ilu_FALSE; }
static ilu_boolean data_source_send_chunk(DataSourceObjectData* p_object_data, ilu_cardinal card_start, ilu_cardinal card_end) { NgRendering_RenderingChunk chunk; NgBasic_UnsignedInclusiveInterval range; CORBA_Environment ilu_env; chunk.contentRange = ⦥ /* determine how much to send */ chunk.contentRange->startValue = card_start; chunk.contentRange->endValue = card_end; /* seek to start of range */ if (SEEK_FUNCTION(p_object_data->m_h_native_content_file, chunk.contentRange->startValue, SEEK_CUR) == -1) /* xxx should really put out some sort of message here */ return ilu_FALSE; /* get and fill a buffer for the rendering bytes */ chunk.renderingBytes._maximum = chunk.contentRange->endValue - chunk.contentRange->startValue + 1; chunk.renderingBytes._length = chunk.renderingBytes._maximum; chunk.renderingBytes._buffer = (CORBA_octet*) ilu_malloc(chunk.renderingBytes._maximum); if (READ_FUNCTION(p_object_data->m_h_native_content_file, chunk.renderingBytes._buffer, chunk.renderingBytes._maximum) == -1) /* xxx should really put out some sort of message here */ return ilu_FALSE; /* send the rendering to the Sink */ NgRendering_RenderingSink_ReceiveRenderingChunk(p_object_data->m_renderSink, &chunk, &ilu_env); if (log_and_clear_if_exception(&ilu_env, "NgStream_DataSink_ReceiveRendering problem")) { if (chunk.renderingBytes._buffer) ilu_free(chunk.renderingBytes._buffer); /* xxx should really put out some sort of message here */ return ilu_FALSE; } if (chunk.renderingBytes._buffer) ilu_free(chunk.renderingBytes._buffer); if (DO_LOG_BASIC()) { LOG_ENTER(); fprintf(g_p_logfile, "data_source_send_chunk of %s, range %u to %u\n", p_object_data->m_pc_object_id, chunk.contentRange->startValue, chunk.contentRange->endValue); LOG_EXIT(); } if (chunk.contentRange->startValue > chunk.contentRange->endValue) return ilu_FALSE; return ilu_TRUE; }
GBL::CmRetCode_t Sift::describe(const GBL::Image_t& image, GBL::KeyPointCollection_t& keypoints, GBL::Descriptor_t& descriptor) const { LOG_ENTER("image = %p", &image); cv::SiftFeatureDetector detectortype = cv::SiftFeatureDetector(); cv::Ptr<cv::FeatureDetector> levelDetector = cv::FeatureDetector::create("SIFT"); cv::PyramidAdaptedFeatureDetector detector(levelDetector, 1); // levels of image scale cv::SiftDescriptorExtractor extractor; cv::Mat descriptors1; detector.detect(image, keypoints); extractor.compute(image, keypoints, descriptor); LOG_EXIT("GBL::RESULT_SUCCESS"); return GBL::RESULT_SUCCESS; }
GBL::CmRetCode_t Draw::openFile(const char* file, uint16_t width, uint16_t height) { LOG_ENTER("File = %s", file); GBL::CmRetCode_t result = GBL::RESULT_FAILURE; cv::Size size(width, height); const std::string filename(file); // _videoFile.open(filename, CV_FOURCC('P','I','M','1'), (double) 30.0f, size, true); if (_videoFile.isOpened()) { // check if we succeeded result = GBL::RESULT_SUCCESS; } else { LOG_ERROR("Could not open %s", file); } LOG_EXIT("result = %d", result); return result; }
void descriptionHelper(const GBL::Image_t& frameToDescribe, GBL::DescriptorContainer_t& descriptor, const GBL::Image_t& background, const Detector::DetectorInterface& detectorInterface, const Descriptor::DescriptorInterface& descriptorInterface, const ImageProc::ImageProc& imProc) { LOG_ENTER("Describing frame %p, type = %d, rows = %d, cols = %d, dims = %d", &frameToDescribe, frameToDescribe.type(), frameToDescribe.rows, frameToDescribe.cols, frameToDescribe.dims); detectorInterface.detect(frameToDescribe, descriptor.keypoints, background, imProc); descriptorInterface.describe(frameToDescribe, descriptor.keypoints, descriptor.descriptor); LOG_INFO("Number of found key points = %d, descriptor length = %d", (uint32_t ) descriptor.descriptor.rows, descriptor.descriptor.cols); LOG_INFO("Describing frame %p, type = %d, rows = %d, cols = %d, dims = %d", &frameToDescribe, frameToDescribe.type(), frameToDescribe.rows, frameToDescribe.cols, frameToDescribe.dims); if (descriptor.descriptor.rows == 0) { LOG_WARNING("Did not find any keypoints"); descriptor.valid = false; } else { LOG_INFO("We did find a couple of keypoints"); descriptor.valid = true; } descriptor.ready = true; LOG_EXIT("void"); }
GBL::CmRetCode_t Utils::drawResults(InputMethod::InputMethodInterface& inputMethod, Draw::DrawInterface& drawer, const ImageProc::ImageProc& imProc, std::vector<GBL::DescriptorContainer_t> descriptors, std::vector<GBL::MatchesContainer_t> allMatches, uint32_t nbFrames, const GBL::Image_t& image2) { LOG_ENTER("void"); GBL::CmRetCode_t result = GBL::RESULT_FAILURE; OutputMethod::OutputImageSequence outputMethod("correspondenceframe"); LOG_INFO("Drawing output images"); if(drawHelper(outputMethod, inputMethod, drawer, imProc, descriptors, allMatches, nbFrames, nullptr, nullptr) != GBL::RESULT_SUCCESS) { LOG_ERROR("Could not draw result frames"); } OutputMethod::OutputImageSequence procOutputMethod("procframe"); DrawResultProc_f fastSubtract_f = fastSubtractHandler; if(drawHelper(procOutputMethod, inputMethod, drawer, imProc, descriptors, allMatches, nbFrames, fastSubtract_f, &image2) != GBL::RESULT_SUCCESS) { LOG_ERROR("Could not draw processing frames"); } LOG_EXIT("result = %d", result); return result; }
void displacementHelper(const GBL::DescriptorContainer_t& descriptor1, const GBL::DescriptorContainer_t& descriptor2, const GBL::MatchesContainer_t& matches, GBL::Displacement_t& displacement, const Displacement::DisplacementInterface& displacementInterface, OutputMethod::OutputMethodInterface& outputMethodInterface) { LOG_ENTER("Descriptor 1 = %p, descriptor2 = %p, matches = %p, displacement = %p, displacementInterface = %p", &descriptor1, &descriptor2, &matches, &displacement, &displacementInterface); if(matches.valid) { if(displacementInterface.calculateDisplacement(matches.matches, descriptor1.keypoints, descriptor2.keypoints, displacement) != GBL::RESULT_SUCCESS) { LOG_ERROR("Could not find displacement"); displacement.x = 0; displacement.y = 0; } } else { LOG_WARNING("Invalid matches"); displacement.x = 0; displacement.y = 0; } LOG_INFO("Writing displacement to socket"); outputMethodInterface.write(displacement); LOG_EXIT("void"); }
int ser_init_conn(char *tty, int speed) { int fd = -1; struct termios tio; int bps_rate = 0; LOG_ENTER(); bps_rate = ser_get_bps_const(speed); if (bps_rate > -1) { /* open the device to be non-blocking (read will return immediatly) */ LOG(LOG_INFO, "Opening serial device"); fd = open(tty, O_RDWR | O_NOCTTY | O_NONBLOCK); if (fd < 0) { ELOG(LOG_FATAL, "TTY %s could not be opened", tty); } else { LOG(LOG_INFO, "Opened serial device %s at speed %d as fd %d", tty, speed, fd); /* Make the file descriptor asynchronous (the manual page says only O_APPEND and O_NONBLOCK, will work with F_SETFL...) */ fcntl(fd, F_SETFL, FASYNC); tio.c_cflag = CS8 | CLOCAL | CREAD | CRTSCTS; tio.c_iflag = IGNBRK; tio.c_oflag = 0; tio.c_lflag = 0; cfsetispeed(&tio, bps_rate); cfsetospeed(&tio, bps_rate); tio.c_cc[VMIN] = 1; tio.c_cc[VTIME] = 0; tcflush(fd, TCIFLUSH); tcsetattr(fd, TCSANOW, &tio); LOG(LOG_INFO, "serial device configured"); } } LOG_EXIT(); return fd; }
void cat_fastqs_se(marksplit_settings_t *settings, splitterhash_params_t *params, char *ffq_r1) { kstring_t ks{0, 0, nullptr}; // Clear output files. ksprintf(&ks, settings->gzip_output ? "> %s.gz" : "> %s", ffq_r1); dlib::check_call(ks.s); ks.l = 0; ksprintf(&ks, "/bin/cat "); for(int i(0); i < settings->n_handles; ++i) { if(!dlib::isfile(params->outfnames_r1[i])) LOG_EXIT("Output filename is not a file. Abort! ('%s').\n", params->outfnames_r1[i]); ksprintf(&ks, " %s", params->outfnames_r1[i]); } ksprintf(&ks, " > %s", ffq_r1); if(settings->gzip_output) kputsnl(".gz", &ks); dlib::check_popen(ks.s); free(ks.s); }
HRESULT COMCALL DualTracer::GetTypeInfo(UINT nInfo, LCID dwLCID, ITypeInfo** ppTypeInfo) { LOG_ENTRY(TXT("DualTracer::GetTypeInfoCount(UINT, dwLCID)")); LOG_PARAM(TXT("UINT=%u"), nInfo); LOG_PARAM(TXT("dwLCID=%u"), dwLCID); HRESULT hr = S_OK; try { hr = COM::IDispatchImpl<DualTracer>::GetTypeInfo(nInfo, dwLCID, ppTypeInfo); } COM_CATCH(hr) LOG_EXIT(TXT("HRESULT=0x%08X [%s]"), hr, CStrCvt::FormatError(hr).c_str()); return hr; }
// 释放SDK ELTE_INT32 __SDK_CALL ELTE_SDK_Cleanup() { LOG_INTERFACE_TRACE(); ELTE_INT32 iRet = eLTE_SDK_ERR_SUCCESS; if (NULL != g_pUserMgr) { //断开连接 SSL_Socket& socket = const_cast<SSL_Socket&>(g_pUserMgr->GetSSLSocket()); socket.Uninit_SSL_Socket(); delete g_pUserMgr; g_pUserMgr = NULL; } LOG_INTERFACE_INFO(iRet, ""); //关闭日志 LOG_EXIT(); return iRet; }
GBL::CmRetCode_t SimpleBlobDetector::detect(const GBL::Image_t& inputImage, GBL::KeyPointCollection_t& detectedKeypoints) const { LOG_ENTER("Image = %p, keypoints = %p", &inputImage, &detectedKeypoints); GBL::CmRetCode_t result = GBL::RESULT_FAILURE; cv::SimpleBlobDetector::Params params; params.filterByColor = false; params.filterByArea = true; params.filterByCircularity = false; params.filterByInertia = false; params.filterByConvexity = false; cv::SimpleBlobDetector detector(params); detector.detect(inputImage, detectedKeypoints); result = GBL::RESULT_SUCCESS; LOG_EXIT("result = %d", result); return result; }