Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
ValidationRuleService.hpp
Go to the documentation of this file.
1
8
9#pragma once
10
11#include <expected>
12#include <string>
13#include <string_view>
14
15namespace correlation::app {
16
22public:
28 [[nodiscard]] static std::expected<float, std::string> parsePositiveFloat(std::string_view str);
29
35 [[nodiscard]] static std::expected<float, std::string>
36 parseNonNegativeFloat(std::string_view str);
37
43 [[nodiscard]] static std::expected<int, std::string> parsePositiveInt(std::string_view str);
44
51 [[nodiscard]] static std::expected<int, std::string> parseMinFrame(std::string_view frame_s,
52 int total_frames);
53
60 [[nodiscard]] static std::expected<int, std::string> parseMaxFrame(std::string_view frame_s,
61 int total_frames);
62
68 [[nodiscard]] static std::expected<int, std::string> parseFrameStride(std::string_view stride_s);
69
77 [[nodiscard]] static std::expected<void, std::string>
78 validateBinWithinMax(float bin_val, float max_val, std::string_view max_label);
79
85 [[nodiscard]] static std::expected<void, std::string> validateAngleDegrees(float angle_val);
86
93 [[nodiscard]] static std::expected<void, std::string> validateXrdTheta(float theta_min,
94 float theta_max);
95
102 [[nodiscard]] static std::expected<void, std::string>
103 validateMaxCutoff(float r_max, float max_ceiling = 50.0F);
104};
105
106} // namespace correlation::app
Stateless utility class providing functional parsing and validation rules.
Definition ValidationRuleService.hpp:21
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.
Definition ValidationRuleService.cpp:134
static std::expected< int, std::string > parsePositiveInt(std::string_view str)
Parses and validates a positive integer value (> 0).
Definition ValidationRuleService.cpp:65
static std::expected< int, std::string > parseFrameStride(std::string_view stride_s)
Parses frame stride input (positive integer >= 1).
Definition ValidationRuleService.cpp:122
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.
Definition ValidationRuleService.cpp:163
static std::expected< float, std::string > parsePositiveFloat(std::string_view str)
Parses and validates a positive floating point value (> 0).
Definition ValidationRuleService.cpp:30
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).
Definition ValidationRuleService.cpp:82
static std::expected< void, std::string > validateXrdTheta(float theta_min, float theta_max)
Validates X-ray diffraction 2-theta minimum and maximum angular bounds.
Definition ValidationRuleService.cpp:149
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).
Definition ValidationRuleService.cpp:102
static std::expected< void, std::string > validateAngleDegrees(float angle_val)
Validates that an angular bin width does not exceed 180 degrees.
Definition ValidationRuleService.cpp:142
static std::expected< float, std::string > parseNonNegativeFloat(std::string_view str)
Parses and validates a non-negative floating point value (>= 0).
Definition ValidationRuleService.cpp:48
Definition AppController.hpp:27