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

All C++ datatypes & components now implement a new Loggable trait #4305

Merged
merged 7 commits into from Nov 23, 2023

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Nov 22, 2023

What

This moves all serialization related methods off of the respective structs themselves, leading to better auto complete.
AsComponents.
The default implementations of AsComponents now all require input types to implement this new trait - before they just required the to_data_cell method to be there (that's still the case, but now with an indirection ;))

This makes our interface cleaner and paves the way to a good fix for:

(there's a few details still missing for this to allow custom types without dragging in arrow headers, but one thing at a time!)

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested demo.rerun.io (if applicable)
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG

this moves all serialization related methods off of the respective structs themselves, leading to better auto complete
@Wumpf Wumpf added enhancement New feature or request 🚜 refactor Change the code, not the functionality 🌊 C++ API C or C++ logging API include in changelog labels Nov 22, 2023
@jleibs jleibs self-requested a review November 22, 2023 14:15
Copy link
Member

@jleibs jleibs left a comment

Choose a reason for hiding this comment

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

Takes a bit to wrap your head around template-specialization as traits, but I really like the way this works out.

rerun_cpp/src/rerun/loggable.hpp Show resolved Hide resolved
rerun_cpp/src/rerun/loggable.hpp Show resolved Hide resolved
@Wumpf Wumpf mentioned this pull request Nov 22, 2023
4 tasks
@Wumpf Wumpf merged commit 13ac376 into main Nov 23, 2023
8 of 12 checks passed
@Wumpf Wumpf deleted the andreas/cpp/loggable-trait branch November 23, 2023 08:42
Wumpf added a commit that referenced this pull request Nov 23, 2023
### What

**&** refactor `rerun::Loggable` to be only producing an the
`arrow::Array`.

This further aligns Rust and C++ apis which can be best seen in the new
example which looks very similar to its rust counterpart \o/

* Fixes #3139
* Depends on / followup of #4305

`DataCell` took over part of the job that `rerun::Loggable` had so far:
type registration and putting together the `DataCell` - `to_data_cell`
got renamed to `to_arrow` for this purpose. Everything else after that
just clicked into place :).

Did a few manual runs of the log benchmark to ensure that this didn't
regress anything.

### Checklist
* [x] I have read and agree to [Contributor
Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and
the [Code of
Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md)
* [x] I've included a screenshot or gif (if applicable)
* [x] I have tested [demo.rerun.io](https://demo.rerun.io/pr/4309) (if
applicable)
* [x] The PR title and labels are set such as to maximize their
usefulness for the next release's CHANGELOG

- [PR Build Summary](https://build.rerun.io/pr/4309)
- [Docs
preview](https://rerun.io/preview/c5f807af263a1a02a734a499bcd22754dc0646ea/docs)
<!--DOCS-PREVIEW-->
- [Examples
preview](https://rerun.io/preview/c5f807af263a1a02a734a499bcd22754dc0646ea/examples)
<!--EXAMPLES-PREVIEW-->
- [Recent benchmark results](https://build.rerun.io/graphs/crates.html)
- [Wasm size tracking](https://build.rerun.io/graphs/sizes.html)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌊 C++ API C or C++ logging API enhancement New feature or request include in changelog 🚜 refactor Change the code, not the functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants