3#include "collection.hpp"
4#include "component_batch.hpp"
17 template <
typename T2>
18 struct NoAsComponentsFor : std::false_type {};
22 NoAsComponentsFor<T>::value,
23 "AsComponents is not implemented for this type. "
24 "It is implemented for all built-in archetypes as well as invidiual & collections of `rerun::ComponentBatch`."
25 "You can add your own implementation by specializing AsComponents<T> for your type T."
29 static Result<Collection<ComponentBatch>> as_batches(
const T& archetype);
37 struct AsComponents<Collection<ComponentBatch>> {
38 static Result<Collection<ComponentBatch>> as_batches(Collection<ComponentBatch> components
46 struct AsComponents<ComponentBatch> {
47 static Result<Collection<ComponentBatch>> as_batches(ComponentBatch components) {
54 struct AsComponents<Result<Collection<ComponentBatch>>> {
55 static Result<Collection<ComponentBatch>> as_batches(
56 Result<Collection<ComponentBatch>> components
58 RR_RETURN_NOT_OK(components.error);
59 return components.value;
65 struct AsComponents<Collection<Result<ComponentBatch>>> {
66 static Result<Collection<ComponentBatch>> as_batches(
67 Collection<Result<ComponentBatch>> components
69 std::vector<ComponentBatch> result;
70 result.reserve(components.size());
71 for (
auto& component : components) {
72 RR_RETURN_NOT_OK(component.error);
73 result.push_back(std::move(component.value));
81 struct AsComponents<Result<ComponentBatch>> {
82 static Result<Collection<ComponentBatch>> as_batches(Result<ComponentBatch> components) {
83 RR_RETURN_NOT_OK(components.error);
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Collection< TElement > take_ownership(std::vector< TElement > data)
Takes ownership of a temporary std::vector, moving it into the collection.
Definition collection.hpp:482