cmCTestResourceSpec.h 1.2 KB

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