1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

Reformat all code to coding standard

This commit is contained in:
Andrew Hutchings
2017-10-26 17:18:17 +01:00
parent 4985f3456e
commit 01446d1e22
1296 changed files with 403852 additions and 353747 deletions

View File

@ -67,7 +67,7 @@ struct CompElement32Rid32Val
struct CompElement32RidOnly
{
uint32_t first;
uint32_t first;
};
//------------------------------------------------------------------------------
@ -79,242 +79,314 @@ struct CompElement32RidOnly
//------------------------------------------------------------------------------
class ElementCompression
{
public:
//
//...Utilities to compress from 64 bit to 32 bit for RID and/or Value
//
template <typename DestType>
static void compress(
std::vector<ElementType>& vIn,
std::vector<DestType>& vOut);
static void compress(
std::vector<ElementType>& vIn,
std::vector<CompElement32RidOnly>& vOut)
{ throw std::logic_error(
"Compression of ElementType to 32RidOnly not supported"); }
public:
//
//...Utilities to compress from 64 bit to 32 bit for RID and/or Value
//
template <typename DestType>
static void compress(
std::vector<ElementType>& vIn,
std::vector<DestType>& vOut);
static void compress(
std::vector<ElementType>& vIn,
std::vector<CompElement32RidOnly>& vOut)
{
throw std::logic_error(
"Compression of ElementType to 32RidOnly not supported");
}
static void compress(
std::vector<StringElementType>& vIn,
std::vector<CompElement64Rid32Val>& vOut)
{ throw std::logic_error(
"Compression of StringElementType to 64/32 not supported"); }
static void compress(
std::vector<StringElementType>& vIn,
std::vector<CompElement32Rid64Val>& vOut)
{ throw std::logic_error(
"Compression of StringElementType to 32/64 not supported"); }
static void compress(
std::vector<StringElementType>& vIn,
std::vector<CompElement32Rid32Val>& vOut)
{ throw std::logic_error(
"Compression of StringElementType to 32/32 not supported"); }
static void compress(
std::vector<StringElementType>& vIn,
std::vector<CompElement32RidOnly>& vOut)
{ throw std::logic_error(
"Compression of StringElementType to 32RidOnly not supported");}
static void compress(
std::vector<StringElementType>& vIn,
std::vector<CompElement64Rid32Val>& vOut)
{
throw std::logic_error(
"Compression of StringElementType to 64/32 not supported");
}
static void compress(
std::vector<StringElementType>& vIn,
std::vector<CompElement32Rid64Val>& vOut)
{
throw std::logic_error(
"Compression of StringElementType to 32/64 not supported");
}
static void compress(
std::vector<StringElementType>& vIn,
std::vector<CompElement32Rid32Val>& vOut)
{
throw std::logic_error(
"Compression of StringElementType to 32/32 not supported");
}
static void compress(
std::vector<StringElementType>& vIn,
std::vector<CompElement32RidOnly>& vOut)
{
throw std::logic_error(
"Compression of StringElementType to 32RidOnly not supported");
}
static void compress(
std::vector<DoubleElementType>& vIn,
std::vector<CompElement64Rid32Val>& vOut)
{ throw std::logic_error(
"Compression of DoubleElementType to 64/32 not supported"); }
static void compress(
std::vector<DoubleElementType>& vIn,
std::vector<CompElement32Rid64Val>& vOut)
{ throw std::logic_error(
"Compression of DoubleElementType to 32/64 not supported"); }
static void compress(
std::vector<DoubleElementType>& vIn,
std::vector<CompElement32Rid32Val>& vOut)
{ throw std::logic_error(
"Compression of DoubleElementType to 32/32 not supported"); }
static void compress(
std::vector<DoubleElementType>& vIn,
std::vector<CompElement32RidOnly>& vOut)
{ throw std::logic_error(
"Compression of DoubleElementType to 32RidOnly not supported");}
static void compress(
std::vector<DoubleElementType>& vIn,
std::vector<CompElement64Rid32Val>& vOut)
{
throw std::logic_error(
"Compression of DoubleElementType to 64/32 not supported");
}
static void compress(
std::vector<DoubleElementType>& vIn,
std::vector<CompElement32Rid64Val>& vOut)
{
throw std::logic_error(
"Compression of DoubleElementType to 32/64 not supported");
}
static void compress(
std::vector<DoubleElementType>& vIn,
std::vector<CompElement32Rid32Val>& vOut)
{
throw std::logic_error(
"Compression of DoubleElementType to 32/32 not supported");
}
static void compress(
std::vector<DoubleElementType>& vIn,
std::vector<CompElement32RidOnly>& vOut)
{
throw std::logic_error(
"Compression of DoubleElementType to 32RidOnly not supported");
}
static void compress(
std::vector<RIDElementType>& vIn,
std::vector<CompElement64Rid32Val>& vOut)
{ throw std::logic_error(
"Compression of RIDElementType to 64/32 not supported"); }
static void compress(
std::vector<RIDElementType>& vIn,
std::vector<CompElement32Rid64Val>& vOut)
{ throw std::logic_error(
"Compression of RIDElementType to 32/64 not supported"); }
static void compress(
std::vector<RIDElementType>& vIn,
std::vector<CompElement32Rid32Val>& vOut)
{ throw std::logic_error(
"Compression of RIDElementType to 32/32 not supported"); }
static void compress(
std::vector<RIDElementType>& vIn,
std::vector<CompElement32RidOnly>& vOut);
static void compress(
std::vector<RIDElementType>& vIn,
std::vector<CompElement64Rid32Val>& vOut)
{
throw std::logic_error(
"Compression of RIDElementType to 64/32 not supported");
}
static void compress(
std::vector<RIDElementType>& vIn,
std::vector<CompElement32Rid64Val>& vOut)
{
throw std::logic_error(
"Compression of RIDElementType to 32/64 not supported");
}
static void compress(
std::vector<RIDElementType>& vIn,
std::vector<CompElement32Rid32Val>& vOut)
{
throw std::logic_error(
"Compression of RIDElementType to 32/32 not supported");
}
static void compress(
std::vector<RIDElementType>& vIn,
std::vector<CompElement32RidOnly>& vOut);
static void compress(
std::vector<TupleType>& vIn,
std::vector<CompElement64Rid32Val>& vOut)
{ throw std::logic_error(
"Compression of TupleType to 64/32 not supported"); }
static void compress(
std::vector<TupleType>& vIn,
std::vector<CompElement32Rid64Val>& vOut)
{ throw std::logic_error(
"Compression of TupleType to 32/64 not supported"); }
static void compress(
std::vector<TupleType>& vIn,
std::vector<CompElement32Rid32Val>& vOut)
{ throw std::logic_error(
"Compression of TupleType to 32/32 not supported"); }
static void compress(
std::vector<TupleType>& vIn,
std::vector<CompElement32RidOnly>& vOut)
{ throw std::logic_error(
"Compression of TupleType to 32/32 not supported"); }
static void compress(
std::vector<TupleType>& vIn,
std::vector<CompElement64Rid32Val>& vOut)
{
throw std::logic_error(
"Compression of TupleType to 64/32 not supported");
}
static void compress(
std::vector<TupleType>& vIn,
std::vector<CompElement32Rid64Val>& vOut)
{
throw std::logic_error(
"Compression of TupleType to 32/64 not supported");
}
static void compress(
std::vector<TupleType>& vIn,
std::vector<CompElement32Rid32Val>& vOut)
{
throw std::logic_error(
"Compression of TupleType to 32/32 not supported");
}
static void compress(
std::vector<TupleType>& vIn,
std::vector<CompElement32RidOnly>& vOut)
{
throw std::logic_error(
"Compression of TupleType to 32/32 not supported");
}
//
//...Utilities to expand from 32 bit to 64 bit for RID and/or Value
//
template <typename SrcType>
static void expand(
std::vector<SrcType>& vIn,
ElementType* vOut);
static void expand(
std::vector<CompElement32RidOnly>& vIn,
ElementType* vOut)
{ throw std::logic_error(
"Expansion to ElementType from 32RidOnly not supported");}
//
//...Utilities to expand from 32 bit to 64 bit for RID and/or Value
//
template <typename SrcType>
static void expand(
std::vector<SrcType>& vIn,
ElementType* vOut);
static void expand(
std::vector<CompElement32RidOnly>& vIn,
ElementType* vOut)
{
throw std::logic_error(
"Expansion to ElementType from 32RidOnly not supported");
}
static void expand(
std::vector<CompElement64Rid32Val>& vIn,
StringElementType* vOut)
{ throw std::logic_error(
"Expansion to StringElementType from 64/32 not supported"); }
static void expand(
std::vector<CompElement32Rid64Val>& vIn,
StringElementType* vOut)
{ throw std::logic_error(
"Expansion to StringElementType from 32/64 not supported"); }
static void expand(
std::vector<CompElement32Rid32Val>& vIn,
StringElementType* vOut)
{ throw std::logic_error(
"Expansion to StringElementType from 32/32 not supported"); }
static void expand(
std::vector<CompElement32RidOnly>& vIn,
StringElementType* vOut)
{ throw std::logic_error(
"Expansion to StringElementType from 32RidOnly not supported");}
static void expand(
std::vector<CompElement64Rid32Val>& vIn,
StringElementType* vOut)
{
throw std::logic_error(
"Expansion to StringElementType from 64/32 not supported");
}
static void expand(
std::vector<CompElement32Rid64Val>& vIn,
StringElementType* vOut)
{
throw std::logic_error(
"Expansion to StringElementType from 32/64 not supported");
}
static void expand(
std::vector<CompElement32Rid32Val>& vIn,
StringElementType* vOut)
{
throw std::logic_error(
"Expansion to StringElementType from 32/32 not supported");
}
static void expand(
std::vector<CompElement32RidOnly>& vIn,
StringElementType* vOut)
{
throw std::logic_error(
"Expansion to StringElementType from 32RidOnly not supported");
}
static void expand(
std::vector<CompElement64Rid32Val>& vIn,
DoubleElementType* vOut)
{ throw std::logic_error(
"Expansion to DoubleElementType from 64/32 not supported"); }
static void expand(
std::vector<CompElement32Rid64Val>& vIn,
DoubleElementType* vOut)
{ throw std::logic_error(
"Expansion to DoubleElementType from 32/64 not supported"); }
static void expand(
std::vector<CompElement32Rid32Val>& vIn,
DoubleElementType* vOut)
{ throw std::logic_error(
"Expansion to DoubleElementType from 32/32 not supported"); }
static void expand(
std::vector<CompElement32RidOnly>& vIn,
DoubleElementType* vOut)
{ throw std::logic_error(
"Expansion to DoubleElementType from 32RidOnly not supported");}
static void expand(
std::vector<CompElement64Rid32Val>& vIn,
DoubleElementType* vOut)
{
throw std::logic_error(
"Expansion to DoubleElementType from 64/32 not supported");
}
static void expand(
std::vector<CompElement32Rid64Val>& vIn,
DoubleElementType* vOut)
{
throw std::logic_error(
"Expansion to DoubleElementType from 32/64 not supported");
}
static void expand(
std::vector<CompElement32Rid32Val>& vIn,
DoubleElementType* vOut)
{
throw std::logic_error(
"Expansion to DoubleElementType from 32/32 not supported");
}
static void expand(
std::vector<CompElement32RidOnly>& vIn,
DoubleElementType* vOut)
{
throw std::logic_error(
"Expansion to DoubleElementType from 32RidOnly not supported");
}
static void expand(
std::vector<CompElement64Rid32Val>& vIn,
RIDElementType* vOut)
{ throw std::logic_error(
"Expansion to RIDElementType from 64/32 not supported"); }
static void expand(
std::vector<CompElement32Rid64Val>& vIn,
RIDElementType* vOut)
{ throw std::logic_error(
"Expansion to RIDElementType from 32/64 not supported"); }
static void expand(
std::vector<CompElement32Rid32Val>& vIn,
RIDElementType* vOut)
{ throw std::logic_error(
"Expansion to RIDElementType from 32/32 not supported"); }
static void expand(
std::vector<CompElement32RidOnly>& vIn,
RIDElementType* vOut);
static void expand(
std::vector<CompElement64Rid32Val>& vIn,
RIDElementType* vOut)
{
throw std::logic_error(
"Expansion to RIDElementType from 64/32 not supported");
}
static void expand(
std::vector<CompElement32Rid64Val>& vIn,
RIDElementType* vOut)
{
throw std::logic_error(
"Expansion to RIDElementType from 32/64 not supported");
}
static void expand(
std::vector<CompElement32Rid32Val>& vIn,
RIDElementType* vOut)
{
throw std::logic_error(
"Expansion to RIDElementType from 32/32 not supported");
}
static void expand(
std::vector<CompElement32RidOnly>& vIn,
RIDElementType* vOut);
static void expand(
std::vector<CompElement64Rid32Val>& vIn,
TupleType* vOut)
{ throw std::logic_error(
"Expansion to TupleType from 64/32 not supported"); }
static void expand(
std::vector<CompElement32Rid64Val>& vIn,
TupleType* vOut)
{ throw std::logic_error(
"Expansion to TupleType from 32/64 not supported"); }
static void expand(
std::vector<CompElement32Rid32Val>& vIn,
TupleType* vOut)
{ throw std::logic_error(
"Expansion to TupleType from 32/32 not supported"); }
static void expand(
std::vector<CompElement32RidOnly>& vIn,
TupleType* vOut)
{ throw std::logic_error(
"Expansion to TupleType from 32/32 not supported"); }
static void expand(
std::vector<CompElement64Rid32Val>& vIn,
TupleType* vOut)
{
throw std::logic_error(
"Expansion to TupleType from 64/32 not supported");
}
static void expand(
std::vector<CompElement32Rid64Val>& vIn,
TupleType* vOut)
{
throw std::logic_error(
"Expansion to TupleType from 32/64 not supported");
}
static void expand(
std::vector<CompElement32Rid32Val>& vIn,
TupleType* vOut)
{
throw std::logic_error(
"Expansion to TupleType from 32/32 not supported");
}
static void expand(
std::vector<CompElement32RidOnly>& vIn,
TupleType* vOut)
{
throw std::logic_error(
"Expansion to TupleType from 32/32 not supported");
}
//
//...Utilities to write a single element with a compressed 32 bit RID.
//
static void writeWith32Rid(
const ElementType& e,
std::fstream& fFile);
static void writeWith32Rid(
const DoubleElementType& e,
std::fstream& fFile)
{ throw std::logic_error(
"Compress/Write of 32 RID DoubleElementType not supported"); }
static void writeWith32Rid(
const StringElementType& e,
std::fstream& fFile);
static void writeWith32Rid(
const RIDElementType& e,
std::fstream& fFile);
static void writeWith32Rid(
const TupleType& e,
std::fstream& fFile)
{throw std::logic_error(
"Compress/Write of 32 RID TupleType not supported");}
//
//...Utilities to write a single element with a compressed 32 bit RID.
//
static void writeWith32Rid(
const ElementType& e,
std::fstream& fFile);
static void writeWith32Rid(
const DoubleElementType& e,
std::fstream& fFile)
{
throw std::logic_error(
"Compress/Write of 32 RID DoubleElementType not supported");
}
static void writeWith32Rid(
const StringElementType& e,
std::fstream& fFile);
static void writeWith32Rid(
const RIDElementType& e,
std::fstream& fFile);
static void writeWith32Rid(
const TupleType& e,
std::fstream& fFile)
{
throw std::logic_error(
"Compress/Write of 32 RID TupleType not supported");
}
//
//...Utilities to read a single element with a compressed 32 bit RID.
//
static void readWith32Rid(
ElementType& e,
std::fstream& fFile);
static void readWith32Rid(
DoubleElementType& e,
std::fstream& fFile)
{ throw std::logic_error(
"Read/Expand of 32 RID DoubleElementType not supported"); }
static void readWith32Rid(
StringElementType& e,
std::fstream& fFile);
static void readWith32Rid(
RIDElementType& e,
std::fstream& fFile);
static void readWith32Rid(
TupleType& e,
std::fstream& fFile)
{throw std::logic_error(
"Read/Expand of 32 RID TupleType not supported");}
//
//...Utilities to read a single element with a compressed 32 bit RID.
//
static void readWith32Rid(
ElementType& e,
std::fstream& fFile);
static void readWith32Rid(
DoubleElementType& e,
std::fstream& fFile)
{
throw std::logic_error(
"Read/Expand of 32 RID DoubleElementType not supported");
}
static void readWith32Rid(
StringElementType& e,
std::fstream& fFile);
static void readWith32Rid(
RIDElementType& e,
std::fstream& fFile);
static void readWith32Rid(
TupleType& e,
std::fstream& fFile)
{
throw std::logic_error(
"Read/Expand of 32 RID TupleType not supported");
}
};
//------------------------------------------------------------------------------
@ -329,15 +401,16 @@ class ElementCompression
template <typename DestType>
/* static */ inline void
ElementCompression::compress(
std::vector<ElementType>& vIn,
std::vector<DestType>& vOut)
std::vector<ElementType>& vIn,
std::vector<DestType>& vOut)
{
uint64_t count = vIn.size();
for (unsigned int i=0; i<count; i++)
{
vOut[i].first = vIn[i].first;
vOut[i].second= vIn[i].second;
}
uint64_t count = vIn.size();
for (unsigned int i = 0; i < count; i++)
{
vOut[i].first = vIn[i].first;
vOut[i].second = vIn[i].second;
}
}
//
@ -348,14 +421,15 @@ ElementCompression::compress(
//
/* static */ inline void
ElementCompression::compress(
std::vector<RIDElementType>& vIn,
std::vector<CompElement32RidOnly>& vOut)
std::vector<RIDElementType>& vIn,
std::vector<CompElement32RidOnly>& vOut)
{
uint64_t count = vIn.size();
for (unsigned int i=0; i<count; i++)
{
vOut[i].first = vIn[i].first;
}
uint64_t count = vIn.size();
for (unsigned int i = 0; i < count; i++)
{
vOut[i].first = vIn[i].first;
}
}
//------------------------------------------------------------------------------
@ -370,15 +444,16 @@ ElementCompression::compress(
template <typename SrcType>
/* static */ inline void
ElementCompression::expand(
std::vector<SrcType>& vIn,
ElementType* vOut)
std::vector<SrcType>& vIn,
ElementType* vOut)
{
uint64_t count = vIn.size();
for (unsigned int i=0; i<count; i++)
{
vOut[i].first = vIn[i].first;
vOut[i].second= vIn[i].second;
}
uint64_t count = vIn.size();
for (unsigned int i = 0; i < count; i++)
{
vOut[i].first = vIn[i].first;
vOut[i].second = vIn[i].second;
}
}
//
@ -389,14 +464,15 @@ ElementCompression::expand(
//
/* static */ inline void
ElementCompression::expand(
std::vector<CompElement32RidOnly>& vIn,
RIDElementType* vOut)
std::vector<CompElement32RidOnly>& vIn,
RIDElementType* vOut)
{
uint64_t count = vIn.size();
for (unsigned int i=0; i<count; i++)
{
vOut[i].first = vIn[i].first;
}
uint64_t count = vIn.size();
for (unsigned int i = 0; i < count; i++)
{
vOut[i].first = vIn[i].first;
}
}
//------------------------------------------------------------------------------
@ -405,36 +481,36 @@ ElementCompression::expand(
/* static */ inline void
ElementCompression::writeWith32Rid(
const ElementType& e,
std::fstream& fFile)
const ElementType& e,
std::fstream& fFile)
{
CompElement32Rid64Val eCompressed;
eCompressed.first = e.first;
eCompressed.second = e.second;
fFile.write((char *) &eCompressed, sizeof(CompElement32Rid64Val));
CompElement32Rid64Val eCompressed;
eCompressed.first = e.first;
eCompressed.second = e.second;
fFile.write((char*) &eCompressed, sizeof(CompElement32Rid64Val));
}
/* static */ inline void
ElementCompression::writeWith32Rid(
const StringElementType& e,
std::fstream& fFile)
const StringElementType& e,
std::fstream& fFile)
{
uint32_t rid = e.first;
uint16_t dlen = e.second.length();
uint32_t rid = e.first;
uint16_t dlen = e.second.length();
fFile.write((char*)&rid, sizeof(rid) );
fFile.write((char*)&dlen,sizeof(dlen));
fFile.write( e.second.c_str(), dlen );
fFile.write((char*)&rid, sizeof(rid) );
fFile.write((char*)&dlen, sizeof(dlen));
fFile.write( e.second.c_str(), dlen );
}
/* static */ inline void
ElementCompression::writeWith32Rid(
const RIDElementType& e,
std::fstream& fFile)
const RIDElementType& e,
std::fstream& fFile)
{
CompElement32RidOnly eCompressed;
eCompressed.first = e.first;
fFile.write((char *) &eCompressed, sizeof(CompElement32RidOnly));
CompElement32RidOnly eCompressed;
eCompressed.first = e.first;
fFile.write((char*) &eCompressed, sizeof(CompElement32RidOnly));
}
//------------------------------------------------------------------------------
@ -443,40 +519,40 @@ ElementCompression::writeWith32Rid(
/* static */ inline void
ElementCompression::readWith32Rid(
ElementType& e,
std::fstream& fFile)
ElementType& e,
std::fstream& fFile)
{
CompElement32Rid64Val eCompressed;
fFile.read((char *) &eCompressed, sizeof(CompElement32Rid64Val));
e.first = eCompressed.first;
e.second = eCompressed.second;
CompElement32Rid64Val eCompressed;
fFile.read((char*) &eCompressed, sizeof(CompElement32Rid64Val));
e.first = eCompressed.first;
e.second = eCompressed.second;
}
/* static */ inline void
ElementCompression::readWith32Rid(
StringElementType& e,
std::fstream& fFile)
StringElementType& e,
std::fstream& fFile)
{
uint32_t rid = 0;
uint16_t dlen = 0;
char d[32768];
uint32_t rid = 0;
uint16_t dlen = 0;
char d[32768];
fFile.read((char*)&rid, sizeof(rid) );
fFile.read((char*)&dlen,sizeof(dlen));
fFile.read( d, dlen );
fFile.read((char*)&rid, sizeof(rid) );
fFile.read((char*)&dlen, sizeof(dlen));
fFile.read( d, dlen );
e.first = rid;
e.second.assign(d, dlen);
e.first = rid;
e.second.assign(d, dlen);
}
/* static */ inline void
ElementCompression::readWith32Rid(
RIDElementType& e,
std::fstream& fFile)
RIDElementType& e,
std::fstream& fFile)
{
CompElement32RidOnly eCompressed;
fFile.read((char *) &eCompressed, sizeof(CompElement32RidOnly));
e.first = eCompressed.first;
CompElement32RidOnly eCompressed;
fFile.read((char*) &eCompressed, sizeof(CompElement32RidOnly));
e.first = eCompressed.first;
}
} // end of joblist namespace