本文整理汇总了C++中boost::intrusive_ptr类的典型用法代码示例。如果您正苦于以下问题:C++ intrusive_ptr类的具体用法?C++ intrusive_ptr怎么用?C++ intrusive_ptr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了intrusive_ptr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
示例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;
}
}
示例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);
}
}
示例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
示例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);
}
示例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));
}
示例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();
}
示例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);
}
示例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);
}
示例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();
}
}
示例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();
}
示例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)
{}
示例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;
}
示例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());
}
示例15: drawScene
void drawScene()
{
program_->create();
program_->bind();
applyCamera();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
game_->getRenderService()->draw();
glDisable(GL_BLEND);
program_->unbind();
}