more methods for UnformattedRead
This commit is contained in:
parent
996a17b509
commit
7adde40f6b
@ -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)
|
||||
{
|
||||
if (!autodrop || checkPointAccum > checkPointRef)
|
||||
throw InvalidUnformattedAccess();
|
||||
f->seekg(checkPointRef-checkPointAccum, ios::cur);
|
||||
}
|
||||
|
||||
int64_t oldCheckPoint = checkPointRef;
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user