1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-29 08:21:15 +03:00

MCOL-523 Add UDAF and UDAnF SDK

This commit is contained in:
David Hall
2017-07-26 11:53:08 -05:00
parent 630b113565
commit bc2a4e7795
75 changed files with 10250 additions and 4523 deletions

48
utils/messageqcpp/bytestream.cpp Normal file → Executable file
View File

@ -588,5 +588,53 @@ void ByteStream::peek(uuid& u) const
memcpy(&u.data[0], fCurOutPtr, uuids::uuid::static_size());
}
ByteStream& ByteStream::operator<<(const float f)
{
int sz = sizeof(float);
if (fBuf == 0 || (fCurInPtr - fBuf + sz > fMaxLen + ISSOverhead))
growBuf(fMaxLen + BlockSize);
*((float *) fCurInPtr) = f;
fCurInPtr += sz;
return *this;
}
ByteStream& ByteStream::operator<<(const double d)
{
int sz = sizeof(double);
if (fBuf == 0 || (fCurInPtr - fBuf + sz > fMaxLen + ISSOverhead))
growBuf(fMaxLen + BlockSize);
*((double *) fCurInPtr) = d;
fCurInPtr += sz;
return *this;
}
ByteStream& ByteStream::operator>>(float& f)
{
peek(f);
fCurOutPtr += sizeof(float);
return *this;
}
ByteStream& ByteStream::operator>>(double& d)
{
peek(d);
fCurOutPtr += sizeof(double);
return *this;
}
void ByteStream::peek(float& f) const
{
if (length() < sizeof(float))
throw underflow_error("ByteStream>int64_t: not enough data in stream to fill datatype");
f = *((float *) fCurOutPtr);
}
void ByteStream::peek(double& d) const
{
if (length() < sizeof(double))
throw underflow_error("ByteStream>int64_t: not enough data in stream to fill datatype");
d = *((double *) fCurOutPtr);
}
}//namespace messageqcpp