diff options
author | Craig Scott <craig.scott@crascit.com> | 2019-11-05 06:27:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-11-05 17:08:35 (GMT) |
commit | c544cb66984f16cc63ebace16ccd911adc550b9d (patch) | |
tree | 013f0d741970ec4efe01e0e22c6ed42dcab050b9 /Source/CTest/cmCTestResourceAllocator.h | |
parent | 6ce27d3a2efad4e40d4354a7d17e4259fb4c1e24 (diff) | |
download | CMake-c544cb66984f16cc63ebace16ccd911adc550b9d.zip CMake-c544cb66984f16cc63ebace16ccd911adc550b9d.tar.gz CMake-c544cb66984f16cc63ebace16ccd911adc550b9d.tar.bz2 |
CTest: Rename hardware -> resources for source code
Diffstat (limited to 'Source/CTest/cmCTestResourceAllocator.h')
-rw-r--r-- | Source/CTest/cmCTestResourceAllocator.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Source/CTest/cmCTestResourceAllocator.h b/Source/CTest/cmCTestResourceAllocator.h new file mode 100644 index 0000000..9f0b9c9 --- /dev/null +++ b/Source/CTest/cmCTestResourceAllocator.h @@ -0,0 +1,39 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cmCTestResourceAllocator_h +#define cmCTestResourceAllocator_h + +#include <map> +#include <string> + +class cmCTestResourceSpec; + +class cmCTestResourceAllocator +{ +public: + struct Resource + { + unsigned int Total; + unsigned int Locked; + + unsigned int Free() const { return this->Total - this->Locked; } + + bool operator==(const Resource& other) const; + bool operator!=(const Resource& other) const; + }; + + void InitializeFromResourceSpec(const cmCTestResourceSpec& spec); + + const std::map<std::string, std::map<std::string, Resource>>& GetResources() + const; + + bool AllocateResource(const std::string& name, const std::string& id, + unsigned int slots); + bool DeallocateResource(const std::string& name, const std::string& id, + unsigned int slots); + +private: + std::map<std::string, std::map<std::string, Resource>> Resources; +}; + +#endif |