more methods for UnformattedRead
This commit is contained in:
parent
996a17b509
commit
7adde40f6b
@ -49,6 +49,25 @@ void UnformattedRead::setCheckpointSize(CheckpointSize cs)
|
|||||||
cSize = 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()
|
void UnformattedRead::beginCheckpoint()
|
||||||
throw (InvalidUnformattedAccess,EndOfFileException)
|
throw (InvalidUnformattedAccess,EndOfFileException)
|
||||||
{
|
{
|
||||||
@ -65,11 +84,15 @@ void UnformattedRead::beginCheckpoint()
|
|||||||
throw EndOfFileException();
|
throw EndOfFileException();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnformattedRead::endCheckpoint()
|
void UnformattedRead::endCheckpoint(bool autodrop)
|
||||||
throw (InvalidUnformattedAccess)
|
throw (InvalidUnformattedAccess)
|
||||||
{
|
{
|
||||||
if (checkPointRef != checkPointAccum)
|
if (checkPointRef != checkPointAccum)
|
||||||
|
{
|
||||||
|
if (!autodrop || checkPointAccum > checkPointRef)
|
||||||
throw InvalidUnformattedAccess();
|
throw InvalidUnformattedAccess();
|
||||||
|
f->seekg(checkPointRef-checkPointAccum, ios::cur);
|
||||||
|
}
|
||||||
|
|
||||||
int64_t oldCheckPoint = checkPointRef;
|
int64_t oldCheckPoint = checkPointRef;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ namespace CosmoTool
|
|||||||
|
|
||||||
void beginCheckpoint()
|
void beginCheckpoint()
|
||||||
throw (InvalidUnformattedAccess,EndOfFileException);
|
throw (InvalidUnformattedAccess,EndOfFileException);
|
||||||
void endCheckpoint()
|
void endCheckpoint(bool autodrop = false)
|
||||||
throw (InvalidUnformattedAccess);
|
throw (InvalidUnformattedAccess);
|
||||||
|
|
||||||
double readReal64()
|
double readReal64()
|
||||||
@ -53,6 +53,9 @@ namespace CosmoTool
|
|||||||
int64_t readInt64()
|
int64_t readInt64()
|
||||||
throw (InvalidUnformattedAccess);
|
throw (InvalidUnformattedAccess);
|
||||||
|
|
||||||
|
void skip(int64_t off)
|
||||||
|
throw (InvalidUnformattedAccess);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool swapOrdering;
|
bool swapOrdering;
|
||||||
CheckpointSize cSize;
|
CheckpointSize cSize;
|
||||||
|
Loading…
Reference in New Issue
Block a user