#1813 Observed data: Functions to add observed data to collection

This commit is contained in:
Rebecca Cox 2017-09-18 10:44:28 +02:00
parent 7bb7e4c5f9
commit ae7430a697
2 changed files with 38 additions and 1 deletions

View File

@ -20,6 +20,7 @@
#include "RimObservedDataCollection.h"
#include "RimObservedData.h"
#include "RimSummaryObservedDataFile.h"
CAF_PDM_SOURCE_INIT(RimObservedDataCollection, "ObservedDataCollection");
@ -41,4 +42,35 @@ RimObservedDataCollection::RimObservedDataCollection()
RimObservedDataCollection::~RimObservedDataCollection()
{
m_observedDataArray.deleteAllChildObjects();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimObservedDataCollection::removeObservedData(RimObservedData* observedData)
{
m_observedDataArray.removeChildObject(observedData);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimObservedDataCollection::addObservedData(RimObservedData* observedData)
{
m_observedDataArray.push_back(observedData);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryObservedDataFile* RimObservedDataCollection::createAndAddObservedDataFromFileName(const QString& fileName)
{
RimSummaryObservedDataFile* newObservedData = new RimSummaryObservedDataFile();
this->m_observedDataArray.push_back(newObservedData);
newObservedData->setSummaryHeaderFilename(fileName);
newObservedData->updateOptionSensitivity();
return newObservedData;
}

View File

@ -20,6 +20,7 @@
#include "cafPdmChildArrayField.h"
class RimObservedData;
class RimSummaryObservedDataFile;
//--------------------------------------------------------------------------------------------------
///
@ -32,6 +33,10 @@ public:
RimObservedDataCollection();
virtual ~RimObservedDataCollection();
void removeObservedData(RimObservedData* observedData);
void addObservedData(RimObservedData* observedData);
RimSummaryObservedDataFile* createAndAddObservedDataFromFileName(const QString& fileName);
private:
caf::PdmChildArrayField<RimObservedData*> m_observedDataArray;
};