RLETriple* RLEGenericDecoder::getTriple(unsigned int triplePos_) { if (triplePos_>=getSize()) return false; // to guarantee atomicity in reading if there is a failure int oldPos=reader->getCurrentPos(); reader->skipToStringPos(triplePos_); RLETriple* t = getNextTriple(); /*unsigned int value; if (!reader->readBits(value, valueSize)) { reader->skipToBitPos(oldBitPos); Log::writeToLog("RLEGenericDecoder", 0, "getTriple() Could not read value"); return NULL; } if (!reader->readBits(result->startPos, startPosSize)) { reader->skipToBitPos(oldBitPos); Log::writeToLog("RLEGenericDecoder", 0, "getTriple() Could not read startPos"); return NULL; } if (!reader->readBits(result->reps, repsSize)) { reader->skipToBitPos(oldBitPos); Log::writeToLog("RLEGenericDecoder", 0, "getTriple() Could not read reps"); return NULL; }*/ //result->value=(unsigned int) value; // assuming encoding for all positive values //result->value->set(result->startPos, (byte*)&value); //result->value = vp; // return to old position for sequential read reader->skipToStringPos(oldPos); return t; }
Block* RLEGenericDecoder::skipToBlock(unsigned int blockPos_) { if (!initialized) throw new CodingException("RLEGenericDecoder: Error, decoder not initialized with buffer"); if (!skipToTriple(blockPos_)) return NULL; RLETriple* triple=getNextTriple(); if (triple==NULL) return NULL; block->setTriple(triple); return block; }
Block* RLEGenericDecoder::getNextBlock() { if (!initialized) throw new CodingException("RLEGenericDecoder: Error, decoder not initialized with buffer"); RLETriple* triple=getNextTriple(); if (triple==NULL) return NULL; block->setTriple(triple); return block; }
//consume the block wih position blockPos_ bool RLEDecoder::skipToPos(unsigned int blockPos_) { throw new CodingException("DNA 7/2/06: I don't think this method is correct but I don't think it matters since this method never gets called in runtime code. Thus, I'll place this here to see if it gets called."); if (!initialized) throw new CodingException("RLEDecoder: Error, decoder not initialized with buffer"); if (!skipToTriple(blockPos_)) return false; RLETriple* triple = getNextTriple(); if (triple == NULL) return false; return true; }
RLETriple* RLEGenericDecoder::peekNextTriple() { RLETriple* retTrip=getNextTriple(); if (retTrip) { reader->unReadString(); return retTrip; } else return NULL; }
Block* RLEDecoder::getNextBlock() { if (!initialized) throw new CodingException("RLEDecoder: Error, decoder not initialized with buffer"); RLETriple* triple = getNextTriple(); if (triple == NULL) return NULL; if (block == NULL) { block = new RLEBlock(triple, valSorted); } else { block->setTriple(triple); } return block; }
RLETriple* RLEDecoder::peekNextTriple() { int oldBitPos = reader->getCurrentBitPosition(); RLETriple* retTrip = getNextTriple(); reader->skipToBitPos(oldBitPos); return retTrip; }
void PlainHeaderIteratorTripleString::doFetch() { do { getNextTriple(); } while(hasMoreTriples && (!nextTriple.match(pattern))); }