Skip to content
Snippets Groups Projects
Commit c47b1115 authored by Luis Gressenbuch's avatar Luis Gressenbuch
Browse files

Move unit definitions to separate header file

parent 393b6582
No related branches found
Tags v2.1.0
1 merge request!141Move unit definitions to separate header file
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2021-2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * Copyright (c) 2021-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* *
* This program and the accompanying materials are made * This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0 * available under the terms of the Eclipse Public License 2.0
...@@ -16,43 +16,9 @@ ...@@ -16,43 +16,9 @@
#define MANTLEAPI_COMMON_ORIENTATION_H #define MANTLEAPI_COMMON_ORIENTATION_H
#include <MantleAPI/Common/floating_point_helper.h> #include <MantleAPI/Common/floating_point_helper.h>
#include <MantleAPI/Common/unit_definitions.h>
#include <units.h> #include <units.h>
namespace units
{
/// Adds a single new unit to the given namespace, as well as a literal definition and `cout` support based on the given
/// `abbreviation`.
UNIT_ADD(angular_acceleration,
radians_per_second_squared,
radians_per_second_squared,
rad_per_s_sq,
compound_unit<angle::radians, inverse<squared<time::seconds>>>)
namespace category
{
using angular_acceleration_unit = base_unit<detail::meter_ratio<0>, std::ratio<0>, std::ratio<-2>, std::ratio<1>>;
} // namespace category
UNIT_ADD_CATEGORY_TRAIT(angular_acceleration)
/// Adds a single new unit to the given namespace, as well as a literal definition and `cout` support based on the given
/// `abbreviation`.
UNIT_ADD(angular_jerk,
radians_per_second_cubed,
radians_per_second_cubed,
rad_per_s_cu,
compound_unit<angle::radians, inverse<cubed<time::seconds>>>)
namespace category
{
using angular_jerk_unit = base_unit<detail::meter_ratio<0>, std::ratio<0>, std::ratio<-3>, std::ratio<1>>;
} // namespace category
UNIT_ADD_CATEGORY_TRAIT(angular_jerk)
} // namespace units
namespace mantle_api namespace mantle_api
{ {
template <typename T, template <typename T,
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2021-2023, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) * Copyright (c) 2021-2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
* *
* This program and the accompanying materials are made * This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0 * available under the terms of the Eclipse Public License 2.0
...@@ -19,50 +19,12 @@ ...@@ -19,50 +19,12 @@
#include <MantleAPI/Common/floating_point_helper.h> #include <MantleAPI/Common/floating_point_helper.h>
#include <MantleAPI/Common/orientation.h> #include <MantleAPI/Common/orientation.h>
#include <MantleAPI/Common/time_utils.h> #include <MantleAPI/Common/time_utils.h>
#include <MantleAPI/Common/unit_definitions.h>
#include <MantleAPI/Common/vector.h> #include <MantleAPI/Common/vector.h>
#include <units.h> #include <units.h>
#include <tuple> #include <tuple>
namespace units
{
/// Adds unit 'jerk' to the given namespace, as well as a literal definition and `cout` support based on the given
/// `abbreviation`.
UNIT_ADD(jerk,
meters_per_second_cubed,
meters_per_second_cubed,
mps_cu,
compound_unit<velocity::meters_per_second, inverse<squared<time::seconds>>>)
namespace category
{
using jerk_unit = base_unit<detail::meter_ratio<1>, std::ratio<0>, std::ratio<-3>>;
} // namespace category
UNIT_ADD_CATEGORY_TRAIT(jerk)
/// Adds new unit 'jerk_acceleration' to the given namespace, as well as a literal definition and `cout` support based on the given
/// `abbreviation`.
UNIT_ADD(jerk_acceleration,
meters_per_second_to_the_power_of_four,
meters_per_second_to_the_power_of_four,
mps_pow4,
compound_unit<velocity::meters_per_second, inverse<cubed<time::seconds>>>)
namespace category
{
using jerk_acceleration_unit = base_unit<detail::meter_ratio<1>, std::ratio<0>, std::ratio<-4>>;
} // namespace category
UNIT_ADD_CATEGORY_TRAIT(jerk_acceleration)
} // namespace units
namespace mantle_api namespace mantle_api
{ {
......
/*******************************************************************************
* Copyright (c) 2024, Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
//-----------------------------------------------------------------------------
/** @file unit_definitions.h */
//-----------------------------------------------------------------------------
#ifndef MANTLEAPI_COMMON_UNIT_DEFINITIONS_H
#define MANTLEAPI_COMMON_UNIT_DEFINITIONS_H
#include <units.h>
namespace units
{
/// Adds a single new unit to the given namespace, as well as a literal definition and `cout` support based on the given
/// `abbreviation`.
UNIT_ADD(angular_acceleration,
radians_per_second_squared,
radians_per_second_squared,
rad_per_s_sq,
compound_unit<angle::radians, inverse<squared<time::seconds>>>)
namespace category
{
using angular_acceleration_unit = base_unit<detail::meter_ratio<0>, std::ratio<0>, std::ratio<-2>, std::ratio<1>>;
} // namespace category
UNIT_ADD_CATEGORY_TRAIT(angular_acceleration)
/// Adds a single new unit to the given namespace, as well as a literal definition and `cout` support based on the given
/// `abbreviation`.
UNIT_ADD(angular_jerk,
radians_per_second_cubed,
radians_per_second_cubed,
rad_per_s_cu,
compound_unit<angle::radians, inverse<cubed<time::seconds>>>)
namespace category
{
using angular_jerk_unit = base_unit<detail::meter_ratio<0>, std::ratio<0>, std::ratio<-3>, std::ratio<1>>;
} // namespace category
UNIT_ADD_CATEGORY_TRAIT(angular_jerk)
/// Adds unit 'jerk' to the given namespace, as well as a literal definition and `cout` support based on the given
/// `abbreviation`.
UNIT_ADD(jerk,
meters_per_second_cubed,
meters_per_second_cubed,
mps_cu,
compound_unit<velocity::meters_per_second, inverse<squared<time::seconds>>>)
namespace category
{
using jerk_unit = base_unit<detail::meter_ratio<1>, std::ratio<0>, std::ratio<-3>>;
} // namespace category
UNIT_ADD_CATEGORY_TRAIT(jerk)
/// Adds new unit 'jerk_acceleration' to the given namespace, as well as a literal definition and `cout` support based on the given
/// `abbreviation`.
UNIT_ADD(jerk_acceleration,
meters_per_second_to_the_power_of_four,
meters_per_second_to_the_power_of_four,
mps_pow4,
compound_unit<velocity::meters_per_second, inverse<cubed<time::seconds>>>)
namespace category
{
using jerk_acceleration_unit = base_unit<detail::meter_ratio<1>, std::ratio<0>, std::ratio<-4>>;
} // namespace category
UNIT_ADD_CATEGORY_TRAIT(jerk_acceleration)
} // namespace units
#endif // MANTLEAPI_COMMON_UNIT_DEFINITIONS_H
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