Exemplo n.º 1
0
void ReadAnnotation::write(ostream*f){
	int rank=getRank();
	int readIndex=getReadIndex();
	int positionOnStrand=getPositionOnStrand();
	char strand=getStrand();
	f->write((char*)&rank,sizeof(int));
	f->write((char*)&readIndex,sizeof(int));
	f->write((char*)&positionOnStrand,sizeof(int));
	f->write((char*)&strand,sizeof(char));
}
Exemplo n.º 2
0
void
CircularByteBuffer::peekBytesNoCopy(unsigned int inByteCount,
                                    const void** outFirstBytes,
                                    unsigned int* outFirstByteCount,
                                    const void** outSecondBytes,
                                    unsigned int* outSecondByteCount)
{
  void* theFirstBytes = NULL;
  void* theSecondBytes = NULL;
  unsigned int theFirstByteCount = 0;
  unsigned int theSecondByteCount = 0;

  if(inByteCount > 0) {
    assert(inByteCount <= getCountOfElements());

    std::pair<unsigned int, unsigned int> theChunkSizes = splitIntoChunks(
      inByteCount, mReadIndex, mQueueSize);

    theFirstBytes = &(mData[getReadIndex()]);
    theFirstByteCount = theChunkSizes.first;
    theSecondByteCount = theChunkSizes.second;
    theSecondBytes = (theSecondByteCount > 0) ? mData : NULL;
  }

  if(outFirstBytes != NULL) {
    *outFirstBytes = theFirstBytes;
  }

  if(outFirstByteCount != NULL) {
    *outFirstByteCount = theFirstByteCount;
  }

  if(outSecondBytes != NULL) {
    *outSecondBytes = theSecondBytes;
  }

  if(outSecondByteCount != NULL) {
    *outSecondByteCount = theSecondByteCount;
  }
}