Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use in class initializers to simplify token macros #2811

Merged
merged 1 commit into from
Nov 28, 2023

Conversation

nvmkuruc
Copy link
Collaborator

@nvmkuruc nvmkuruc commented Nov 14, 2023

Description of Change(s)

In class initializers reduce the number of internal macros required as well as the number of boost headers required to produce static tokens objects. This introduces a dependency onto boost/preprocessor/seq/enum.hpp to convert sequences into standard variadic arguments. This retains the dependency on boost/preprocessor/seq/for_each.hpp and boost/preprocessor/seq/filter.hpp to continue support for arrays.

While this change does not update the interface to support this, in class member initializers also allow for the public token macros to define tokens inline akin to the private macros.

/** header **/
#define MY_TOKENS \
   (abc)                       \
   (xyz)

TF_DECLARE_PUBLIC_TOKENS(MyTokens, MY_TOKENS);

/** source **/
TF_DEFINE_PUBLIC_TOKENS(MyTokens, MY_TOKENS);

could become

/** header **/
TF_DECLARE_PUBLIC_TOKENS(MyTokens,
   (abc)
   (xyz)
);

/** source **/
TF_DEFINE_PUBLIC_TOKENS(MyTokens);

Fixes Issue(s)

  • I have verified that all unit tests pass with the proposed changes
  • I have submitted a signed Contributor License Agreement

@jesschimein
Copy link
Contributor

Filed as internal issue #USD-8954

@nvmkuruc nvmkuruc force-pushed the tfstatictokensinline branch 3 times, most recently from f89f472 to dff7f66 Compare November 18, 2023 03:46
@pixar-oss pixar-oss merged commit 91bc3d7 into PixarAnimationStudios:dev Nov 28, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants