| 1 |
/* |
| 2 |
* UsageLimits.h - TaskJuggler |
| 3 |
* |
| 4 |
* SPDX-FileCopyrightText: 2001, 2002, 2003, 2004, 2005 Chris Schlaeger <[email protected]> |
| 5 |
* SPDX-FileCopyrightText: 2011 Dag Andersen <[email protected]> |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of version 2 of the GNU General Public License as |
| 9 |
* published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* $Id$ |
| 12 |
*/ |
| 13 |
|
| 14 |
#ifndef _UsageLimits_h_ |
| 15 |
#define _UsageLimits_h_ |
| 16 |
|
| 17 |
namespace TJ |
| 18 |
{ |
| 19 |
|
| 20 |
/** |
| 21 |
* This class stores usage limits of resources or task allocations. The values |
| 22 |
* are stored as number of scoreboard slots. |
| 23 |
* |
| 24 |
* @short The class stores usage limits |
| 25 |
* @see Resource |
| 26 |
* @see Allocation |
| 27 |
* @author Chris Schlaeger <[email protected]> |
| 28 |
*/ |
| 29 |
class UsageLimits |
| 30 |
{ |
| 31 |
public: |
| 32 |
UsageLimits() : |
| 33 |
dailyMax(0), |
| 34 |
weeklyMax(0), |
| 35 |
monthlyMax(0), |
| 36 |
dailyUnits(0) |
| 37 |
{ } |
| 38 |
|
| 39 |
~UsageLimits() { } |
| 40 |
|
| 41 |
/// Set the max number of work slots that can be allocated per day |
| 42 |
/// dailyUnits has precedence over dailyMax |
| 43 |
void setDailyMax(uint m) { dailyMax = m; } |
| 44 |
/// Get the max number of work slots that can be allocated per day |
| 45 |
uint getDailyMax() const { return dailyMax; } |
| 46 |
|
| 47 |
/// Set the max number of work slots that can be allocated per week |
| 48 |
void setWeeklyMax(uint m) { weeklyMax = m; } |
| 49 |
/// Get the max number of work slots that can be allocated per week |
| 50 |
uint getWeeklyMax() const { return weeklyMax; } |
| 51 |
|
| 52 |
/// Set the max number of work slots that can be allocated per month |
| 53 |
void setMonthlyMax(uint m) { monthlyMax = m; } |
| 54 |
/// Get the max number of work slots that can be allocated per month |
| 55 |
uint getMonthlyMax() const { return monthlyMax; } |
| 56 |
|
| 57 |
/// Set percentage of how many working slots can be allocated on a day of total number of working slots |
| 58 |
/// dailyUnits has precedence over dailyMax |
| 59 |
void setDailyUnits(uint units) { dailyUnits = units; } |
| 60 |
/// Get percentage of how many working slots can be allocated on a day of total number of working slots |
| 61 |
uint getDailyUnits() const { return dailyUnits; } |
| 62 |
|
| 63 |
private: |
| 64 |
uint dailyMax; |
| 65 |
uint weeklyMax; |
| 66 |
uint monthlyMax; |
| 67 |
uint dailyUnits; |
| 68 |
} ; |
| 69 |
|
| 70 |
} // namespace TJ |
| 71 |
|
| 72 |
#endif |
| 73 |
|