cmCTestResourceSpec.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #pragma once
  4. #include <map>
  5. #include <string>
  6. #include <vector>
  7. class cmCTestResourceSpec
  8. {
  9. public:
  10. class Resource
  11. {
  12. public:
  13. std::string Id;
  14. unsigned int Capacity;
  15. bool operator==(const Resource& other) const;
  16. bool operator!=(const Resource& other) const;
  17. };
  18. class Socket
  19. {
  20. public:
  21. std::map<std::string, std::vector<Resource>> Resources;
  22. bool operator==(const Socket& other) const;
  23. bool operator!=(const Socket& other) const;
  24. };
  25. Socket LocalSocket;
  26. enum class ReadFileResult
  27. {
  28. READ_OK,
  29. FILE_NOT_FOUND,
  30. JSON_PARSE_ERROR,
  31. INVALID_ROOT,
  32. NO_VERSION,
  33. INVALID_VERSION,
  34. UNSUPPORTED_VERSION,
  35. INVALID_SOCKET_SPEC, // Can't be INVALID_SOCKET due to a Windows macro
  36. INVALID_RESOURCE_TYPE,
  37. INVALID_RESOURCE,
  38. };
  39. ReadFileResult ReadFromJSONFile(const std::string& filename);
  40. static const char* ResultToString(ReadFileResult result);
  41. bool operator==(const cmCTestResourceSpec& other) const;
  42. bool operator!=(const cmCTestResourceSpec& other) const;
  43. };