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

View File

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

View File

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

View File

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