You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
992 B
37 lines
992 B
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
#pragma once
|
|
|
|
#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;
|
|
};
|