5#include <unordered_map>
7#include "collection.hpp"
8#include "component_descriptor.hpp"
9#include "component_type.hpp"
11#include "loggable.hpp"
18struct rr_component_batch;
21 struct ComponentColumn;
30 std::shared_ptr<arrow::Array>
array;
51 rerun::is_loggable<T>,
52 "The given type does not implement the rerun::Loggable trait."
57 RR_RETURN_NOT_OK(
array.error);
82 const std::optional<T>& component,
85 if (component.has_value()) {
102 if (components.has_value()) {
110 template <
typename Archetype>
113 typename Archetype::IndicatorComponent(),
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
static Collection< TElement > borrow(const T *data, size_t num_instances=1)
Borrows binary compatible data into the collection from a typed pointer.
Definition collection.hpp:154
size_t size() const
Returns the number of instances in this collection.
Definition collection.hpp:291
const TElement * data() const
Returns a raw pointer to the underlying data.
Definition collection.hpp:327
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:96
A class for representing either a usable value, or an error.
Definition result.hpp:14
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
uint32_t ComponentTypeHandle
Handle to a registered component types.
Definition component_type.hpp:14
Arrow-encoded data of a single batch of components together with a component descriptor.
Definition component_batch.hpp:28
Result< ComponentColumn > partitioned() const &
Partitions the component data into unit-length sub-batches.
size_t length() const
Size in the number of elements the underlying arrow array contains.
static Result< ComponentBatch > empty(const ComponentDescriptor &descriptor)
Creates a new empty component batch with a given descriptor.
Definition component_batch.hpp:38
static Result< ComponentBatch > from_loggable(const std::optional< T > &component, const ComponentDescriptor &descriptor=rerun::Loggable< T >::Descriptor)
Creates a new data cell from a single optional component instance.
Definition component_batch.hpp:81
Error to_c_ffi_struct(rr_component_batch &out_component_batch) const
To rerun C API component batch.
static Result< ComponentBatch > from_loggable(const std::optional< rerun::Collection< T > > &components, const ComponentDescriptor &descriptor=rerun::Loggable< T >::Descriptor)
Creates a new data cell from an optional collection of component instances.
Definition component_batch.hpp:98
Result< ComponentColumn > partitioned(const Collection< uint32_t > &lengths) &&
Partitions the component data into multiple sub-batches.
ComponentTypeHandle component_type
The type of the component instances in array.
Definition component_batch.hpp:33
static Result< ComponentBatch > from_loggable(const T &component, const ComponentDescriptor &descriptor=rerun::Loggable< T >::Descriptor)
Creates a new component batch from a single component instance.
Definition component_batch.hpp:66
static Result< ComponentBatch > from_arrow_array(std::shared_ptr< arrow::Array > array, const ComponentDescriptor &descriptor)
Creates a new component batch from an already existing arrow array.
std::shared_ptr< arrow::Array > array
Arrow-encoded data of the component instances.
Definition component_batch.hpp:30
static Result< ComponentBatch > from_indicator()
Creates a new component batch for an archetype indicator.
Definition component_batch.hpp:111
Result< ComponentColumn > partitioned() &&
Partitions the component data into unit-length sub-batches.
Result< ComponentColumn > partitioned(const Collection< uint32_t > &lengths) const &
Partitions the component data into multiple sub-batches.
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor=rerun::Loggable< T >::Descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:14
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11