move stdexcept to base, convert InterleavedAccessor.cpp to exceptions

LT1AB
scott 2021-07-07 12:46:25 -05:00
parent 99d478f87e
commit 5181aa0e6d
4 changed files with 8 additions and 9 deletions

View File

@ -9,7 +9,6 @@
#endif #endif
#include <iostream> #include <iostream>
#include <stdexcept>
#include "InterleavedBase.h" #include "InterleavedBase.h"
#include <stdint.h> #include <stdint.h>
#include "gdal_priv.h" #include "gdal_priv.h"

View File

@ -10,6 +10,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
#include <stdexcept>
using namespace std; using namespace std;

View File

@ -75,8 +75,7 @@ GDALAccessor::openFile (string filename, string accessMode, GDALDataset ** fd)
string errMsg = "Cannot open the file " + filename + " in " string errMsg = "Cannot open the file " + filename + " in "
+ accessMode + " mode."; + accessMode + " mode.";
throw runtime_error(errMsg); throw runtime_error(errMsg);
// ERR_MESSAGE // ERR_MESSAGE;
// ;
} }
} }
else else

View File

@ -112,8 +112,8 @@ void InterleavedAccessor::openFile(string filename, string accessMode, fstream
fd.open(filename.c_str(), ios_base::in); fd.open(filename.c_str(), ios_base::in);
if(fd.fail()) if(fd.fail())
{ {
cout << "Error. Cannot open the file " << filename << " in " << accessMode << " mode." <<endl; string errMsg = "Cannot open the file " + filename + " in " + accessMode + " mode.";
ERR_MESSAGE; throw runtime_error(errMsg);
} }
} }
@ -139,13 +139,13 @@ void InterleavedAccessor::openFile(string filename, string accessMode, fstream
} }
else else
{ {
cout << "Error. Unrecognized open mode " << accessMode << " for file " << filename << endl; string errMsg = "Unrecognized open mode " + accessMode + " for file " + filename;
ERR_MESSAGE; throw runtime_error(errMsg);
} }
if(!fd.good()) if(!fd.good())
{ {
cout << "Cannot open file " << filename << endl; string errMsg = "Cannot open file " + filename;
ERR_MESSAGE; throw runtime_error(errMsg);
} }
} }
void InterleavedAccessor::getStream(char * dataLine, int & numEl) void InterleavedAccessor::getStream(char * dataLine, int & numEl)