int main(int argc, char **argv) { initFoomatic(); registerHandler("apsfilter:", initAps, parseApsFile); registerHandler("lprngtool:", initIfhp, parseIfhpFile); return execute(argc, argv); }
void CorrespondenceEstimation::prepareInterface() { // Register src-trg related data streams. registerStream("in_src_cloud_xyzsift", &in_src_cloud_xyzsift); registerStream("in_trg_cloud_xyzsift", &in_trg_cloud_xyzsift); registerStream("out_correspondences", &out_src_trg_correspondences); registerStream("out_corest", &out_corest); // Register lum related data streams. registerStream("in_lum_xyzsift", &in_lum_xyzsift); registerStream("out_lum_xyzsift", &out_lum_xyzsift); // Register models-scene related data streams. registerStream("in_scene_cloud_xyzsift", &in_trg_cloud_xyzsift); registerStream("in_model_clouds_xyzsift", &in_model_clouds_xyzsift); registerStream("out_models_scene_correspondences", &out_models_scene_correspondences); // Register src-trg correspondence estimation handler. registerHandler("estimateCorrespondencesForPairOfClouds", boost::bind(&CorrespondenceEstimation::estimateCorrespondencesForPairOfClouds, this)); addDependency("estimateCorrespondencesForPairOfClouds", &in_src_cloud_xyzsift); addDependency("estimateCorrespondencesForPairOfClouds", &in_trg_cloud_xyzsift); // Register lum-related correspondence estimation handler. registerHandler("estimateCorrespondencesForLUMGraph", boost::bind(&CorrespondenceEstimation::estimateCorrespondencesForLUMGraph, this)); addDependency("estimateCorrespondencesForLUMGraph", &in_lum_xyzsift); // Register src-trg correspondence estimation handler. registerHandler("estimateCorrespondencesBeteenModelsAndScene", boost::bind(&CorrespondenceEstimation::estimateCorrespondencesBeteenModelsAndScene, this)); addDependency("estimateCorrespondencesBeteenModelsAndScene", &in_trg_cloud_xyzsift); addDependency("estimateCorrespondencesBeteenModelsAndScene", &in_model_clouds_xyzsift); }
void PassThrough::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_cloud_xyz", &in_cloud_xyz); registerStream("in_cloud_xyzrgb", &in_cloud_xyzrgb); registerStream("in_cloud_xyzsift", &in_cloud_xyzsift); registerStream("in_cloud_xyzshot", &in_cloud_xyzshot); registerStream("out_cloud_xyz", &out_cloud_xyz); registerStream("out_cloud_xyzrgb", &out_cloud_xyzrgb); registerStream("out_cloud_xyzsift", &out_cloud_xyzsift); registerStream("out_cloud_xyzshot", &out_cloud_xyzshot); // Register handlers registerHandler("filter_xyz", boost::bind(&PassThrough::filter_xyz, this)); addDependency("filter_xyz", &in_cloud_xyz); registerHandler("filter_xyzrgb", boost::bind(&PassThrough::filter_xyzrgb, this)); addDependency("filter_xyzrgb", &in_cloud_xyzrgb); registerHandler("filter_xyzsift", boost::bind(&PassThrough::filter_xyzsift, this)); addDependency("filter_xyzsift", &in_cloud_xyzsift); registerHandler("filter_xyzshot", boost::bind(&PassThrough::filter_xyzshot, this)); addDependency("filter_xyzshot", &in_cloud_xyzshot); registerHandler("filter_xyz_rgb_shot_sift", boost::bind(&PassThrough::filter_xyz_rgb_shot_sift, this)); addDependency("filter_xyz_rgb_shot_sift", &in_cloud_xyzshot); addDependency("filter_xyz_rgb_shot_sift", &in_cloud_xyzsift); addDependency("filter_xyz_rgb_shot_sift", &in_cloud_xyzrgb); }
void CvWindow_Sink::prepareInterface() { CLOG(LTRACE) << "CvWindow_Sink::configure\n"; h_onRefresh.setup(this, &CvWindow_Sink::onRefresh); registerHandler("onRefresh", &h_onRefresh); addDependency("onRefresh", NULL); Base::EventHandler2 * hand; for (int i = 0; i < count; ++i) { char id = '0' + i; hand = new Base::EventHandler2; hand->setup(boost::bind(&CvWindow_Sink::onNewImageN, this, i)); handlers.push_back(hand); registerHandler(std::string("onNewImage") + id, hand); Base::DataStreamIn<cv::Mat, Base::DataStreamBuffer::Newest, Base::Synchronization::Mutex> * stream = new Base::DataStreamIn<cv::Mat, Base::DataStreamBuffer::Newest, Base::Synchronization::Mutex>; in_img.push_back(stream); registerStream(std::string("in_img") + id, (Base::DataStreamInterface*) (in_img[i])); addDependency(std::string("onNewImage") + id, stream); in_draw.push_back(new Base::DataStreamInPtr<Types::Drawable>); registerStream(std::string("in_draw") + id, in_draw[i]); out_point.push_back(new Base::DataStreamOut<cv::Point>); registerStream(std::string("out_point") + id, out_point[i]); // save handlers hand = new Base::EventHandler2; hand->setup(boost::bind(&CvWindow_Sink::onSaveImageN, this, i)); handlers.push_back(hand); registerHandler(std::string("onSaveImage") + id, hand); } h_onSaveAllImages.setup(this, &CvWindow_Sink::onSaveAllImages); registerHandler("onSaveAllImages", &h_onSaveAllImages); // register aliases for first handler and streams registerHandler("onNewImage", handlers[0]); registerStream("in_img", in_img[0]); registerStream("in_draw", in_draw[0]); img.resize(count); to_draw.resize(count); // Split window titles. std::string t = title; boost::split(titles, t, boost::is_any_of(",")); if ((titles.size() == 1) && (count > 1)) titles.clear(); for (int i = titles.size(); i < count; ++i) { char id = '0' + i; titles.push_back(std::string(title) + id); } }
LDSTQNetProtocol::LDSTQNetProtocol(InterConnection *net, RouterID_t rID) : ProtocolBase(net, rID) { ProtocolCBBase *pcb = new ProtocolCB<LDSTQNetProtocol,&LDSTQNetProtocol::LookUpMsgHandler>(this); registerHandler(pcb,LookUpMsg); pcb = new ProtocolCB<LDSTQNetProtocol,&LDSTQNetProtocol::RetLookUpMsgHandler>(this); registerHandler(pcb,RetLookUpMsg); protocols.push_back(this); }
void ImageWriter::prepareInterface() { CLOG(LTRACE) << name() << "::prepareInterface()"; // Register handlers Base::EventHandler2 * hand; for (int i = 0; i < count; ++i) { char id = '0'+i; hand = new Base::EventHandler2; hand->setup(boost::bind(&ImageWriter::write_image_N, this, i)); handlers.push_back(hand); registerHandler(std::string("write_image_")+id, hand); Base::DataStreamIn<cv::Mat, Base::DataStreamBuffer::Newest> * stream = new Base::DataStreamIn<cv::Mat, Base::DataStreamBuffer::Newest>; in_img.push_back(stream); registerStream( std::string("in_img")+id, (Base::DataStreamInterface*)(in_img[i])); addDependency(std::string("write_image_")+id, stream); // Add n flags for manual trigger. bool tmp_flag = false; save_flags.push_back(tmp_flag); } // register aliases for first handler and streams registerHandler("write_image", handlers[0]); registerStream("in_img", in_img[0]); counts.resize(count, 0); std::string t = base_name; boost::split(base_names, t, boost::is_any_of(",")); if ( (base_names.size() == 1) && (count > 1) ) base_names.clear(); for (int i = base_names.size(); i < count; ++i) { char id = '0' + i; base_names.push_back(std::string(base_name) + id); } std::string f = format; boost::split(formats, f, boost::is_any_of(",")); if ( (formats.size() == 1) && (count > 1) ) formats.clear(); for (int i = formats.size(); i < count; ++i) { formats.push_back(format); } // Register handlers - next image, can be triggered manually (from GUI) or by new data present in_load_next_image_trigger dataport. // 1st version - manually. registerHandler("SaveImage", boost::bind(&ImageWriter::onSaveButtonPressed, this)); // 2nd version - external trigger. registerHandler("onSaveTriggered", boost::bind(&ImageWriter::onSaveTriggered, this)); addDependency("onSaveTriggered", &in_trigger); }
ProtocolA(InterConnection *net, RouterID_t rID) : ProtocolBase(net, rID) { ProtocolCBBase *pcb = new ProtocolCB<ProtocolA,&ProtocolA::TestHandler>(this); registerHandler(pcb,TestMsg); pcb = new ProtocolCB<ProtocolA,&ProtocolA::TestAckHandler>(this); registerHandler(pcb,TestAckMsg); pcb = new ProtocolCB<ProtocolA,&ProtocolA::defaultHandler>(this); registerHandler(pcb,DefaultMessage); };
void PCDReader::prepareInterface() { // Register data streams. registerStream("in_trigger", &in_trigger); registerStream("out_cloud_xyz", &out_cloud_xyz); registerStream("out_cloud_xyzrgb", &out_cloud_xyzrgb); registerStream("out_cloud_xyzsift", &out_cloud_xyzsift); // Register handlers registerHandler("Read", boost::bind(&PCDReader::Read, this)); registerHandler("onTriggeredLoadNextCloud", boost::bind(&PCDReader::onTriggeredLoadNextCloud, this)); addDependency("onTriggeredLoadNextCloud", &in_trigger); }
void HomogMatrixVector::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_hm", &in_hm); registerStream("in_hms", &in_hms); registerStream("out_hms", &out_hms); // Register handlers registerHandler("create_vector", boost::bind(&HomogMatrixVector::create_vector, this)); addDependency("create_vector", &in_hm); registerHandler("expand_vector", boost::bind(&HomogMatrixVector::expand_vector, this)); addDependency("expand_vector", &in_hms); addDependency("expand_vector", &in_hm); }
void ModelReader::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("out_img", &out_img); registerStream("out_points_2", &out_points_2); registerStream("out_points_3", &out_points_3); registerStream("out_model_info", &out_model_info); // Register handlers registerHandler("step", boost::bind(&ModelReader::step, this)); addDependency("step", NULL); registerHandler("readNextModel", boost::bind(&ModelReader::readNextModel, this)); registerHandler("readPreviousModel", boost::bind(&ModelReader::readPreviousModel, this)); }
void AsyncPipeWriter::handleWrite() { DestructorGuard dg(this); assert(!queue_.empty()); do { auto& front = queue_.front(); folly::IOBufQueue& curQueue = front.first; DCHECK(!curQueue.empty()); // someday, support writev. The logic for partial writes is a bit complex const IOBuf* head = curQueue.front(); CHECK(head->length()); #if _WIN32 // On Windows you can't call write on a socket. ssize_t rc = folly::fileutil_detail::wrapNoInt( send_internal, fd_, head->data(), head->length()); #else ssize_t rc = folly::writeNoInt(fd_.toFd(), head->data(), head->length()); #endif if (rc < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK) { // pipe is full VLOG(5) << "write blocked"; registerHandler(EventHandler::WRITE); return; } else { failAllWrites(AsyncSocketException( AsyncSocketException::INTERNAL_ERROR, "write failed", errno)); closeNow(); return; } } else if (rc == 0) { registerHandler(EventHandler::WRITE); return; } curQueue.trimStart(size_t(rc)); if (curQueue.empty()) { auto cb = front.second; queue_.pop_front(); if (cb) { cb->writeSuccess(); } } else { VLOG(5) << "partial write blocked"; } } while (!queue_.empty()); if (closeOnEmpty_) { closeNow(); } else { unregisterHandler(); } }
void CvBayesClassifier::prepareInterface() { // Register handlers with their dependencies. registerHandler("onNewData", boost::bind(&CvBayesClassifier::onNewData, this)); addDependency("onNewData", &in_moments); // Add to dataset. registerHandler("Training dataset add sample", boost::bind(&CvBayesClassifier::onAddToDataset, this)); // Clear dataset. registerHandler("Training dataset clear", boost::bind(&CvBayesClassifier::onClearDataset, this)); // Display dataset. registerHandler("Training dataset display", boost::bind(&CvBayesClassifier::onDisplayDataset, this)); // Bayes: clear. registerHandler("Bayes reset", boost::bind(&CvBayesClassifier::onBayesClear, this)); // Bayes: Training. registerHandler("Bayes train classifier with dataset", boost::bind(&CvBayesClassifier::onBayesTraining, this)); // Bayes: Save. registerHandler("Bayes save parameters to file", boost::bind(&CvBayesClassifier::onBayesSave, this)); // Bayes: Load. registerHandler("Bayes load parameters from file", boost::bind(&CvBayesClassifier::onBayesLoad, this)); // Input data stream. registerStream("in_moments", &in_moments); }
bool ExecTimer::onInit() { LOG(LTRACE) << "ExecTimer::initialize\n"; h_onStartExec.setup(this, &ExecTimer::onStartExec); registerHandler("onStartExec", &h_onStartExec); h_onStopExec.setup(this, &ExecTimer::onStopExec); registerHandler("onStopExec", &h_onStopExec); stopped = registerEvent("stopped"); started = registerEvent("started"); return true; }
void ClustersViewer::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_clouds", &in_clouds); registerStream("in_projections", &in_projections); // Register handlers registerHandler("on_clouds", boost::bind(&ClustersViewer::on_clouds, this)); addDependency("on_clouds", &in_clouds); registerHandler("on_projections", boost::bind(&ClustersViewer::on_projections, this)); addDependency("on_projections", &in_projections); // Register spin handler. registerHandler("on_spin", boost::bind(&ClustersViewer::on_spin, this)); addDependency("on_spin", NULL); }
void TORecognize::prepareInterface() { // Input and output data streams. registerStream("in_img", &in_img); registerStream("out_img_all_correspondences", &out_img_all_correspondences); registerStream("out_img_good_correspondences", &out_img_good_correspondences); registerStream("out_img_object", &out_img_object); // Register handlers with their dependencies. registerHandler("onNewImage", boost::bind(&TORecognize::onNewImage, this)); addDependency("onNewImage", &in_img); // Register handler - load model manually. registerHandler("Load model", boost::bind(&TORecognize::onLoadModelButtonPressed, this)); }
void StatisticalOutlierRemoval::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_cloud_xyzrgb", &in_cloud_xyzrgb); registerStream("out_cloud_xyzrgb", &out_cloud_xyzrgb); registerStream("in_cloud_xyz", &in_cloud_xyz); registerStream("out_cloud_xyz", &out_cloud_xyz); // Register handlers registerHandler("filter_xyzrgb", boost::bind(&StatisticalOutlierRemoval::filter_xyzrgb, this)); addDependency("filter_xyzrgb", &in_cloud_xyzrgb); registerHandler("filter_xyz", boost::bind(&StatisticalOutlierRemoval::filter_xyz, this)); addDependency("filter_xyz", &in_cloud_xyz); }
void PCDWriter::prepareInterface() { // Register data streams. registerStream("in_cloud_xyz", &in_cloud_xyz); registerStream("in_cloud_xyzrgb", &in_cloud_xyzrgb); registerStream("in_cloud_xyzsift", &in_cloud_xyzsift); registerStream("in_trigger", &in_trigger); // Register handlers - no dependencies. registerHandler("Write_xyz", boost::bind(&PCDWriter::Write_xyz, this)); registerHandler("Write_xyzrgb", boost::bind(&PCDWriter::Write_xyzrgb, this)); registerHandler("Write_xyzsift", boost::bind(&PCDWriter::Write_xyzsift, this)); registerHandler("onTriggeredLoadNextCloud", boost::bind(&PCDWriter::onTriggeredLoadNextCloud, this)); addDependency("onTriggeredLoadNextCloud", &in_trigger); }
ConfigInterface::ConfigInterface(const std::string &sockfile, const LogSink &logInstance) : ConnectionTCPServer(this, logInstance, "localhost", -1) { // Create UNIX socket int m_socket; socklen_t length; struct sockaddr_un local; m_loaded = false; m_socketId = 0; m_admin = new AdhocAdmin(); registerHandler(m_admin); if ((m_socket = getUnixSocket()) == -1) Log("ConfigInterface", "Could not create UNIX socket: " << strerror(errno)); local.sun_family = AF_UNIX; strcpy(local.sun_path, sockfile.c_str()); unlink(local.sun_path); length = offsetof(struct sockaddr_un, sun_path) + strlen(sockfile.c_str()); if (bind(m_socket, (struct sockaddr *) &local, length) == -1) { Log("ConfigInterface", "Could not bind to UNIX socket: " << sockfile << " " << strerror(errno)); return; } if (listen(m_socket, 5) == -1) { Log("ConfigInterface", "Could not listen to UNIX socket: " << sockfile << " " << strerror(errno)); return; } setSocket(m_socket); m_socketId = purple_input_add(m_socket, PURPLE_INPUT_READ, gotData, this); m_loaded = true; }
void CurlMultiAwait::addHandle(int fd, int events) { auto asio_event_base = getSingleton<AsioEventBase>(); auto handler = req::make_shared<CurlEventHandler>(asio_event_base.get(), fd, this); handler->registerHandler(events); m_handlers.push_back(handler); }
void Trigger::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("out_trigger", &out_trigger); // Register handlers registerHandler("trigger", boost::bind(&Trigger::trigger, this)); }
bool DisplayCorrespondence::onInit() { matched = registerEvent("matched"); h_onNewImage.setup(this, &DisplayCorrespondence::onNewImage); registerHandler("onNewImage", &h_onNewImage); registerStream("in_image_params", &in_image_params); registerStream("in_img", &in_img); registerStream("in_path", &in_path); registerStream("out_image", &out_image); registerStream("in_MatchedSourceForTile", &in_MatchedSourceForTile); registerStream("in_PositionOfPatchesInImages", &in_PositionOfPatchesInImages); registerStream("in_MatchedPatchInMatcher", &in_MatchedPatchInMatcher); registerStream("in_DistanceMap", &in_DistanceMap); registerStream("in_all_file_paths", &in_all_file_paths); registerStream("in_match_map", &in_match_map); registerStream("in_match_quality", &in_match_quality); LOG(LTRACE) << "DisplayCorrespondence::initialize\n"; // Register data streams, events and event handlers HERE! return true; }
bool CvSplit_Processor::onInit() { LOG(LTRACE) << "CvSplit_Processor::initialize\n"; h_onNewImage.setup(this, &CvSplit_Processor::onNewImage); registerHandler("onNewImage", &h_onNewImage); registerStream("in_img", &in_img); newImage = registerEvent("newImage"); if (props.channels < 1) { LOG(LERROR) << "CvSplit_Processor::number of channels must be positive\n"; return false; } mv.resize(props.channels); out_img.resize(props.channels); for (int i = 0; i < props.channels; ++i) { out_img[i] = new Base::DataStreamOut<cv::Mat>; registerStream("out_img_"+int2str(i), out_img[i]); } return true; }
void HomogMatrixPub::prepareInterface() { // Register data streams, events and event handlers HERE! //input streams registerStream("in_matrix", &in_matrix); registerStream("in_found", &in_found); registerStream("in_time_nsec_pocz", &in_time_nsec_pocz); registerStream("in_time_sec_pocz", &in_time_sec_pocz); //output streams registerStream("out_matrix", &out_matrix); registerStream("out_found", &out_found); registerStream("out_time_nsec_pocz", &out_time_nsec_pocz); registerStream("out_time_sec_pocz", &out_time_sec_pocz); registerStream("out_time_nsec_kon", &out_time_nsec_kon); registerStream("out_time_sec_kon", &out_time_sec_kon); // Register handlers h_onNewData.setup(boost::bind(&HomogMatrixPub::onNewData, this)); registerHandler("onNewData", &h_onNewData); addDependency("onNewData", &in_matrix); addDependency("onNewData", &in_found); //addDependency("onNewData", &in_time_nsec_pocz); //addDependency("onNewData", &in_time_sec_pocz); //registerProperty(trigger_delay); }
void RGBDViewer::prepareInterface() { CLOG(LTRACE) << name() << "::onFinish"; // Register data streams, events and event handlers HERE! registerStream("in_rgb", &in_rgb); //registerStream("in_depth", &in_depth); // Refresh. h_onNewRGBDImage.setup(this, &RGBDViewer::onNewRGBDImage); registerHandler("onNewRGBDImage", &h_onNewRGBDImage); addDependency("onNewRGBDImage", &in_rgb); //addDependency("onNewRGBDImage", &in_depth); // Save. h_onSaveRGBDImage.setup(this, &RGBDViewer::onSaveRGBDImage); registerHandler("onSaveRGBDImage", &h_onSaveRGBDImage); }
EventHandler::EventHandler( WindowIF* window ) : _window( window ), _buttonState( PTR_BUTTON_NONE ) { _hWnd = window->getWGLWindowHandle(); if( !_hWnd ) { LBWARN << "Window has no window handle" << std::endl; return; } registerHandler( _hWnd, this ); #pragma warning(push) #pragma warning(disable: 4312) _prevWndProc = (WNDPROC)SetWindowLongPtr( _hWnd, GWLP_WNDPROC, (LONG_PTR)wndProc ); #pragma warning(pop) if( _prevWndProc == wndProc ) // avoid recursion _prevWndProc = DefWindowProc; UINT scrollLines; SystemParametersInfo( SPI_GETWHEELSCROLLLINES, 0, &scrollLines, 0 ); _wheelDeltaPerLine = WHEEL_DELTA / scrollLines; }
void Trigger::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("out_trigger", &out_trigger); h_onTrigger.setup(this, &Trigger::onTrigger); registerHandler("onTrigger", &h_onTrigger); addDependency("onTrigger", NULL); }
void Normals::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_cloud_xyz", &in_cloud_xyz); registerStream("in_cloud_xyzrgb", &in_cloud_xyzrgb); registerStream("out_cloud_normals", &out_cloud_normals); registerStream("out_cloud_xyzrgb_normals", &out_cloud_xyzrgb_normals); // registerStream("out_cloud_xyzrgb", &out_cloud_xyzrgb); h_compute_xyz.setup(boost::bind(&Normals::computeNormalsXYZ, this)); registerHandler("h_compute_xyz", &h_compute_xyz); addDependency("h_compute_xyz", &in_cloud_xyz); h_compute_xyzrgb.setup(boost::bind(&Normals::computeNormalsXYZRGB, this)); registerHandler("h_compute_xyzrgb", &h_compute_xyzrgb); addDependency("h_compute_xyzrgb", &in_cloud_xyzrgb); }
void CenterOfMass::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_cloud_xyzrgb", &in_cloud_xyzrgb); registerStream("in_cloud_xyz", &in_cloud_xyz); registerStream("out_centroid", &out_centroid); registerStream("out_point", &out_point); registerStream("out_cloud_xyz", &out_cloud_xyz); registerStream("out_cloud_xyzrgb", &out_cloud_xyzrgb); // Register handlers h_compute.setup(boost::bind(&CenterOfMass::compute, this)); registerHandler("compute", &h_compute); addDependency("compute", &in_cloud_xyz); h_compute_xyzrgb.setup(boost::bind(&CenterOfMass::compute_xyzrgb, this)); registerHandler("compute_xyzrgb", &h_compute_xyzrgb); addDependency("compute_xyzrgb", &in_cloud_xyzrgb); }
void S2ObjectViewer::prepareInterface() { // Register data streams, events and event handlers HERE! registerStream("in_cloud", &in_cloud); registerStream("in_shots", &in_shots); registerStream("in_sifts", &in_sifts); // Register handlers h_display.setup(boost::bind(&S2ObjectViewer::display, this)); registerHandler("h_display", &h_display); addDependency("h_display", &in_cloud); addDependency("h_display", &in_shots); addDependency("h_display", &in_sifts); h_on_spin.setup(boost::bind(&S2ObjectViewer::on_spin, this)); registerHandler("on_spin", &h_on_spin); addDependency("on_spin", NULL); }
GroupingProtocol::GroupingProtocol(Agent* owner, PPtr<KString> role, k_longint_t groupId) : Protocol(owner) { _role = role; _groupId = new KLongint(groupId); registerHandler((phandler_t)&GroupingProtocol::handleOpHello, OP_HELLO); }