Valkyrie 2026
Loading...
Searching...
No Matches
valor::EigenUnit::ConstUnitMap< UnitTags > Class Template Reference

A non-owning, read-only unit-safe view over a const double* buffer. More...

#include <valkyrie/util/eigenunit/UnitMap.h>

Public Types

using StorageType = Eigen::Matrix<double, Size, 1>
 The underlying Eigen storage type.
using ConstMapType = Eigen::Map<const StorageType>
 The constant Eigen::Map type.
using UnitTuple = std::tuple<UnitTags...>
 A tuple of the unit tags.

Public Member Functions

 ConstUnitMap (const double *ptr)
 Construct a read-only view over a raw buffer.
 ConstUnitMap (const UnitMap< UnitTags... > &m)
 Construct from a mutable UnitMap (const widening).
 ConstUnitMap (const ConstUnitMap &)=delete
ConstUnitMapoperator= (const ConstUnitMap &)=delete
 ConstUnitMap (ConstUnitMap &&)=default
 Move constructor.
ConstUnitMapoperator= (ConstUnitMap &&)=default
 Move assignment.
template<std::size_t N>
requires ValidIndex<N, UnitTags...>
constexpr auto Get () const
 Get the N-th element with its unit.
ConstMapType Raw () const
 Read-only access to the underlying Eigen map.
UnitVector< UnitTags... > ToVector () const
 Produce an owned UnitVector copy of the mapped data.
 operator UnitVector< UnitTags... > () const
 Implicit conversion to UnitVector (copies data).
constexpr auto X () const
 Access the first element (x).
constexpr auto Y () const
 Access the second element (y).
constexpr auto Z () const
 Access the third element (z).
constexpr auto W () const
 Access the fourth element (w).

Static Public Attributes

static constexpr std::size_t Size = sizeof...(UnitTags)
 The number of elements in the map.

Friends

std::ostream & operator<< (std::ostream &os, const ConstUnitMap &m)
 Debug printing support.

Detailed Description

template<typename... UnitTags>
class valor::EigenUnit::ConstUnitMap< UnitTags >

A non-owning, read-only unit-safe view over a const double* buffer.

Template Parameters
UnitTagsThe unit types for each element.

Constructor & Destructor Documentation

◆ ConstUnitMap() [1/2]

template<typename... UnitTags>
valor::EigenUnit::ConstUnitMap< UnitTags >::ConstUnitMap ( const double * ptr)
inlineexplicit

Construct a read-only view over a raw buffer.

Parameters
ptrPointer to at least Size doubles. Lifetime must exceed this map.

◆ ConstUnitMap() [2/2]

template<typename... UnitTags>
valor::EigenUnit::ConstUnitMap< UnitTags >::ConstUnitMap ( const UnitMap< UnitTags... > & m)
inlineexplicit

Construct from a mutable UnitMap (const widening).

Parameters
mThe source UnitMap.

Member Function Documentation

◆ Get()

template<typename... UnitTags>
template<std::size_t N>
requires ValidIndex<N, UnitTags...>
auto valor::EigenUnit::ConstUnitMap< UnitTags >::Get ( ) const
inlineconstexpr

Get the N-th element with its unit.

Template Parameters
NThe index of the element.

◆ ToVector()

template<typename... UnitTags>
UnitVector< UnitTags... > valor::EigenUnit::ConstUnitMap< UnitTags >::ToVector ( ) const
inline

Produce an owned UnitVector copy of the mapped data.

Returns
A new UnitVector with copied data.

The documentation for this class was generated from the following file:
  • src/main/include/valkyrie/util/eigenunit/UnitMap.h