/* Web Polygraph       http://www.web-polygraph.org/
 * (C) 2003-2006 The Measurement Factory
 * Licensed under the Apache License, Version 2.0 */

#include "base/polygraph.h"

#include "base/ILog.h"
#include "base/OLog.h"
#include "xstd/gadgets.h"
#include "runtime/RepSize.h"

RepSize::RepSize() {
	reset();
}

void RepSize::reset() {
	theExpSize = Size();
	theActSize = 0;
	isExpectingWhatParsed = false;
}

Size RepSize::expectToGet(Size availSize) const {
	if (expected().known())
		return Min(availSize, theExpSize - theActSize);
	else
		return availSize;
}

void RepSize::store(OLog &ol) const {
	ol << theExpSize << theActSize; // not storing isExpectingWhatParsed
}

void RepSize::load(ILog &il) {
	il >> theExpSize >> theActSize; // not loading isExpectingWhatParsed
}


syntax highlighted by Code2HTML, v. 0.9.1