24#ifndef PXR_BASE_TF_ENV_SETTING_H
25#define PXR_BASE_TF_ENV_SETTING_H
124PXR_NAMESPACE_OPEN_SCOPE
134 std::atomic<T*> *_value;
137 char const * _description;
143struct TfEnvSetting<
std::string>
145 std::atomic<std::string*> *_value;
146 char const * _default;
148 char const * _description;
152void Tf_InitializeEnvSetting(TfEnvSetting<T> *);
159 T *val = setting._value->load();
160 if (ARCH_UNLIKELY(!val)) {
161 Tf_InitializeEnvSetting(&setting);
162 val = setting._value->load();
170bool Tf_ChooseEnvSettingType(
bool);
171int Tf_ChooseEnvSettingType(
int);
172std::string Tf_ChooseEnvSettingType(
char const *);
174class Tf_EnvSettingRegistry;
179#define TF_DEFINE_ENV_SETTING(envVar, defValue, description) \
180 std::atomic< decltype(Tf_ChooseEnvSettingType(defValue))*> \
182 TfEnvSetting<decltype(Tf_ChooseEnvSettingType(defValue))> envVar = { \
183 &envVar##_value, defValue, #envVar, description }; \
184 TF_REGISTRY_FUNCTION_WITH_TAG(Tf_EnvSettingRegistry, envVar) { \
185 (void)TfGetEnvSetting(envVar); \
188PXR_NAMESPACE_CLOSE_SCOPE
T const & TfGetEnvSetting(TfEnvSetting< T > &setting)
Returns the value of the specified env setting, registered using TF_DEFINE_ENV_SETTING.