Rerun C++ SDK
No Matches
1#pragma once
3#include <type_traits> // std::enable_if, std::false_type
5namespace rerun {
6 /// The `rerun::CollectionAdapter` trait is responsible for mapping an input argument to a `rerun::Collection`.
7 ///
8 /// There are default implementations for standard containers, as well as single
9 /// elements. These can be found in `rerun/collection_adapter_builtins.hpp`.
10 ///
11 /// An adapter may choose to either produce an owned or borrowed collection.
12 /// Borrowed collections required that a pointer to the passed in ("adapted") data
13 /// outlives the collection. Owned component batches on the other hand take ownership by
14 /// allocating a `std::vector` and moving the data into it. This is typically only required when
15 /// passing in temporary objects into an adapter or non-trivial data conversion is necessary.
16 ///
17 /// By implementing your own adapters for certain component types, you can map your data to
18 /// Rerun types which then can be logged.
19 ///
20 /// To implement an adapter for a type T, specialize `CollectionAdapter<TElement, T>` and
21 /// define `Collection<TElement> operator()(const T& input)`.
22 /// It is *highly recommended* to also specify `Collection<TElement> operator()(T&&
23 /// input)` in order to accidentally borrow data that is passed in as a temporary!
24 template <typename TElement, typename TContainer, typename Enable = std::enable_if_t<true>>
26 /// \private
27 /// `NoAdapterFor` always evaluates to false, but in a way that requires template instantiation.
28 template <typename... Ts>
29 struct NoAdapterFor : std::false_type {};
31 static_assert(
32 NoAdapterFor<TElement, TContainer>::value,
33 "CollectionAdapter is not implemented for this type. "
34 "It is implemented for single elements as well as std::vector, std::array, and "
35 "c-arrays of components. "
36 "You can add your own implementation by specializing "
37 "rerun::CollectionAdapter<TElement, TContainer> for a given "
38 "target type TElement and your input type TContainer."
39 );
41 // TODO(andreas): List methods that the trait should implement.
42 };
43} // namespace rerun
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:20
The rerun::CollectionAdapter trait is responsible for mapping an input argument to a rerun::Collectio...
Definition collection_adapter.hpp:25