Added iterators begin() and end() to DeckKeyword class.

This commit is contained in:
Joakim Hove
2014-05-30 13:19:01 +02:00
committed by Andreas Lauser
parent 5c04cd4540
commit 22ed38b319
3 changed files with 15 additions and 0 deletions

View File

@@ -68,6 +68,14 @@ namespace Opm {
m_recordList.push_back(record);
}
std::vector<DeckRecordConstPtr>::const_iterator DeckKeyword::begin() const {
return m_recordList.begin();
}
std::vector<DeckRecordConstPtr>::const_iterator DeckKeyword::end() const {
return m_recordList.end();
}
DeckRecordConstPtr DeckKeyword::getRecord(size_t index) const {
if (index < m_recordList.size()) {
return m_recordList[index];

View File

@@ -40,6 +40,9 @@ namespace Opm {
const std::vector<float>& getRawFloatData() const;
const std::vector<std::string>& getStringData() const;
size_t getDataSize() const;
std::vector<DeckRecordConstPtr>::const_iterator begin() const;
std::vector<DeckRecordConstPtr>::const_iterator end() const;
private:
std::string m_keywordName;
std::vector<DeckRecordConstPtr> m_recordList;

View File

@@ -60,6 +60,10 @@ BOOST_AUTO_TEST_CASE(addRecord_onerecord_recordadded) {
DeckKeywordPtr deckKeyword(new DeckKeyword("KW"));
deckKeyword->addRecord(DeckRecordConstPtr(new DeckRecord()));
BOOST_CHECK_EQUAL(1U, deckKeyword->size());
for (auto iter = deckKeyword->begin(); iter != deckKeyword->end(); ++iter) {
//
}
}
BOOST_AUTO_TEST_CASE(getRecord_onerecord_recordretured) {