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


C++ ThreadPtr::start方法代码示例

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


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

示例1: sync

void
SessionHelperI::destroy()
{
    IceUtil::Mutex::Lock sync(_mutex);
    if(_destroy)
    {
        return;
    }
    _destroy = true;

    if(!_connected)
    {
        //
        // In this case a connecting session is being destroyed.
        // We destroy the communicator to trigger the immediate
        // failure of the connection establishment.
        //
        IceUtil::ThreadPtr destroyCommunicator = new DestroyCommunicator(shared_from_this());
        _threadCB = ICE_NULLPTR;
        destroyCommunicator->start();
        return;
    }

    IceUtil::ThreadPtr destroyInternal = new DestroyInternal(shared_from_this(), _threadCB, _callback);

    _session = ICE_NULLPTR;
    _connected = false;
    _threadCB = ICE_NULLPTR;

    //
    // Run destroyInternal in a thread because it makes remote invocations.
    //
    destroyInternal->start();
}
开发者ID:SmarkSeven,项目名称:ice,代码行数:34,代码来源:SessionHelper.cpp

示例2: ActivateAdapterThread

void
TimeoutI::holdAdapter(Ice::Int to, const Ice::Current& current)
{
    current.adapter->hold();
    IceUtil::ThreadPtr thread = new ActivateAdapterThread(current.adapter, to);
    thread->start();
}
开发者ID:bholl,项目名称:zeroc-ice,代码行数:7,代码来源:TestI.cpp

示例3:

void
SessionHelperI::destroy(const IceUtil::ThreadPtr& destroyInternal)
{
    if(_destroy)
    {
        return;
    }
    _destroy = true;

    if(!_connected)
    {
        //
        // In this case a connecting session is being
        // destroyed. The communicator and session will be
        // destroyed when the connection establishment has
        // completed.
        //
        return;
    }
    _session = 0;
    _connected = false;

    //
    // Run the destroyInternal in a thread. This is because it
    // destroyInternal makes remote invocations.
    //
    destroyInternal->start().detach();
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:28,代码来源:SessionHelper.cpp

示例4: sync

void
SessionHelperI::destroy()
{
    IceUtil::Mutex::Lock sync(_mutex);
    if(_destroy)
    {
        return;
    }
    _destroy = true;

    if(!_connected)
    {
        //
        // In this case a connecting session is being
        // destroyed. The communicator and session will be
        // destroyed when the connection establishment has
        // completed.
        //
        _threadCB = 0;
        return;
    }

    IceUtil::ThreadPtr destroyInternal = new DestroyInternal(this, _threadCB, _callback);

    _session = 0;
    _connected = false;
    _threadCB = 0;

    //
    // Run destroyInternal in a thread because it makes remote invocations.
    //
    destroyInternal->start();
}
开发者ID:herclogon,项目名称:ice,代码行数:33,代码来源:SessionHelper.cpp

示例5: LoadConfigurationError

Client::Client() {
    try {
        // We use ip address and process id to identify a client.
        char hostname[100];
        gethostname(hostname, 100);
        m_address.name = hostname;
        m_address.port = getpid();

        // Get configuration.
        string homedir = getenv("HOME");
        if (!m_configured && !setFromFile("tfs_client.ini") 
                    && !setFromFile(homedir + "/.tfs_client.ini")
                    && !setFromFile("/etc/tfs_client.ini")) {
            //LOG_FATAL("Client: Throw api::LoadConfigurationError")
            throw api::LoadConfigurationError();
        }

        // Initialize client logger.    
        if (m_conf.logFile[0] == '~')
            m_conf.logFile = homedir + m_conf.logFile.substr(1);
        helpers::LogLog::getLogLog()->setInternalDebugging(false);
        SharedAppenderPtr append_1(
            new RollingFileAppender(m_conf.logFile, 1024 * 1024, 1));
        std::string pattern = "%D %p - %m\n";
        append_1->setLayout(std::auto_ptr<Layout>(new PatternLayout(pattern)));
        Logger logger = Logger::getInstance("tfs_client");
        logger.addAppender(append_1);

        // Set logger level
        if (m_conf.logLevel == "FATAL") logger.setLogLevel(FATAL_LOG_LEVEL);
        if (m_conf.logLevel == "ERROR") logger.setLogLevel(ERROR_LOG_LEVEL);
        if (m_conf.logLevel == "WARN") logger.setLogLevel(WARN_LOG_LEVEL);
        if (m_conf.logLevel == "INFO") logger.setLogLevel(INFO_LOG_LEVEL);
        if (m_conf.logLevel == "DEBUG") logger.setLogLevel(DEBUG_LOG_LEVEL);
        LOG_INFO("Client: Starts TFS Client instance.");
        LOG_INFO("Client: Get master address: " <<m_conf.masterIP <<":" 
                                                <<m_conf.masterPort);
        LOG_INFO("Client: Get default buffer size: " <<m_conf.bufferSize);
        LOG_INFO("Client: Get log level: " <<m_conf.logLevel);
        LOG_INFO("Client: Get log file: " <<m_conf.logFile);

        // Initialize ice.
        Ice::CommunicatorPtr ic = Ice::initialize();
        Ice::ObjectPrx base = ic->stringToProxy(
            "ClientService:tcp -h " + m_conf.masterIP + " -p " + m_conf.masterPort);
        m_service = slice::ClientServicePrx::checkedCast(base);
        LOG_INFO("Client: Ice service initialized.")

        // Begin heartbeat.
        IceUtil::ThreadPtr deamon = new HeartbeatDeamon(m_address,
                                                        m_service);
        deamon->start();
        LOG_INFO("Client: Heartbeat Deamon started.")
    } catch (Ice::Exception &ex) {
        LOG_FATAL("Client: Get Ice Exception:" <<ex.ice_name());
        LOG_FATAL("Client: Throw api::ConnectionError");
        throw api::ConnectionError();
    }
}
开发者ID:kyhhdm,项目名称:TPlatform,代码行数:59,代码来源:Client.cpp

示例6: lock

	void C2S_Append(
		const std::string& bucketID,
		const std::string& objID,
		const FleCS::ByteSeq& content)
	{
		_LOG(objID);

		string boID = bucketID + "/" + objID;

		GlobalLock lock(boID, 'W');
         	redisContext *c;
                redisReply *reply;

                struct timeval timeout = { 1, 500000 }; // 1.5 seconds
                c = redisConnectWithTimeout((char*)"REDIS_HOST ", 6379, timeout);
                if (c->err) {
                        _LOG("Connection error"<<c->errstr);
                        //exit(1);
                 }
                _LOG("Redis connected");

		reply = (redisReply*)redisCommand(c, "GET %s",(string(bucketID + ":" + objID).c_str()));
                _LOG("GET:"<< reply->str);
		_appendfile(reply->str, content);

		// propagate update to the other servers.
		//
		// You need to make sure that a deadlock does not happen, such as:
		//   C1 ----> S1 --(S2 is not responding while processing C2's request)--> S2
		//   C2 ----> S2 --(S1 is not responding while processing C1's request)--> S1
		//
		// It can be avoided by serializing requests from a connection and
		// setting the thread pool size large enough. At least to the (number
		// of local clients) * (number of servers).
		//
		// It applies the same to the Put().
		map<string, FleCS::SM2SPrx*>& s = FleCSServer::peer_servers;

#ifdef _SERIAL_PROCESSING
		for (map<string, FleCS::SM2SPrx*>::const_iterator i = s.begin(); i != s.end(); ++ i)
			(*(i->second))->Append(bucketID, objID, content);

#else	// Parallel processing (by default)
		vector<IceUtil::ThreadPtr> tpv;
		vector<IceUtil::ThreadControl> tcv;

		for (map<string, FleCS::SM2SPrx*>::const_iterator i = s.begin(); i != s.end(); ++ i)
		{
			IceUtil::ThreadPtr t = new AppendThread(*(i->second), bucketID, objID, content);
			tcv.push_back(t->start());
			tpv.push_back(t);
		}

		for (vector<IceUtil::ThreadControl>::iterator j = tcv.begin(); j != tcv.end(); ++ j)
			j->join();
#endif
	}
开发者ID:pjawahar,项目名称:flecs-rpc,代码行数:57,代码来源:container-rep-redis.cpp

示例7: assert

void
SessionHelperI::connectImpl(const ConnectStrategyPtr& factory)
{
    assert(!_destroy);

    try
    {
        _communicator = Ice::initialize(_initData);
    }
    catch(const Ice::LocalException& ex)
    {
        _destroy = true;
        IceUtil::ThreadPtr thread = new DispatchCallThread(this, new ConnectFailed(_callback, this, ex), 0);
        thread->start().detach();
        return;
    }

    IceUtil::ThreadPtr connectThread = new ConnectThread(_callback, this, factory, _communicator);
    connectThread->start().detach();
}
开发者ID:2008hatake,项目名称:zeroc-ice,代码行数:20,代码来源:SessionHelper.cpp

示例8: lock

	void C2S_Append(
		const std::string& bucketID,
		const std::string& objID,
		const FleCS::ByteSeq& content)
	{
		_LOG(objID);

		string boID = bucketID + "/" + objID;

		GlobalLock lock(boID, 'W');

		_appendfile((string(FleCSServer::stg_root_dir) + "/" + bucketID + "/" + objID).c_str(), content);

		// propagate update to the other servers.
		//
		// You need to make sure that a deadlock does not happen, such as:
		//   C1 ----> S1 --(S2 is not responding while processing C2's request)--> S2
		//   C2 ----> S2 --(S1 is not responding while processing C1's request)--> S1
		//
		// It can be avoided by serializing requests from a connection and
		// setting the thread pool size large enough. At least to the (number
		// of local clients) * (number of servers).
		//
		// It applies the same to the Put().
		map<string, FleCS::SM2SPrx*>& s = FleCSServer::peer_servers;

#ifdef _SERIAL_PROCESSING
		for (map<string, FleCS::SM2SPrx*>::const_iterator i = s.begin(); i != s.end(); ++ i)
			(*(i->second))->Append(bucketID, objID, content);

#else	// Parallel processing (by default)
		vector<IceUtil::ThreadPtr> tpv;
		vector<IceUtil::ThreadControl> tcv;

		for (map<string, FleCS::SM2SPrx*>::const_iterator i = s.begin(); i != s.end(); ++ i)
		{
			IceUtil::ThreadPtr t = new AppendThread(*(i->second), bucketID, objID, content);
			tcv.push_back(t->start());
			tpv.push_back(t);
		}

		for (vector<IceUtil::ThreadControl>::iterator j = tcv.begin(); j != tcv.end(); ++ j)
			j->join();
#endif
	}
开发者ID:pjawahar,项目名称:flecs-rpc,代码行数:45,代码来源:container-rep-strong-const.cpp

示例9: Shutdown

/***********************************************************
tell the server to shutdown
***********************************************************/
void MaintenanceInterfaceServant::Shutdown(const Ice::Current&)
{
	IceUtil::ThreadPtr t = new ShutdownThread(_communicator, _worldname, _wcH);
	t->start();
}
开发者ID:Rincevent,项目名称:lbanet,代码行数:8,代码来源:MaintenanceInterfaceServant.cpp

示例10: m


//.........这里部分代码省略.........

    //
    // Non-exact match
    //
    p = m.findByValue(21);
    test(p == m.end());

    test(m.valueCount(21) == 0);

    p = m.findByValue(21, false);
    test(p == m.end());

    p = m.findByValue(22, false);
    int previous = 21;
    int count = 0;
    while(p != m.end())
    {
        test(p->second > previous);
        previous = p->second;
        ++p;
        count++;
    }
    test(count == 4);
    cout << "ok " << endl;

    cout << "testing concurrent access... " << flush;
    m.clear();
    populateDB(connection, m);

    vector<IceUtil::ThreadControl> controls;
    for(int i = 0; i < 5; ++i)
    {
        IceUtil::ThreadPtr rt = new ReadThread(communicator, envName, dbName);
        controls.push_back(rt->start());
        IceUtil::ThreadPtr wt = new WriteThread(communicator, envName, dbName);
        controls.push_back(wt->start());
    }
    for(vector<IceUtil::ThreadControl>::iterator q = controls.begin(); q != controls.end(); ++q)
    {
        q->join();
    }
    cout << "ok" << endl;

    cout << "testing index creation... " << flush;
    
    {
        IntIdentityMap iim(connection, "intIdentity");
        
        Ice::Identity odd;
        odd.name = "foo";
        odd.category = "odd";
        
        Ice::Identity even;
        even.name = "bar";
        even.category = "even";
            
        TransactionHolder txHolder(connection);
        for(int i = 0; i < 1000; i++)
        {
            if(i % 2 == 0)
            {
                iim.put(IntIdentityMap::value_type(i, even));
            }
            else
            {
                iim.put(IntIdentityMap::value_type(i, odd));
开发者ID:updowndown,项目名称:myffff,代码行数:67,代码来源:Client.cpp

示例11: Connect


//.........这里部分代码省略.........
		return -1;
	}

	try
	{
		std::string verS = _session->GetVersion();
		Ice::PropertiesPtr prop = _communicator->getProperties();
		std::string serverV = prop->getPropertyWithDefault("LbanetServerVersion", "v0");
		if(verS != serverV)
		{
			reason = "Server version mismatch - please update your game.";
			Disconnect();
			return -1;
		}
	}
	catch(const Ice::Exception& ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Error getting server version: ") + ex.what());
		return 0;
	}


	try
	{
		_adapter = _communicator->createObjectAdapter("LbaNetClient");
		_adapter->activate();

	}
	catch(const Ice::Exception& ex)
	{
		LogHandler::getInstance()->LogToFile(std::string("Error creating adapter: ") + ex.what());
		return 0;
	}


	// clear online list
	ThreadSafeWorkpile::JoinEvent evcl;
	evcl.ListName = "online";
	evcl.Clear = true;
	ThreadSafeWorkpile::getInstance()->HappenedJoinEvent(evcl);


	// fill it with already connected people
	if(_session)
	{
		Ice::Long ownid = -1;
		LbaNet::ConnectedL listco = _session->GetConnected(ownid);
		ThreadSafeWorkpile::getInstance()->SetPlayerId(ownid);
		LbaNet::ConnectedL::const_iterator it = listco.begin();
		LbaNet::ConnectedL::const_iterator end = listco.end();
		for(;it != end; ++it)
		{
			ThreadSafeWorkpile::JoinEvent ev;
			ev.ListName = "online";
			ev.Joined = true;
			ev.Clear = false;
			ev.Nickname = it->first;
			ev.Status = it->second.Status;
			ev.Color = it->second.NameColor;
			ThreadSafeWorkpile::getInstance()->HappenedJoinEvent(ev);
			ThreadSafeWorkpile::getInstance()->ChatColorChanged(ev.Nickname, ev.Color);
		}

		//synchronize time with server
		//SynchronizedTimeHandler::getInstance()->Initialize(session);
	}



	IceUtil::ThreadPtr t = new SendingLoopThread(_adapter, _session,
						_router->getServerProxy()->ice_getIdentity().category,
						user);
	_tc = t->start();
	_thread_started = true;


	//---------------------------------------------------------------
	// start the irc thread
	Ice::PropertiesPtr prop = _communicator->getProperties();
	_ircOn = (prop->getPropertyAsInt("IrcOn") == 1);
	std::string IrcServer = prop->getProperty("IrcServer");
	std::string IrcChannel = "#" + prop->getProperty("IrcChannel");
	if(_ircOn)
	{
		ircon = true;
		IrcThread::IrcCoInfo coi;
		coi.Server = IrcServer;
		coi.Nickname = user;
		coi.Channel = IrcChannel;

		_ircth = new IrcThread(coi);
		_tcirc = _ircth->start();
	}
	else
		ircon = false;



	return 1;
}
开发者ID:leloulight,项目名称:lbanet,代码行数:101,代码来源:ServerConnectionHandler.cpp

示例12: ds


//.........这里部分代码省略.........
                Ice::CommunicatorPtr ic = Ice::initialize(initData);

                Ice::Context ctx;
                ctx["one"] = "ONE";
                ctx["two"] = "TWO";
                ctx["three"] = "THREE";

                Test::MyClassPrxPtr p = ICE_UNCHECKED_CAST(Test::MyClassPrx,
                                                           ic->stringToProxy("test:" + getTestEndpoint(ic, 0)));

                ic->getImplicitContext()->setContext(ctx);
                test(ic->getImplicitContext()->getContext() == ctx);
                test(p->opContext() == ctx);

                test(ic->getImplicitContext()->containsKey("zero") == false);
                string r = ic->getImplicitContext()->put("zero", "ZERO");
                test(r == "");
                test(ic->getImplicitContext()->containsKey("zero") == true);
                test(ic->getImplicitContext()->get("zero") == "ZERO");

                ctx = ic->getImplicitContext()->getContext();
                test(p->opContext() == ctx);
                Ice::Context prxContext;
                prxContext["one"] = "UN";
                prxContext["four"] = "QUATRE";

                Ice::Context combined = prxContext;
                combined.insert(ctx.begin(), ctx.end());
                test(combined["one"] == "UN");

                p = ICE_UNCHECKED_CAST(Test::MyClassPrx, p->ice_context(prxContext));

                ic->getImplicitContext()->setContext(Ice::Context());
                test(p->opContext() == prxContext);

                ic->getImplicitContext()->setContext(ctx);
                test(p->opContext() == combined);

                test(ic->getImplicitContext()->remove("one") == "ONE");

                if(impls[i] == "PerThread")
                {
                    IceUtil::ThreadPtr thread = new PerThreadContextInvokeThread(p->ice_context(Ice::Context()));
                    thread->start();
                    thread->getThreadControl().join();
                }

                ic->getImplicitContext()->setContext(Ice::Context()); // Clear the context to avoid leak report.
                ic->destroy();
            }
        }
#endif
        }

    {
        Ice::Double d = 1278312346.0 / 13.0;
        Test::DoubleS ds(5, d);
        p->opDoubleMarshaling(d, ds);
    }

    p->opIdempotent();

    p->opNonmutating();

    test(p->opByte1(0xFF) == 0xFF);
    test(p->opShort1(0x7FFF) == 0x7FFF);
    test(p->opInt1(0x7FFFFFFF) == 0x7FFFFFFF);
    test(p->opLong1(0x7FFFFFFFFFFFFFFFLL) == 0x7FFFFFFFFFFFFFFFLL);
    test(p->opFloat1(1.0) == 1.0);
    test(p->opDouble1(1.0) == 1.0);
    test(p->opString1("opString1") == "opString1");

    Test::MyDerivedClassPrxPtr d = ICE_UNCHECKED_CAST(Test::MyDerivedClassPrx, p);

    Test::MyStruct1 s;
    s.tesT = "Test::MyStruct1::s";
    s.myClass = 0;
    s.myStruct1 = "Test::MyStruct1::myStruct1";
    s = d->opMyStruct1(s);
    test(s.tesT == "Test::MyStruct1::s");
    test(s.myClass == 0);
    test(s.myStruct1 == "Test::MyStruct1::myStruct1");

    Test::MyClass1Ptr c = ICE_MAKE_SHARED(Test::MyClass1);
    c->tesT = "Test::MyClass1::testT";
    c->myClass = 0;
    c->myClass1 = "Test::MyClass1::myClass1";
    c = d->opMyClass1(c);
    test(c->tesT == "Test::MyClass1::testT");
    test(c->myClass == 0);
    test(c->myClass1 == "Test::MyClass1::myClass1");

    Test::StringS seq;
    p->opStringS1(seq);

    Test::ByteBoolD dict;
    p->opByteBoolD1(dict);


}
开发者ID:chenbk85,项目名称:ice,代码行数:101,代码来源:Twoways.cpp

示例13: planifica

void ARobot::planifica(Scene *scn,int event){
//    _robot->parar();
    _scn=scn;
    tiposEstrategias es=AMANHATTAN;
    if (event == NEWAI){
        cout<<"ARobot::"<<_id<<":: NEWAI:"<<_object->getPos()[0]<<":"<<_object->getPos()[1]<<endl;
        _lMov.clear();
        _guardia = -1;
        Search *b = new Search(_id, scn->getMap(), scn->getMarca(_id+2)->getPos()[0]%scn->getGrid(), scn->getMarca(_id+2)->getPos()[1]%scn->getGrid(), scn->getMarca(_id+2)->getPos()[0]/scn->getGrid(), scn->getMarca(_id+2)->getPos()[1]/scn->getGrid(), scn->getAncho()/scn->getGrid()+1, scn->getAlto()/scn->getGrid()+1, scn->getMarca(_id+2)->getRatio()[0], scn->getMarca(_id+2)->getRatio()[1], es, _object->getId()+3, _object->getPos()[0]/scn->getGrid(), _object->getPos()[1]/scn->getGrid());
        //Search *b = new Search(_id, scn->getMap(), scn->getMarca(_id+2)->getPos()[0]%scn->getGrid(), scn->getMarca(_id+2)->getPos()[1]%scn->getGrid(), scn->getMarca(_id+2)->getPos()[0]/scn->getGrid(), scn->getMarca(_id+2)->getPos()[1]/scn->getGrid(), scn->getAncho()/scn->getGrid()+1, scn->getAlto()/scn->getGrid()+1, scn->getMarca(_id+2)->getRatio()[0], scn->getMarca(_id+2)->getRatio()[1], es, _id, fin0,fin1);
        //State *e = new State(_id,scn->getMarca(_id+2)->getPos()[0]%scn->getGrid(),scn->getMarca(_id+2)->getPos()[1]%scn->getGrid(),scn->getMarca(_id+2)->getPos()[0]/scn->getGrid(),scn->getMarca(_id+2)->getPos()[1]/scn->getGrid(),scn->getMarca(_id+2)->getRatio()[0],scn->getMarca(_id+2)->getRatio()[1],scn->getAncho()/scn->getGrid()+1,scn->getAlto()/scn->getGrid()+1,_object->getPos()[0],_object->getPos()[1],scn->getGrid(),scn->getGrid(),scn->arrayToVectorMap());
        IceUtil::ThreadPtr t = new AI(b,this);
        t->start();

    }else if (event == MOVIMIENTO){
        cout<<"ARobot::"<<_id<<":: MOVIMIENTO"<<endl;
        if (casillaValida(scn)){
            if ((int)_lMov.size() <= scn->getMarca(_id+2)->getRatio()[0]+1){
                if(_guardia>0){
                    fin0 = -1, fin1 = -1;
                    switch(_guardia){
                        case 1:
                            _guardia = 2;
                            fin0 = scn->getFin()[0]/scn->getGrid();
                            fin1 = scn->getCenter()[1]/scn->getGrid();
                        break;
                        case 2:
                            _guardia = 3;
                            fin0 = scn->getCenter()[0]/scn->getGrid();;
                            fin1 = scn->getCenter()[1]/scn->getGrid();;
                        break;
                        case 3:
                            _guardia = 4;
                            fin0 = scn->getCenter()[0]/scn->getGrid();;
                            fin1 = scn->getFin()[1]/scn->getGrid();
                        break;
                        case 4:
                            _guardia = 1;
                            fin0 = scn->getFin()[0]/scn->getGrid();
                            fin1 = scn->getFin()[1]/scn->getGrid();
                        break;
                    }
                    _lMov.clear();
                    Search *b = new Search(_id, scn->getMap(), scn->getMarca(_id+2)->getPos()[0]%scn->getGrid(), scn->getMarca(_id+2)->getPos()[1]%scn->getGrid(), scn->getMarca(_id+2)->getPos()[0]/scn->getGrid(), scn->getMarca(_id+2)->getPos()[1]/scn->getGrid(), scn->getAncho()/scn->getGrid()+1, scn->getAlto()/scn->getGrid()+1, scn->getMarca(_id+2)->getRatio()[0], scn->getMarca(_id+2)->getRatio()[1], es, _id, fin0,fin1);
                    IceUtil::ThreadPtr t = new AI(b,this);
                    t->start();
//                    cout<<"TIDDDDDD:"<<tc.id()<<endl;
                } else {
                    orientarO(scn);
                }
            }else{
                if ((scn->getMarca(_id+2)->getPos()[0]/scn->getGrid() == static_cast<int>(_pos[0]/scn->getGrid())) && (scn->getMarca(_id+2)->getPos()[1]/scn->getGrid()) == static_cast<int>(_pos[1]/scn->getGrid())){
                    orientar(scn);
                }else{
//                    cout<<"nextm ove"<<endl;
                    nextMov();
                    orientar(scn);
                }
            }
        }else{
            _lMov.clear();
            if(_guardia>0){
                Search *b = new Search(_id, scn->getMap(), scn->getMarca(_id+2)->getPos()[0]%scn->getGrid(), scn->getMarca(_id+2)->getPos()[1]%scn->getGrid(), scn->getMarca(_id+2)->getPos()[0]/scn->getGrid(), scn->getMarca(_id+2)->getPos()[1]/scn->getGrid(), scn->getAncho()/scn->getGrid()+1, scn->getAlto()/scn->getGrid()+1, scn->getMarca(_id+2)->getRatio()[0], scn->getMarca(_id+2)->getRatio()[1], es, _id, fin0,fin1);
                IceUtil::ThreadPtr t = new AI(b,this);
                t->start();
//                cout<<"TIDDDDDD:"<<tc.id()<<endl;
            }else{
                Search *b = new Search(_id, scn->getMap(), scn->getMarca(_id+2)->getPos()[0]%scn->getGrid(), scn->getMarca(_id+2)->getPos()[1]%scn->getGrid(), scn->getMarca(_id+2)->getPos()[0]/scn->getGrid(), scn->getMarca(_id+2)->getPos()[1]/scn->getGrid(), scn->getAncho()/scn->getGrid()+1, scn->getAlto()/scn->getGrid()+1, scn->getMarca(_id+2)->getRatio()[0], scn->getMarca(_id+2)->getRatio()[1], es, _object->getId()+3, _object->getPos()[0]/scn->getGrid(), _object->getPos()[1]/scn->getGrid());
                //State *e = new State(_id,scn->getMarca(_id+2)->getPos()[0]%scn->getGrid(),scn->getMarca(_id+2)->getPos()[1]%scn->getGrid(),scn->getMarca(_id+2)->getPos()[0]/scn->getGrid(),scn->getMarca(_id+2)->getPos()[1]/scn->getGrid(),scn->getMarca(_id+2)->getRatio()[0],scn->getMarca(_id+2)->getRatio()[1],scn->getAncho()/scn->getGrid()+1,scn->getAlto()/scn->getGrid()+1,scn->getFin()[0]/scn->getGrid(),scn->getFin()[1]/scn->getGrid(),scn->getGrid(),scn->getGrid(),scn->arrayToVectorMap());
                IceUtil::ThreadPtr t = new AI(b,this);
                t->start();
            }
        }
    }else if (event == GUARDAI){
        cout<<"ARobot::"<<_id<<":: GUARDAI"<<endl;
        _lMov.clear();
        if (_guardia==-1){
            _guardia = 1;
//        for (int j=0;j<=scn->getAlto()/scn->getGrid();j++){
//            for (int i=0;i<=scn->getAncho()/scn->getGrid();i++){
//              std::cout<<scn->getMap(i,j);
//            }
//            std::cout<<""<<std::endl;
//          }
          fin0=scn->getFin()[0]/scn->getGrid();
          fin1=scn->getFin()[1]/scn->getGrid();
        }
//        cout<<"ARobot:: Inicio: "<<scn->getMarca(_id+2)->getPos()[0]/scn->getGrid()<<" : "<<scn->getMarca(_id+2)->getPos()[1]/scn->getGrid()<<endl;
//        cout<<"ARobot:: ratio: "<<scn->getMarca(_id+2)->getRatio()[0]<<" : "<<scn->getMarca(_id+2)->getRatio()[1]<<endl;
        Search *b = new Search(_id, scn->getMap(), scn->getMarca(_id+2)->getPos()[0]%scn->getGrid(), scn->getMarca(_id+2)->getPos()[1]%scn->getGrid(), scn->getMarca(_id+2)->getPos()[0]/scn->getGrid(), scn->getMarca(_id+2)->getPos()[1]/scn->getGrid(), scn->getAncho()/scn->getGrid()+1, scn->getAlto()/scn->getGrid()+1, scn->getMarca(_id+2)->getRatio()[0], scn->getMarca(_id+2)->getRatio()[1], es, _id, fin0,fin1);
        //State *e = new State(_id,scn->getMarca(_id+2)->getPos()[0]%scn->getGrid(),scn->getMarca(_id+2)->getPos()[1]%scn->getGrid(),scn->getMarca(_id+2)->getPos()[0]/scn->getGrid(),scn->getMarca(_id+2)->getPos()[1]/scn->getGrid(),scn->getMarca(_id+2)->getRatio()[0],scn->getMarca(_id+2)->getRatio()[1],scn->getAncho()/scn->getGrid()+1,scn->getAlto()/scn->getGrid()+1,scn->getFin()[0]/scn->getGrid(),scn->getFin()[1]/scn->getGrid(),scn->getGrid(),scn->getGrid(),scn->arrayToVectorMap());
        IceUtil::ThreadPtr t = new AI(b,this);
        t->start();
//        cout<<"TIDDDDDD:"<<tc.id()<<endl;
    }
    double po[2] = {scn->getMarca(_id+2)->getPos()[0],scn->getMarca(_id+2)->getPos()[1]};
    setPos(po);
//    _markerInfo = markerInfo;
//    _pos[0] = _markerInfo->pos[0];
//    _pos[1] = _markerInfo->pos[1];
//.........这里部分代码省略.........
开发者ID:rovertpd,项目名称:simrovime,代码行数:101,代码来源:ARobot.cpp


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