1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4//
5// --------------------------------------------------------------------------------------------------
6// configuration.h
7//
8//
9// Access and update configuration values, falling back on legacy CLRConfig methods where necessary.
10//
11// --------------------------------------------------------------------------------------------------
12
13#include "clrconfig.h"
14
15#ifndef __configuration_h__
16#define __configuration_h__
17
18class Configuration
19{
20public:
21 static void InitializeConfigurationKnobs(int numberOfConfigs, LPCWSTR *configNames, LPCWSTR *configValues);
22
23 // Returns (in priority order):
24 // - The value of the ConfigDWORDInfo if it's set
25 // - The value of the ConfigurationKnob (searched by name) if it's set (performs a wcstoul).
26 // - The default set in the ConfigDWORDInfo
27 static DWORD GetKnobDWORDValue(LPCWSTR name, const CLRConfig::ConfigDWORDInfo& dwordInfo);
28
29 // Returns (in priority order):
30 // - The value of the ConfigurationKnob (searched by name) if it's set (performs a wcstoul)
31 // - The default value passed in
32 static DWORD GetKnobDWORDValue(LPCWSTR name, DWORD defaultValue);
33
34 // Unfortunately our traditional config system insists on interpreting numbers as 32-bit so intepret the config
35 // in the traditional way separately if you need to.
36 //
37 // Returns value for name if found in config.
38 static ULONGLONG GetKnobULONGLONGValue(LPCWSTR name);
39
40 // Returns (in priority order):
41 // - The value of the ConfigStringInfo if it's set
42 // - The value of the ConfigurationKnob (searched by name) if it's set
43 // - nullptr
44 static LPCWSTR GetKnobStringValue(LPCWSTR name, const CLRConfig::ConfigStringInfo& stringInfo);
45
46 // Returns (in priority order):
47 // - The value of the ConfigurationKnob (searched by name) if it's set
48 // - nullptr
49 static LPCWSTR GetKnobStringValue(LPCWSTR name);
50
51 // Returns (in priority order):
52 // - The value of the ConfigDWORDInfo if it's set (1 is true, anything else is false)
53 // - The value of the ConfigurationKnob (searched by name) if it's set (performs a wcscmp with "true").
54 // - The default set in the ConfigDWORDInfo (1 is true, anything else is false)
55 static bool GetKnobBooleanValue(LPCWSTR name, const CLRConfig::ConfigDWORDInfo& dwordInfo);
56
57 // Returns (in priority order):
58 // - The value of the ConfigurationKnob (searched by name) if it's set (performs a wcscmp with "true").
59 // - The default value passed in
60 static bool GetKnobBooleanValue(LPCWSTR name, bool defaultValue);
61};
62
63#endif // __configuration_h__
64