diff options
author | Andrew Morrow <acm@mongodb.com> | 2015-06-10 17:43:13 -0400 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2015-06-10 22:37:44 -0400 |
commit | a9b6612f5322f916298c19a6728817a1034c6aab (patch) | |
tree | 0da5b1ce36e6a8e2d85dbdeb49d505ac99bf6e1d /src/mongo/dbtests | |
parent | 0ec1e625760eb9c1a20a3dba78200e8f9ff28d9e (diff) | |
download | mongo-a9b6612f5322f916298c19a6728817a1034c6aab.tar.gz |
SERVER-17309 Replace std::auto_ptr<T> with std::unique_ptr<T>
Diffstat (limited to 'src/mongo/dbtests')
27 files changed, 135 insertions, 135 deletions
diff --git a/src/mongo/dbtests/clienttests.cpp b/src/mongo/dbtests/clienttests.cpp index c7cb467983b..c35db8eb404 100644 --- a/src/mongo/dbtests/clienttests.cpp +++ b/src/mongo/dbtests/clienttests.cpp @@ -38,7 +38,7 @@ namespace ClientTests { - using std::auto_ptr; + using std::unique_ptr; using std::string; using std::vector; @@ -141,7 +141,7 @@ namespace ClientTests { ASSERT_OK(dbtests::createIndex(&txn, ns(), BSON( "a" << 1 << "b" << 1 ) )); - auto_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "a" << 1 << "b" << 1 ) ) ); + unique_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "a" << 1 << "b" << 1 ) ) ); ASSERT_EQUALS( 1111, c->itcount() ); } }; @@ -157,7 +157,7 @@ namespace ClientTests { db.insert(ns(), BSON("i" << i)); } - auto_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "i" << 1 ) ) ); + unique_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "i" << 1 ) ) ); BSONObj o = c->next(); ASSERT( c->more() ); diff --git a/src/mongo/dbtests/dbhelper_tests.cpp b/src/mongo/dbtests/dbhelper_tests.cpp index 24aeb64be2a..9a7f2de4103 100644 --- a/src/mongo/dbtests/dbhelper_tests.cpp +++ b/src/mongo/dbtests/dbhelper_tests.cpp @@ -39,7 +39,7 @@ namespace mongo { - using std::auto_ptr; + using std::unique_ptr; using std::set; /** @@ -96,7 +96,7 @@ namespace mongo { BSONArray docs(OperationContext* txn) const { DBDirectClient client(txn); - auto_ptr<DBClientCursor> cursor = client.query( ns, + unique_ptr<DBClientCursor> cursor = client.query( ns, Query().hint( BSON( "_id" << 1 ) ) ); BSONArrayBuilder bab; while ( cursor->more() ) { diff --git a/src/mongo/dbtests/directclienttests.cpp b/src/mongo/dbtests/directclienttests.cpp index fc076a9f926..e7503413b9e 100644 --- a/src/mongo/dbtests/directclienttests.cpp +++ b/src/mongo/dbtests/directclienttests.cpp @@ -44,7 +44,7 @@ namespace DirectClientTests { - using std::auto_ptr; + using std::unique_ptr; using std::vector; class ClientBase { @@ -127,7 +127,7 @@ namespace DirectClientTests { OperationContextImpl txn; DBDirectClient client(&txn); - auto_ptr<DBClientCursor> cursor = client.query( "", Query(), 1 ); + unique_ptr<DBClientCursor> cursor = client.query( "", Query(), 1 ); ASSERT(cursor->more()); BSONObj result = cursor->next().getOwned(); ASSERT( result.hasField( "$err" )); @@ -141,7 +141,7 @@ namespace DirectClientTests { OperationContextImpl txn; DBDirectClient client(&txn); - auto_ptr<DBClientCursor> cursor = client.getMore("", 1, 1); + unique_ptr<DBClientCursor> cursor = client.getMore("", 1, 1); ASSERT(cursor->more()); BSONObj result = cursor->next().getOwned(); ASSERT(result.hasField("$err")); diff --git a/src/mongo/dbtests/executor_registry.cpp b/src/mongo/dbtests/executor_registry.cpp index a22187460be..af365b37e46 100644 --- a/src/mongo/dbtests/executor_registry.cpp +++ b/src/mongo/dbtests/executor_registry.cpp @@ -47,7 +47,7 @@ namespace ExecutorRegistry { - using std::auto_ptr; + using std::unique_ptr; class ExecutorRegistryBase { public: @@ -66,12 +66,12 @@ namespace ExecutorRegistry { * Return a plan executor that is going over the collection in ns(). */ PlanExecutor* getCollscan() { - auto_ptr<WorkingSet> ws(new WorkingSet()); + unique_ptr<WorkingSet> ws(new WorkingSet()); CollectionScanParams params; params.collection = collection(); params.direction = CollectionScanParams::FORWARD; params.tailable = false; - auto_ptr<CollectionScan> scan(new CollectionScan(&_opCtx, params, ws.get(), NULL)); + unique_ptr<CollectionScan> scan(new CollectionScan(&_opCtx, params, ws.get(), NULL)); // Create a plan executor to hold it CanonicalQuery* cq; @@ -115,7 +115,7 @@ namespace ExecutorRegistry { // Order of these is important for initialization OperationContextImpl _opCtx; - auto_ptr<OldClientWriteContext> _ctx; + unique_ptr<OldClientWriteContext> _ctx; DBDirectClient _client; }; @@ -128,7 +128,7 @@ namespace ExecutorRegistry { return; } - auto_ptr<PlanExecutor> run(getCollscan()); + unique_ptr<PlanExecutor> run(getCollscan()); BSONObj obj; // Read some of it. @@ -170,7 +170,7 @@ namespace ExecutorRegistry { class ExecutorRegistryDropCollection : public ExecutorRegistryBase { public: void run() { - auto_ptr<PlanExecutor> run(getCollscan()); + unique_ptr<PlanExecutor> run(getCollscan()); BSONObj obj; // Read some of it. @@ -213,7 +213,7 @@ namespace ExecutorRegistry { class ExecutorRegistryDropAllIndices : public ExecutorRegistryBase { public: void run() { - auto_ptr<PlanExecutor> run(getCollscan()); + unique_ptr<PlanExecutor> run(getCollscan()); BSONObj obj; ASSERT_OK(dbtests::createIndex(&_opCtx, ns(), BSON("foo" << 1))); @@ -244,7 +244,7 @@ namespace ExecutorRegistry { class ExecutorRegistryDropOneIndex : public ExecutorRegistryBase { public: void run() { - auto_ptr<PlanExecutor> run(getCollscan()); + unique_ptr<PlanExecutor> run(getCollscan()); BSONObj obj; ASSERT_OK(dbtests::createIndex(&_opCtx, ns(), BSON("foo" << 1))); @@ -275,7 +275,7 @@ namespace ExecutorRegistry { class ExecutorRegistryDropDatabase : public ExecutorRegistryBase { public: void run() { - auto_ptr<PlanExecutor> run(getCollscan()); + unique_ptr<PlanExecutor> run(getCollscan()); BSONObj obj; // Read some of it. diff --git a/src/mongo/dbtests/jstests.cpp b/src/mongo/dbtests/jstests.cpp index 07098656497..fcd271bd3fc 100644 --- a/src/mongo/dbtests/jstests.cpp +++ b/src/mongo/dbtests/jstests.cpp @@ -48,7 +48,7 @@ #include "mongo/util/timer.h" using boost::scoped_ptr; -using std::auto_ptr; +using std::unique_ptr; using std::cout; using std::endl; using std::string; @@ -92,7 +92,7 @@ namespace JSTests { public: void run() { /* Currently reset does not clear data in v8 or spidermonkey scopes. See SECURITY-10 - auto_ptr<Scope> s; + unique_ptr<Scope> s; s.reset( globalScriptEngine->newScope() ); s->setBoolean( "x" , true ); @@ -655,7 +655,7 @@ namespace JSTests { class NumberLong { public: void run() { - auto_ptr<Scope> s( globalScriptEngine->newScope() ); + unique_ptr<Scope> s( globalScriptEngine->newScope() ); BSONObjBuilder b; long long val = (long long)( 0xbabadeadbeefbaddULL ); b.append( "a", val ); @@ -715,7 +715,7 @@ namespace JSTests { class NumberLong2 { public: void run() { - auto_ptr<Scope> s( globalScriptEngine->newScope() ); + unique_ptr<Scope> s( globalScriptEngine->newScope() ); BSONObj in; { @@ -742,7 +742,7 @@ namespace JSTests { class NumberLongUnderLimit { public: void run() { - auto_ptr<Scope> s( globalScriptEngine->newScope() ); + unique_ptr<Scope> s( globalScriptEngine->newScope() ); BSONObjBuilder b; // limit is 2^53 @@ -788,7 +788,7 @@ namespace JSTests { class InvalidTimestamp { public: void run() { - auto_ptr<Scope> s( globalScriptEngine->newScope() ); + unique_ptr<Scope> s( globalScriptEngine->newScope() ); // Timestamp 't' component cannot exceed max for int32_t. BSONObj in; @@ -966,7 +966,7 @@ namespace JSTests { if( !globalScriptEngine->utf8Ok() ) return; - auto_ptr<Scope> s; + unique_ptr<Scope> s; s.reset( globalScriptEngine->newScope() ); BSONObj b; @@ -1928,7 +1928,7 @@ namespace JSTests { BSONObj start = BSON( "x" << 5.0 ); BSONObj empty; - auto_ptr<Scope> s; + unique_ptr<Scope> s; s.reset( globalScriptEngine->newScope() ); ScriptingFunction f = s->createFunction( "return this.x + 6;" ); @@ -1946,7 +1946,7 @@ namespace JSTests { class ScopeOut { public: void run() { - auto_ptr<Scope> s; + unique_ptr<Scope> s; s.reset( globalScriptEngine->newScope() ); s->invokeSafe( "x = 5;" , 0, 0 ); @@ -1972,7 +1972,7 @@ namespace JSTests { class RenameTest { public: void run() { - auto_ptr<Scope> s; + unique_ptr<Scope> s; s.reset( globalScriptEngine->newScope() ); s->setNumber( "x" , 5 ); diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.cpp b/src/mongo/dbtests/mock/mock_dbclient_connection.cpp index 28a04779d25..46cb3f2b732 100644 --- a/src/mongo/dbtests/mock/mock_dbclient_connection.cpp +++ b/src/mongo/dbtests/mock/mock_dbclient_connection.cpp @@ -75,7 +75,7 @@ namespace mongo { return false; } - std::auto_ptr<mongo::DBClientCursor> MockDBClientConnection::query(const string& ns, + std::unique_ptr<mongo::DBClientCursor> MockDBClientConnection::query(const string& ns, mongo::Query query, int nToReturn, int nToSkip, @@ -88,7 +88,7 @@ namespace mongo { mongo::BSONArray result(_remoteServer->query(_remoteServerInstanceID, ns, query, nToReturn, nToSkip, fieldsToReturn, queryOptions, batchSize)); - std::auto_ptr<mongo::DBClientCursor> cursor; + std::unique_ptr<mongo::DBClientCursor> cursor; cursor.reset(new MockDBClientCursor(this, result)); return cursor; } @@ -97,7 +97,7 @@ namespace mongo { throw; } - std::auto_ptr<mongo::DBClientCursor> nullPtr; + std::unique_ptr<mongo::DBClientCursor> nullPtr; return nullPtr; } diff --git a/src/mongo/dbtests/mock/mock_dbclient_connection.h b/src/mongo/dbtests/mock/mock_dbclient_connection.h index 8fa1a890c90..38016a0eb8e 100644 --- a/src/mongo/dbtests/mock/mock_dbclient_connection.h +++ b/src/mongo/dbtests/mock/mock_dbclient_connection.h @@ -68,7 +68,7 @@ namespace mongo { bool runCommand(const std::string& dbname, const mongo::BSONObj& cmdObj, mongo::BSONObj &info, int options = 0); - std::auto_ptr<mongo::DBClientCursor> query(const std::string &ns, + std::unique_ptr<mongo::DBClientCursor> query(const std::string &ns, mongo::Query query = mongo::Query(), int nToReturn = 0, int nToSkip = 0, diff --git a/src/mongo/dbtests/mock_dbclient_conn_test.cpp b/src/mongo/dbtests/mock_dbclient_conn_test.cpp index 09a88ea316a..e88bf1f5054 100644 --- a/src/mongo/dbtests/mock_dbclient_conn_test.cpp +++ b/src/mongo/dbtests/mock_dbclient_conn_test.cpp @@ -84,7 +84,7 @@ namespace mongo_test { { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns); ASSERT(!cursor->more()); server.insert(ns, BSON("x" << 1)); @@ -93,7 +93,7 @@ namespace mongo_test { { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns); ASSERT(cursor->more()); BSONObj firstDoc = cursor->next(); @@ -109,7 +109,7 @@ namespace mongo_test { // Make sure that repeated calls will still give you the same result { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns); ASSERT(cursor->more()); BSONObj firstDoc = cursor->next(); @@ -131,7 +131,7 @@ namespace mongo_test { { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns); ASSERT(cursor->more()); BSONObj firstDoc = cursor->next(); @@ -142,7 +142,7 @@ namespace mongo_test { { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns); ASSERT(cursor->more()); BSONObj firstDoc = cursor->next(); @@ -162,7 +162,7 @@ namespace mongo_test { server.insert(ns, BSON("x" << 1)); MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query("other.ns"); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query("other.ns"); ASSERT(!cursor->more()); } @@ -187,7 +187,7 @@ namespace mongo_test { { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns1); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns1); ASSERT(cursor->more()); BSONObj firstDoc = cursor->next(); @@ -202,7 +202,7 @@ namespace mongo_test { { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns2); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns2); ASSERT(cursor->more()); BSONObj firstDoc = cursor->next(); @@ -221,7 +221,7 @@ namespace mongo_test { { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns3); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns3); ASSERT(cursor->more()); BSONObj firstDoc = cursor->next(); @@ -237,7 +237,7 @@ namespace mongo_test { { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns); ASSERT(!cursor->more()); conn.insert(ns, BSON("x" << 1)); @@ -251,7 +251,7 @@ namespace mongo_test { { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns); ASSERT(!cursor->more()); } @@ -259,7 +259,7 @@ namespace mongo_test { // Make sure that repeated calls will still give you the same result { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns); ASSERT(!cursor->more()); } @@ -287,13 +287,13 @@ namespace mongo_test { MockDBClientConnection conn(&server); conn.remove(ns2, Query(), false); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns2); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns2); ASSERT(!cursor->more()); } { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns1); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns1); ASSERT(cursor->more()); BSONObj firstDoc = cursor->next(); @@ -308,7 +308,7 @@ namespace mongo_test { { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns3); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns3); ASSERT(cursor->more()); BSONObj firstDoc = cursor->next(); @@ -341,7 +341,7 @@ namespace mongo_test { { MockDBClientConnection conn(&server); - std::auto_ptr<mongo::DBClientCursor> cursor = conn.query(ns); + std::unique_ptr<mongo::DBClientCursor> cursor = conn.query(ns); ASSERT(cursor->more()); BSONObj firstDoc = cursor->next(); diff --git a/src/mongo/dbtests/namespacetests.cpp b/src/mongo/dbtests/namespacetests.cpp index f8b6c0d95f1..1fa48c03631 100644 --- a/src/mongo/dbtests/namespacetests.cpp +++ b/src/mongo/dbtests/namespacetests.cpp @@ -370,7 +370,7 @@ namespace NamespaceTests { RecordId last, first; { - auto_ptr<Runner> runner(InternalPlanner::collectionScan(&txn, + unique_ptr<Runner> runner(InternalPlanner::collectionScan(&txn, ns(), collection(), InternalPlanner::BACKWARD)); @@ -378,7 +378,7 @@ namespace NamespaceTests { ASSERT( !last.isNull() ); } { - auto_ptr<Runner> runner(InternalPlanner::collectionScan(&txn, + unique_ptr<Runner> runner(InternalPlanner::collectionScan(&txn, ns(), collection(), InternalPlanner::FORWARD)); @@ -392,7 +392,7 @@ namespace NamespaceTests { { RecordId loc; - auto_ptr<Runner> runner(InternalPlanner::collectionScan(&txn, + unique_ptr<Runner> runner(InternalPlanner::collectionScan(&txn, ns(), collection(), InternalPlanner::FORWARD)); @@ -400,7 +400,7 @@ namespace NamespaceTests { ASSERT( first == loc); } { - auto_ptr<Runner> runner(InternalPlanner::collectionScan(&txn, + unique_ptr<Runner> runner(InternalPlanner::collectionScan(&txn, ns(), collection(), InternalPlanner::BACKWARD)); diff --git a/src/mongo/dbtests/query_multi_plan_runner.cpp b/src/mongo/dbtests/query_multi_plan_runner.cpp index 8525f2bdade..c43b5ab111b 100644 --- a/src/mongo/dbtests/query_multi_plan_runner.cpp +++ b/src/mongo/dbtests/query_multi_plan_runner.cpp @@ -58,14 +58,14 @@ namespace mongo { namespace QueryMultiPlanRunner { using boost::scoped_ptr; - using std::auto_ptr; + using std::unique_ptr; using std::vector; /** * Create query solution. */ QuerySolution* createQuerySolution() { - std::auto_ptr<QuerySolution> soln(new QuerySolution()); + std::unique_ptr<QuerySolution> soln(new QuerySolution()); soln->cacheData.reset(new SolutionCacheData()); soln->cacheData->solnType = SolutionCacheData::COLLSCAN_SOLN; soln->cacheData->tree.reset(new PlanCacheIndexTree()); @@ -132,9 +132,9 @@ namespace QueryMultiPlanRunner { ixparams.bounds.endKeyInclusive = true; ixparams.direction = 1; - auto_ptr<WorkingSet> sharedWs(new WorkingSet()); + unique_ptr<WorkingSet> sharedWs(new WorkingSet()); IndexScan* ix = new IndexScan(&_txn, ixparams, sharedWs.get(), NULL); - auto_ptr<PlanStage> firstRoot(new FetchStage(&_txn, sharedWs.get(), ix, NULL, coll)); + unique_ptr<PlanStage> firstRoot(new FetchStage(&_txn, sharedWs.get(), ix, NULL, coll)); // Plan 1: CollScan with matcher. CollectionScanParams csparams; @@ -145,9 +145,9 @@ namespace QueryMultiPlanRunner { BSONObj filterObj = BSON("foo" << 7); StatusWithMatchExpression swme = MatchExpressionParser::parse(filterObj); verify(swme.isOK()); - auto_ptr<MatchExpression> filter(swme.getValue()); + unique_ptr<MatchExpression> filter(swme.getValue()); // Make the stage. - auto_ptr<PlanStage> secondRoot(new CollectionScan(&_txn, csparams, sharedWs.get(), + unique_ptr<PlanStage> secondRoot(new CollectionScan(&_txn, csparams, sharedWs.get(), filter.get())); // Hand the plans off to the runner. diff --git a/src/mongo/dbtests/query_plan_executor.cpp b/src/mongo/dbtests/query_plan_executor.cpp index 9d771acdbfe..e79c9980898 100644 --- a/src/mongo/dbtests/query_plan_executor.cpp +++ b/src/mongo/dbtests/query_plan_executor.cpp @@ -53,7 +53,7 @@ namespace QueryPlanExecutor { using boost::scoped_ptr; using boost::shared_ptr; - using std::auto_ptr; + using std::unique_ptr; using std::string; class PlanExecutorBase { @@ -97,7 +97,7 @@ namespace QueryPlanExecutor { CollectionScanParams csparams; csparams.collection = coll; csparams.direction = CollectionScanParams::FORWARD; - auto_ptr<WorkingSet> ws(new WorkingSet()); + unique_ptr<WorkingSet> ws(new WorkingSet()); // Canonicalize the query CanonicalQuery* cq; @@ -105,7 +105,7 @@ namespace QueryPlanExecutor { verify(NULL != cq); // Make the stage. - auto_ptr<PlanStage> root(new CollectionScan(&_txn, csparams, ws.get(), cq->root())); + unique_ptr<PlanStage> root(new CollectionScan(&_txn, csparams, ws.get(), cq->root())); PlanExecutor* exec; // Hand the plan off to the executor. @@ -140,9 +140,9 @@ namespace QueryPlanExecutor { const Collection* coll = db->getCollection(ns()); - auto_ptr<WorkingSet> ws(new WorkingSet()); + unique_ptr<WorkingSet> ws(new WorkingSet()); IndexScan* ix = new IndexScan(&_txn, ixparams, ws.get(), NULL); - auto_ptr<PlanStage> root(new FetchStage(&_txn, ws.get(), ix, NULL, coll)); + unique_ptr<PlanStage> root(new FetchStage(&_txn, ws.get(), ix, NULL, coll)); CanonicalQuery* cq; verify(CanonicalQuery::canonicalize(ns(), BSONObj(), &cq).isOK()); @@ -284,8 +284,8 @@ namespace QueryPlanExecutor { ASSERT_EQUALS(errmsg, ""); // Create the output PlanExecutor that pulls results from the pipeline. - std::auto_ptr<WorkingSet> ws(new WorkingSet()); - std::auto_ptr<PipelineProxyStage> proxy( + std::unique_ptr<WorkingSet> ws(new WorkingSet()); + std::unique_ptr<PipelineProxyStage> proxy( new PipelineProxyStage(pipeline, innerExec, ws.get())); Collection* collection = ctx.getCollection(); diff --git a/src/mongo/dbtests/query_stage_and.cpp b/src/mongo/dbtests/query_stage_and.cpp index 29db2eaf104..8b59cc7304b 100644 --- a/src/mongo/dbtests/query_stage_and.cpp +++ b/src/mongo/dbtests/query_stage_and.cpp @@ -56,7 +56,7 @@ namespace QueryStageAnd { using boost::scoped_ptr; using boost::shared_ptr; - using std::auto_ptr; + using std::unique_ptr; using std::set; class QueryStageAndBase { @@ -759,7 +759,7 @@ namespace QueryStageAnd { BSONObj filter = BSON("bar" << 97); StatusWithMatchExpression swme = MatchExpressionParser::parse(filter); verify(swme.isOK()); - auto_ptr<MatchExpression> filterExpr(swme.getValue()); + unique_ptr<MatchExpression> filterExpr(swme.getValue()); scoped_ptr<AndHashStage> ah(new AndHashStage(&ws, filterExpr.get(), coll)); // Foo <= 20 @@ -1338,7 +1338,7 @@ namespace QueryStageAnd { BSONObj filterObj = BSON("foo" << BSON("$ne" << 1)); StatusWithMatchExpression swme = MatchExpressionParser::parse(filterObj); verify(swme.isOK()); - auto_ptr<MatchExpression> filterExpr(swme.getValue()); + unique_ptr<MatchExpression> filterExpr(swme.getValue()); scoped_ptr<AndSortedStage> ah(new AndSortedStage(&ws, filterExpr.get(), coll)); // Scan over foo == 1 diff --git a/src/mongo/dbtests/query_stage_collscan.cpp b/src/mongo/dbtests/query_stage_collscan.cpp index ab6ea366ea9..ffb204c2623 100644 --- a/src/mongo/dbtests/query_stage_collscan.cpp +++ b/src/mongo/dbtests/query_stage_collscan.cpp @@ -50,7 +50,7 @@ namespace QueryStageCollectionScan { using boost::scoped_ptr; - using std::auto_ptr; + using std::unique_ptr; using std::vector; // @@ -90,7 +90,7 @@ namespace QueryStageCollectionScan { // Make the filter. StatusWithMatchExpression swme = MatchExpressionParser::parse(filterObj); verify(swme.isOK()); - auto_ptr<MatchExpression> filterExpr(swme.getValue()); + unique_ptr<MatchExpression> filterExpr(swme.getValue()); // Make a scan and have the runner own it. WorkingSet* ws = new WorkingSet(); diff --git a/src/mongo/dbtests/query_stage_count.cpp b/src/mongo/dbtests/query_stage_count.cpp index d2bca4701a4..7adc5b6996f 100644 --- a/src/mongo/dbtests/query_stage_count.cpp +++ b/src/mongo/dbtests/query_stage_count.cpp @@ -44,7 +44,7 @@ namespace QueryStageCount { using boost::scoped_ptr; - using std::auto_ptr; + using std::unique_ptr; using std::vector; const int kDocuments = 100; @@ -147,10 +147,10 @@ namespace QueryStageCount { setup(); getLocs(); - auto_ptr<WorkingSet> ws(new WorkingSet); + unique_ptr<WorkingSet> ws(new WorkingSet); StatusWithMatchExpression swme = MatchExpressionParser::parse(request.query); - auto_ptr<MatchExpression> expression(swme.getValue()); + unique_ptr<MatchExpression> expression(swme.getValue()); PlanStage* scan; if (indexed) { diff --git a/src/mongo/dbtests/query_stage_fetch.cpp b/src/mongo/dbtests/query_stage_fetch.cpp index e33d9b08420..d03a619a9b2 100644 --- a/src/mongo/dbtests/query_stage_fetch.cpp +++ b/src/mongo/dbtests/query_stage_fetch.cpp @@ -48,7 +48,7 @@ namespace QueryStageFetch { using boost::shared_ptr; - using std::auto_ptr; + using std::unique_ptr; using std::set; class QueryStageFetchBase { @@ -108,7 +108,7 @@ namespace QueryStageFetch { ASSERT_EQUALS(size_t(1), locs.size()); // Create a mock stage that returns the WSM. - auto_ptr<QueuedDataStage> mockStage(new QueuedDataStage(&ws)); + unique_ptr<QueuedDataStage> mockStage(new QueuedDataStage(&ws)); // Mock data. { @@ -126,7 +126,7 @@ namespace QueryStageFetch { mockStage->pushBack(mockMember); } - auto_ptr<FetchStage> fetchStage(new FetchStage(&_txn, &ws, mockStage.release(), + unique_ptr<FetchStage> fetchStage(new FetchStage(&_txn, &ws, mockStage.release(), NULL, coll)); WorkingSetID id = WorkingSet::INVALID_ID; @@ -170,7 +170,7 @@ namespace QueryStageFetch { ASSERT_EQUALS(size_t(1), locs.size()); // Create a mock stage that returns the WSM. - auto_ptr<QueuedDataStage> mockStage(new QueuedDataStage(&ws)); + unique_ptr<QueuedDataStage> mockStage(new QueuedDataStage(&ws)); // Mock data. { @@ -188,10 +188,10 @@ namespace QueryStageFetch { BSONObj filterObj = BSON("foo" << 6); StatusWithMatchExpression swme = MatchExpressionParser::parse(filterObj); verify(swme.isOK()); - auto_ptr<MatchExpression> filterExpr(swme.getValue()); + unique_ptr<MatchExpression> filterExpr(swme.getValue()); // Matcher requires that foo==6 but we only have data with foo==5. - auto_ptr<FetchStage> fetchStage( + unique_ptr<FetchStage> fetchStage( new FetchStage(&_txn, &ws, mockStage.release(), filterExpr.get(), coll)); // First call should return a fetch request as it's not in memory. diff --git a/src/mongo/dbtests/query_stage_ixscan.cpp b/src/mongo/dbtests/query_stage_ixscan.cpp index e3f5f8877cc..e56ba1128f4 100644 --- a/src/mongo/dbtests/query_stage_ixscan.cpp +++ b/src/mongo/dbtests/query_stage_ixscan.cpp @@ -159,7 +159,7 @@ namespace QueryStageIxscan { // Make the {x: 1} index multikey by inserting a doc where 'x' is an array. insert(fromjson("{_id: 1, x: [1, 2, 3]}")); - std::auto_ptr<IndexScan> ixscan( + std::unique_ptr<IndexScan> ixscan( createIndexScanSimpleRange(BSON("x" << 1), BSON("x" << 3))); // Verify that SpecificStats of 'ixscan' have been properly initialized. diff --git a/src/mongo/dbtests/query_stage_keep.cpp b/src/mongo/dbtests/query_stage_keep.cpp index 743d1f7bdd2..00de94c770d 100644 --- a/src/mongo/dbtests/query_stage_keep.cpp +++ b/src/mongo/dbtests/query_stage_keep.cpp @@ -143,7 +143,7 @@ namespace QueryStageKeep { // Create a KeepMutations stage to merge in the 10 flagged objects. // Takes ownership of 'cs' MatchExpression* nullFilter = NULL; - std::auto_ptr<KeepMutationsStage> keep(new KeepMutationsStage(nullFilter, &ws, cs)); + std::unique_ptr<KeepMutationsStage> keep(new KeepMutationsStage(nullFilter, &ws, cs)); for (size_t i = 0; i < 10; ++i) { WorkingSetID id = getNextResult(keep.get()); @@ -191,7 +191,7 @@ namespace QueryStageKeep { // Create a KeepMutationsStage with an EOF child, and flag 50 objects. We expect these // objects to be returned by the KeepMutationsStage. MatchExpression* nullFilter = NULL; - std::auto_ptr<KeepMutationsStage> keep(new KeepMutationsStage(nullFilter, &ws, + std::unique_ptr<KeepMutationsStage> keep(new KeepMutationsStage(nullFilter, &ws, new EOFStage())); for (size_t i = 0; i < 50; ++i) { WorkingSetID id = ws.allocate(); diff --git a/src/mongo/dbtests/query_stage_limit_skip.cpp b/src/mongo/dbtests/query_stage_limit_skip.cpp index bc4697327de..afb4436e4b9 100644 --- a/src/mongo/dbtests/query_stage_limit_skip.cpp +++ b/src/mongo/dbtests/query_stage_limit_skip.cpp @@ -46,7 +46,7 @@ using namespace mongo; namespace { using boost::scoped_ptr; - using std::auto_ptr; + using std::unique_ptr; using std::max; using std::min; @@ -54,7 +54,7 @@ namespace { /* Populate a QueuedDataStage and return it. Caller owns it. */ QueuedDataStage* getMS(WorkingSet* ws) { - auto_ptr<QueuedDataStage> ms(new QueuedDataStage(ws)); + unique_ptr<QueuedDataStage> ms(new QueuedDataStage(ws)); // Put N ADVANCED results into the mock stage, and some other stalling results (YIELD/TIME). for (int i = 0; i < N; ++i) { diff --git a/src/mongo/dbtests/query_stage_merge_sort.cpp b/src/mongo/dbtests/query_stage_merge_sort.cpp index 0c3813e5a37..f4fa4ea9bd7 100644 --- a/src/mongo/dbtests/query_stage_merge_sort.cpp +++ b/src/mongo/dbtests/query_stage_merge_sort.cpp @@ -46,7 +46,7 @@ namespace QueryStageMergeSortTests { - using std::auto_ptr; + using std::unique_ptr; using std::set; using std::string; @@ -527,7 +527,7 @@ namespace QueryStageMergeSortTests { // Sort by foo:1 MergeSortStageParams msparams; msparams.pattern = BSON("foo" << 1); - auto_ptr<MergeSortStage> ms(new MergeSortStage(msparams, &ws, coll)); + unique_ptr<MergeSortStage> ms(new MergeSortStage(msparams, &ws, coll)); IndexScanParams params; params.bounds.isSimpleRange = true; diff --git a/src/mongo/dbtests/query_stage_sort.cpp b/src/mongo/dbtests/query_stage_sort.cpp index dc267b9a8b1..b9b34bda21f 100644 --- a/src/mongo/dbtests/query_stage_sort.cpp +++ b/src/mongo/dbtests/query_stage_sort.cpp @@ -46,7 +46,7 @@ namespace QueryStageSortTests { - using std::auto_ptr; + using std::unique_ptr; using std::set; class QueryStageSortTestBase { @@ -104,15 +104,15 @@ namespace QueryStageSortTests { PlanExecutor* makePlanExecutorWithSortStage(Collection* coll) { PlanExecutor* exec; // Build the mock scan stage which feeds the data. - std::auto_ptr<WorkingSet> ws(new WorkingSet()); - auto_ptr<QueuedDataStage> ms(new QueuedDataStage(ws.get())); + std::unique_ptr<WorkingSet> ws(new WorkingSet()); + unique_ptr<QueuedDataStage> ms(new QueuedDataStage(ws.get())); insertVarietyOfObjects(ms.get(), coll); SortStageParams params; params.collection = coll; params.pattern = BSON("foo" << 1); params.limit = limit(); - auto_ptr<SortStage> ss(new SortStage(params, ws.get(), ms.release())); + unique_ptr<SortStage> ss(new SortStage(params, ws.get(), ms.release())); // The PlanExecutor will be automatically registered on construction due to the auto // yield policy, so it can receive invalidations when we remove documents later. @@ -308,7 +308,7 @@ namespace QueryStageSortTests { set<RecordId> locs; getLocs(&locs, coll); - std::auto_ptr<PlanExecutor> exec(makePlanExecutorWithSortStage(coll)); + std::unique_ptr<PlanExecutor> exec(makePlanExecutorWithSortStage(coll)); SortStage * ss = static_cast<SortStage*>(exec->getRootStage()); QueuedDataStage* ms = static_cast<QueuedDataStage*>(ss->getChildren()[0]); @@ -415,7 +415,7 @@ namespace QueryStageSortTests { set<RecordId> locs; getLocs(&locs, coll); - std::auto_ptr<PlanExecutor> exec(makePlanExecutorWithSortStage(coll)); + std::unique_ptr<PlanExecutor> exec(makePlanExecutorWithSortStage(coll)); SortStage * ss = static_cast<SortStage*>(exec->getRootStage()); QueuedDataStage* ms = static_cast<QueuedDataStage*>(ss->getChildren()[0]); diff --git a/src/mongo/dbtests/query_stage_tests.cpp b/src/mongo/dbtests/query_stage_tests.cpp index 83298723775..c5365d140ae 100644 --- a/src/mongo/dbtests/query_stage_tests.cpp +++ b/src/mongo/dbtests/query_stage_tests.cpp @@ -45,7 +45,7 @@ namespace QueryStageTests { - using std::auto_ptr; + using std::unique_ptr; class IndexScanBase { public: @@ -78,7 +78,7 @@ namespace QueryStageTests { StatusWithMatchExpression swme = MatchExpressionParser::parse(filterObj); verify(swme.isOK()); - auto_ptr<MatchExpression> filterExpr(swme.getValue()); + unique_ptr<MatchExpression> filterExpr(swme.getValue()); WorkingSet* ws = new WorkingSet(); diff --git a/src/mongo/dbtests/query_stage_update.cpp b/src/mongo/dbtests/query_stage_update.cpp index c2686462dbe..92f95f5fdb6 100644 --- a/src/mongo/dbtests/query_stage_update.cpp +++ b/src/mongo/dbtests/query_stage_update.cpp @@ -55,7 +55,7 @@ namespace QueryStageUpdate { using boost::scoped_ptr; - using std::auto_ptr; + using std::unique_ptr; using std::vector; class QueryStageUpdateBase { @@ -219,7 +219,7 @@ namespace QueryStageUpdate { params.canonicalQuery = cq.get(); scoped_ptr<WorkingSet> ws(new WorkingSet()); - auto_ptr<EOFStage> eofStage(new EOFStage()); + unique_ptr<EOFStage> eofStage(new EOFStage()); scoped_ptr<UpdateStage> updateStage( new UpdateStage(&_txn, params, ws.get(), collection, eofStage.release())); @@ -296,7 +296,7 @@ namespace QueryStageUpdate { updateParams.canonicalQuery = cq.get(); scoped_ptr<WorkingSet> ws(new WorkingSet()); - auto_ptr<CollectionScan> cs( + unique_ptr<CollectionScan> cs( new CollectionScan(&_txn, collScanParams, ws.get(), cq->root())); scoped_ptr<UpdateStage> updateStage( diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp index d668cb8e2d4..01415387dd6 100644 --- a/src/mongo/dbtests/querytests.cpp +++ b/src/mongo/dbtests/querytests.cpp @@ -56,7 +56,7 @@ namespace mongo { namespace QueryTests { - using std::auto_ptr; + using std::unique_ptr; using std::cout; using std::endl; using std::string; @@ -264,7 +264,7 @@ namespace QueryTests { insert( ns, BSON( "a" << 1 ) ); insert( ns, BSON( "a" << 2 ) ); insert( ns, BSON( "a" << 3 ) ); - auto_ptr< DBClientCursor > cursor = _client.query( ns, BSONObj(), 2 ); + unique_ptr< DBClientCursor > cursor = _client.query( ns, BSONObj(), 2 ); long long cursorId = cursor->getCursorId(); cursor->decouple(); cursor.reset(); @@ -301,7 +301,7 @@ namespace QueryTests { } // Create a cursor on the collection, with a batch size of 200. - auto_ptr<DBClientCursor> cursor = _client.query( ns, "", 0, 0, 0, 0, 200 ); + unique_ptr<DBClientCursor> cursor = _client.query( ns, "", 0, 0, 0, 0, 200 ); CursorId cursorId = cursor->getCursorId(); // Count 500 results, spanning a few batches of documents. @@ -353,7 +353,7 @@ namespace QueryTests { } // Create a cursor on the collection, with a batch size of 200. - auto_ptr<DBClientCursor> cursor = _client.query( ns, "", 0, 0, 0, 0, 200 ); + unique_ptr<DBClientCursor> cursor = _client.query( ns, "", 0, 0, 0, 0, 200 ); CursorId cursorId = cursor->getCursorId(); // Count 500 results, spanning a few batches of documents. @@ -422,7 +422,7 @@ namespace QueryTests { insert( ns, BSON( "a" << 0 ) ); insert( ns, BSON( "a" << 1 ) ); insert( ns, BSON( "a" << 2 ) ); - auto_ptr< DBClientCursor > c = _client.query( ns, QUERY( "a" << GT << 0 ).hint( BSON( "$natural" << 1 ) ), 1, 0, 0, QueryOption_CursorTailable ); + unique_ptr< DBClientCursor > c = _client.query( ns, QUERY( "a" << GT << 0 ).hint( BSON( "$natural" << 1 ) ), 1, 0, 0, QueryOption_CursorTailable ); // If only one result requested, a cursor is not saved. ASSERT_EQUALS( 0, c->getCursorId() ); ASSERT( c->more() ); @@ -441,7 +441,7 @@ namespace QueryTests { insert( ns, BSON( "a" << 0 ) ); insert( ns, BSON( "a" << 1 ) ); insert( ns, BSON( "a" << 2 ) ); - auto_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable ); + unique_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable ); ASSERT( 0 != c->getCursorId() ); while( c->more() ) c->next(); @@ -463,7 +463,7 @@ namespace QueryTests { void run() { const char *ns = "unittests.querytests.EmptyTail"; _client.createCollection( ns, 1900, true ); - auto_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable ); + unique_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable ); ASSERT_EQUALS( 0, c->getCursorId() ); ASSERT( c->isDead() ); insert( ns, BSON( "a" << 0 ) ); @@ -483,7 +483,7 @@ namespace QueryTests { _client.createCollection( ns, 8192, true, 2 ); insert( ns, BSON( "a" << 0 ) ); insert( ns, BSON( "a" << 1 ) ); - auto_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable ); + unique_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable ); c->next(); c->next(); ASSERT( !c->more() ); @@ -507,7 +507,7 @@ namespace QueryTests { _client.createCollection( ns, 8192, true, 2 ); insert( ns, BSON( "a" << 0 ) ); insert( ns, BSON( "a" << 1 ) ); - auto_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable ); + unique_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable ); c->next(); c->next(); ASSERT( !c->more() ); @@ -533,7 +533,7 @@ namespace QueryTests { _client.createCollection( ns, 1330, true ); insert( ns, BSON( "a" << 0 ) ); insert( ns, BSON( "a" << 1 ) ); - auto_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable ); + unique_ptr< DBClientCursor > c = _client.query( ns, Query().hint( BSON( "$natural" << 1 ) ), 2, 0, 0, QueryOption_CursorTailable ); c->next(); c->next(); ASSERT( !c->more() ); @@ -553,7 +553,7 @@ namespace QueryTests { void run() { const char *ns = "unittests.querytests.TailCappedOnly"; _client.insert( ns, BSONObj() ); - auto_ptr< DBClientCursor > c = _client.query( ns, BSONObj(), 0, 0, 0, QueryOption_CursorTailable ); + unique_ptr< DBClientCursor > c = _client.query( ns, BSONObj(), 0, 0, 0, QueryOption_CursorTailable ); ASSERT( c->isDead() ); } }; @@ -578,10 +578,10 @@ namespace QueryTests { _client.runCommand( "unittests", BSON( "create" << "querytests.TailableQueryOnId" << "capped" << true << "size" << 8192 << "autoIndexId" << true ), info ); insertA( ns, 0 ); insertA( ns, 1 ); - auto_ptr< DBClientCursor > c1 = _client.query( ns, QUERY( "a" << GT << -1 ), 0, 0, 0, QueryOption_CursorTailable ); + unique_ptr< DBClientCursor > c1 = _client.query( ns, QUERY( "a" << GT << -1 ), 0, 0, 0, QueryOption_CursorTailable ); OID id; id.init("000000000000000000000000"); - auto_ptr< DBClientCursor > c2 = _client.query( ns, QUERY( "value" << GT << id ), 0, 0, 0, QueryOption_CursorTailable ); + unique_ptr< DBClientCursor > c2 = _client.query( ns, QUERY( "value" << GT << id ), 0, 0, 0, QueryOption_CursorTailable ); c1->next(); c1->next(); ASSERT( !c1->more() ); @@ -609,7 +609,7 @@ namespace QueryTests { insert( ns, BSON( "ts" << 0 ) ); insert( ns, BSON( "ts" << 1 ) ); insert( ns, BSON( "ts" << 2 ) ); - auto_ptr< DBClientCursor > c = _client.query( ns, QUERY( "ts" << GT << 1 ).hint( BSON( "$natural" << 1 ) ), 0, 0, 0, QueryOption_OplogReplay ); + unique_ptr< DBClientCursor > c = _client.query( ns, QUERY( "ts" << GT << 1 ).hint( BSON( "$natural" << 1 ) ), 0, 0, 0, QueryOption_OplogReplay ); ASSERT( c->more() ); ASSERT_EQUALS( 2, c->next().getIntField( "ts" ) ); ASSERT( !c->more() ); @@ -645,7 +645,7 @@ namespace QueryTests { insert( ns, BSON( "ts" << one ) ); insert( ns, BSON( "ts" << two ) ); insert( ns, BSON( "ts" << three ) ); - auto_ptr<DBClientCursor> c = + unique_ptr<DBClientCursor> c = _client.query( ns, QUERY( "ts" << GTE << two ).hint( BSON( "$natural" << 1 ) ), 0, 0, 0, QueryOption_OplogReplay | QueryOption_CursorTailable ); ASSERT( c->more() ); @@ -668,7 +668,7 @@ namespace QueryTests { insert( ns, BSON( "ts" << 0 ) ); insert( ns, BSON( "ts" << 1 ) ); insert( ns, BSON( "ts" << 2 ) ); - auto_ptr< DBClientCursor > c = _client.query( + unique_ptr< DBClientCursor > c = _client.query( ns, QUERY( "ts" << GT << 1 ).hint( BSON( "$natural" << 1 ) ).explain(), 0, 0, 0, QueryOption_OplogReplay ); ASSERT( c->more() ); @@ -968,7 +968,7 @@ namespace QueryTests { check( 1, 2, 2, 2, 2, hints[ i ] ); check( 1, 2, 2, 1, 1, hints[ i ] ); - auto_ptr< DBClientCursor > c = query( 1, 2, 2, 2, hints[ i ] ); + unique_ptr< DBClientCursor > c = query( 1, 2, 2, 2, hints[ i ] ); BSONObj obj = c->next(); ASSERT_EQUALS( 1, obj.getIntField( "a" ) ); ASSERT_EQUALS( 2, obj.getIntField( "b" ) ); @@ -979,7 +979,7 @@ namespace QueryTests { } } private: - auto_ptr< DBClientCursor > query( int minA, int minB, int maxA, int maxB, const BSONObj &hint ) { + unique_ptr< DBClientCursor > query( int minA, int minB, int maxA, int maxB, const BSONObj &hint ) { Query q; q = q.minKey( BSON( "a" << minA << "b" << minB ) ).maxKey( BSON( "a" << maxA << "b" << maxB ) ); if ( !hint.isEmpty() ) @@ -989,7 +989,7 @@ namespace QueryTests { void check( int minA, int minB, int maxA, int maxB, int expectedCount, const BSONObj &hint = empty_ ) { ASSERT_EQUALS( expectedCount, count( query( minA, minB, maxA, maxB, hint ) ) ); } - int count( auto_ptr< DBClientCursor > c ) { + int count( unique_ptr< DBClientCursor > c ) { int ret = 0; while( c->more() ) { ++ret; @@ -1113,7 +1113,7 @@ namespace QueryTests { _client.dropCollection( "unittests.querytests.DifferentNumbers" ); } void t( const char * ns ) { - auto_ptr< DBClientCursor > cursor = _client.query( ns, Query().sort( "7" ) ); + unique_ptr< DBClientCursor > cursor = _client.query( ns, Query().sort( "7" ) ); while ( cursor->more() ) { BSONObj o = cursor->next(); verify( o.valid() ); @@ -1214,7 +1214,7 @@ namespace QueryTests { int a = count(); - auto_ptr< DBClientCursor > c = _client.query( ns() , QUERY( "i" << GT << 0 ).hint( BSON( "$natural" << 1 ) ), 0, 0, 0, QueryOption_CursorTailable ); + unique_ptr< DBClientCursor > c = _client.query( ns() , QUERY( "i" << GT << 0 ).hint( BSON( "$natural" << 1 ) ), 0, 0, 0, QueryOption_CursorTailable ); int n=0; while ( c->more() ) { BSONObj z = c->next(); @@ -1362,7 +1362,7 @@ namespace QueryTests { _client.insert( ns(), BSON( "ts" << i++ ) ); int min = _client.query( ns(), Query().sort( BSON( "$natural" << 1 ) ) )->next()[ "ts" ].numberInt(); for( int j = -1; j < i; ++j ) { - auto_ptr< DBClientCursor > c = _client.query( ns(), QUERY( "ts" << GTE << j ), 0, 0, 0, QueryOption_OplogReplay ); + unique_ptr< DBClientCursor > c = _client.query( ns(), QUERY( "ts" << GTE << j ), 0, 0, 0, QueryOption_OplogReplay ); ASSERT( c->more() ); BSONObj next = c->next(); ASSERT( !next[ "ts" ].eoo() ); @@ -1392,7 +1392,7 @@ namespace QueryTests { _client.insert( ns(), BSON( "ts" << i++ ) ); int min = _client.query( ns(), Query().sort( BSON( "$natural" << 1 ) ) )->next()[ "ts" ].numberInt(); for( int j = -1; j < i; ++j ) { - auto_ptr< DBClientCursor > c = _client.query( ns(), QUERY( "ts" << GTE << j ), 0, 0, 0, QueryOption_OplogReplay ); + unique_ptr< DBClientCursor > c = _client.query( ns(), QUERY( "ts" << GTE << j ), 0, 0, 0, QueryOption_OplogReplay ); ASSERT( c->more() ); BSONObj next = c->next(); ASSERT( !next[ "ts" ].eoo() ); @@ -1418,14 +1418,14 @@ namespace QueryTests { size_t startNumCursors = numCursorsOpen(); // Check OplogReplay mode with missing collection. - auto_ptr< DBClientCursor > c0 = _client.query( ns(), QUERY( "ts" << GTE << 50 ), 0, 0, 0, QueryOption_OplogReplay ); + unique_ptr< DBClientCursor > c0 = _client.query( ns(), QUERY( "ts" << GTE << 50 ), 0, 0, 0, QueryOption_OplogReplay ); ASSERT( !c0->more() ); BSONObj info; ASSERT( _client.runCommand( "unittests", BSON( "create" << "querytests.findingstart" << "capped" << true << "$nExtents" << 5 << "autoIndexId" << false ), info ) ); // Check OplogReplay mode with empty collection. - auto_ptr< DBClientCursor > c = _client.query( ns(), QUERY( "ts" << GTE << 50 ), 0, 0, 0, QueryOption_OplogReplay ); + unique_ptr< DBClientCursor > c = _client.query( ns(), QUERY( "ts" << GTE << 50 ), 0, 0, 0, QueryOption_OplogReplay ); ASSERT( !c->more() ); // Check with some docs in the collection. @@ -1495,7 +1495,7 @@ namespace QueryTests { for( int i = 0; i < 150; ++i ) { insert( ns(), BSONObj() ); } - auto_ptr<DBClientCursor> c = _client.query( ns(), Query() ); + unique_ptr<DBClientCursor> c = _client.query( ns(), Query() ); ASSERT( c->more() ); long long cursorId = c->getCursorId(); @@ -1521,7 +1521,7 @@ namespace QueryTests { { // With five results and a batch size of 5, a cursor is created since we don't know // there are no more results. - std::auto_ptr<DBClientCursor> c = _client.query( ns(), Query(), 5 ); + std::unique_ptr<DBClientCursor> c = _client.query( ns(), Query(), 5 ); ASSERT(c->more()); ASSERT_NE(0, c->getCursorId()); for (int i = 0; i < 5; ++i) { @@ -1533,7 +1533,7 @@ namespace QueryTests { { // With a batchsize of 6 we know there are no more results so we don't create a // cursor. - std::auto_ptr<DBClientCursor> c = _client.query( ns(), Query(), 6 ); + std::unique_ptr<DBClientCursor> c = _client.query( ns(), Query(), 6 ); ASSERT(c->more()); ASSERT_EQ(0, c->getCursorId()); } @@ -1549,7 +1549,7 @@ namespace QueryTests { } void run() { _client.insert( ns(), vector<BSONObj>( 3, BSONObj() ) ); - auto_ptr<DBClientCursor> cursor = _client.query( ns(), BSONObj(), 0, 0, 0, 0, 2 ); + unique_ptr<DBClientCursor> cursor = _client.query( ns(), BSONObj(), 0, 0, 0, 0, 2 ); ASSERT_EQUALS( 2, cursor->objsLeftInBatch() ); long long cursorId = cursor->getCursorId(); diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp index 74c250fc098..cb1872f6dd8 100644 --- a/src/mongo/dbtests/repltests.cpp +++ b/src/mongo/dbtests/repltests.cpp @@ -54,7 +54,7 @@ using namespace mongo::repl; namespace ReplTests { - using std::auto_ptr; + using std::unique_ptr; using std::endl; using std::string; using std::stringstream; @@ -120,7 +120,7 @@ namespace ReplTests { check( o, one( o ) ); } void checkAll( const BSONObj &o ) const { - auto_ptr< DBClientCursor > c = _client.query( ns(), o ); + unique_ptr< DBClientCursor > c = _client.query( ns(), o ); verify( c->more() ); while( c->more() ) { check( o, c->next() ); @@ -718,7 +718,7 @@ namespace ReplTests { string s() const { stringstream ss; - auto_ptr<DBClientCursor> cc = _client.query( ns() , Query().sort( BSON( "_id" << 1 ) ) ); + unique_ptr<DBClientCursor> cc = _client.query( ns() , Query().sort( BSON( "_id" << 1 ) ) ); bool first = true; while ( cc->more() ) { if ( first ) first = false; diff --git a/src/mongo/dbtests/sharding.cpp b/src/mongo/dbtests/sharding.cpp index bd5ac493c24..9bc6068c9fb 100644 --- a/src/mongo/dbtests/sharding.cpp +++ b/src/mongo/dbtests/sharding.cpp @@ -48,7 +48,7 @@ namespace ShardingTests { using boost::shared_ptr; - using std::auto_ptr; + using std::unique_ptr; using std::make_pair; using std::map; using std::pair; @@ -218,7 +218,7 @@ namespace ShardingTests { string keyName = "_id"; createChunks( keyName ); - auto_ptr<DBClientCursor> cursor = + unique_ptr<DBClientCursor> cursor = _client.query(ChunkType::ConfigNS, QUERY(ChunkType::ns(collName()))); set<int> minorVersions; diff --git a/src/mongo/dbtests/threadedtests.cpp b/src/mongo/dbtests/threadedtests.cpp index b03f5877e17..3ef74711c04 100644 --- a/src/mongo/dbtests/threadedtests.cpp +++ b/src/mongo/dbtests/threadedtests.cpp @@ -57,7 +57,7 @@ namespace ThreadedTests { - using std::auto_ptr; + using std::unique_ptr; using std::cout; using std::endl; using std::string; @@ -366,7 +366,7 @@ namespace ThreadedTests { */ RWLockRecursiveNongreedy lk( "eliot2" , 120 * 1000 ); cout << "RWLock impl: " << lk.implType() << endl; - auto_ptr<RWLockRecursiveNongreedy::Shared> a( new RWLockRecursiveNongreedy::Shared(lk) ); + unique_ptr<RWLockRecursiveNongreedy::Shared> a( new RWLockRecursiveNongreedy::Shared(lk) ); AtomicUInt32 x1(0); cout << "A : " << &x1 << endl; boost::thread t1( stdx::bind( worker1 , &lk , &x1 ) ); @@ -404,7 +404,7 @@ namespace ThreadedTests { RWLockRecursiveNongreedy lk( "eliot2" , 120 * 1000 ); - auto_ptr<RWLockRecursiveNongreedy::Shared> a( new RWLockRecursiveNongreedy::Shared( lk ) ); + unique_ptr<RWLockRecursiveNongreedy::Shared> a( new RWLockRecursiveNongreedy::Shared( lk ) ); AtomicUInt32 x2(0); diff --git a/src/mongo/dbtests/updatetests.cpp b/src/mongo/dbtests/updatetests.cpp index fa7271bcb6b..e5159780a6e 100644 --- a/src/mongo/dbtests/updatetests.cpp +++ b/src/mongo/dbtests/updatetests.cpp @@ -45,7 +45,7 @@ namespace UpdateTests { - using std::auto_ptr; + using std::unique_ptr; using std::numeric_limits; using std::string; using std::stringstream; @@ -375,7 +375,7 @@ namespace UpdateTests { string s() { stringstream ss; - auto_ptr<DBClientCursor> cc = _client.query( ns() , Query().sort( BSON( "_id" << 1 ) ) ); + unique_ptr<DBClientCursor> cc = _client.query( ns() , Query().sort( BSON( "_id" << 1 ) ) ); bool first = true; while ( cc->more() ) { if ( first ) first = false; |