Skip to content
Snippets Groups Projects
Commit 03c0a90c authored by Raphael Grimm's avatar Raphael Grimm
Browse files

make it possible to enqueue Arviz layers

parent 4c60c2ad
No related branches found
No related tags found
No related merge requests found
......@@ -37,55 +37,93 @@ namespace armarx::viz
return client;
}
// ////////////////////////////////////////////////////////////////// //
//layer
Layer layer(std::string const& name)
{
return Layer(componentName, name);
}
void commit(std::initializer_list<Layer> const& layers)
template<class...Ts>
Layer layerContaining(std::string const& name, Ts&& ...elems)
{
updates.clear();
std::transform(layers.begin(), layers.end(), std::back_inserter(updates),
[](const auto & layer)
auto l = layer(name);
l.add(std::forward<Ts>(elems)...);
return l;
}
// ////////////////////////////////////////////////////////////////// //
//enqueue
void enqueueLayer(const Layer& l)
{
updates.emplace_back(l.data_);
}
void enqueueLayer(const Layer* l)
{
updates.emplace_back(l->data_);
}
void enqueueLayer(std::initializer_list<Layer> const& layers)
{
for (const auto& l : layers)
{
return layer.data_;
});
topic->updateLayers(updates);
enqueueLayer(l);
}
}
void enqueueLayer(const std::vector<const Layer*>& layers)
{
for (const auto& l : layers)
{
enqueueLayer(l);
}
}
void enqueueLayer(const std::vector<Layer>& layers)
{
for (const auto& l : layers)
{
enqueueLayer(l);
}
}
template<class...Ts>
void enqueueLayerContaining(std::string const& name, Ts&& ...elems)
{
enqueueLayer(layerContaining(name, std::forward<Ts>(elems)...));
}
// ////////////////////////////////////////////////////////////////// //
//commit
void commit(std::initializer_list<Layer> const& layers)
{
enqueueLayer(layers);
commit();
}
void commit(Layer const& layer)
{
commit({layer});
enqueueLayer(layer);
commit();
}
void commit(const std::vector<const Layer*>& layers)
{
updates.clear();
std::transform(layers.begin(), layers.end(), std::back_inserter(updates),
[](const auto & layerRef)
{
return layerRef->data_;
});
topic->updateLayers(updates);
enqueueLayer(layers);
commit();
}
void commit(const std::vector<Layer>& layers)
{
updates.clear();
std::transform(layers.begin(), layers.end(), std::back_inserter(updates),
[](const auto & layer)
{
return layer.data_;
});
enqueueLayer(layers);
commit();
}
void commit()
{
topic->updateLayers(updates);
updates.clear();
}
template<class...Ts>
void commitLayerContaining(std::string const& name, Ts&& ...elems)
{
auto l = layer(name);
l.add(std::forward<Ts>(elems)...);
commit(l);
commit(layerContaining(name, std::forward<Ts>(elems)...));
}
private:
std::string componentName;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment