utilities.h 847 B

1234567891011121314151617181920212223242526272829303132
  1. #ifndef UTILITIES_H
  2. #define UTILITIES_H
  3. #include <iostream>
  4. #include <fstream>
  5. #include <vector>
  6. #include <sstream>
  7. #include <chrono>
  8. #include <algorithm>
  9. // Aidmar
  10. /**
  11. * Split a string.
  12. * @param str string to be splitted
  13. * @param delimiter delimiter to use in splitting
  14. * @return vector of substrings
  15. */
  16. /*std::vector<std::string> split(std::string str, char delimiter) {
  17. std::vector<std::string> internal;
  18. std::stringstream ss(str); // Turn the string into a stream.
  19. std::string tok;
  20. while(getline(ss, tok, delimiter)) {
  21. internal.push_back(tok);
  22. }
  23. return internal;
  24. }*/
  25. void split_str(const std::string& s, char delim,std::vector<std::string>& v);
  26. std::string getIPv4Class(std::string ipAddress);
  27. int getClosestIndex(std::vector<std::chrono::microseconds> v, std::chrono::microseconds refElem);
  28. #endif //UTILITIES_H