Skip to content

Commit 06ade60

Browse files
committed
Replace CPP11_auto_ptr with std::unique_ptr (CPP11_auto_ptr was #defined as std::unique_ptr)
1 parent df4abb9 commit 06ade60

30 files changed

+152
-207
lines changed

Alignment/Geners/interface/CPP11_auto_ptr.hh

Lines changed: 0 additions & 14 deletions
This file was deleted.

Alignment/Geners/interface/CStringStream.hh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <iostream>
1919
#include <vector>
2020

21-
#include "Alignment/Geners/interface/CPP11_auto_ptr.hh"
2221
#include "Alignment/Geners/interface/CStringBuf.hh"
2322
#include "Alignment/Geners/interface/ZlibHandle.hh"
2423

@@ -76,8 +75,8 @@ namespace gs {
7675
std::vector<char> comprBuf_;
7776
std::vector<char> readBuf_;
7877
std::ostream *sink_;
79-
CPP11_auto_ptr<ZlibInflateHandle> inflator_;
80-
CPP11_auto_ptr<ZlibDeflateHandle> deflator_;
78+
std::unique_ptr<ZlibInflateHandle> inflator_;
79+
std::unique_ptr<ZlibDeflateHandle> deflator_;
8180
};
8281
} // namespace gs
8382

Alignment/Geners/interface/CompressedIO.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace gs {
2525
void restore_compressed_item(std::istream &in, Item *item);
2626

2727
template <class Item>
28-
CPP11_auto_ptr<Item> read_compressed_item(std::istream &in);
28+
std::unique_ptr<Item> read_compressed_item(std::istream &in);
2929
} // namespace gs
3030

3131
namespace gs {
@@ -77,7 +77,7 @@ namespace gs {
7777
}
7878

7979
template <class Item>
80-
inline CPP11_auto_ptr<Item> read_compressed_item(std::istream &is) {
80+
inline std::unique_ptr<Item> read_compressed_item(std::istream &is) {
8181
long long len;
8282
read_pod(is, &len);
8383
unsigned compressionCode;

Alignment/Geners/interface/GenericIO.hh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ namespace gs {
5151
// from std::exception.
5252
*/
5353
template <class Item, class Stream>
54-
inline CPP11_auto_ptr<Item> read_item(Stream &is, const bool readClassId = true) {
54+
inline std::unique_ptr<Item> read_item(Stream &is, const bool readClassId = true) {
5555
typedef std::vector<ClassId> State;
5656
Item *item = nullptr;
5757
State state;
5858
const bool status = GenericReader<Stream, State, Item *, Int2Type<IOTraits<int>::ISNULLPOINTER>>::process(
5959
item, is, &state, readClassId);
60-
CPP11_auto_ptr<Item> ptr(item);
60+
std::unique_ptr<Item> ptr(item);
6161
if (is.fail())
6262
throw IOReadFailure("In gs::read_item: input stream failure");
6363
if (!status || item == nullptr)
@@ -150,9 +150,9 @@ namespace gs {
150150
template <class Stream, class State, class T>
151151
struct GenericReader<Stream, State, T, Int2Type<IOTraits<int>::ISPOD>> {
152152
inline static bool readIntoPtr(T *&ptr, Stream &str, State *, const bool processClassId) {
153-
CPP11_auto_ptr<T> myptr;
153+
std::unique_ptr<T> myptr;
154154
if (ptr == nullptr)
155-
myptr = CPP11_auto_ptr<T>(new T());
155+
myptr = std::unique_ptr<T>(new T());
156156
if (processClassId) {
157157
static const ClassId current(ClassId::makeId<T>());
158158
ClassId id(str, 1);
@@ -441,9 +441,9 @@ namespace gs {
441441
template <class Stream, class State, class T>
442442
struct GenericReader<Stream, State, T, Int2Type<IOTraits<int>::ISPAIR>> {
443443
inline static bool readIntoPtr(T *&ptr, Stream &str, State *s, const bool processClassId) {
444-
CPP11_auto_ptr<T> myptr;
444+
std::unique_ptr<T> myptr;
445445
if (ptr == 0) {
446-
myptr = CPP11_auto_ptr<T>(new T());
446+
myptr = std::unique_ptr<T>(new T());
447447
clearIfPointer(myptr.get()->first);
448448
clearIfPointer(myptr.get()->second);
449449
}
@@ -499,9 +499,9 @@ namespace gs {
499499
template <class Stream, class State>
500500
struct GenericReader<Stream, State, std::string, Int2Type<IOTraits<int>::ISSTRING>> {
501501
inline static bool readIntoPtr(std::string *&ptr, Stream &is, State *, const bool processClassId) {
502-
CPP11_auto_ptr<std::string> myptr;
502+
std::unique_ptr<std::string> myptr;
503503
if (ptr == nullptr)
504-
myptr = CPP11_auto_ptr<std::string>(new std::string());
504+
myptr = std::unique_ptr<std::string>(new std::string());
505505
if (processClassId) {
506506
static const ClassId current(ClassId::makeId<std::string>());
507507
ClassId id(is, 1);
@@ -613,7 +613,7 @@ namespace gs {
613613
if (ptr)
614614
return process_item<GenericReader2>(*ptr, str, s, processClassId);
615615
else {
616-
CPP11_auto_ptr<T> myptr(new T());
616+
std::unique_ptr<T> myptr(new T());
617617
if (!process_item<GenericReader2>(*myptr, str, s, processClassId))
618618
return false;
619619
ptr = myptr.release();
@@ -673,9 +673,9 @@ namespace gs {
673673
template <class Stream, class State, class T>
674674
struct GenericReader<Stream, State, T, Int2Type<IOTraits<int>::ISPLACEREADABLE>> {
675675
inline static bool readIntoPtr(T *&ptr, Stream &str, State *s, const bool processClassId) {
676-
CPP11_auto_ptr<T> myptr;
676+
std::unique_ptr<T> myptr;
677677
if (ptr == 0)
678-
myptr = CPP11_auto_ptr<T>(new T());
678+
myptr = std::unique_ptr<T>(new T());
679679
if (processClassId) {
680680
ClassId id(str, 1);
681681
T::restore(id, str, ptr ? ptr : myptr.get());

Alignment/Geners/interface/Reference.hh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define GENERS_REFERENCE_HH_
33

44
#include "Alignment/Geners/interface/AbsReference.hh"
5-
#include "Alignment/Geners/interface/CPP11_auto_ptr.hh"
65

76
#include <memory>
87

@@ -32,7 +31,7 @@ namespace gs {
3231

3332
// Methods to retrieve the item
3433
void restore(unsigned long index, T *obj) const;
35-
CPP11_auto_ptr<T> get(unsigned long index) const;
34+
std::unique_ptr<T> get(unsigned long index) const;
3635
std::shared_ptr<T> getShared(unsigned long index) const;
3736

3837
Reference() = delete;
@@ -73,8 +72,8 @@ namespace gs {
7372
}
7473

7574
template <typename T>
76-
inline CPP11_auto_ptr<T> Reference<T>::get(const unsigned long index) const {
77-
return CPP11_auto_ptr<T>(getPtr(index));
75+
inline std::unique_ptr<T> Reference<T>::get(const unsigned long index) const {
76+
return std::unique_ptr<T>(getPtr(index));
7877
}
7978

8079
template <typename T>

Alignment/Geners/interface/WriteOnlyCatalog.hh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include <iostream>
55

66
#include "Alignment/Geners/interface/AbsCatalog.hh"
7-
#include "Alignment/Geners/interface/CPP11_auto_ptr.hh"
87

98
namespace gs {
109
class WriteOnlyCatalog : public AbsCatalog {
@@ -63,7 +62,7 @@ namespace gs {
6362
unsigned long long count_;
6463
unsigned long long smallestId_;
6564
unsigned long long largestId_;
66-
CPP11_auto_ptr<const CatalogEntry> lastEntry_;
65+
std::unique_ptr<const CatalogEntry> lastEntry_;
6766
};
6867
} // namespace gs
6968

Alignment/Geners/interface/binaryIO.hh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#ifndef GENERS_BINARYIO_HH_
1616
#define GENERS_BINARYIO_HH_
1717

18-
#include "Alignment/Geners/interface/CPP11_auto_ptr.hh"
1918
#include "Alignment/Geners/interface/ClassId.hh"
2019
#include "Alignment/Geners/interface/IOException.hh"
2120

@@ -143,9 +142,9 @@ namespace gs {
143142
}
144143

145144
template <typename T>
146-
inline CPP11_auto_ptr<T> read_obj(std::istream &in) {
145+
inline std::unique_ptr<T> read_obj(std::istream &in) {
147146
const ClassId id(in, 1);
148-
return CPP11_auto_ptr<T>(T::read(id, in));
147+
return std::unique_ptr<T>(T::read(id, in));
149148
}
150149

151150
template <typename T>
@@ -157,10 +156,10 @@ namespace gs {
157156

158157
// The following function is templated upon the reader factory
159158
template <typename Reader>
160-
inline CPP11_auto_ptr<typename Reader::value_type> read_base_obj(std::istream &in, const Reader &f) {
159+
inline std::unique_ptr<typename Reader::value_type> read_base_obj(std::istream &in, const Reader &f) {
161160
typedef typename Reader::value_type T;
162161
const ClassId id(in, 1);
163-
return CPP11_auto_ptr<T>(f.read(id, in));
162+
return std::unique_ptr<T>(f.read(id, in));
164163
}
165164

166165
// The following function assumes that the array contains actual
@@ -279,7 +278,7 @@ namespace gs {
279278
const ClassId id(in, 1);
280279
pv->reserve(vlen);
281280
for (unsigned long i = 0; i < vlen; ++i) {
282-
CPP11_auto_ptr<T> obj(T::read(id, in));
281+
std::unique_ptr<T> obj(T::read(id, in));
283282
pv->push_back(*obj);
284283
}
285284
}

0 commit comments

Comments
 (0)