Merge branch 'master' of file:///home/lavaux/Dropbox/gitRoot/CosmoToolbox

This commit is contained in:
Guilhem Lavaux 2010-04-23 02:36:15 -05:00
commit 73060dd6cb
2 changed files with 29 additions and 3 deletions

View File

@ -49,6 +49,25 @@ void UnformattedRead::setCheckpointSize(CheckpointSize cs)
cSize = cs;
}
void UnformattedRead::skip(int64_t off)
throw (InvalidUnformattedAccess)
{
if (checkPointAccum == 0 && checkPointRef == 0)
{
// We are not in a checked block
f->seekg(off, ios::cur);
return;
}
if (off < 0)
throw InvalidUnformattedAccess();
if ((checkPointAccum+off) > checkPointRef)
throw InvalidUnformattedAccess();
f->seekg(off, ios::cur);
checkPointAccum += off;
}
void UnformattedRead::beginCheckpoint()
throw (InvalidUnformattedAccess,EndOfFileException)
{
@ -65,11 +84,15 @@ void UnformattedRead::beginCheckpoint()
throw EndOfFileException();
}
void UnformattedRead::endCheckpoint()
void UnformattedRead::endCheckpoint(bool autodrop)
throw (InvalidUnformattedAccess)
{
if (checkPointRef != checkPointAccum)
throw InvalidUnformattedAccess();
{
if (!autodrop || checkPointAccum > checkPointRef)
throw InvalidUnformattedAccess();
f->seekg(checkPointRef-checkPointAccum, ios::cur);
}
int64_t oldCheckPoint = checkPointRef;

View File

@ -41,7 +41,7 @@ namespace CosmoTool
void beginCheckpoint()
throw (InvalidUnformattedAccess,EndOfFileException);
void endCheckpoint()
void endCheckpoint(bool autodrop = false)
throw (InvalidUnformattedAccess);
double readReal64()
@ -53,6 +53,9 @@ namespace CosmoTool
int64_t readInt64()
throw (InvalidUnformattedAccess);
void skip(int64_t off)
throw (InvalidUnformattedAccess);
protected:
bool swapOrdering;
CheckpointSize cSize;