Skip to content

Commit

Permalink
comment improvements, reordered a field
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Oct 11, 2023
1 parent f76db10 commit 14ee46b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion rerun_cpp/src/rerun/as_components.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ namespace rerun {

// TODO(andreas): This should also mention an example of how to implement this.
static_assert(
NoAsComponentsFor<T>::value,
NoAsComponentsFor<T>::value, // Always evaluate to false, but in a way that requires
// template instantiation.
"AsComponents is not implemented for this type. "
"It is implemented for all built-in archetypes as well as std::vector, std::array, and "
"c-arrays of components. "
Expand Down
11 changes: 5 additions & 6 deletions rerun_cpp/src/rerun/component_batch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ namespace rerun {
struct NoAdapterFor : std::false_type {};

static_assert(
NoAdapterFor<TComponent, TInput>::value,
NoAdapterFor<TComponent, TInput>::value, // Always evaluate to false, but in a way that
// requires template instantiation.
"ComponentBatchAdapter is not implemented for this type. "
"It is implemented for for single components as well as std::vector, std::array, and "
"c-arrays of components. "
Expand Down Expand Up @@ -195,11 +196,10 @@ namespace rerun {

/// Serializes the component batch into a rerun datacell that can be sent to a store.
Result<SerializedComponentBatch> serialize() const {
// TODO(andreas): `to_data_cell` should actually get our storage representation passed
// in which we'll allow "type adaptors" in the future (for e.g. setting a stride or
// similar).
// TODO(andreas): For improved error messages we should add a static_assert that
// TComponent implements `to_data_cell`.
// TODO(andreas): Invert this relationship - a user of this *container* should call
// TComponent::serialize (or similar) passing in this container.
switch (ownership) {
case BatchOwnership::Borrowed: {
auto cell_result = TComponent::to_data_cell(
Expand Down Expand Up @@ -243,8 +243,6 @@ namespace rerun {
}

private:
BatchOwnership ownership;

template <typename T>
union ComponentBatchStorage {
struct {
Expand All @@ -259,6 +257,7 @@ namespace rerun {
~ComponentBatchStorage() {}
};

BatchOwnership ownership;
ComponentBatchStorage<TComponent> storage;
};

Expand Down

0 comments on commit 14ee46b

Please sign in to comment.