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

Minor fixes/enhancements to TypeSpec & Symbol (OSL internal classes) #1267

Merged
merged 1 commit into from
Oct 15, 2020

Conversation

lgritz
Copy link
Collaborator

@lgritz lgritz commented Oct 13, 2020

  • Simplify implementation of TypeSpec::is_triple, more efficient.

  • Add TypeSpec::is_triple_based(), analogous to all the other
    is_X/is_X_based.

  • Bug fix: Symbol::get_string()'s assertion was checking whether it was
    a string, but should have checked if it was string_based.

  • Add Symbol::get_vec3(), analogous to get_int/float/string.

  • Add Symbol::coerce_float and coerce_vec3, like get but with some type
    coercions.

  • Add Symbol::dataptr() as synonym for data(). This is for "forward
    compatibility", a future PR will make more widespread use of this.

  • Lots and lots of places where error-prone and verbose casts are replaced
    with the new methods, and some logic simplified.

Signed-off-by: Larry Gritz [email protected]

@lgritz
Copy link
Collaborator Author

lgritz commented Oct 15, 2020

Does this seem ok to everyone?

* Simplify implementation of TypeSpec::is_triple, more efficient.

* Add TypeSpec::is_triple_based(), analogous to all the other
  is_X/is_X_based.

* Bug fix: Symbol::get_string()'s assertion was checking whether it was
  a string, but should have checked if it was string_based.

* Add Symbol::get_vec3(), analogous to get_int/float/string.

* Add Symbol::coerce_float and coerce_vec3, like get but with some type
  coercions.

* Add Symbol::dataptr() as synonym for data(). This is for "forward
  compatibility", a future PR will make more widespread use of this.

* Lots and lots of places were error-prone and verbose casts are replaced
  with the new methods, and some logic simplified.

Signed-off-by: Larry Gritz <[email protected]>
Copy link
Contributor

@aconty aconty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, looks better!

@lgritz lgritz merged commit 27152ad into AcademySoftwareFoundation:master Oct 15, 2020
@lgritz lgritz deleted the lg-get branch October 17, 2020 23:07
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.

2 participants