10#include "util/SimpleRNG.hpp"
15#include <boost/iostreams/device/mapped_file.hpp>
26static inline bool compare(std::string file1, std::string file2)
28 boost::iostreams::mapped_file_source f1(file1);
29 boost::iostreams::mapped_file_source f2(file2);
31 if( f1.size() == f2.size() && std::equal(f1.data(), f1.data() + f1.size(), f2.data()) )
52 return std::to_string(
R) +
" " + std::to_string(
G) +
" " + std::to_string(
B);
81 float s = (float)d.GetUniform();
85#ifdef ON_IO_UNIT_TESTS
149 else if (group == 10)
171static inline bool hasEnding (std::string
const &fullString, std::string
const &ending)
173 if (fullString.length() >= ending.length())
174 {
return (0 == fullString.compare (fullString.length() - ending.length(), ending.length(), ending));}
179static const std::string base64_chars =
180 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
181 "abcdefghijklmnopqrstuvwxyz"
185static inline bool is_base64(
unsigned char c) {
186 return (isalnum(c) || (c ==
'+') || (c ==
'/'));
285static const unsigned char vtkBase64UtilitiesEncodeTable[65] =
286 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
287 "abcdefghijklmnopqrstuvwxyz"
291inline static unsigned char vtkBase64UtilitiesEncodeChar(
unsigned char c)
294 return vtkBase64UtilitiesEncodeTable[c];
298static void EncodeTriplet(
unsigned char i0,
306 *o0 = vtkBase64UtilitiesEncodeChar((i0 >> 2) & 0x3F);
307 *o1 = vtkBase64UtilitiesEncodeChar(((i0 << 4) & 0x30)|((i1 >> 4) & 0x0F));
308 *o2 = vtkBase64UtilitiesEncodeChar(((i1 << 2) & 0x3C)|((i2 >> 6) & 0x03));
309 *o3 = vtkBase64UtilitiesEncodeChar(i2 & 0x3F);
313static void EncodePair(
unsigned char i0,
320 *o0 = vtkBase64UtilitiesEncodeChar((i0 >> 2) & 0x3F);
321 *o1 = vtkBase64UtilitiesEncodeChar(((i0 << 4) & 0x30)|((i1 >> 4) & 0x0F));
322 *o2 = vtkBase64UtilitiesEncodeChar(((i1 << 2) & 0x3C));
327static void EncodeSingle(
unsigned char i0,
333 *o0 = vtkBase64UtilitiesEncodeChar((i0 >> 2) & 0x3F);
334 *o1 = vtkBase64UtilitiesEncodeChar(((i0 << 4) & 0x30));
340static unsigned long EncodeToBase64(
const unsigned char *input,
341 unsigned long length,
342 unsigned char *output,
346 const unsigned char *ptr = input;
347 const unsigned char *end = input + length;
348 unsigned char *optr = output;
352 while ((end - ptr) >= 3)
354 EncodeTriplet(ptr[0], ptr[1], ptr[2],
355 &optr[0], &optr[1], &optr[2], &optr[3]);
364 EncodePair(ptr[0], ptr[1],
365 &optr[0], &optr[1], &optr[2], &optr[3]);
371 else if (end - ptr == 1)
374 &optr[0], &optr[1], &optr[2], &optr[3]);
382 optr[0] = optr[1] = optr[2] = optr[3] =
'=';
386 return optr - output;
SimpleRNG is a simple random number generator based on George Marsaglia's MWC (multiply with carry) g...
KeyT const ValueT ValueT OffsetIteratorT OffsetIteratorT int
[in] The number of segments that comprise the sorting data
std::string toString()
Return the color as string.