Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::app::ValidationRuleService Class Reference

Stateless utility class providing functional parsing and validation rules. More...

#include <ValidationRuleService.hpp>

Static Public Member Functions

static std::expected< float, std::string > parsePositiveFloat (std::string_view str)
 Parses and validates a positive floating point value (> 0).
static std::expected< float, std::string > parseNonNegativeFloat (std::string_view str)
 Parses and validates a non-negative floating point value (>= 0).
static std::expected< int, std::string > parsePositiveInt (std::string_view str)
 Parses and validates a positive integer value (> 0).
static std::expected< int, std::string > parseMinFrame (std::string_view frame_s, int total_frames)
 Parses starting frame input ("Start", "End", or 1-based numeric).
static std::expected< int, std::string > parseMaxFrame (std::string_view frame_s, int total_frames)
 Parses ending frame input ("End", "Start", or 1-based numeric).
static std::expected< int, std::string > parseFrameStride (std::string_view stride_s)
 Parses frame stride input (positive integer >= 1).
static std::expected< void, std::string > validateBinWithinMax (float bin_val, float max_val, std::string_view max_label)
 Validates that a histogram bin width does not exceed its maximum cutoff.
static std::expected< void, std::string > validateAngleDegrees (float angle_val)
 Validates that an angular bin width does not exceed 180 degrees.
static std::expected< void, std::string > validateXrdTheta (float theta_min, float theta_max)
 Validates X-ray diffraction 2-theta minimum and maximum angular bounds.
static std::expected< void, std::string > validateMaxCutoff (float r_max, float max_ceiling=50.0F)
 Validates that a cutoff radius does not exceed the safe maximum ceiling.

Detailed Description

Stateless utility class providing functional parsing and validation rules.

Member Function Documentation

◆ parseFrameStride()

std::expected< int, std::string > correlation::app::ValidationRuleService::parseFrameStride ( std::string_view stride_s)
staticnodiscard

Parses frame stride input (positive integer >= 1).

Parameters
[in]stride_sInput text string.
Returns
Stride integer on success, or error message on failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseMaxFrame()

std::expected< int, std::string > correlation::app::ValidationRuleService::parseMaxFrame ( std::string_view frame_s,
int total_frames )
staticnodiscard

Parses ending frame input ("End", "Start", or 1-based numeric).

Parameters
[in]frame_sInput text string.
[in]total_framesTotal number of available frames in trajectory.
Returns
0-based frame index (-1 for end) on success, or error message on failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseMinFrame()

std::expected< int, std::string > correlation::app::ValidationRuleService::parseMinFrame ( std::string_view frame_s,
int total_frames )
staticnodiscard

Parses starting frame input ("Start", "End", or 1-based numeric).

Parameters
[in]frame_sInput text string.
[in]total_framesTotal number of available frames in trajectory.
Returns
0-based frame index on success, or error message on failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseNonNegativeFloat()

std::expected< float, std::string > correlation::app::ValidationRuleService::parseNonNegativeFloat ( std::string_view str)
staticnodiscard

Parses and validates a non-negative floating point value (>= 0).

Parameters
[in]strInput text to parse.
Returns
Parsed float value on success, or error message on failure.
Here is the caller graph for this function:

◆ parsePositiveFloat()

std::expected< float, std::string > correlation::app::ValidationRuleService::parsePositiveFloat ( std::string_view str)
staticnodiscard

Parses and validates a positive floating point value (> 0).

Parameters
[in]strInput text to parse.
Returns
Parsed float value on success, or error message on failure.
Here is the caller graph for this function:

◆ parsePositiveInt()

std::expected< int, std::string > correlation::app::ValidationRuleService::parsePositiveInt ( std::string_view str)
staticnodiscard

Parses and validates a positive integer value (> 0).

Parameters
[in]strInput text to parse.
Returns
Parsed integer value on success, or error message on failure.
Here is the caller graph for this function:

◆ validateAngleDegrees()

std::expected< void, std::string > correlation::app::ValidationRuleService::validateAngleDegrees ( float angle_val)
staticnodiscard

Validates that an angular bin width does not exceed 180 degrees.

Parameters
[in]angle_valEvaluated angle in degrees.
Returns
Void on success, or error message on failure.
Here is the caller graph for this function:

◆ validateBinWithinMax()

std::expected< void, std::string > correlation::app::ValidationRuleService::validateBinWithinMax ( float bin_val,
float max_val,
std::string_view max_label )
staticnodiscard

Validates that a histogram bin width does not exceed its maximum cutoff.

Parameters
[in]bin_valEvaluated bin width.
[in]max_valEvaluated maximum cutoff.
[in]max_labelName of the maximum property (e.g. "r_max", "q_max").
Returns
Void on success, or error message on failure.
Here is the caller graph for this function:

◆ validateMaxCutoff()

std::expected< void, std::string > correlation::app::ValidationRuleService::validateMaxCutoff ( float r_max,
float max_ceiling = 50.0F )
staticnodiscard

Validates that a cutoff radius does not exceed the safe maximum ceiling.

Parameters
[in]r_maxEvaluated cutoff radius in Angstroms.
[in]max_ceilingMaximum allowable cutoff radius ceiling in Angstroms (default: 50.0).
Returns
Void on success, or error message on failure.
Here is the caller graph for this function:

◆ validateXrdTheta()

std::expected< void, std::string > correlation::app::ValidationRuleService::validateXrdTheta ( float theta_min,
float theta_max )
staticnodiscard

Validates X-ray diffraction 2-theta minimum and maximum angular bounds.

Parameters
[in]theta_minEvaluated minimum 2-theta angle.
[in]theta_maxEvaluated maximum 2-theta angle.
Returns
Void on success, or error message on failure.
Here is the caller graph for this function:

The documentation for this class was generated from the following files: