void ToBuffer(StreamList& TheVec, char* pBuffer, int& nBuffUsed) { int nNumEntries = TheVec.size(); int nOffset = 0; int nTemp = 0; memcpy(pBuffer, &nNumEntries, sizeof(int)); StreamList::iterator i; nOffset = sizeof(int); for (i = TheVec.begin(); i != TheVec.end(); i++) { nTemp = (*i).first.size(); memcpy(&pBuffer[nOffset], (*i).first.c_str(), nTemp); nOffset += nTemp; pBuffer[nOffset] = '\0'; nOffset += sizeof(char); nTemp = (*i).second.size(); memcpy(&pBuffer[nOffset], (*i).second.c_str(), nTemp); nOffset += nTemp; pBuffer[nOffset] = '\0'; nOffset += sizeof(char); } nBuffUsed = nOffset; }
int BufSize(StreamList& TheVec) { int nBufSize = TheVec.size() * (sizeof(char)*2); nBufSize += sizeof(int); StreamList::iterator i; for (i = TheVec.begin(); i != TheVec.end(); i++) { nBufSize += (*i).first.size() + (*i).second.size(); } return nBufSize; }
void RecursiveStream::findUsedStreams(StreamList& streams, bool expandAll) const { RecordStream::findUsedStreams(streams); if (expandAll) { if (!streams.exist(m_mapStream)) streams.add(m_mapStream); m_root->findUsedStreams(streams, true); m_inner->findUsedStreams(streams, true); } }
void FromBuffer(StreamList& TheVec, char* pBuffer, int& nBuffUsed) { int nOffset = 0; int nNumEntries = 0; memcpy(&nNumEntries, pBuffer, sizeof(int)); int i = 0; string strOne, strTwo; nOffset = sizeof(int); for (i = 0; i < nNumEntries; i++) { strOne = &pBuffer[nOffset]; nOffset += strOne.size() + sizeof(char); strTwo = &pBuffer[nOffset]; nOffset += strTwo.size() + sizeof(char); TheVec.push_back(pair<string, string>(strOne, strTwo)); } nBuffUsed = nOffset; }
void submitPullDescriptor(LaneHandle lane, F functor) { StreamList list; list.push_back(frigg::construct<PullDescriptor<F>>(*kernelAlloc, frigg::move(functor))); Stream::transmit(lane, list); }
void submitRecvBuffer(LaneHandle lane, AnyBufferAccessor accessor, F functor) { StreamList list; list.push_back(frigg::construct<RecvToBuffer<F>>(*kernelAlloc, frigg::move(functor), frigg::move(accessor))); Stream::transmit(lane, list); }
void submitRecvInline(LaneHandle lane, F functor) { StreamList list; list.push_back(frigg::construct<RecvInline<F>>(*kernelAlloc, frigg::move(functor))); Stream::transmit(lane, list); }
void submitSendBuffer(LaneHandle lane, frigg::UniqueMemory<KernelAlloc> buffer, F functor) { StreamList list; list.push_back(frigg::construct<SendFromBuffer<F>>(*kernelAlloc, frigg::move(functor), frigg::move(buffer))); Stream::transmit(lane, list); }
void submitExtractCredentials(LaneHandle lane, F functor) { StreamList list; list.push_back(frigg::construct<ExtractCredentials<F>>(*kernelAlloc, frigg::move(functor))); Stream::transmit(lane, list); }
void submitImbueCredentials(LaneHandle lane, const char *credentials, F functor) { StreamList list; list.push_back(frigg::construct<ImbueCredentials<F>>(*kernelAlloc, frigg::move(functor), credentials)); Stream::transmit(lane, list); }
BufferedStream::BufferedStream(CompilerScratch* csb, RecordSource* next) : m_next(next), m_map(csb->csb_pool) { fb_assert(m_next); m_impure = CMP_impure(csb, sizeof(Impure)); StreamList streams; m_next->findUsedStreams(streams); Array<dsc> fields; for (StreamList::iterator i = streams.begin(); i != streams.end(); ++i) { const StreamType stream = *i; CompilerScratch::csb_repeat* const tail = &csb->csb_rpt[stream]; UInt32Bitmap::Accessor accessor(tail->csb_fields); if (accessor.getFirst()) { do { const USHORT id = (USHORT) accessor.current(); const Format* const format = tail->csb_format; // CMP_format(tdbb, csb, stream); const dsc* const desc = &format->fmt_desc[id]; m_map.add(FieldMap(FieldMap::REGULAR_FIELD, stream, id)); fields.add(*desc); } while (accessor.getNext()); } dsc desc; desc.makeLong(0); m_map.add(FieldMap(FieldMap::TRANSACTION_ID, stream, 0)); fields.add(desc); desc.makeInt64(0); m_map.add(FieldMap(FieldMap::DBKEY_NUMBER, stream, 0)); fields.add(desc); desc.makeText(1, CS_BINARY); m_map.add(FieldMap(FieldMap::DBKEY_VALID, stream, 0)); fields.add(desc); } const size_t count = fields.getCount(); Format* const format = Format::newFormat(csb->csb_pool, count); format->fmt_length = FLAG_BYTES(count); for (size_t i = 0; i < count; i++) { dsc& desc = format->fmt_desc[i] = fields[i]; if (desc.dsc_dtype >= dtype_aligned) format->fmt_length = FB_ALIGN(format->fmt_length, type_alignments[desc.dsc_dtype]); desc.dsc_address = (UCHAR*)(IPTR) format->fmt_length; format->fmt_length += desc.dsc_length; } m_format = format; }
void RecordStream::findUsedStreams(StreamList& streams, bool /*expandAll*/) const { if (!streams.exist(m_stream)) streams.add(m_stream); }