25 #ifndef INCLUDED_CSVCellGroup_h_GUID_F36004E7_71A4_43AD_7353_B67BCBD8045A 26 #define INCLUDED_CSVCellGroup_h_GUID_F36004E7_71A4_43AD_7353_B67BCBD8045A 42 struct DefaultGroupTag;
50 template <
typename RowProxyType,
typename GroupTag = DefaultGroupTag>
54 : row_(row), prefix_(groupPrefix){};
56 : row_(row), prefix_(groupPrefix){};
58 RowProxyType getRow() {
return std::forward<RowProxyType>(row_); }
60 std::string
const &getPrefix()
const {
return prefix_; }
64 const std::string prefix_;
71 template <
typename RowProxyType,
typename GroupTag,
typename... CellArgs>
73 operator<<(CellGroupProxy<RowProxyType, GroupTag> &group,
76 group.getRow().add(
cell(group.getPrefix() + currentCell.getHeader(),
77 currentCell.getData()));
83 using type = PrefixType;
86 using type = std::string
const &;
90 template <
typename T,
typename PrefixType =
const char *,
91 typename Tag = DefaultGroupTag>
94 using prefix_type = PrefixType;
95 using prefix_arg_type =
96 typename PrefixTypeToArgType<PrefixType>::type;
97 CellGroup(prefix_arg_type prefix,
T const &data)
98 : prefix_(prefix), data_(data) {}
100 prefix_arg_type getPrefix()
const {
return prefix_; }
101 T const &getData()
const {
return data_; }
108 template <
typename T,
typename Tag>
111 using prefix_type = std::string;
112 CellGroup(prefix_type
const &prefix, T
const &data)
113 : prefix_(prefix), data_(data) {}
115 prefix_type
const &getPrefix()
const {
return prefix_; }
116 T
const &getData()
const {
return data_; }
128 template <
typename Derived,
typename T,
typename PrefixType,
131 operator<<(CSVRowProxy<Derived> &row,
136 proxy << group.getData();
144 template <
typename Derived,
typename T,
typename PrefixType,
147 operator<<(CSVRowProxy<Derived> &&row,
151 std::forward<RowProxyType>(row), group.getPrefix()};
152 proxy << group.getData();
153 return std::move(row);
159 template <
typename T>
166 template <
typename T>
173 template <
typename Tag,
typename T>
176 Tag * = static_cast<Tag *>(
nullptr)) {
182 template <
typename Tag,
typename T>
185 Tag * = static_cast<Tag *>(
nullptr)) {
196 template <
typename Tag,
typename T>
198 cellGroup(
T const &data, Tag * = static_cast<Tag *>(
nullptr)) {
202 template <
typename T>
203 inline void operator<<(CellGroupProxy<T, DefaultGroupTag> &group,
205 group <<
cell(
"seconds", tv.seconds)
206 <<
cell(
"microseconds", tv.microseconds);
208 struct AbbreviatedTimeMemberFieldsTag;
209 template <
typename T>
211 operator<<(CellGroupProxy<T, AbbreviatedTimeMemberFieldsTag> &group,
213 group <<
cell(
"sec", tv.seconds) <<
cell(
"usec", tv.microseconds);
216 struct DecimalTimeFieldTag;
217 template <
typename T>
218 inline void operator<<(CellGroupProxy<T, DecimalTimeFieldTag> &group,
224 template <
typename T>
225 inline void operator<<(CellGroupProxy<T, DefaultGroupTag> &group,
227 group <<
cell(
"x", v.data[0]) <<
cell(
"y", v.data[1])
228 <<
cell(
"z", v.data[2]);
231 template <
typename T>
232 inline void operator<<(CellGroupProxy<T, DefaultGroupTag> &group,
234 group <<
cell(
"qw", osvrQuatGetW(&q)) <<
cell(
"qx", osvrQuatGetX(&q))
235 <<
cell(
"qy", osvrQuatGetY(&q)) <<
cell(
"qz", osvrQuatGetZ(&q));
238 #ifdef EIGEN_WORLD_VERSION 239 template <
typename T,
typename Scalar>
240 inline void operator<<(CellGroupProxy<T, DefaultGroupTag> &group,
242 group <<
cell(
"x", v.x()) <<
cell(
"y", v.y());
245 template <
typename T>
246 inline void operator<<(CellGroupProxy<T, DefaultGroupTag> &group,
247 Eigen::Vector3d
const &v) {
248 group <<
cell(
"x", v.x()) <<
cell(
"y", v.y()) <<
cell(
"z", v.z());
251 template <
typename T>
252 inline void operator<<(CellGroupProxy<T, DefaultGroupTag> &group,
254 group <<
cell(
"qw", q.w()) <<
cell(
"qx", q.x()) <<
cell(
"qy", q.y())
255 <<
cell(
"qz", q.z());
261 #endif // INCLUDED_CSVCellGroup_h_GUID_F36004E7_71A4_43AD_7353_B67BCBD8045A Temporary object created by the cellGroup call, captures the string (literal) prefix, the data reference/type, and the group tag.
Definition: CSVCellGroup.h:92
Definition: RunLoopManager.h:42
A structure defining a 3D vector, often a position/translation.
Definition: Vec3C.h:48
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Definition: CSVCellGroup.h:82
Definition: TypeSafeIdHash.h:44
Returned by calls to .row() on a CSV object (you'll never need instantiate manually), and only really interacted with using the operator<< and cell() calls.
Definition: CSV.h:112
A structure defining a quaternion, often a unit quaternion representing 3D rotation.
Definition: QuaternionC.h:49
detail::CellGroup< T > cellGroup(const char *groupHeader, T const &data)
Helper function to create a cell group with a group header prefix.
Definition: CSVCellGroup.h:160
Utility class used in conjunction with osvr::util::CSV, to store a single table cell's column header ...
Definition: CSV.h:62
Definition: newuoa.h:1888
Header providing a C++ wrapper around TimeValueC.h.
A class that exists to make it easier to output composite data structures to CSV. ...
Definition: CSVCellGroup.h:51
Definition: Quaternion.h:47
std::string toDecimalString(TimeValue tv)
Converts to a precise decimal string.
Definition: TimeValue.h:67
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
detail::Cell< T > cell(const char *header, T const &data)
Helper free function to make a CSV cell.
Definition: CSV.h:401