当前位置: 首页>>代码示例>>C++>>正文


C++ Port::close方法代码示例

本文整理汇总了C++中Port::close方法的典型用法代码示例。如果您正苦于以下问题:C++ Port::close方法的具体用法?C++ Port::close怎么用?C++ Port::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Port的用法示例。


在下文中一共展示了Port::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: checkSendReceive

    void checkSendReceive()
    {
        report(0,"check matrix send/receive");
        Port portIn;
        Port portOut;

        MThread2 *receiverThread=new MThread2(&portIn);
        MThread1 *senderThread=new MThread1(&portOut);

        portOut.open("/harness_sig/mtest/o");
        portIn.open("/harness_sig/mtest/i");

        Network::connect("/harness_sig/mtest/o", "/harness_sig/mtest/i");

        receiverThread->start();
        senderThread->start();

        receiverThread->stop();
        senderThread->stop();

        portOut.close();
        portIn.close();

        checkTrue(senderThread->success, "Send matrix test");
        checkTrue(receiverThread->success, "Receive matrix test");

        delete receiverThread;
        delete senderThread;
    }
开发者ID:claudiofantacci,项目名称:yarp,代码行数:29,代码来源:MatrixTest.cpp

示例2: close

    /*
    * Close function, to perform cleanup.
    */
    bool close()
    {
        vergencePort.close();
		handlerPort.close();
		suspendPort.close();
		return true;
    }
开发者ID:xufango,项目名称:contrib_bk,代码行数:10,代码来源:main.cpp

示例3: close

 bool close()
 {
     // order does matter!
     imageInPort.close();
     coordPort.close();        
     imageOutPort.close();
     return true;
 }
开发者ID:xufango,项目名称:contrib_bk,代码行数:8,代码来源:main.cpp

示例4: testCloseOpenRepeats

    virtual void testCloseOpenRepeats() {
        report(0,"check that opening-closing-opening etc is ok...");
        report(0,"non-buffered port:");
        Port p;
        p.open("/test1");
        p.open("/test2");
        p.open("/test3");
        p.close();
        p.open("/test4");
        p.close();
        report(0,"buffered port:");
        BufferedPort<Bottle> p2, p3;
        p2.open("/test1");
        p2.open("/test2");
        p2.open("/in");
        p3.open("/out");
        Network::connect("/out","/in");
        p3.prepare().fromString("10 20 30");
        p3.write();
        report(0,"wait for input...");
        p2.read(true);
        report(0,"... got it");
        p3.prepare().fromString("10 20 30");
        p3.write();
        p2.open("/test1");
        p3.open("/test2");
        Network::connect("/test2","/test1");
        p3.prepare().fromString("10 20 30");
        p3.write();
        report(0,"wait for input...");
        p2.read(true);
        report(0,"... got it");

        report(0,"fast loop on temporary port");
        for (int i=0; i<20; i++) {
            Port p;
            Port p2;
            p.open("...");
            p2.open("...");
            p.close();
        }
        Port pa;
        pa.open("...");
        for (int i=0; i<20; i++) {
            Port p;
            p.enableBackgroundWrite(true);
            p.open("...");
            NetworkBase::connect(p.getName(),pa.getName());
            Bottle b("10 20 30");
            p.write(b);
            pa.read(b);
            p.close();
        }
    }
开发者ID:JoErNanO,项目名称:yarp,代码行数:54,代码来源:PortTest.cpp

示例5: close

    bool close()
    {        
        // Close ports
        rpcPort.close();

        imInPort.close();
        imOutPort.close();
        tempOutPort.close();
        coordsInPort.close();
        trackInPort.close();
        coordsOutPort.close();

        return true;
    }
开发者ID:tanismar,项目名称:affordances,代码行数:14,代码来源:objectFinder.cpp

示例6: close

    bool close()
    {
        igaze->restoreContext(startup_context_gaze);
        drvGaze.close();

        iarm->restoreContext(startup_context_arm);
        drvArm.close();

        imgLPortIn.close();
        imgRPortIn.close();
        imgLPortOut.close();
        imgRPortOut.close();
        rpcPort.close();
        return true;
    }
开发者ID:miladmalekzadeh,项目名称:iCub-course-exam,代码行数:15,代码来源:main.cpp

示例7: close

    virtual bool close()
    {
        rpcPort.interrupt();
        rpcPort.close();
        thread.stop();

        velThread.stop();
        velPort.interrupt();
        velPort.close();

        velInitPort.interrupt();
        velInitPort.close();

        return true;
    }
开发者ID:robotology,项目名称:icub-main,代码行数:15,代码来源:main.cpp

示例8: close

    void close()
    {
        mutex.wait();

        if (dump_code)
        {
            fclose(fout_code);
        }

        port_out_code.close();
        port_out_img.close();

        BufferedPort<Image>::close();

        mutex.post();
    }
开发者ID:,项目名称:,代码行数:16,代码来源:

示例9: close

 bool close(){
     cout << "closing .." << endl;
     vGrabber.close();
     outPort.close();
     handlerPort.close();
     return true;
 }
开发者ID:fhaust,项目名称:event-driven,代码行数:7,代码来源:main.cpp

示例10: companion_sigint_handler

static void companion_sigint_handler(int sig) {
    double now = Time::now();
    static double firstCall = now;
    static bool showedMessage = false;
    static bool unregistered = false;
    done = 1;
    //sleep(1);
    if (now-firstCall<2) {
        Port *port = companion_active_port;
        if (!showedMessage) {
            showedMessage = true;
            //YARP_LOG_INFO("Interrupting...");
        }
        if (companion_unregister_name!="") {
            if (!unregistered) {
                unregistered = true;
                NetworkBase::unregisterName(companion_unregister_name);
                if (port!=NULL) {
                    NetworkBase::unregisterName(port->getName());
                }
                exit(1);
            }
        }
        if (port!=NULL) {
            port->interrupt();
#ifndef YARP2_WINDOWS
            port->close();
#endif
        }
    } else {
        fprintf(stderr,"Aborting...\n");
        exit(1);
    }
}
开发者ID:hauptmech,项目名称:stupid_yarp_tricks,代码行数:34,代码来源:main.cpp

示例11: close

    bool close() override
    {
        t->stop();

        if (type==bottle)
        {
            p_bottle->interrupt();
            p_bottle->close();
            delete p_bottle;
        }
        else
        {
            p_image->interrupt();
            p_image->close();
            delete p_image;
        }

        rpcPort.interrupt();
        rpcPort.close();

        delete t;
        delete q;

        return true;
    }
开发者ID:robotology,项目名称:yarp,代码行数:25,代码来源:main.cpp

示例12: threadRelease

	virtual void threadRelease() {

		/* Stop and close ports */
		cportL->interrupt();
		cportR->interrupt();
		susPort->interrupt();

		cportL->close();
		cportR->close();
		susPort->close();

		delete cportL;
		delete cportR;
		delete susPort;

		/* stop motor interfaces and close */
		gaze->stopControl();
		clientGazeCtrl.close();
		carm->stopControl();
		clientArmCart.close();

		robotTorso.close();
		robotHead.close();
		robotArm.close();

	}
开发者ID:oosuagwu,项目名称:uiuc-lar,代码行数:26,代码来源:objectMover.cpp

示例13: rosToKind

std::string TcpRosStream::rosToKind(const char *rosname) {
    if (ConstString(rosname)=="") return "";
    std::map<std::string, std::string> kinds = rosToKind();

    if (kinds.find(rosname)!=kinds.end()) {
        return kinds[rosname];
    }
    Port port;
    port.openFake("yarpidl_rosmsg");
    if (port.addOutput("/typ")) {
        Bottle cmd, resp;
        cmd.addString(ConstString("twiddle ") + rosname);
        dbg_printf("QUERY yarpidl_rosmsg %s\n", cmd.toString().c_str());
        port.write(cmd,resp);
        dbg_printf("GOT yarpidl_rosmsg %s\n", resp.toString().c_str());
        ConstString txt = resp.get(0).asString();
        if (txt!="?") return txt;
    }
    port.close();
    if (ConstString(rosname)!="") {
        fprintf(stderr, "Do not know anything about type '%s'\n", rosname);
        fprintf(stderr, "Could not connect to a type server to look up type '%s'\n", rosname);
        ::exit(1);
    }
    return "";
}
开发者ID:JoErNanO,项目名称:yarp,代码行数:26,代码来源:TcpRosStream.cpp

示例14: close

    virtual bool close()
    {
        rpcPort.interrupt();
        rpcPort.close();

        return true;
    }
开发者ID:kt10aan,项目名称:icub-main,代码行数:7,代码来源:main.cpp

示例15: client

int client(int nframes)
{
    double delay = 0;
    int count = 0;
    int wait = 10;

    Port port;
    port.open("/profiling/port2");
    while(!Network::connect("/profiling/port","/profiling/port2"))
        {
            fprintf(stderr, "Waiting for connection\n");
            Time::delay(0.5);
        }

    while(count<nframes)
        {
            Bottle datum;
            port.read(datum);
            double t=datum.get(0).asDouble();
            double now=Time::now();
            delay+=(now-t)*1000;
            count++;
            // remove this to spare cpu time
            fprintf(stderr, "%lf\n", (now-t)*1000);
        }

    port.close();

    fprintf(stderr, "Received: %d average latency %.3lf[ms]\n", 
            count, delay/count);
    return 0;
}
开发者ID:AbuMussabRaja,项目名称:yarp,代码行数:32,代码来源:port_latency_st.cpp


注:本文中的Port::close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。