7#ifndef PXR_BASE_TF_ENV_SETTING_H
8#define PXR_BASE_TF_ENV_SETTING_H
107PXR_NAMESPACE_OPEN_SCOPE
117 std::atomic<T*> *_value;
120 char const * _description;
126struct TfEnvSetting<
std::string>
128 std::atomic<std::string*> *_value;
129 char const * _default;
131 char const * _description;
135void Tf_InitializeEnvSetting(TfEnvSetting<T> *);
142 T *val = setting._value->load();
143 if (ARCH_UNLIKELY(!val)) {
144 Tf_InitializeEnvSetting(&setting);
145 val = setting._value->load();
153bool Tf_ChooseEnvSettingType(
bool);
154int Tf_ChooseEnvSettingType(
int);
155std::string Tf_ChooseEnvSettingType(
char const *);
157class Tf_EnvSettingRegistry;
162#define TF_DEFINE_ENV_SETTING(envVar, defValue, description) \
163 std::atomic< decltype(Tf_ChooseEnvSettingType(defValue))*> \
165 TfEnvSetting<decltype(Tf_ChooseEnvSettingType(defValue))> envVar = { \
166 &envVar##_value, defValue, #envVar, description }; \
167 TF_REGISTRY_FUNCTION_WITH_TAG(Tf_EnvSettingRegistry, envVar) { \
168 (void)TfGetEnvSetting(envVar); \
171PXR_NAMESPACE_CLOSE_SCOPE
T const & TfGetEnvSetting(TfEnvSetting< T > &setting)
Returns the value of the specified env setting, registered using TF_DEFINE_ENV_SETTING.