Template Struct type_caster< Karana::Math::QuantityValue< Value, Tag > >

Template Struct type_caster< Karana::Math::QuantityValue< Value, Tag > >#

Struct Documentation#

template<typename Value, typename Tag>
struct type_caster<Karana::Math::QuantityValue<Value, Tag>>#

Converts every Karana quantity value with a known quantity between C++ and Pint.

Template Parameters:
  • Value – The scalar, vector, or matrix magnitude type.

  • Tag – The quantity metadata tag selecting the Pint dimension and units.

Public Functions

PYBIND11_TYPE_CASTER(type, casterName)#

Type caster for pint quantities and associated C++ values.

inline bool load(handle src, bool convert)#

Converts a Pint quantity or bare Python magnitude to C++.

Parameters:
  • src – The source Python object.

  • convert – Whether implicit conversions are allowed.

Returns:

True when the source has the expected dimension and value shape.

Public Static Functions

static inline handle cast(const type &src, return_value_policy policy, handle parent)#

Converts a C++ quantity to a Pint quantity in default units.

Parameters:
  • src – The source C++ quantity.

  • policy – The pybind11 return-value policy for the magnitude.

  • parent – The parent Python object, when applicable.

Returns:

A new reference to the resulting Pint quantity.