Replace auto_ptr with unique_ptr

This commit is contained in:
Erik Hofman
2016-12-07 11:03:49 +01:00
parent b74d1a8351
commit e768553a4a
22 changed files with 46 additions and 46 deletions

View File

@@ -24,7 +24,7 @@
#define SG_DEBUG_BUFFEREDLOGCALLBACK_HXX
#include <vector>
#include <memory> // for std::auto_ptr
#include <memory> // for std::unique_ptr
#include <simgear/debug/logstream.hxx>
@@ -70,10 +70,10 @@ public:
unsigned int threadsafeCopy(vector_cstring& aOutput);
private:
class BufferedLogCallbackPrivate;
std::auto_ptr<BufferedLogCallbackPrivate> d;
std::unique_ptr<BufferedLogCallbackPrivate> d;
};
} // of namespace simgear
#endif // of SG_DEBUG_BUFFEREDLOGCALLBACK_HXX
#endif // of SG_DEBUG_BUFFEREDLOGCALLBACK_HXX

View File

@@ -117,7 +117,7 @@ public:
// bool unconditionalAttributeOwnershipDivestiture(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles)
// {
// try {
// std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// std::unique_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
// attributeHandleSet->add(*i);
// _rtiAmbassador.unconditionalAttributeOwnershipDivestiture(objectHandle, *attributeHandleSet);
@@ -136,7 +136,7 @@ public:
// bool negotiatedAttributeOwnershipDivestiture(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles, const RTIData& tag)
// {
// try {
// std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// std::unique_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
// attributeHandleSet->add(*i);
// _rtiAmbassador.negotiatedAttributeOwnershipDivestiture(objectHandle, *attributeHandleSet, tag.data());
@@ -156,7 +156,7 @@ public:
// bool attributeOwnershipAcquisition(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles, const RTIData& tag)
// {
// try {
// std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// std::unique_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
// attributeHandleSet->add(*i);
// _rtiAmbassador.attributeOwnershipAcquisition(objectHandle, *attributeHandleSet, tag.data());
@@ -177,7 +177,7 @@ public:
// bool attributeOwnershipAcquisitionIfAvailable(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles)
// {
// try {
// std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// std::unique_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
// attributeHandleSet->add(*i);
// _rtiAmbassador.attributeOwnershipAcquisitionIfAvailable(objectHandle, *attributeHandleSet);
@@ -199,7 +199,7 @@ public:
// RTIHandleSet attributeOwnershipReleaseResponse(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles)
// {
// try {
// std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// std::unique_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
// attributeHandleSet->add(*i);
// attributeHandleSet.reset(_rtiAmbassador.attributeOwnershipReleaseResponse(objectHandle, *attributeHandleSet));
@@ -223,7 +223,7 @@ public:
// bool cancelNegotiatedAttributeOwnershipDivestiture(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles)
// {
// try {
// std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// std::unique_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
// attributeHandleSet->add(*i);
// _rtiAmbassador.cancelNegotiatedAttributeOwnershipDivestiture(objectHandle, *attributeHandleSet);
@@ -243,7 +243,7 @@ public:
// bool cancelAttributeOwnershipAcquisition(const RTIHandle& objectHandle, const RTIHandleSet& attributeHandles)
// {
// try {
// std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// std::unique_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(attributeHandles.size()));
// for (RTIHandleSet::const_iterator i = attributeHandles.begin(); i != attributeHandles.end(); ++i)
// attributeHandleSet->add(*i);
// _rtiAmbassador.cancelAttributeOwnershipAcquisition(objectHandle, *attributeHandleSet);

View File

@@ -101,7 +101,7 @@ RTI13ObjectClass::publish(const HLAIndexList& indexList)
try {
unsigned numAttributes = getNumAttributes();
std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(numAttributes));
std::unique_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(numAttributes));
for (HLAIndexList::const_iterator i = indexList.begin(); i != indexList.end(); ++i) {
if (_attributeHandleVector.size() <= *i) {
SG_LOG(SG_NETWORK, SG_WARN, "RTI13ObjectClass::publish(): Invalid attribute index!");
@@ -195,7 +195,7 @@ RTI13ObjectClass::subscribe(const HLAIndexList& indexList, bool active)
try {
unsigned numAttributes = getNumAttributes();
std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(numAttributes));
std::unique_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(numAttributes));
for (HLAIndexList::const_iterator i = indexList.begin(); i != indexList.end(); ++i) {
if (_attributeHandleVector.size() <= *i) {
SG_LOG(SG_NETWORK, SG_WARN, "RTI13ObjectClass::subscribe(): Invalid attribute index!");

View File

@@ -243,7 +243,7 @@ RTI13ObjectInstance::requestObjectAttributeValueUpdate(const HLAIndexList& index
try {
unsigned numAttributes = getNumAttributes();
std::auto_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(numAttributes));
std::unique_ptr<RTI::AttributeHandleSet> attributeHandleSet(RTI::AttributeHandleSetFactory::create(numAttributes));
for (HLAIndexList::const_iterator i = indexList.begin(); i != indexList.end(); ++i) {
if (getAttributeOwned(*i)) {
SG_LOG(SG_NETWORK, SG_WARN, "RTI13ObjectInstance::requestObjectAttributeValueUpdate(): "

View File

@@ -101,7 +101,7 @@ private:
SGSharedPtr<RTI13Ambassador> _ambassador;
// cached storage for updates
std::auto_ptr<RTI::AttributeHandleValuePairSet> _attributeValuePairSet;
std::unique_ptr<RTI::AttributeHandleValuePairSet> _attributeValuePairSet;
};
}

View File

@@ -24,7 +24,7 @@
#ifndef SG_DNS_CLIENT_HXX
#define SG_DNS_CLIENT_HXX
#include <memory> // for std::auto_ptr
#include <memory> // for std::unique_ptr
#include <string>
#include <vector>
#include <ctime> // for time_t
@@ -133,7 +133,7 @@ public:
// void cancelRequest(const Request_ptr& r, std::string reason = std::string());
class ClientPrivate;
std::auto_ptr<ClientPrivate> d;
std::unique_ptr<ClientPrivate> d;
};
} // of namespace DNS

View File

@@ -24,7 +24,7 @@
#ifndef SG_HTTP_CLIENT_HXX
#define SG_HTTP_CLIENT_HXX
#include <memory> // for std::auto_ptr
#include <memory> // for std::unique_ptr
#include <stdint.h> // for uint_64t
#include <simgear/io/HTTPFileRequest.hxx>
@@ -125,7 +125,7 @@ private:
friend class Request;
class ClientPrivate;
std::auto_ptr<ClientPrivate> d;
std::unique_ptr<ClientPrivate> d;
};
} // of namespace HTTP

View File

@@ -725,7 +725,7 @@ HTTPRepository::failure() const
std::string fileName; // if empty, we're getting the directory itself
SGPath pathInRepo;
simgear::sha1nfo hashContext;
std::auto_ptr<SGBinaryFile> file;
std::unique_ptr<SGBinaryFile> file;
};
class DirGetRequest : public HTTPRepoGetRequest

View File

@@ -73,7 +73,7 @@ public:
private:
bool isBare() const;
std::auto_ptr<HTTPRepoPrivate> _d;
std::unique_ptr<HTTPRepoPrivate> _d;
};
} // of namespace simgear

View File

@@ -71,7 +71,7 @@ public:
int requestCount;
bool getWillFail;
bool returnCorruptData;
std::auto_ptr<SGCallback> accessCallback;
std::unique_ptr<SGCallback> accessCallback;
void clearRequestCounts();
@@ -400,7 +400,7 @@ void waitForUpdateComplete(HTTP::Client* cl, HTTPRepository* repo)
void testBasicClone(HTTP::Client* cl)
{
std::auto_ptr<HTTPRepository> repo;
std::unique_ptr<HTTPRepository> repo;
SGPath p(simgear::Dir::current().path());
p.append("http_repo_basic");
simgear::Dir pd(p);
@@ -435,7 +435,7 @@ void testBasicClone(HTTP::Client* cl)
void testModifyLocalFiles(HTTP::Client* cl)
{
std::auto_ptr<HTTPRepository> repo;
std::unique_ptr<HTTPRepository> repo;
SGPath p(simgear::Dir::current().path());
p.append("http_repo_modify_local_2");
simgear::Dir pd(p);
@@ -476,7 +476,7 @@ void testNoChangesUpdate()
void testMergeExistingFileWithoutDownload(HTTP::Client* cl)
{
std::auto_ptr<HTTPRepository> repo;
std::unique_ptr<HTTPRepository> repo;
SGPath p(simgear::Dir::current().path());
p.append("http_repo_merge_existing");
simgear::Dir pd(p);
@@ -518,7 +518,7 @@ void testMergeExistingFileWithoutDownload(HTTP::Client* cl)
void testLossOfLocalFiles(HTTP::Client* cl)
{
std::auto_ptr<HTTPRepository> repo;
std::unique_ptr<HTTPRepository> repo;
SGPath p(simgear::Dir::current().path());
p.append("http_repo_lose_local");
simgear::Dir pd(p);
@@ -552,7 +552,7 @@ void testLossOfLocalFiles(HTTP::Client* cl)
void testAbandonMissingFiles(HTTP::Client* cl)
{
std::auto_ptr<HTTPRepository> repo;
std::unique_ptr<HTTPRepository> repo;
SGPath p(simgear::Dir::current().path());
p.append("http_repo_missing_files");
simgear::Dir pd(p);
@@ -576,7 +576,7 @@ void testAbandonMissingFiles(HTTP::Client* cl)
void testAbandonCorruptFiles(HTTP::Client* cl)
{
std::auto_ptr<HTTPRepository> repo;
std::unique_ptr<HTTPRepository> repo;
SGPath p(simgear::Dir::current().path());
p.append("http_repo_corrupt_files");
simgear::Dir pd(p);
@@ -616,7 +616,7 @@ void modifyBTree()
void testServerModifyDuringSync(HTTP::Client* cl)
{
std::auto_ptr<HTTPRepository> repo;
std::unique_ptr<HTTPRepository> repo;
SGPath p(simgear::Dir::current().path());
p.append("http_repo_server_modify_during_sync");
simgear::Dir pd(p);
@@ -647,7 +647,7 @@ void testServerModifyDuringSync(HTTP::Client* cl)
void testDestroyDuringSync(HTTP::Client* cl)
{
std::auto_ptr<HTTPRepository> repo;
std::unique_ptr<HTTPRepository> repo;
SGPath p(simgear::Dir::current().path());
p.append("http_repo_destory_during_sync");
simgear::Dir pd(p);
@@ -676,7 +676,7 @@ void testDestroyDuringSync(HTTP::Client* cl)
void testCopyInstalledChildren(HTTP::Client* cl)
{
std::auto_ptr<HTTPRepository> repo;
std::unique_ptr<HTTPRepository> repo;
SGPath p(simgear::Dir::current().path());
p.append("http_repo_copy_installed_children");
simgear::Dir pd(p);

View File

@@ -101,7 +101,7 @@ public:
};
size_t bytesRemaining;
std::auto_ptr<SGFile> currentFile;
std::unique_ptr<SGFile> currentFile;
size_t currentFileSize;
z_stream zlibStream;
uint8_t* zlibOutput;

View File

@@ -44,7 +44,7 @@ public:
bool hasError() const;
private:
std::auto_ptr<TarExtractorPrivate> d;
std::unique_ptr<TarExtractorPrivate> d;
};
} // of namespace simgear

View File

@@ -1200,7 +1200,7 @@ namespace nasal
return ctx;
};
typedef std::auto_ptr<Ghost> GhostPtr;
typedef std::unique_ptr<Ghost> GhostPtr;
MemberMap _members;
fallback_getter_t _fallback_getter;
fallback_setter_t _fallback_setter;

View File

@@ -19,7 +19,7 @@
#define SG_PACKAGE_ROOT_HXX
#include <vector>
#include <memory> // for auto_ptr
#include <memory> // for unique_ptr
#include <simgear/misc/sg_path.hxx>
#include <simgear/package/Delegate.hxx>
@@ -161,7 +161,7 @@ private:
class ThumbnailDownloader;
class RootPrivate;
std::auto_ptr<RootPrivate> d;
std::unique_ptr<RootPrivate> d;
};
typedef SGSharedPtr<Root> RootRef;

View File

@@ -69,7 +69,7 @@ class SGMaterialLib : public SGReferenced
private:
class MatLibPrivate;
std::auto_ptr<MatLibPrivate> d;
std::unique_ptr<MatLibPrivate> d;
// associative array of materials
typedef std::vector< SGSharedPtr<SGMaterial> > material_list;

View File

@@ -51,7 +51,7 @@ public:
osg::Node* getSignsGroup();
private:
class AirportSignBuilderPrivate;
std::auto_ptr<AirportSignBuilderPrivate> d;
std::unique_ptr<AirportSignBuilderPrivate> d;
};
} // of namespace simgear

View File

@@ -165,7 +165,7 @@ public:
SyncItem currentItem;
bool isNewDirectory;
std::queue<SyncItem> queue;
std::auto_ptr<HTTPRepository> repository;
std::unique_ptr<HTTPRepository> repository;
SGTimeStamp stamp;
bool busy; ///< is the slot working or idle
unsigned int pendingKBytes;

View File

@@ -33,7 +33,7 @@
#include <string>
#include <vector>
#include <map>
#include <memory> // for std::auto_ptr
#include <memory> // for std::unique_ptr
#include <simgear/compiler.h>
#include <simgear/structure/subsystem_mgr.hxx>
@@ -328,7 +328,7 @@ public:
private:
class SoundManagerPrivate;
/// private implementation object
std::auto_ptr<SoundManagerPrivate> d;
std::unique_ptr<SoundManagerPrivate> d;
bool _block_support;
bool _active;

View File

@@ -64,7 +64,7 @@ public:
void update();
class StatePrivate;
std::auto_ptr<StatePrivate> d;
std::unique_ptr<StatePrivate> d;
};
class Transition : public SGReferenced
@@ -118,7 +118,7 @@ public:
void fireBindings();
class TransitionPrivate;
std::auto_ptr<TransitionPrivate> d;
std::unique_ptr<TransitionPrivate> d;
};
typedef SGSharedPtr<State> State_ptr;
@@ -167,7 +167,7 @@ private:
void innerChangeState(State_ptr aState, Transition_ptr aTrans);
class StateMachinePrivate;
std::auto_ptr<StateMachinePrivate> d;
std::unique_ptr<StateMachinePrivate> d;
};
typedef SGSharedPtr<StateMachine> StateMachine_ptr;

View File

@@ -60,7 +60,7 @@ static const double J2000 = 2451545.0 - MJD0;
static const double SIDRATE = 0.9972695677;
// tzContainer stores all the current Timezone control points/
std::auto_ptr<SGTimeZoneContainer> static_tzContainer;
std::unique_ptr<SGTimeZoneContainer> static_tzContainer;
void SGTime::init( const SGGeod& location, const SGPath& root, time_t init_time )
{

View File

@@ -36,7 +36,7 @@
#include <simgear/compiler.h>
#include <ctime>
#include <memory> // for std::auto_ptr
#include <memory> // for std::unique_ptr
#include <string>
// forward decls

View File

@@ -7,7 +7,7 @@
#include <string>
#include <map>
#include <stack>
#include <auto_ptr>
#include <memory>
#include <osg/ref_ptr>
#include <osg/Referenced>