Skip to content
Snippets Groups Projects
Commit 18b6ad31 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

check file integrity before accepting it into online memory

parent 36bbaf08
No related branches found
No related tags found
No related merge requests found
......@@ -77,6 +77,7 @@ namespace NOlm {
//! Store file f in online memory. If overwrite and k!=-1, overwrite file k.
void mem_store( POlo f, int k )
{
f->check_integrity();
if( overwrite && k!=-1 ){
// replace file k
if( k>=MOM.size() )
......
......@@ -59,6 +59,17 @@ string COlo::info_line( int j ) const
}
//! Check integrity, to be called before accepting a new file into online memory.
void COlo::check_integrity() const
{
if( nJ()<1 )
throw S("BUG: File has no slices");
if( nJ()>1 && nZ()<1 )
throw S("BUG: File has several slices but no z coordinate");
}
//! Return value of iz-th z-variable for slice j.
RObj COlo::z( int j, int iz ) const
......
......@@ -32,6 +32,7 @@ class COlo {
void remove_z( int iz );
string info_line( int j ) const;
void check_integrity() const;
virtual void copy_mainvec( ROlo fin ) =0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment