int GraphPath::dump(char * buffer) const { int position = 0; uint32_t elements = size(); int operationSize = sizeof(uint32_t); memcpy(buffer + position, &elements, operationSize); position += operationSize; uint32_t kmerLength = getKmerLength(); #ifdef CONFIG_ASSERT assert(kmerLength > 0); #endif memcpy(buffer + position, &kmerLength, operationSize); position += operationSize; //cout << "[DEBUG] GraphPath::dump kmerLength " << kmerLength << endl; for(int i = 0 ; i < (int)elements ; i ++) { Kmer value; at(i, &value); position += value.dump(buffer + position); } return position; }
void StoreKeeper::sendKmersSamples() { char buffer[MAXIMUM_MESSAGE_SIZE_IN_BYTES]; int bytes = 0; ExperimentVertex * currentVertex = NULL; VirtualKmerColorHandle currentVirtualColor = NULL_VIRTUAL_COLOR; vector<bool> samplesVector (m_sampleSize, false); if(m_hashTableIterator.hasNext()){ currentVertex = m_hashTableIterator.next(); Kmer kmer = currentVertex->getKey(); bytes += kmer.dump(buffer); currentVirtualColor = currentVertex->getVirtualColor(); set<PhysicalKmerColor> * samples = m_colorSet.getPhysicalColors(currentVirtualColor); for(set<PhysicalKmerColor>:: iterator sampleIterator = samples->begin(); sampleIterator != samples->end(); ++sampleIterator) { PhysicalKmerColor value = *sampleIterator; samplesVector[value] = true; } for (std::vector<bool>::iterator it = samplesVector.begin(); it != samplesVector.end(); ++it) { buffer[bytes] = *it; bytes++; } } Message message; message.setNumberOfBytes(bytes); message.setBuffer(buffer); if(m_hashTableIterator.hasNext()){ message.setTag(KmerMatrixOwner::PUSH_KMER_SAMPLES); }else{ message.setTag(KmerMatrixOwner::PUSH_KMER_SAMPLES_END); } send(m_kmerMatrixOwner, message); }