Skip to content

Commit

Permalink
Refs #8550. VectorColumn: sizeOfData() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbekasov committed Dec 5, 2013
1 parent 3f4b415 commit 2f3f48f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Expand Up @@ -123,10 +123,17 @@ namespace DataObjects
return false;
}

/// Overall memory size taken by the column
/// Overall memory size taken by the column (bytes)
virtual long int sizeOfData() const
{
// TODO: implement
long int size(0);

for ( auto elemIt = m_data.begin(); elemIt != m_data.end(); ++elemIt )
size += elemIt->size() * sizeof(Type);
{
}

return size;
}

/// Create another copy of the column
Expand Down
13 changes: 13 additions & 0 deletions Code/Mantid/Framework/DataObjects/test/VectorColumnTest.h
Expand Up @@ -91,6 +91,19 @@ class VectorColumnTest : public CxxTest::TestSuite
TS_ASSERT_THROWS_NOTHING( col.print(2, s3) );
TS_ASSERT( s3.str().empty() );
}

void test_sizeOfData()
{
VectorColumnTestHelper<int> col;

col.resize(3);

col.read(0, "1,2,3");
col.read(1, "3,4,5");
col.read(2, "7,8,9,10");

TS_ASSERT_EQUALS( col.sizeOfData(), 10 * sizeof(int) );
}
};


Expand Down

0 comments on commit 2f3f48f

Please sign in to comment.