mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#2350. Renaming, robustify
This commit is contained in:
parent
55147e5b70
commit
766f4da48b
@ -41,10 +41,14 @@ static QStringList splitLineAndTrim(const QString& line, const QString& separato
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
ElementPropertyMetadata RifElementPropertyTableReader::readMetadata(const QString& fileName)
|
||||
RifElementPropertyMetadata RifElementPropertyTableReader::readMetadata(const QString& fileName)
|
||||
{
|
||||
ElementPropertyMetadata metadata;
|
||||
QFile* file = openFile(fileName);
|
||||
RifElementPropertyMetadata metadata;
|
||||
QFile* file = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
file = openFile(fileName);
|
||||
|
||||
if (file)
|
||||
{
|
||||
@ -78,6 +82,12 @@ ElementPropertyMetadata RifElementPropertyTableReader::readMetadata(const QStrin
|
||||
|
||||
closeFile(file);
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
closeFile(file);
|
||||
throw;
|
||||
}
|
||||
|
||||
return metadata;
|
||||
}
|
||||
@ -85,12 +95,16 @@ ElementPropertyMetadata RifElementPropertyTableReader::readMetadata(const QStrin
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RifElementPropertyTableReader::readData(const ElementPropertyMetadata *metadata, ElementPropertyTable *table)
|
||||
void RifElementPropertyTableReader::readData(const RifElementPropertyMetadata *metadata, RifElementPropertyTable *table)
|
||||
{
|
||||
CVF_ASSERT(metadata && table);
|
||||
|
||||
QFile* file = openFile(metadata->fileName);
|
||||
int expectedColumnCount = (int)metadata->dataColumns.size() + 1;
|
||||
QFile* file = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
file = openFile(metadata->fileName);
|
||||
|
||||
if (file && expectedColumnCount > 0)
|
||||
{
|
||||
@ -152,6 +166,12 @@ void RifElementPropertyTableReader::readData(const ElementPropertyMetadata *meta
|
||||
|
||||
closeFile(file);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
closeFile(file);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@ -29,8 +29,8 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
class ElementPropertyTable;
|
||||
class ElementPropertyMetadata;
|
||||
class RifElementPropertyTable;
|
||||
class RifElementPropertyMetadata;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -38,8 +38,8 @@ class ElementPropertyMetadata;
|
||||
class RifElementPropertyTableReader : cvf::Object
|
||||
{
|
||||
public:
|
||||
static ElementPropertyMetadata readMetadata(const QString& filePath);
|
||||
static void readData(const ElementPropertyMetadata *metadata, ElementPropertyTable *table);
|
||||
static RifElementPropertyMetadata readMetadata(const QString& filePath);
|
||||
static void readData(const RifElementPropertyMetadata *metadata, RifElementPropertyTable *table);
|
||||
};
|
||||
|
||||
//==================================================================================================
|
||||
@ -55,7 +55,7 @@ public:
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class ElementPropertyMetadata
|
||||
class RifElementPropertyMetadata
|
||||
{
|
||||
public:
|
||||
QString fileName;
|
||||
@ -66,12 +66,12 @@ public:
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class ElementPropertyTable
|
||||
class RifElementPropertyTable
|
||||
{
|
||||
public:
|
||||
ElementPropertyTable() : hasData(false) {}
|
||||
RifElementPropertyTable() : hasData(false) {}
|
||||
|
||||
ElementPropertyMetadata metadata;
|
||||
RifElementPropertyMetadata metadata;
|
||||
bool hasData;
|
||||
std::vector<int> elementIds;
|
||||
std::vector<std::vector<float>> data;
|
||||
|
Loading…
Reference in New Issue
Block a user