コード例 #1
0
PosBlockIter* PosBlockArray::getIterator() const {
//	throw UnexpectedException();
	if (startEndPosValid) {
//		cerr << "new PosBlockArrayIterator; valid start/end positions of " << startPos << "/" << endPos << endl;
//		return new PosBlockArrayIter(this, true, startPos, endPos);
		throw UnexpectedException();
	} else {
	//	cerr << "new PosBlockArrayIterator; start/end positions invalid" << endl;
		throw UnexpectedException();
	}
}
コード例 #2
0
PosBlockIter* PosBlockArray::getIterator(unsigned int startPos_, unsigned int endPos_) const {
//	throw UnexpectedException();
//	assert (startPos_ >= startPos && startPos_ <= endPos);
//	assert (endPos_ >= startPos && endPos <= endPos);
//	return new PosBlockArrayIter(this, true, startPos_, endPos_);
	throw UnexpectedException();
}
コード例 #3
0
PosBlockArray::PosBlockArrayIter::PosBlockArrayIter(const PosBlockArrayIter& pbai) {
/*	pba = pbai.pba;
	currindex = pbai.currindex;
	curBlockIter = pbai.curBlockIter->clone();
	startPos = pbai.startPos;
	endPos = pbai.endPos;*/
	throw UnexpectedException();
}
コード例 #4
0
ファイル: Enum.hpp プロジェクト: kemcoi/libfacebookcpp
	void _Deserialize(const AuthorizedObject &parent_obj, const Json::Value &json)
	{
		if(!json.isConvertibleTo(Json::stringValue))
			throw UnexpectedException("!json.isConvertibleTo(Json::stringValue)");

		const std::string &str = json.asString();

		bool found = false;

		// Hack: This is nasty, but required to do a complete iteration. Hopefully, we never have to go over the int limit!
		for(int s = (int)none; s < (int)count; ++s)
		{
			if(stricmp(str.c_str(), str_array[s]) == 0)
			{
				t_ = (T)s;
				break;
			}
		}

		if(!found)
			throw UnexpectedException("!found");
	}
コード例 #5
0
ファイル: LZEncoder.cpp プロジェクト: Kamilll/LRCS
byte* LZEncoder::getPage() {
	buffer=encoder->getPage();	
	if(buffer != NULL){
		//startPos = encoder->getStartPos();
		//numValsPerPage=encoder->getNumValsPerPage();
		//valsize=encoder->getValSize();
		bufferSize = encoder->getBufferSize();
	}else{
		return NULL;
	}
	memset(page, 0, PAGE_SIZE);

	if(lzo_init() != LZO_E_OK)
		throw UnexpectedException("LZEncoder: Error, lzo initialization error!");

	lzo_byte *compressedData = 
		(lzo_bytep) lzo_malloc(bufferSize + bufferSize / 64 + 16 + 3);
	//new byte[numValsPerPage*valsize + numValsPerPage*valsize / 64 + 16 + 3];
	lzo_byte *wrkmem = (lzo_bytep) lzo_malloc(LZO1X_1_MEM_COMPRESS);

	int r = 0;		
	r = lzo1x_1_compress((const unsigned char*)buffer, bufferSize, compressedData, &sizeCompressedData, wrkmem);
	if (r != LZO_E_OK) {
		throw new UnexpectedException("LZEncoder: compress error!");
	}


	// Writing header for decoder to use
	*((int*) page)=sizeCompressedData;
	*((int*) (page+sizeof(int)))=bufferSize;
	//*((int*) (page+2*sizeof(int)))=startPos;
	//*((int*) (page+3*sizeof(int)))=valsize;

	if (sizeCompressedData>PAGE_SIZE-2*sizeof(int)) 
		throw CodingException("LZEncoder: Error, compressed data larger than what we can fit on page");
    
	memcpy(page+2*sizeof(int), compressedData, sizeCompressedData);
	delete[] compressedData;
	lzo_free(wrkmem);
	return page;
}
コード例 #6
0
int PosBlockArray::PosBlockArrayIter::getSize() {
  if (isPosContiguous())
    return (endPos-startPos)+1;
  else
    throw UnexpectedException("This is going to be annoying to write. Do I really need to?");
}
コード例 #7
0
void PosBlockArray::resetBlock() {
	throw UnexpectedException();
  for (int i=0; i < size; i++)
    posBlockArray[i]->resetBlock();
}
コード例 #8
0
unsigned int PosBlockArray::getCurrLoc() {
		throw UnexpectedException();
  return posBlockArray[currindex]->getCurrLoc();
}