You've already forked mariadb-columnstore-engine
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:
48
utils/messageqcpp/bytestream.cpp
Normal file → Executable file
48
utils/messageqcpp/bytestream.cpp
Normal file → Executable 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
|
||||
|
||||
|
Reference in New Issue
Block a user