11 #ifndef EVIO_6_0_UTIL_H
12 #define EVIO_6_0_UTIL_H
53 uint32_t words = length/4;
66 static uint32_t padValue[4] = {0,3,2,1};
67 return padValue[length%4];
80 static bool iStrEquals(
const std::string& a,
const std::string& b) {
81 unsigned int sz = a.size();
84 for (
unsigned int i = 0; i < sz; ++i)
85 if (tolower(a[i]) != tolower(b[i]))
134 const ByteOrder & byteOrder, uint32_t *dest) {
136 if (data ==
nullptr || dest ==
nullptr) {
140 for (
int i = 0; i < dataLen-3; i+=4) {
141 dest[i/4] =
toInt(data[i ], data[i+1], data[i+2], data[i+3], byteOrder);
156 static uint32_t
toInt(
char b1,
char b2,
char b3,
char b4,
const ByteOrder & byteOrder) {
186 if (data ==
nullptr) {
192 (0xff & data[0]) << 24 |
193 (0xff & data[1]) << 16 |
194 (0xff & data[2]) << 8 |
201 (0xff & data[1]) << 8 |
202 (0xff & data[2]) << 16 |
203 (0xff & data[3]) << 24
218 if (data ==
nullptr) {
224 (uint64_t)(0xff & data[0]) << 56 |
225 (uint64_t)(0xff & data[1]) << 48 |
226 (uint64_t)(0xff & data[2]) << 40 |
227 (uint64_t)(0xff & data[3]) << 32 |
228 (uint64_t)(0xff & data[4]) << 24 |
229 (uint64_t)(0xff & data[5]) << 16 |
230 (uint64_t)(0xff & data[6]) << 8 |
231 (uint64_t)(0xff & data[7])
236 (uint64_t)(0xff & data[0]) |
237 (uint64_t)(0xff & data[1]) << 8 |
238 (uint64_t)(0xff & data[2]) << 16 |
239 (uint64_t)(0xff & data[3]) << 24 |
240 (uint64_t)(0xff & data[4]) << 32 |
241 (uint64_t)(0xff & data[5]) << 40 |
242 (uint64_t)(0xff & data[6]) << 48 |
243 (uint64_t)(0xff & data[7]) << 56
259 if (dest ==
nullptr) {
264 dest[0] = (uint8_t)(data >> 24);
265 dest[1] = (uint8_t)(data >> 16);
266 dest[2] = (uint8_t)(data >> 8);
267 dest[3] = (uint8_t)(data );
270 dest[0] = (uint8_t)(data );
271 dest[1] = (uint8_t)(data >> 8);
272 dest[2] = (uint8_t)(data >> 16);
273 dest[3] = (uint8_t)(data >> 24);
288 if (dest ==
nullptr) {
293 dest[0] = (uint8_t)(data >> 56);
294 dest[1] = (uint8_t)(data >> 48);
295 dest[2] = (uint8_t)(data >> 40);
296 dest[3] = (uint8_t)(data >> 32);
297 dest[4] = (uint8_t)(data >> 24);
298 dest[5] = (uint8_t)(data >> 16);
299 dest[6] = (uint8_t)(data >> 8);
300 dest[7] = (uint8_t)(data );
303 dest[0] = (uint8_t)(data );
304 dest[1] = (uint8_t)(data >> 8);
305 dest[2] = (uint8_t)(data >> 16);
306 dest[3] = (uint8_t)(data >> 24);
307 dest[4] = (uint8_t)(data >> 32);
308 dest[5] = (uint8_t)(data >> 40);
309 dest[6] = (uint8_t)(data >> 48);
310 dest[7] = (uint8_t)(data >> 56);
324 std::vector<uint8_t> & dest,
size_t off) {
327 dest[off ] = (uint8_t)(data >> 24);
328 dest[off+1] = (uint8_t)(data >> 16);
329 dest[off+2] = (uint8_t)(data >> 8);
330 dest[off+3] = (uint8_t)(data );
333 dest[off ] = (uint8_t)(data );
334 dest[off+1] = (uint8_t)(data >> 8);
335 dest[off+2] = (uint8_t)(data >> 16);
336 dest[off+3] = (uint8_t)(data >> 24);
351 if (dest ==
nullptr) {
356 dest[0] = (uint8_t)(data >> 8);
357 dest[1] = (uint8_t)(data );
360 dest[0] = (uint8_t)(data );
361 dest[1] = (uint8_t)(data >> 8);
375 std::vector<uint8_t> & dest,
size_t off) {
378 dest[off ] = (uint8_t)(data >> 8);
379 dest[off+1] = (uint8_t)(data );
382 dest[off ] = (uint8_t)(data );
383 dest[off+1] = (uint8_t)(data >> 8);
394 static std::string s(
"???");
416 if (bb.
limit() - initialPos < 32) {
417 throw std::underflow_error(
"not enough data to read in header");
439 throw EvioException(
"magic number is bad, " + std::to_string(magicNumber));
458 static void printBytes(
const std::shared_ptr<ByteBuffer> buf, uint32_t position, uint32_t bytes,
459 const std::string & label) {
460 printBytes(*(buf.get()), position, bytes, label);
475 bytes = bytes + position > buf.
capacity() ? (buf.
capacity() - position) : bytes;
477 if (!label.empty()) std::cout << label <<
":" << std::endl;
480 std::cout <<
" no data in buf from position = " << position << std::endl;
484 for (
int i=0; i < bytes; i++) {
486 std::cout << std::endl << std::dec << std::right << std::setfill(
' ') <<
487 " Buf(" << std::setw(3) << (i + 1) <<
488 " - "<< std::setw(3) << (i + 20) <<
") = ";
494 std::cout << std::hex << std::noshowbase << std::internal << std::setfill(
'0') <<
495 std::setw(2) << (int)(buf[i + position]) <<
" ";
498 std::cout << std::dec << std::endl << std::endl << std::setfill(
' ');
510 static void printBytes(uint8_t
const * data, uint32_t bytes,
const std::string & label) {
512 if (!label.empty()) std::cout << label <<
":" << std::endl;
518 for (
int i=0; i < bytes; i++) {
520 std::cout << std::endl << std::dec << std::right << std::setfill(
' ') <<
521 " Buf(" << std::setw(3) << (i + 1) <<
522 " - "<< std::setw(3) << (i + 20) <<
") = ";
528 std::cout << std::hex << std::noshowbase << std::internal << std::setfill(
'0') <<
529 std::setw(2) << (int)(*((data + i))) <<
" ";
532 std::cout << std::dec << std::endl << std::endl << std::setfill(
' ');
545 static void printBytes(
const std::string & fileName, uint64_t offset,
546 uint32_t bytes,
const std::string & label) {
548 if (fileName.empty()) {
549 std::cout <<
"Util::printBytes: fileName arg is invalid" << std::endl;
554 std::ifstream inStreamRandom;
557 inStreamRandom.open(fileName, std::ios::in | std::ios::ate);
558 size_t fileSize = inStreamRandom.tellg();
560 inStreamRandom.seekg(0);
563 uint64_t limit = bytes + offset > fileSize ? fileSize : bytes + offset;
564 auto dataLen = (uint32_t)(limit - offset);
566 uint8_t * array = buf.
array();
567 inStreamRandom.read(reinterpret_cast<char *>(array), dataLen);
571 catch (std::exception & e) {
573 std::cout <<
"Util::printBytes: " << strerror(errno) << std::endl;
587 if (fileName.empty()) {
588 std::cout <<
"Util::writeBytes: fileName arg is invalid" << std::endl;
593 file.open(fileName, std::ios::binary | std::ios::out);
595 std::cout <<
"error opening file " << fileName << std::endl;
604 std::cout <<
"error writing to file " << fileName << std::endl;
622 if (fileName.empty()) {
623 std::cout <<
"Util::writeBytes: fileName arg is invalid" << std::endl;
628 file.open(fileName, std::ios::binary | std::ios::in);
630 std::cout <<
"error opening file " << fileName << std::endl;
639 std::cout <<
"error reading from file " << fileName << std::endl;
655 if (x < 0)
return -1;
684 static void stringToASCII(
const std::string & input, std::vector<uint8_t> & array) {
685 size_t inputSize = input.size();
687 array.reserve(inputSize);
689 for (
int i=0; i < inputSize; i++) {
690 array.push_back((uint8_t) input[i]);
702 size_t inputSize = input.size();
706 for (
int i=0; i < inputSize; i++) {
707 buf.
put(i, input[i]);
731 if (strings.empty()) {
735 uint32_t dataLen = 0;
736 for (std::string
const & s : strings) {
737 dataLen += s.length() + 1;
744 int pads[] = {4,3,2,1};
745 dataLen += pads[dataLen%4];
764 uint32_t dataLen = str.length() + 1;
770 int pads[] = {4,3,2,1};
771 dataLen += pads[dataLen%4];
785 std::vector<uint8_t> & bytes) {
787 if (strings.empty()) {
795 strData.reserve(dataLen);
797 for (std::string
const & s : strings) {
801 strData.append(1,
'\000');
808 int pads[] = {4,3,2,1};
809 switch (pads[strData.length()%4]) {
811 strData.append(4,
'\004');
814 strData.append(3,
'\004');
817 strData.append(2,
'\004');
820 strData.append(1,
'\004');
824 bytes.resize(dataLen);
825 for (
int i=0; i < strData.length(); i++) {
826 bytes[i] = strData[i];
839 std::vector<std::string> & strData) {
855 size_t offset,
size_t maxLength,
856 std::vector<std::string> & strData) {
857 int length = bytes.size() - offset;
858 if (bytes.empty() || (length < 4))
return;
861 length = length > maxLength ? maxLength : length;
863 std::string sData(reinterpret_cast<const char *>(bytes.data()) + offset, length);
878 std::vector<std::string> & strData) {
879 if (bytes ==
nullptr)
return;
881 std::string sData(reinterpret_cast<const char *>(bytes), length);
896 size_t pos,
size_t length,
897 std::vector<std::string> & strData) {
899 if (length < 4)
return;
901 std::string sData(reinterpret_cast<const char *>(buffer.
array() + buffer.
arrayOffset()) + pos, length);
921 std::vector<std::string> & strings) {
932 std::vector<int> nullIndexList;
933 nullIndexList.reserve(10);
934 uint32_t nullCount = 0, goodChars = 0;
935 bool badFormat =
true;
937 size_t length = strData.length();
938 bool noEnding4 =
false;
939 if (strData[length - 1] !=
'\004') {
943 for (
int i=0; i < length; i++) {
949 nullIndexList.push_back(i);
959 else if ((c < 32 || c > 126) && c != 9 && c != 10) {
974 int charsLeft = length - (i+1);
983 for (
int j=1; j <= charsLeft; j++) {
1009 if (onlyGoodChars) {
1011 std::string goodStr(strData.data(), goodChars);
1012 strings.push_back(goodStr);
1016 strings.push_back(strData);
1023 for (
int nullIndex : nullIndexList) {
1024 std::string str(strData.data() + firstIndex, (nullIndex - firstIndex));
1025 strings.push_back(str);
1026 firstIndex = nullIndex + 1;
1041 static std::regex env(
"\\$\\(([^)]+)\\)");
1043 while ( std::regex_search(text, match, env) ) {
1044 char * s = getenv(match[1].str().c_str());
1045 std::string var(s ==
nullptr ?
"" : s);
1046 text.replace(match[0].first, match[0].second, var);
1062 static std::regex specifier(
"%(\\d*)([xd])");
1064 auto begin = std::sregex_iterator(text.begin(), text.end(), specifier);
1065 auto end = std::sregex_iterator();
1066 uint32_t specifierCount = std::distance(begin, end);
1068 std::sregex_iterator i = begin;
1071 for (
int j = 0; j < specifierCount; j++) {
1074 i = std::sregex_iterator(text.begin(), text.end(), specifier);
1076 while (k-- > 0) i++;
1079 std::smatch match = *i;
1080 std::string specWidth = match[1].str();
1083 if (specWidth.length() > 0 && specWidth[0] !=
'0') {
1084 text.replace(match[1].first, match[1].second,
"0" + specWidth);
1088 return specifierCount;
1120 std::string & modifiedBaseName) {
1122 int* returnInts =
new int[1];
1125 modifiedBaseName = baseName;
1127 if (modifiedBaseName.length() < 1) {
1132 std::string::size_type pos;
1133 while ((pos = modifiedBaseName.find(
"%s")) != std::string::npos) {
1134 modifiedBaseName = (runType.length() < 1) ? modifiedBaseName.replace(pos, 2,
"") :
1135 modifiedBaseName.replace(pos, 2, runType);
1147 if (specifierCount > 3) {
1148 throw EvioException(
"baseName arg is improperly formatted");
1152 return specifierCount;
1193 uint32_t runNumber, uint64_t split, uint32_t splitNumber,
1194 uint32_t streamId, uint32_t streamCount) {
1196 if (streamCount < 1) streamCount = 1;
1197 if (splitNumber < 1) splitNumber = 0;
1198 if (runNumber < 0) runNumber = 0;
1199 if (streamId < 0) streamId = 0;
1200 bool oneStream = streamCount < 2;
1202 if (fileName.length() < 1) {
1214 if (specifierCount < 1) {
1216 fileName +=
"." + std::to_string(splitNumber);
1219 fileName +=
"." + std::to_string(streamId) +
1220 "." + std::to_string(splitNumber);
1225 else if (specifierCount == 1) {
1226 char tempChar[fileName.length() + 1024];
1227 int err = std::sprintf(tempChar, fileName.c_str(), runNumber);
1228 if (err < 0)
throw EvioException(
"badly formatted file name");
1229 std::string temp(tempChar);
1233 fileName +=
"." + std::to_string(splitNumber);
1236 fileName +=
"." + std::to_string(streamId) +
1237 "." + std::to_string(splitNumber);
1242 else if (specifierCount == 2) {
1246 static std::regex specifier(
"(%\\d*[xd])");
1247 auto it = std::sregex_iterator(fileName.begin(), fileName.end(), specifier);
1251 std::smatch match = *it;
1252 fileName.replace(match[0].first, match[0].second,
"%d." + match.str());
1254 char tempChar[fileName.length() + 1024];
1255 int err = std::sprintf(tempChar, fileName.c_str(), runNumber, streamId, splitNumber);
1256 if (err < 0)
throw EvioException(
"badly formatted file name");
1257 std::string temp(tempChar);
1261 char tempChar[fileName.length() + 1024];
1262 int err = std::sprintf(tempChar, fileName.c_str(), runNumber, splitNumber);
1263 if (err < 0)
throw EvioException(
"badly formatted file name");
1264 std::string temp(tempChar);
1269 else if (specifierCount == 3) {
1270 char tempChar[fileName.length() + 1024];
1271 int err = std::sprintf(tempChar, fileName.c_str(), runNumber, streamId, splitNumber);
1272 if (err < 0)
throw EvioException(
"badly formatted file name");
1273 std::string temp(tempChar);
1282 if (specifierCount < 1) {
1284 fileName +=
"." + std::to_string(streamId);
1287 else if (specifierCount == 1) {
1289 char tempChar[fileName.length() + 1024];
1290 int err = std::sprintf(tempChar, fileName.c_str(), runNumber);
1291 if (err < 0)
throw EvioException(
"badly formatted file name");
1292 std::string temp(tempChar);
1296 fileName +=
"." + std::to_string(streamId);
1299 else if (specifierCount == 2) {
1301 static std::regex specifier(
"(%\\d*[xd])");
1302 auto it = std::sregex_iterator(fileName.begin(), fileName.end(), specifier);
1305 std::smatch match = *it;
1306 fileName.replace(match[0].first, match[0].second,
"");
1309 char tempChar[fileName.length() + 1024];
1310 int err = std::sprintf(tempChar, fileName.c_str(), runNumber);
1311 if (err < 0)
throw EvioException(
"badly formatted file name");
1312 std::string temp(tempChar);
1316 fileName +=
"." + std::to_string(streamId);
1319 else if (specifierCount == 3) {
1321 static std::regex specifier(
"(%\\d*[xd])");
1322 auto it = std::sregex_iterator(fileName.begin(), fileName.end(), specifier);
1325 std::smatch match = *it;
1326 fileName.replace(match[0].first, match[0].second,
"");
1329 char tempChar[fileName.length() + 1024];
1330 int err = std::sprintf(tempChar, fileName.c_str(), runNumber, streamId);
1331 if (err < 0)
throw EvioException(
"badly formatted file name");
1332 std::string temp(tempChar);
1346 #endif //EVIO_6_0_UTIL_H
static void unpackRawBytesToStrings(std::vector< uint8_t > &bytes, size_t offset, size_t maxLength, std::vector< std::string > &strData)
This method extracts an array of strings from byte array of raw evio string data. ...
Definition: Util.h:854
static uint32_t countAndFixIntSpecifiers(std::string &text)
Count the number of integer specifiers (e.g.
Definition: Util.h:1061
This class is copied from one of the same name in the Java programming language.
Definition: ByteBuffer.h:42
void expand(size_t newSize)
This method expands the size of this buffer if it's less than the given size.
Definition: ByteBuffer.cpp:386
static const DataType ALSOBANK
Bank alternate value.
Definition: DataType.h:50
static const DataType LONG64
64 bit int.
Definition: DataType.h:45
static const DataType UCHAR8
Unsigned 8 bit int.
Definition: DataType.h:43
static const DataType INT32
32 bit int.
Definition: DataType.h:47
static void printBytes(const std::string &fileName, uint64_t offset, uint32_t bytes, const std::string &label)
This method takes a file and prints out the desired number of bytes from the given offset...
Definition: Util.h:545
const ByteOrder & order() const
Get the byte order of the data.
Definition: ByteBuffer.cpp:466
static const ByteOrder ENDIAN_LITTLE
Little endian byte order.
Definition: ByteOrder.h:57
static uint32_t stringsToRawSize(std::vector< std::string > const &strings)
This method returns the number of bytes in a raw evio format of the given string array, not including header.
Definition: Util.h:729
static void toBytes(uint32_t data, const ByteOrder &byteOrder, uint8_t *dest)
Write int into byte array.
Definition: Util.h:257
static const std::string & NO_NAME_STRING()
Get a string used to indicate that no name can be determined.
Definition: Util.h:392
static std::string generateFileName(std::string fileName, uint32_t specifierCount, uint32_t runNumber, uint64_t split, uint32_t splitNumber, uint32_t streamId, uint32_t streamCount)
This method does NOT work on its own.
Definition: Util.h:1192
static void stringToASCII(const std::string &input, std::vector< uint8_t > &array)
Return an input string as ASCII in which each character is one byte.
Definition: Util.h:684
ByteBuffer & put(const ByteBuffer &src)
Relative bulk put method.
Definition: ByteBuffer.cpp:1325
size_t remaining() const
Returns the number of bytes from the current position to the end of the data.
Definition: ByteBuffer.cpp:497
Class containing static methods of general purpose.
Definition: Util.h:41
static void toBytes(uint32_t data, const ByteOrder &byteOrder, std::vector< uint8_t > &dest, size_t off)
Write int into byte vector.
Definition: Util.h:323
Numerical values associated with endian byte order.
Definition: ByteOrder.h:53
static void unpackRawBytesToStrings(uint8_t *bytes, size_t length, std::vector< std::string > &strData)
This method extracts an array of strings from byte array of raw evio string data. ...
Definition: Util.h:877
uint32_t getUInt() const
Relative get method for reading an unsigned int value.
Definition: ByteBuffer.cpp:1115
static const DataType CHARSTAR8
ASCII characters.
Definition: DataType.h:39
static int generateBaseFileName(const std::string &baseName, const std::string &runType, std::string &modifiedBaseName)
This method generates part of a file name given a base file name as an argument.
Definition: Util.h:1119
static bool iStrEquals(const std::string &a, const std::string &b)
Case insensitive compare for 2 strings.
Definition: Util.h:80
Exception class for Evio software package.
Definition: EvioException.h:29
static const DataType DOUBLE64
64 bit double.
Definition: DataType.h:44
static const DataType COMPOSITE
Composite data type.
Definition: DataType.h:51
size_t capacity() const
Returns the total available bytes in this buffer.
Definition: ByteBuffer.cpp:504
static const DataType FLOAT32
32 bit float.
Definition: DataType.h:38
static void unpackRawBytesToStrings(ByteBuffer &buffer, size_t pos, size_t length, std::vector< std::string > &strData)
This method extracts an array of strings from buffer containing raw evio string data.
Definition: Util.h:895
size_t arrayOffset() const
Get the offset within this buffer's backing array of the first element of the buffer.
Definition: ByteBuffer.cpp:490
static const DataType NOT_A_VALID_TYPE
Not a valid data type.
Definition: DataType.h:63
static void toBytes(uint64_t data, const ByteOrder &byteOrder, uint8_t *dest)
Turn long into byte array.
Definition: Util.h:286
static void printBytes(const ByteBuffer &buf, uint32_t position, uint32_t bytes, const std::string &label)
This method takes a byte buffer and prints out the desired number of bytes from the given position...
Definition: Util.h:472
static const DataType SHORT16
16 bit int.
Definition: DataType.h:40
static void readBytes(const std::string &fileName, ByteBuffer &buf)
This method reads part of a file into a ByteBuffer.
Definition: Util.h:620
static const DataType & getDataType(const std::string &type)
This method returns an XML element name given an evio data type.
Definition: Util.h:96
static const DataType UINT32
Unsigned 32 bit int.
Definition: DataType.h:37
static uint32_t findEvioVersion(ByteBuffer &bb, size_t initialPos)
Reads a couple things in a block/record header in order to determine the evio version and endianness ...
Definition: Util.h:412
static uint32_t getPadding(uint32_t length)
Returns number of bytes needed to pad to 4-byte boundary for the given length.
Definition: Util.h:64
static uint32_t getWords(uint32_t length)
Returns length padded to 4-byte boundary for given length in bytes.
Definition: Util.h:52
static const DataType CHAR8
8 bit int.
Definition: DataType.h:42
static uint32_t toInt(uint8_t const *data, ByteOrder const &byteOrder)
Turn 4 bytes into an unsigned 32 bit int.
Definition: Util.h:185
int32_t getInt() const
Relative get method for reading an int value.
Definition: ByteBuffer.cpp:1074
static void writeBytes(const std::string &fileName, ByteBuffer &buf)
This method takes a ByteBuffer and writes its data to a file.
Definition: Util.h:585
static void stringBuilderToStrings(std::string const &strData, bool onlyGoodChars, std::vector< std::string > &strings)
This method extracts an array of strings from a string containing evio string data.
Definition: Util.h:920
static int powerOfTwo(int x, bool roundUp)
Return the power of 2 closest to the given argument.
Definition: Util.h:654
size_t position() const
Returns the position of the buffer.
Definition: ByteBuffer.cpp:518
static void printBytes(const std::shared_ptr< ByteBuffer > buf, uint32_t position, uint32_t bytes, const std::string &label)
This method takes a byte buffer and prints out the desired number of bytes from the given position...
Definition: Util.h:458
static const DataType ALSOSEGMENT
Segment alternate value.
Definition: DataType.h:49
Numerical values associated with evio data types.
Definition: DataType.h:32
static void toIntArray(char const *data, uint32_t dataLen, const ByteOrder &byteOrder, uint32_t *dest)
Turn byte array into an int array.
Definition: Util.h:133
static uint32_t toInt(char b1, char b2, char b3, char b4, const ByteOrder &byteOrder)
Turn 4 bytes into an unsigned 32 bit int.
Definition: Util.h:156
static const DataType UNKNOWN32
Unknown data type.
Definition: DataType.h:36
static uint64_t toLong(uint8_t const *data, ByteOrder const &byteOrder)
Turn 4 bytes into an unsigned 32 bit int.
Definition: Util.h:217
static void stringToASCII(const std::string &input, ByteBuffer &buf)
Return an input string as ASCII in which each character is one byte.
Definition: Util.h:701
uint8_t * array() const
Get a pointer to this buffer's backing array which contains the data.
Definition: ByteBuffer.cpp:475
static void toBytes(uint16_t data, const ByteOrder &byteOrder, std::vector< uint8_t > &dest, size_t off)
Write short into byte vector.
Definition: Util.h:374
static const DataType USHORT16
Unsigned 16 bit int.
Definition: DataType.h:41
static void unpackRawBytesToStrings(std::vector< uint8_t > &bytes, size_t offset, std::vector< std::string > &strData)
This method extracts an array of strings from byte array of raw evio string data. ...
Definition: Util.h:838
static void expandEnvironmentalVariables(std::string &text)
Substitute environmental variables in a given string when they come in the form, .
Definition: Util.h:1040
static const DataType TAGSEGMENT
Tag segment.
Definition: DataType.h:48
static uint32_t stringToRawSize(const std::string &str)
This method returns the number of bytes in a raw evio format of the given string array (with a single...
Definition: Util.h:758
static void printBytes(uint8_t const *data, uint32_t bytes, const std::string &label)
This method takes a pointer and prints out the desired number of bytes from the given position...
Definition: Util.h:510
ByteBuffer & clear()
Clears this buffer.
Definition: ByteBuffer.cpp:536
static const DataType ULONG64
Unsigned 64 bit int.
Definition: DataType.h:46
static void stringsToRawBytes(std::vector< std::string > &strings, std::vector< uint8_t > &bytes)
This method transforms an array/vector of strings into raw evio format data, not including header...
Definition: Util.h:784
size_t limit() const
Returns the limit, the position of the last valid data byte.
Definition: ByteBuffer.cpp:511
static const ByteOrder ENDIAN_BIG
Big endian byte order.
Definition: ByteOrder.h:58
static void toBytes(uint16_t data, const ByteOrder &byteOrder, uint8_t *dest)
Write short into byte array.
Definition: Util.h:349