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


C++ weak_ptr::expired方法代码示例

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


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

示例1: RegisterVariable

void Settings::RegisterVariable( std::string name, boost::weak_ptr<BaseDator> dator )
{
    boost::shared_ptr<BaseDator> real_dator = dator.lock();

    StringMap::iterator it = unparsed_settings_map.find( name );
    if( it != unparsed_settings_map.end() && real_dator )
    {
        std::string ret = real_dator->Set( it->second );
        UpdateListeners( name, it->second, ret );
        unparsed_settings_map.erase( it );
    }
    else {
        DatorMap::iterator it = dator_map.find( name );
        if( it != dator_map.end() && real_dator )
        {
            boost::shared_ptr<BaseDator> other_dator = it->second.lock();
            if( other_dator ) {
                std::string ret = real_dator->Set( other_dator->Get() );
                UpdateListeners( name, real_dator->Get(), ret );
            }
            else {
                dator_map.erase( it );
            }
        }
    }

    if( !dator.expired() ) {
        dator_map.insert( std::make_pair( name, dator ) );
    }
}
开发者ID:treeman,项目名称:7days,代码行数:30,代码来源:Settings.cpp

示例2: services

void ServicePort::services(boost::weak_ptr<ServicePort> weakService, IPAddressList ips, uint16_t port)
{
	if(weakService.expired())
		return;

	if(ServicePort_ptr service = weakService.lock())
		service->open(ips, port);
}
开发者ID:081421,项目名称:otxserver,代码行数:8,代码来源:server.cpp

示例3: openAcceptor

void ServicePort::openAcceptor(boost::weak_ptr<ServicePort> weak_service, uint16_t port)
{
	if(weak_service.expired())
		return;

	if(ServicePort_ptr service = weak_service.lock())
		service->open(port);
}
开发者ID:Codex-NG,项目名称:TFS-1.0,代码行数:8,代码来源:server.cpp

示例4: Insert

void SceneDict::Insert(boost::weak_ptr<zeitgeist::Leaf> leaf, const FileRef& ref)
{
    if (leaf.expired())
        {
            return;
        }

    mDictionary[leaf] = ref;
}
开发者ID:MadMaxPavlo,项目名称:SimSpark-SPL,代码行数:9,代码来源:scenedict.cpp

示例5: Register

void TimerMaster::Register(boost::weak_ptr<Timer> weak_timer) {
  boost::mutex::scoped_lock locker(mutex_);
  boost::shared_ptr<Timer> timer = weak_timer.lock();
  if (weak_timer.expired()) {
    return;
  }
  TimerSlot *slot = new TimerSlot;
  InternalAddTimer(slot, weak_timer, timer->timeout() + timer_jiffies_);
}
开发者ID:0xec,项目名称:server1,代码行数:9,代码来源:timer_master.cpp

示例6: onOpen

void ServicePort::onOpen(boost::weak_ptr<ServicePort> weakService, uint16_t port)
{
	if(weakService.expired())
		return;

	if(ServicePort_ptr service = weakService.lock())
	{
		#ifdef __DEBUG_NET_DETAIL__
		std::cout << "ServicePort::onOpen" << std::endl;
		#endif
		service->open(port);
	}
}
开发者ID:A-Syntax,项目名称:cryingdamson-0.3.6-8.60-V8.2,代码行数:13,代码来源:server.cpp

示例7: shared

    boost::shared_ptr< _ResolverMap > get_resolvers()
    {
        static boost::weak_ptr< _ResolverMap > singleton;

        boost::shared_ptr< _ResolverMap > shared(singleton.lock());
        if (singleton.expired()) {
            shared = boost::shared_ptr< _ResolverMap >(new _ResolverMap);
            singleton = shared;

            // Populate resolver list
            foreach (Resolver * resolver, Utopia::instantiateAllExtensions< Resolver >()) {
                (*shared)[resolver->weight()].push_back(boost::shared_ptr< Resolver >(resolver));
            }
开发者ID:project-renard-survey,项目名称:utopia-documents-mirror,代码行数:13,代码来源:resolverrunnable.cpp

示例8: service

void ServicePort::service(boost::weak_ptr<ServicePort> weakService, IPAddress ip, uint16_t port)
{
	if(weakService.expired())
		return;

	ServicePort_ptr service = weakService.lock();
	if(!service)
		return;

	IPAddressList ips;
	ips.push_back(ip);
	service->open(ips, port);
}
开发者ID:081421,项目名称:otxserver,代码行数:13,代码来源:server.cpp

示例9: handleWriteTimeout

void Connection::handleWriteTimeout(boost::weak_ptr<Connection> weak, const boost::system::error_code& error)
{
	if(error == boost::asio::error::operation_aborted || weak.expired())
		return;

	if(shared_ptr<Connection> connection = weak.lock())
	{
		#ifdef __DEBUG_NET_DETAIL__
		std::clog << "Connection::handleWriteTimeout" << std::endl;
		#endif
		connection->onWriteTimeout();
	}
}
开发者ID:alexisjojo,项目名称:darkkonia,代码行数:13,代码来源:connection.cpp

示例10: handleWriteTimeout

void Connection::handleWriteTimeout(boost::weak_ptr<Connection> weak_conn, const boost::system::error_code& error)
{
	if (error == boost::asio::error::operation_aborted) {
		return;
	}

	if (weak_conn.expired()) {
		return;
	}

	if (Connection_ptr connection = weak_conn.lock()) {
		connection->onWriteTimeout();
	}
}
开发者ID:nclx,项目名称:forgottenserver,代码行数:14,代码来源:connection.cpp

示例11: openAcceptor

void ServicePort::openAcceptor(boost::weak_ptr<ServicePort> weak_service, IPAddress ip, uint16_t port)
{
  if(weak_service.expired()){
    return;
  }

  if(ServicePort_ptr service = weak_service.lock()){
    #ifdef __DEBUG_NET_DETAIL__
    std::cout << "ServicePort::openAcceptor" << std::endl;
    #endif
    IPAddressList ips;
    ips.push_back(ip);
    service->open(ips, port);
  }
}
开发者ID:OMARTINEZ210,项目名称:server,代码行数:15,代码来源:server.cpp

示例12: handleReadTimeout

void Connection::handleReadTimeout(boost::weak_ptr<Connection> weak_conn, const boost::system::error_code& error)
{
	if(error != boost::asio::error::operation_aborted){
		if(weak_conn.expired()){
			return;
		}

		if(shared_ptr<Connection> connection = weak_conn.lock()){
			#ifdef __DEBUG_NET_DETAIL__
			std::cout << "Connection::handleReadTimeout" << std::endl;
			#endif

			connection->onReadTimeout();
		}
	}
}
开发者ID:angeliker,项目名称:OTHire,代码行数:16,代码来源:connection.cpp

示例13: new_global_session

libusb::session::sptr libusb::session::get_global_session(void){
    static boost::weak_ptr<session> global_session;

    //not expired -> get existing session
    if (not global_session.expired()) return global_session.lock();

    //create a new global session
    sptr new_global_session(new libusb_session_impl());
    global_session = new_global_session;

    //set logging if envvar is set
    const char *level_string = getenv("LIBUSB_DEBUG_LEVEL");
    if (level_string != NULL)
    {
        const int level = int(level_string[0] - '0'); //easy conversion to integer
        if (level >= 0 and level <= 3) libusb_set_debug(new_global_session->get_context(), level);
    }

    return new_global_session;
}
开发者ID:13572293130,项目名称:uhd,代码行数:20,代码来源:libusb1_base.cpp

示例14: OpenNIThread

void CPNUIPlugin::OpenNIThread(boost::weak_ptr<CPNUIPluginAPI> JSAPI,
	xn::Context& Context)
{
	printf("Started OpenNI thread\n");

	extern boost::weak_ptr<CPNUIPluginAPI> GJSAPI;
	GJSAPI = JSAPI;

	while (!JSAPI.expired())
	{
		XnStatus rc = Context.WaitAnyUpdateAll();
		if (rc != XN_STATUS_OK)
		{
			printf("Read failed: %s\n", xnGetStatusString(rc));
			//m_NUIAvailable = false;
			return;
		}
	}
	printf("JSAPI pointer expired!\n");
}
开发者ID:inequation,项目名称:chromepadder,代码行数:20,代码来源:CPNUIPlugin.cpp

示例15: check_expired

				void check_expired() const {
					if (memory_.expired()) {
						throw position_expired("Position expired.");
					}
				}
开发者ID:bolero-MURAKAMI,项目名称:Sprig,代码行数:5,代码来源:position.hpp


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