• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ boost::intrusive_ptr类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1:

void
WindowManager::removeView( boost::intrusive_ptr< IView > _view )
{
	DockWidgetByViewCollectionIterator iterator = m_dockWidgetByViewCollection.find( _view );

	if ( iterator != m_dockWidgetByViewCollection.end() )
	{
		_view->getViewWidget()->setParent( NULL );
		m_mainWindow->removeDockWidget( iterator->second );

		_view->viewWasClosed();

		m_dockWidgetByViewCollection.erase( _view );
	}

	CentralViewsCollectionIterator centralViewiterator = m_centralViewsCollection.find( _view );

	if ( centralViewiterator != m_centralViewsCollection.end() )
	{
		_view->getViewWidget()->setParent( NULL );
		m_centralWidget->removeTab( m_centralWidget->indexOf( _view->getViewWidget() ) );

		_view->viewWasClosed();

		m_centralViewsCollection.erase( _view );
	}

} // WindowManager::removeView
开发者ID:valeriyr,项目名称:Hedgehog,代码行数:28,代码来源:wm_window_manager.cpp


示例2: switch

void tSolution3::Execute(boost::intrusive_ptr<tShipCommand> shipCommand){
int a=0;// 123
	boost::intrusive_ptr<tObj> conPoint;
	boost::intrusive_ptr<tObj> stationPoint;
	if (!shipCommand->_command) return;
	int cmd=shipCommand->GetCommandId();
	switch(cmd){
		case 3:
/*
			conPoint=_base->starInterface->GetConnectPoint();
//123					(*sIter)->_ship->New_Target(tar);
			shipCommand->SetTarget(conPoint);
			shipCommand->_command=boost::intrusive_ptr<tICommand5> (new tICommand5);//cPatrul;//next command
			//shipCommand->SetCommand(
			shipCommand->m_refCounter+=tSolution3::m_refCounter-1;//???check!!!!
			break;
		case 5:
*/
			shipCommand->_ship->obj->SetMinSpeed(0.5f);
			stationPoint=_base->starInterface->GetNearStation();
			shipCommand->SetTarget(stationPoint);
			shipCommand->_command=boost::intrusive_ptr<tICommand4> (new tICommand4);//cReturn;//next command
			shipCommand->m_refCounter+=tSolution3::m_refCounter-1;//???check!!!!
			break;
		default:
			//shipCommand->_command=0;
			break;
	}

}
开发者ID:sirdyf,项目名称:ENEV_2_261,代码行数:30,代码来源:tSolution3.cpp


示例3:

/**
 * Stores a message before it has been enqueued
 * (enqueueing automatically stores the message so this is
 * only required if storage is required prior to that
 * point).
 */
void
MessageStorePlugin::stage(const boost::intrusive_ptr<broker::PersistableMessage>& msg)
{
    if (msg->getPersistenceId() == 0 && !msg->isContentReleased()) {
        provider->second->stage(msg);
    }
}
开发者ID:losciamano,项目名称:bdbmsgstore,代码行数:13,代码来源:MessageStorePlugin.cpp


示例4: viewPossition

void
WindowManager::addView(
		boost::intrusive_ptr< IView > _view
	,	const ViewPosition::Enum _position )
{
	assert( m_dockWidgetByViewCollection.find( _view ) == m_dockWidgetByViewCollection.end() );

	if ( _position == ViewPosition::Center )
	{
		m_centralWidget->addTab( _view->getViewWidget(), _view->getViewTitle() );
		m_centralViewsCollection.insert( _view );
	}
	else
	{
		Qt::DockWidgetArea viewPossition( getQtViewPossition( _position ) );

		QDockWidget* docWidget( new QDockWidget() );

		docWidget->setWindowTitle( _view->getViewTitle() );
		docWidget->setWidget( _view->getViewWidget() );

		m_mainWindow->addDockWidget( viewPossition, docWidget );

		m_dockWidgetByViewCollection.insert( std::make_pair( _view, docWidget ) );
	}

} // WindowManager::addView
开发者ID:valeriyr,项目名称:Hedgehog,代码行数:27,代码来源:wm_window_manager.cpp


示例5: Exception

template <> void
BlobEncoder::encode(const boost::intrusive_ptr<qpid::broker::PersistableMessage> &item)
{
    // NOTE! If this code changes, verify the recovery code in MessageRecordset
    SAFEARRAYBOUND bound[1] = {0, 0};
    bound[0].cElements = item->encodedSize() + sizeof(uint32_t);
    blob = SafeArrayCreate(VT_UI1, 1, bound);
    if (S_OK != SafeArrayLock(blob)) {
        SafeArrayDestroy(blob);
        blob = 0;
        throw qpid::Exception("Error locking blob area for message");
    }
    try {
        uint32_t headerSize = item->encodedHeaderSize();
        qpid::framing::Buffer buff((char *)blob->pvData, bound[0].cElements);
        buff.putLong(headerSize);
        item->encode(buff);
    }
    catch(...) {
        SafeArrayUnlock(blob);
        SafeArrayDestroy(blob);
        blob = 0;
        throw;
    }
    this->vt = VT_ARRAY | VT_UI1;
    this->parray = blob;
    SafeArrayUnlock(blob);
}
开发者ID:ChugR,项目名称:qpid-cpp,代码行数:28,代码来源:BlobEncoder.cpp


示例6: intrusive_make_valid_unique

//typename boost::enable_if<typename intrusive_traits<T>::user_allocator>::type
void
intrusive_make_valid_unique(boost::intrusive_ptr<T> & p)
{
  if (!p)
    p.reset(construct<typename intrusive_traits<T>::user_allocator,T>());
  else if (!p->unique())
    p.reset(intrusive_clone(*p));
}
开发者ID:fullstackenviormentss,项目名称:sbmt,代码行数:9,代码来源:intrusive_refcount.hpp


示例7: getInterface

static as_object*
getInterface()
{
    GNASH_REPORT_FUNCTION;
    static boost::intrusive_ptr<as_object> o;
    if (o == NULL) {
	o = new as_object();
    }
    return o.get();
}
开发者ID:adamh,项目名称:gnash-fork,代码行数:10,代码来源:launcher_ext.cpp


示例8: addShadowConnection

// Called in connection thread to insert an updated shadow connection.
void Cluster::addShadowConnection(const boost::intrusive_ptr<Connection>& c) {
    QPID_LOG(debug, *this << " new shadow connection " << c->getId());
    // Safe to use connections here because we're pre-catchup, stalled
    // and discarding, so deliveredFrame is not processing any
    // connection events.
    assert(discarding);
    pair<ConnectionMap::iterator, bool> ib
        = connections.insert(ConnectionMap::value_type(c->getId(), c));
    // Like this to avoid tripping up unused variable warning when NDEBUG set
    if (!ib.second) assert(ib.second);
}
开发者ID:cajus,项目名称:qpid-cpp-debian,代码行数:12,代码来源:Cluster.cpp


示例9: move

// static
StatusWith<std::unique_ptr<CanonicalQuery>> CanonicalQuery::canonicalize(
    OperationContext* opCtx,
    std::unique_ptr<QueryRequest> qr,
    const boost::intrusive_ptr<ExpressionContext>& expCtx,
    const ExtensionsCallback& extensionsCallback,
    MatchExpressionParser::AllowedFeatureSet allowedFeatures) {
    auto qrStatus = qr->validate();
    if (!qrStatus.isOK()) {
        return qrStatus;
    }

    std::unique_ptr<CollatorInterface> collator;
    if (!qr->getCollation().isEmpty()) {
        auto statusWithCollator = CollatorFactoryInterface::get(opCtx->getServiceContext())
                                      ->makeFromBSON(qr->getCollation());
        if (!statusWithCollator.isOK()) {
            return statusWithCollator.getStatus();
        }
        collator = std::move(statusWithCollator.getValue());
    }

    // Make MatchExpression.
    boost::intrusive_ptr<ExpressionContext> newExpCtx;
    if (!expCtx.get()) {
        newExpCtx.reset(new ExpressionContext(opCtx, collator.get()));
    } else {
        newExpCtx = expCtx;
        invariant(CollatorInterface::collatorsMatch(collator.get(), expCtx->getCollator()));
    }
    StatusWithMatchExpression statusWithMatcher = MatchExpressionParser::parse(
        qr->getFilter(), newExpCtx, extensionsCallback, allowedFeatures);
    if (!statusWithMatcher.isOK()) {
        return statusWithMatcher.getStatus();
    }
    std::unique_ptr<MatchExpression> me = std::move(statusWithMatcher.getValue());

    // Make the CQ we'll hopefully return.
    std::unique_ptr<CanonicalQuery> cq(new CanonicalQuery());

    Status initStatus =
        cq->init(opCtx,
                 std::move(qr),
                 parsingCanProduceNoopMatchNodes(extensionsCallback, allowedFeatures),
                 std::move(me),
                 std::move(collator));

    if (!initStatus.isOK()) {
        return initStatus;
    }
    return std::move(cq);
}
开发者ID:louiswilliams,项目名称:mongo,代码行数:52,代码来源:canonical_query.cpp


示例10: m_pses

 peer_connection_handle::peer_connection_handle(boost::intrusive_ptr<peer_connection> pc, aux::session_impl* pses) : m_pses(pses)
 {
     if (pc)
     {
         m_np = pc->get_network_point();
     }
 }
开发者ID:ST3ALth,项目名称:libed2k,代码行数:7,代码来源:peer_connection_handle.cpp


示例11: reparsePipeline

/**
 * Round trips the pipeline through serialization by calling serialize(), then Pipeline::parse().
 * fasserts if it fails to parse after being serialized.
 */
boost::intrusive_ptr<Pipeline> reparsePipeline(
    const boost::intrusive_ptr<Pipeline>& pipeline,
    const AggregationRequest& request,
    const boost::intrusive_ptr<ExpressionContext>& expCtx) {
    auto serialized = pipeline->serialize();

    // Convert vector<Value> to vector<BSONObj>.
    std::vector<BSONObj> parseableSerialization;
    parseableSerialization.reserve(serialized.size());
    for (auto&& serializedStage : serialized) {
        invariant(serializedStage.getType() == BSONType::Object);
        parseableSerialization.push_back(serializedStage.getDocument().toBson());
    }

    auto reparsedPipeline = Pipeline::parse(parseableSerialization, expCtx);
    if (!reparsedPipeline.isOK()) {
        error() << "Aggregation command did not round trip through parsing and serialization "
                   "correctly. Input pipeline: "
                << Value(request.getPipeline()).toString()
                << ", serialized pipeline: " << Value(serialized).toString();
        fassertFailedWithStatusNoTrace(40175, reparsedPipeline.getStatus());
    }

    reparsedPipeline.getValue()->injectExpressionContext(expCtx);
    reparsedPipeline.getValue()->optimizePipeline();
    return reparsedPipeline.getValue();
}
开发者ID:carlyrobison,项目名称:mongo,代码行数:31,代码来源:pipeline_command.cpp


示例12: find_data_observer

	find_data_observer(
		boost::intrusive_ptr<find_data> const& algorithm
		, node_id self)
		: observer(algorithm->allocator())
		, m_algorithm(algorithm)
		, m_self(self)
	{}
开发者ID:BlackYoup,项目名称:medusa,代码行数:7,代码来源:find_data.hpp


示例13: request_bandwidth

	// non prioritized means that, if there's a line for bandwidth,
	// others will cut in front of the non-prioritized peers.
	// this is used by web seeds
	int bandwidth_manager::request_bandwidth(boost::intrusive_ptr<bandwidth_socket> const& peer
		, int blk, int priority
		, bandwidth_channel* chan1
		, bandwidth_channel* chan2
		, bandwidth_channel* chan3
		, bandwidth_channel* chan4
		, bandwidth_channel* chan5
		)
	{
		INVARIANT_CHECK;
		if (m_abort) return 0;

		TORRENT_ASSERT(blk > 0);
		TORRENT_ASSERT(priority > 0);
		TORRENT_ASSERT(!is_queued(peer.get()));

		bw_request bwr(peer, blk, priority);
		int i = 0;
		if (chan1 && chan1->throttle() > 0) bwr.channel[i++] = chan1;
		if (chan2 && chan2->throttle() > 0) bwr.channel[i++] = chan2;
		if (chan3 && chan3->throttle() > 0) bwr.channel[i++] = chan3;
		if (chan4 && chan4->throttle() > 0) bwr.channel[i++] = chan4;
		if (chan5 && chan5->throttle() > 0) bwr.channel[i++] = chan5;
		if (i == 0)
		{
			// the connection is not rate limited by any of its
			// bandwidth channels, or it doesn't belong to any
			// channels. There's no point in adding it to
			// the queue, just satisfy the request immediately
			return blk;
		}
		m_queued_bytes += blk;
		m_queue.push_back(bwr);
		return 0;
	}
开发者ID:Chaduke,项目名称:bah.mod,代码行数:38,代码来源:bandwidth_manager.cpp


示例14: launcher_class_init

    void
    launcher_class_init(as_object &obj)
    {
//	GNASH_REPORT_FUNCTION;
	// This is going to be the global "class"/"function"
	static boost::intrusive_ptr<builtin_function> cl;
	if (cl == NULL) {
        Global_as* gl = getGlobal(global);
        as_object* proto = getInterface();
        cl = gl->createClass(&launcher_ctor, proto);
// 	    // replicate all interface to class, to be able to access
// 	    // all methods as static functions
 	    attachInterface(cl.get());
	}
	
	obj.init_member("Launcher", cl.get());
    }
开发者ID:adamh,项目名称:gnash-fork,代码行数:17,代码来源:launcher_ext.cpp


示例15: recover

void DtxWorkRecord::recover(std::auto_ptr<TPCTransactionContext> _txn, boost::intrusive_ptr<DtxBuffer> ops)
{
    add(ops);
    txn = _txn;
    ops->markEnded();
    completed = true;
    prepared = true;
}
开发者ID:ChugR,项目名称:qpid-cpp,代码行数:8,代码来源:DtxWorkRecord.cpp


示例16: enqueue

    void enqueue(TransactionContext* tx,
                 const boost::intrusive_ptr<PersistableMessage>& pmsg,
                 const PersistableQueue& queue)
    {
        ostringstream o;
        string data = getContent(pmsg);
        o << "<enqueue " << queue.getName() << " " << data;
        if (tx) o << " tx=" << getId(*tx);
        o << ">";
        log(o.str());

        // Dump the message if there is a dump file.
        if (dump.get()) {
            *dump << "Message(" << data.size() << "): " << data << endl;
        }
        string logPrefix = "TestStore "+name+": ";
        Action action(data);
        bool doComplete = true;
        if (action.index && action.executeIn(name)) {
            switch (action.index) {

              case Action::THROW:
                throw Exception(logPrefix + data);
                break;

              case Action::DELAY: {
                  if (action.args.empty()) {
                      QPID_LOG(error, logPrefix << "async-id needs argument: " << data);
                      break;
                  }
                  asyncIds[action.args[0]] = pmsg;
                  QPID_LOG(debug, logPrefix << "delayed completion " << action.args[0]);
                  doComplete = false;
                  break;
              }

              case Action::COMPLETE: {
                  if (action.args.empty()) {
                      QPID_LOG(error, logPrefix << "complete-id needs argument: " << data);
                      break;
                  }
                  AsyncIds::iterator i = asyncIds.find(action.args[0]);
                  if (i != asyncIds.end()) {
                      i->second->enqueueComplete();
                      QPID_LOG(debug, logPrefix << "completed " << action.args[0]);
                      asyncIds.erase(i);
                  } else {
                      QPID_LOG(info, logPrefix << "not found for completion " << action.args[0]);
                  }
                  break;
              }

              default:
                QPID_LOG(error, logPrefix << "unknown action: " << data);
            }
        }
        if (doComplete) pmsg->enqueueComplete();
    }
开发者ID:ChugR,项目名称:qpid-cpp,代码行数:58,代码来源:test_store.cpp


示例17: init_grid

void tcontainer_::init_grid(
		const boost::intrusive_ptr<tbuilder_grid>& grid_builder)
{
	log_scope2(log_gui_general, LOG_SCOPE_HEADER);

	assert(initial_grid().get_rows() == 0 && initial_grid().get_cols() == 0);

	grid_builder->build(&initial_grid());
}
开发者ID:asimonov-im,项目名称:wesnoth,代码行数:9,代码来源:container.cpp


示例18: save

 inline void save(Archive& ar, boost::intrusive_ptr<T> const& t,
     unsigned int const)
 {
     // The most common cause of trapping here would be serializing
     // something like intrusive_ptr<int>.  This occurs because int
     // is never tracked by default.  Wrap int in a trackable type
     BOOST_STATIC_ASSERT((tracking_level<T>::value != track_never));
     T const* ptr = t.get();
     ar << ptr;
 }
开发者ID:Stevejohntest,项目名称:hpx,代码行数:10,代码来源:serialize_intrusive_ptr.hpp


示例19: AddObj

void tStorage::AddObj(boost::intrusive_ptr<tObj> obj) {
    tSendData tmp;
    tmp.pos=obj->GetPos();
    tmp.dir=obj->tz;
    tmp.up=obj->ty;
    //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//	tmp.uin=obj->uin;
//	tmp.radius=obj->radius;
//	physObj.push_back(tmp);
}
开发者ID:sirdyf,项目名称:ENEV_2_261,代码行数:10,代码来源:tStorage.cpp


示例20: DocumentSourceNeedsMongod

DocumentSourceLookUp::DocumentSourceLookUp(NamespaceString fromNs,
                                           std::string as,
                                           std::string localField,
                                           std::string foreignField,
                                           const boost::intrusive_ptr<ExpressionContext>& pExpCtx)
    : DocumentSourceNeedsMongod(pExpCtx),
      _fromNs(std::move(fromNs)),
      _as(std::move(as)),
      _localField(std::move(localField)),
      _foreignField(foreignField),
      _foreignFieldFieldName(std::move(foreignField)) {
    const auto& resolvedNamespace = pExpCtx->getResolvedNamespace(_fromNs);
    _fromExpCtx = pExpCtx->copyWith(resolvedNamespace.ns);
    _fromPipeline = resolvedNamespace.pipeline;

    // We append an additional BSONObj to '_fromPipeline' as a placeholder for the $match stage
    // we'll eventually construct from the input document.
    _fromPipeline.reserve(_fromPipeline.size() + 1);
    _fromPipeline.push_back(BSONObj());
}
开发者ID:ksuarz,项目名称:mongo,代码行数:20,代码来源:document_source_lookup.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ boost::iterator_range类代码示例发布时间:2022-05-31
下一篇:
C++ boost::format类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap