NDArrayHelper.h
Go to the documentation of this file.
1
#pragma once
2
#include <string>
3
#include <vector>
4
5
#include <SimoxUtility/algorithm/string.h>
6
7
namespace
armarx::skills::gui
8
{
9
class
NDArrayHelper
10
{
11
public
:
12
// Uses the simox utility to parse floatingpoint and fixed precision types
13
// it then writes the result into a byte vector
14
// an empty byte vector encodes a parsing error.
15
template
<
typename
T>
16
std::vector<unsigned char>
static
toByteVector
(
const
std::string&
str
)
17
{
18
try
19
{
20
auto
val = simox::alg::to_<T>(
str
);
21
std::vector<unsigned char> res(
sizeof
(val), 0);
22
T
* reinterpPtr =
reinterpret_cast<
T
*
>
(res.data());
23
T
* laundered = std::launder(reinterpPtr);
24
*laundered = val;
25
return
res;
26
}
27
catch
(
const
simox::error::SimoxError& err)
28
{
29
return
{};
30
}
31
}
32
};
33
}
// namespace armarx::skills::gui
T
float T
Definition
UnscentedKalmanFilterTest.cpp:38
str
std::string str(const T &t)
Definition
UserAssistedSegmenterGuiWidgetController.cpp:43
armarx::skills::gui::NDArrayHelper
Definition
NDArrayHelper.h:10
armarx::skills::gui::NDArrayHelper::toByteVector
static std::vector< unsigned char > toByteVector(const std::string &str)
Definition
NDArrayHelper.h:16
armarx::skills::gui
Definition
PeriodicUpdateWidget.cpp:12
RobotAPI
libraries
skills_gui
aron_tree_widget
widgets
NDArrayHelper.h
Generated by
1.13.2