Fix to remove C++11 warnings

This commit is contained in:
Guilhem Lavaux 2017-07-19 18:46:05 +03:00
parent 07cfe4137f
commit c4f5029877
4 changed files with 26 additions and 78 deletions

View File

@ -43,7 +43,6 @@ using namespace std;
using namespace CosmoTool; using namespace CosmoTool;
UnformattedRead::UnformattedRead(const string& fname) UnformattedRead::UnformattedRead(const string& fname)
throw(NoSuchFileException)
{ {
f = new ifstream(fname.c_str()); f = new ifstream(fname.c_str());
if (!*f) if (!*f)
@ -55,7 +54,6 @@ UnformattedRead::UnformattedRead(const string& fname)
} }
UnformattedRead::UnformattedRead(const char *fname) UnformattedRead::UnformattedRead(const char *fname)
throw(NoSuchFileException)
{ {
f = new ifstream(fname); f = new ifstream(fname);
if (!*f) if (!*f)
@ -100,7 +98,6 @@ void UnformattedRead::setCheckpointSize(CheckpointSize cs)
} }
void UnformattedRead::skip(int64_t off) void UnformattedRead::skip(int64_t off)
throw (InvalidUnformattedAccess)
{ {
if (checkPointAccum == 0 && checkPointRef == 0) if (checkPointAccum == 0 && checkPointRef == 0)
{ {
@ -119,7 +116,6 @@ void UnformattedRead::skip(int64_t off)
} }
void UnformattedRead::beginCheckpoint(bool bufferRecord) void UnformattedRead::beginCheckpoint(bool bufferRecord)
throw (InvalidUnformattedAccess,EndOfFileException)
{ {
if (checkPointAccum != 0) if (checkPointAccum != 0)
throw InvalidUnformattedAccess(); throw InvalidUnformattedAccess();
@ -140,7 +136,6 @@ void UnformattedRead::beginCheckpoint(bool bufferRecord)
} }
void UnformattedRead::endCheckpoint(bool autodrop) void UnformattedRead::endCheckpoint(bool autodrop)
throw (InvalidUnformattedAccess)
{ {
if (recordBuffer != 0) { if (recordBuffer != 0) {
delete[] recordBuffer; delete[] recordBuffer;
@ -169,7 +164,6 @@ void UnformattedRead::endCheckpoint(bool autodrop)
} }
void UnformattedRead::readOrderedBuffer(void *buffer, int size) void UnformattedRead::readOrderedBuffer(void *buffer, int size)
throw (InvalidUnformattedAccess)
{ {
if ((checkPointAccum+(uint64_t)size) > checkPointRef) if ((checkPointAccum+(uint64_t)size) > checkPointRef)
throw InvalidUnformattedAccess(); throw InvalidUnformattedAccess();
@ -190,7 +184,6 @@ void UnformattedRead::readOrderedBuffer(void *buffer, int size)
} }
double UnformattedRead::readReal64() double UnformattedRead::readReal64()
throw (InvalidUnformattedAccess)
{ {
union union
{ {
@ -204,7 +197,6 @@ double UnformattedRead::readReal64()
} }
float UnformattedRead::readReal32() float UnformattedRead::readReal32()
throw (InvalidUnformattedAccess)
{ {
union union
{ {
@ -218,7 +210,6 @@ float UnformattedRead::readReal32()
} }
uint32_t UnformattedRead::readUint32() uint32_t UnformattedRead::readUint32()
throw (InvalidUnformattedAccess)
{ {
union union
{ {
@ -232,7 +223,6 @@ uint32_t UnformattedRead::readUint32()
} }
int32_t UnformattedRead::readInt32() int32_t UnformattedRead::readInt32()
throw (InvalidUnformattedAccess)
{ {
union union
{ {
@ -246,7 +236,6 @@ int32_t UnformattedRead::readInt32()
} }
int64_t UnformattedRead::readInt64() int64_t UnformattedRead::readInt64()
throw (InvalidUnformattedAccess)
{ {
union union
{ {
@ -262,7 +251,6 @@ int64_t UnformattedRead::readInt64()
//// UnformattedWrite //// UnformattedWrite
UnformattedWrite::UnformattedWrite(const string& fname) UnformattedWrite::UnformattedWrite(const string& fname)
throw(NoSuchFileException)
{ {
f = new ofstream(fname.c_str()); f = new ofstream(fname.c_str());
if (!*f) if (!*f)
@ -274,7 +262,6 @@ UnformattedWrite::UnformattedWrite(const string& fname)
} }
UnformattedWrite::UnformattedWrite(const char *fname) UnformattedWrite::UnformattedWrite(const char *fname)
throw(NoSuchFileException)
{ {
f = new ofstream(fname); f = new ofstream(fname);
if (!*f) if (!*f)
@ -304,7 +291,6 @@ void UnformattedWrite::setCheckpointSize(CheckpointSize cs)
} }
void UnformattedWrite::beginCheckpoint() void UnformattedWrite::beginCheckpoint()
throw (InvalidUnformattedAccess,FilesystemFullException)
{ {
if (checkPointAccum != 0) if (checkPointAccum != 0)
throw InvalidUnformattedAccess(); throw InvalidUnformattedAccess();
@ -322,7 +308,6 @@ void UnformattedWrite::beginCheckpoint()
} }
void UnformattedWrite::endCheckpoint() void UnformattedWrite::endCheckpoint()
throw (InvalidUnformattedAccess,FilesystemFullException)
{ {
if (checkPointAccum == 0) if (checkPointAccum == 0)
throw InvalidUnformattedAccess(); throw InvalidUnformattedAccess();
@ -354,7 +339,6 @@ void UnformattedWrite::endCheckpoint()
} }
void UnformattedWrite::writeOrderedBuffer(void *buffer, int size) void UnformattedWrite::writeOrderedBuffer(void *buffer, int size)
throw (FilesystemFullException)
{ {
f->write((char *)buffer, size); f->write((char *)buffer, size);
@ -371,7 +355,6 @@ void UnformattedWrite::writeOrderedBuffer(void *buffer, int size)
} }
void UnformattedWrite::writeReal64(double d) void UnformattedWrite::writeReal64(double d)
throw (FilesystemFullException)
{ {
union union
{ {
@ -385,7 +368,6 @@ void UnformattedWrite::writeReal64(double d)
} }
void UnformattedWrite::writeReal32(float f) void UnformattedWrite::writeReal32(float f)
throw (FilesystemFullException)
{ {
union union
{ {
@ -399,7 +381,6 @@ void UnformattedWrite::writeReal32(float f)
} }
void UnformattedWrite::writeInt32(int32_t i) void UnformattedWrite::writeInt32(int32_t i)
throw (FilesystemFullException)
{ {
union union
{ {
@ -412,7 +393,6 @@ void UnformattedWrite::writeInt32(int32_t i)
} }
void UnformattedWrite::writeInt64(int64_t i) void UnformattedWrite::writeInt64(int64_t i)
throw (FilesystemFullException)
{ {
union union
{ {
@ -425,7 +405,6 @@ void UnformattedWrite::writeInt64(int64_t i)
} }
void UnformattedWrite::writeInt8(int8_t i) void UnformattedWrite::writeInt8(int8_t i)
throw (FilesystemFullException)
{ {
union { char b; int8_t i; } a; union { char b; int8_t i; } a;

View File

@ -67,10 +67,8 @@ namespace CosmoTool
{ {
public: public:
UnformattedRead(const std::string& fname) UnformattedRead(const std::string& fname);
throw (NoSuchFileException); UnformattedRead(const char *fname);
UnformattedRead(const char *fname)
throw (NoSuchFileException);
~UnformattedRead(); ~UnformattedRead();
// Todo implement primitive description // Todo implement primitive description
@ -79,30 +77,21 @@ namespace CosmoTool
uint64_t getBlockSize() const { return checkPointRef; } uint64_t getBlockSize() const { return checkPointRef; }
void beginCheckpoint(bool bufferRecord = false) void beginCheckpoint(bool bufferRecord = false);
throw (InvalidUnformattedAccess,EndOfFileException); void endCheckpoint(bool autodrop = false);
void endCheckpoint(bool autodrop = false)
throw (InvalidUnformattedAccess);
double readReal64() double readReal64();
throw (InvalidUnformattedAccess); float readReal32();
float readReal32() uint32_t readUint32();
throw (InvalidUnformattedAccess); int32_t readInt32();
uint32_t readUint32() int64_t readInt64();
throw (InvalidUnformattedAccess);
int32_t readInt32()
throw (InvalidUnformattedAccess);
int64_t readInt64()
throw (InvalidUnformattedAccess);
void skip(int64_t off) void skip(int64_t off);
throw (InvalidUnformattedAccess);
int64_t position() const; int64_t position() const;
void seek(int64_t pos); void seek(int64_t pos);
void readOrderedBuffer(void *buffer, int size) void readOrderedBuffer(void *buffer, int size);
throw (InvalidUnformattedAccess);
protected: protected:
bool swapOrdering; bool swapOrdering;
CheckpointSize cSize; CheckpointSize cSize;
@ -117,34 +106,24 @@ namespace CosmoTool
{ {
public: public:
UnformattedWrite(const std::string& fname) UnformattedWrite(const std::string& fname);
throw (NoSuchFileException); UnformattedWrite(const char *fname);
UnformattedWrite(const char *fname)
throw (NoSuchFileException);
~UnformattedWrite(); ~UnformattedWrite();
// Todo implement primitive description // Todo implement primitive description
void setOrdering(Ordering o); void setOrdering(Ordering o);
void setCheckpointSize(CheckpointSize cs); void setCheckpointSize(CheckpointSize cs);
void beginCheckpoint() void beginCheckpoint();
throw (FilesystemFullException,InvalidUnformattedAccess); void endCheckpoint();
void endCheckpoint()
throw (FilesystemFullException,InvalidUnformattedAccess);
void writeReal64(double d) void writeReal64(double d);
throw (FilesystemFullException); void writeReal32(float f);
void writeReal32(float f) void writeInt32(int32_t i);
throw (FilesystemFullException); void writeInt64(int64_t i);
void writeInt32(int32_t i) void writeInt8(int8_t c);
throw (FilesystemFullException);
void writeInt64(int64_t i)
throw (FilesystemFullException);
void writeInt8(int8_t c)
throw (FilesystemFullException);
void writeOrderedBuffer(void *buffer, int size) void writeOrderedBuffer(void *buffer, int size);
throw(FilesystemFullException);
protected: protected:
bool swapOrdering; bool swapOrdering;
CheckpointSize cSize; CheckpointSize cSize;

View File

@ -66,7 +66,6 @@ Interpolate::~Interpolate()
} }
double Interpolate::compute(double x) double Interpolate::compute(double x)
throw (InvalidRangeException)
{ {
double y; double y;
@ -85,7 +84,6 @@ double Interpolate::compute(double x)
} }
double Interpolate::compute(double x) const double Interpolate::compute(double x) const
throw (InvalidRangeException)
{ {
double y; double y;
@ -107,7 +105,6 @@ double Interpolate::compute(double x) const
double Interpolate::derivative(double x) double Interpolate::derivative(double x)
throw (InvalidRangeException)
{ {
double y, dy, x0 = x; double y, dy, x0 = x;
@ -199,7 +196,6 @@ Interpolate CosmoTool::buildFromVector(const InterpolatePairs& v)
} }
Interpolate CosmoTool::buildInterpolateFromFile(const char *fname) Interpolate CosmoTool::buildInterpolateFromFile(const char *fname)
throw (NoSuchFileException)
{ {
vector<MyPair> allData; vector<MyPair> allData;
ifstream f(fname); ifstream f(fname);
@ -239,7 +235,6 @@ Interpolate CosmoTool::buildInterpolateFromFile(const char *fname)
Interpolate CosmoTool::buildInterpolateFromColumns(const char *fname, uint32_t col1, uint32_t col2, bool logx, Interpolate CosmoTool::buildInterpolateFromColumns(const char *fname, uint32_t col1, uint32_t col2, bool logx,
bool logy) bool logy)
throw (NoSuchFileException,InvalidRangeException)
{ {
vector<MyPair> allData; vector<MyPair> allData;
ifstream f(fname); ifstream f(fname);

View File

@ -54,12 +54,9 @@ namespace CosmoTool
bool logx = false, bool logy = false); bool logx = false, bool logy = false);
~Interpolate(); ~Interpolate();
double compute(double x) double compute(double x);
throw (InvalidRangeException); double compute(double x) const;
double compute(double x) const double derivative(double x);
throw (InvalidRangeException);
double derivative(double x)
throw (InvalidRangeException);
const Interpolate& operator=(const Interpolate& a); const Interpolate& operator=(const Interpolate& a);
@ -77,10 +74,8 @@ namespace CosmoTool
typedef std::vector< std::pair<double,double> > InterpolatePairs; typedef std::vector< std::pair<double,double> > InterpolatePairs;
Interpolate buildInterpolateFromFile(const char *fname) Interpolate buildInterpolateFromFile(const char *fname);
throw (NoSuchFileException); Interpolate buildInterpolateFromColumns(const char *fname, uint32_t col1, uint32_t col2, bool logx = false, bool logy = false);
Interpolate buildInterpolateFromColumns(const char *fname, uint32_t col1, uint32_t col2, bool logx = false, bool logy = false)
throw (NoSuchFileException,InvalidRangeException);
Interpolate buildFromVector(const InterpolatePairs& v); Interpolate buildFromVector(const InterpolatePairs& v);