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;
|
RifElementPropertyMetadata metadata;
|
||||||
QFile* file = openFile(fileName);
|
QFile* file = nullptr;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
file = openFile(fileName);
|
||||||
|
|
||||||
if (file)
|
if (file)
|
||||||
{
|
{
|
||||||
@ -78,6 +82,12 @@ ElementPropertyMetadata RifElementPropertyTableReader::readMetadata(const QStrin
|
|||||||
|
|
||||||
closeFile(file);
|
closeFile(file);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(...)
|
||||||
|
{
|
||||||
|
closeFile(file);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
return metadata;
|
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);
|
CVF_ASSERT(metadata && table);
|
||||||
|
|
||||||
QFile* file = openFile(metadata->fileName);
|
|
||||||
int expectedColumnCount = (int)metadata->dataColumns.size() + 1;
|
int expectedColumnCount = (int)metadata->dataColumns.size() + 1;
|
||||||
|
QFile* file = nullptr;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
file = openFile(metadata->fileName);
|
||||||
|
|
||||||
if (file && expectedColumnCount > 0)
|
if (file && expectedColumnCount > 0)
|
||||||
{
|
{
|
||||||
@ -152,6 +166,12 @@ void RifElementPropertyTableReader::readData(const ElementPropertyMetadata *meta
|
|||||||
|
|
||||||
closeFile(file);
|
closeFile(file);
|
||||||
}
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
closeFile(file);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
class ElementPropertyTable;
|
class RifElementPropertyTable;
|
||||||
class ElementPropertyMetadata;
|
class RifElementPropertyMetadata;
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
@ -38,8 +38,8 @@ class ElementPropertyMetadata;
|
|||||||
class RifElementPropertyTableReader : cvf::Object
|
class RifElementPropertyTableReader : cvf::Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static ElementPropertyMetadata readMetadata(const QString& filePath);
|
static RifElementPropertyMetadata readMetadata(const QString& filePath);
|
||||||
static void readData(const ElementPropertyMetadata *metadata, ElementPropertyTable *table);
|
static void readData(const RifElementPropertyMetadata *metadata, RifElementPropertyTable *table);
|
||||||
};
|
};
|
||||||
|
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
@ -55,7 +55,7 @@ public:
|
|||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class ElementPropertyMetadata
|
class RifElementPropertyMetadata
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString fileName;
|
QString fileName;
|
||||||
@ -66,12 +66,12 @@ public:
|
|||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
///
|
///
|
||||||
//==================================================================================================
|
//==================================================================================================
|
||||||
class ElementPropertyTable
|
class RifElementPropertyTable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ElementPropertyTable() : hasData(false) {}
|
RifElementPropertyTable() : hasData(false) {}
|
||||||
|
|
||||||
ElementPropertyMetadata metadata;
|
RifElementPropertyMetadata metadata;
|
||||||
bool hasData;
|
bool hasData;
|
||||||
std::vector<int> elementIds;
|
std::vector<int> elementIds;
|
||||||
std::vector<std::vector<float>> data;
|
std::vector<std::vector<float>> data;
|
||||||
|
Loading…
Reference in New Issue
Block a user