本文整理汇总了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 ) );
}
}
示例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);
}
示例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);
}
示例4: Insert
void SceneDict::Insert(boost::weak_ptr<zeitgeist::Leaf> leaf, const FileRef& ref)
{
if (leaf.expired())
{
return;
}
mDictionary[leaf] = ref;
}
示例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_);
}
示例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);
}
}
示例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));
}
示例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);
}
示例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();
}
}
示例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();
}
}
示例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);
}
}
示例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();
}
}
}
示例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;
}
示例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");
}
示例15: check_expired
void check_expired() const {
if (memory_.expired()) {
throw position_expired("Position expired.");
}
}