24 #ifndef PXR_BASE_TF_ENV_SETTING_H 25 #define PXR_BASE_TF_ENV_SETTING_H 124 PXR_NAMESPACE_OPEN_SCOPE
134 std::atomic<T*> *_value;
137 char const * _description;
143 struct TfEnvSetting<std::string>
145 std::atomic<std::string*> *_value;
146 char const * _default;
148 char const * _description;
152 void Tf_InitializeEnvSetting(TfEnvSetting<T> *);
159 T *val = setting._value->load();
160 if (ARCH_UNLIKELY(!val)) {
161 Tf_InitializeEnvSetting(&setting);
162 val = setting._value->load();
170 bool Tf_ChooseEnvSettingType(
bool);
171 int Tf_ChooseEnvSettingType(
int);
172 std::string Tf_ChooseEnvSettingType(
char const *);
174 class 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); \ 188 PXR_NAMESPACE_CLOSE_SCOPE
190 #endif // PXR_BASE_TF_ENV_SETTING_H T const & TfGetEnvSetting(TfEnvSetting< T > &setting)
Returns the value of the specified env setting, registered using TF_DEFINE_ENV_SETTING.