Grok 20.3.2
SchedulerFactory.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016-2026 Grok Image Compression Inc.
3 *
4 * This source code is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License, version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This source code is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Affero General Public License for more details.
12 *
13 * You should have received a copy of the GNU Affero General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18#pragma once
19
20#include <cstdlib>
21#include <string>
22
23namespace grk
24{
25
27{
28public:
29 static bool isExcalibur()
30 {
31 const char* env = std::getenv("GRK_EXCALIBUR");
32 if(!env)
33 {
34 return false; // Unset variable
35 }
36 try
37 {
38 std::string value(env);
39 size_t pos;
40 int num = std::stoi(value, &pos);
41 // Ensure entire string was consumed and no trailing characters
42 return pos == value.length() && num != 0;
43 }
44 catch(const std::exception&)
45 {
46 return false; // Invalid number
47 }
48 }
49
50 static bool isFreebyrd()
51 {
52 const char* env = std::getenv("GRK_SCHEDULER");
53 if(!env)
54 return false;
55 return std::string(env) == "freebyrd";
56 }
57};
58
59} // namespace grk
Definition SchedulerFactory.h:27
static bool isFreebyrd()
Definition SchedulerFactory.h:50
static bool isExcalibur()
Definition SchedulerFactory.h:29
ResWindow.
Definition CompressedChunkCache.h:36