WSF
usmtf::Radius Class Reference

USMTF Excerpt: More...

#include <Radius.hpp>

Inheritance diagram for usmtf::Radius:
Collaboration diagram for usmtf::Radius:

Public Member Functions

 Radius ()
bool ParseAndValidate (const Field &aField) override
const std::string & GetRadiusValue () const noexcept
const std::string & GetUnitOfMeasure () const noexcept
const double GetRadiusInMeters () const noexcept
const double GetRadiusInMeters (double aRadius) const noexcept
const double GetRadius () const noexcept
Public Member Functions inherited from usmtf::RangeValidator< double >
bool ParseAndValidate (const usmtf::Field &aField) override
void SetValidRange (double aLowerBound, double aUpperBound)
double GetCastedValue () const noexcept
Public Member Functions inherited from usmtf::FFIRN_Validator
 FFIRN_Validator ()=default
const std::string & GetRawContent () const noexcept
 Return the content of the field as it was in the USMTF set.
std::vector< std::string > SplitOnDelimeter (const std::string &value, const std::string &delimeter)
 Values separated by delimeter.
const std::string & GetFieldContent () const noexcept
Public Member Functions inherited from usmtf::Validatable
bool IsValid () const noexcept
Public Member Functions inherited from usmtf::ErrorManager
virtual ~ErrorManager ()=default
bool HasErrors () const noexcept
void LogErrors (std::ostream &aOut) const noexcept
const std::vector< ValidationError > & GetErrors () const

Protected Member Functions

bool IsValidRadius () noexcept
bool IsValidUnitOfMeasureForRadius (const std::string &aUom) noexcept
Protected Member Functions inherited from usmtf::RangeValidator< double >
bool IsInvalidRange (double aValue) noexcept
Protected Member Functions inherited from usmtf::FFIRN_Validator
bool ValidateByDescriptor (const FFIRN_DescriptorMap &aDescriptorMap)
 Speed up validation if descriptor is present. Runs all functions if it isn't.
void ClearErrorsIfValid (bool aHasAtLeastOnePassed) noexcept
void SetField (const Field &aField) noexcept
 Field Setter for internal use only.
Protected Member Functions inherited from usmtf::ErrorManager
void AddError (const ValidationError &aError) noexcept
void AddError (const std::string &aFailureReason, const std::string &aValueValidatied, const std::string &aOptionalSuggestion="") noexcept
void AddError (const std::string &aErrorMessage) noexcept
void AddErrors (const std::vector< ValidationError > &aErrors) noexcept
void ClearErrors () noexcept

Protected Attributes

std::string mRadiusValue
std::string mUnitOfMeasure
double mRadiusDouble
Protected Attributes inherited from usmtf::RangeValidator< double >
double mCastedRangeValue
double mLowerBound
double mUpperBound
Protected Attributes inherited from usmtf::FFIRN_Validator
Field mField

Additional Inherited Members

Public Types inherited from usmtf::FFIRN_Validator
using FFIRN_Func = std::function<bool(void)>
using FFIRN_DescriptorMap = std::unordered_map<std::string, FFIRN_Func>
Static Public Member Functions inherited from usmtf::FFIRN_Validator
static bool IsInSelection (const std::string &aValue, const std::vector< std::string > &choices) noexcept
static bool IsStringLength (const std::string &aValue, size_t aLength) noexcept
static size_t CheckForAnyDelimeter (const std::string &aValue, const std::vector< std::string > &aDelimeters) noexcept
 Returns the positions of a specified delimiter if present, npos if not.
static size_t CheckForAnyDelimeter (const std::string &aValue, const std::vector< std::string > &aDelimeters, std::string &aFoundDelimeter) noexcept
template<class T>
static bool IsInRange (T aValue, T aLowerBound, T aUpperBound) noexcept

Detailed Description

USMTF Excerpt:

FFIRN_Validator responsible for the validation and property extraction of a Radius. An Radius is somewhat self explanatory given the mathematical definition. What might be confusing is this classes use in situations that simple mean distance, like in widths of volumes. It comes with a unit of measure.

EXPRESSED AS FOLLOWS:

CONTEXT QUANTITY, DECIMAL PT PERMITTED, 5 CHARACTER MAX ALLOWABLE ENTRIES: (0 THROUGH 99999) [0 TO 4 DECIMAL PLACES]. DATA ITEM AND DATA CODE VALUES CONSIST OF THE INTEGERS 0 THROUGH 99999, AND DECIMAL POINT VALUES. DECIMAL POINT VALUES RANGE FROM .0001 TO 999.9, CONSISTING OF ALL POSSIBLE COMBINATIONS OF FOUR OR FEWER SIGNIFICANT DIGITS AND A SIGNIFICANT DECIMAL POINT. THERE IS A MAXIMUM OF FIVE CHARACTERS.

UNIT OF LINEAR MEASUREMENT, M/KM/NM (Meters, Kilometers, Nautical Miles) EXAMPLE: /25NM

Constructor & Destructor Documentation

◆ Radius()

usmtf::Radius::Radius ( )

Member Function Documentation

◆ GetRadius()

const double usmtf::Radius::GetRadius ( ) const
noexcept

References mRadiusDouble.

◆ GetRadiusInMeters() [1/2]

const double usmtf::Radius::GetRadiusInMeters ( ) const
noexcept

Given Meters is the common UOM in use for calculations we opted to always have a implicit conversion between the other supported UOMS, nm, km etc

References GetRadiusInMeters(), and mRadiusDouble.

Referenced by usmtf::InnerOuterRange::GetInnerRadiusInMeters(), and GetRadiusInMeters().

◆ GetRadiusInMeters() [2/2]

const double usmtf::Radius::GetRadiusInMeters ( double aRadius) const
noexcept

◆ GetRadiusValue()

const std::string & usmtf::Radius::GetRadiusValue ( ) const
noexcept

References mRadiusValue.

◆ GetUnitOfMeasure()

const std::string & usmtf::Radius::GetUnitOfMeasure ( ) const
noexcept

References mUnitOfMeasure.

◆ IsValidRadius()

◆ IsValidUnitOfMeasureForRadius()

bool usmtf::Radius::IsValidUnitOfMeasureForRadius ( const std::string & aUom)
protectednoexcept

◆ ParseAndValidate()

bool usmtf::Radius::ParseAndValidate ( const Field & aField)
overridevirtual

I am not a huge fan of violating command query separation. But, in this case it makes sense. The functions that come into ParseAndValidate have to parse to get value of the component, sometimes there are many components in a single field. Unfortunately parsing is an intertwined attribute of validation. You cant parse according to some rule set if the field is invalid, making it impossible to separate the two notions easily. I have opted to instead name the functions for what they are actually doing. Parsing components and validating them as well. Optionally members can be set within the function as well.

Implements usmtf::FFIRN_Validator.

References IsValidRadius(), and usmtf::FFIRN_Validator::SetField().

Referenced by usmtf::TrackWidth::IsValidTrackWidth(), and usmtf::InnerOuterRange::ParseAndValidate().

Member Data Documentation

◆ mRadiusDouble

double usmtf::Radius::mRadiusDouble
protected

◆ mRadiusValue

std::string usmtf::Radius::mRadiusValue
protected

◆ mUnitOfMeasure

std::string usmtf::Radius::mUnitOfMeasure
protected

The documentation for this class was generated from the following files:
Copyrights Multiple, All Rights Reserved