HighMap library (C++)
Loading...
Searching...
No Matches
validation.hpp File Reference

Array validation functions with source location logging. More...

Go to the source code of this file.

Namespaces

namespace  hmap
 

Functions

bool hmap::validate_shape (glm::ivec2 shape, const std::source_location &loc=std::source_location::current())
 Validates that array dimensions are strictly positive.
 
bool hmap::validate_non_empty (const Array &array, const std::source_location &loc=std::source_location::current())
 Validates that an array is initialized, non-empty, and has a consistent buffer size.
 
template<typename T >
requires requires(const T &t) { { t.empty() } -> std::convertible_to<bool>; }
bool hmap::validate_non_empty (const T &container, std::string_view name="Container", const std::source_location &loc=std::source_location::current())
 Validates that a container or object with an empty() method is not empty.
 
template<typename T >
requires requires(const T &t) { { t.size() } -> std::convertible_to<size_t>; }
bool hmap::validate_min_size (const T &container, size_t min_size, std::string_view name="Container", const std::source_location &loc=std::source_location::current())
 Validates that a container has at least min_size elements.
 
bool hmap::validate_same_shape (const Array &a, const Array &b, const std::source_location &loc=std::source_location::current())
 Validates that two arrays have identical shapes and buffer sizes.
 
bool hmap::validate_same_shape (glm::ivec2 shape, const Array &b, const std::source_location &loc=std::source_location::current())
 Validates that an array has the expected 2D shape.
 
bool hmap::validate_non_empty (const Texture &tex, int min_channels=1, const std::source_location &loc=std::source_location::current())
 Validates that a Texture is initialized, non-empty, and has valid channel buffers.
 
bool hmap::validate_channels (const Texture &tex, int expected_channels, const std::source_location &loc=std::source_location::current())
 Validates exact channel count of a Texture.
 
bool hmap::validate_same_shape (const Texture &a, const Texture &b, const std::source_location &loc=std::source_location::current())
 Validates that two Textures have matching 2D shapes.
 
bool hmap::validate_same_shape (const Texture &tex, const Array &arr, const std::source_location &loc=std::source_location::current())
 Validates that a Texture and an Array have matching 2D shapes.
 
bool hmap::validate_slice (const Array &array, glm::ivec4 idx, const std::source_location &loc=std::source_location::current())
 Validates that a slice extent {i1, i2, j1, j2} is valid and within array boundaries.
 
bool hmap::validate_slice_for_array (const Array &dest, glm::ivec4 idx, const Array &src, const std::source_location &loc=std::source_location::current())
 Validates that a slice extent matches the dimensions of a source array.
 
bool hmap::validate_not_zero (float value, const std::source_location &loc=std::source_location::current())
 Validates that a divisor value is not zero.
 
bool hmap::validate_parameter_range (glm::vec2 range, float min_val, float max_val, std::string_view param_name="Range", const std::source_location &loc=std::source_location::current())
 Validates that a 2D range vector {low, high} lies within [min_val, max_val] with low <= high.
 
bool hmap::validate_finite (const Array &array, const std::source_location &loc=std::source_location::current())
 Validates that all elements of an array are finite (not NaN or Inf).
 
bool hmap::validate_cmap (int cmap, const std::source_location &loc=std::source_location::current())
 Validates that a colormap ID corresponds to a valid Cmap enum value.
 

Detailed Description

Array validation functions with source location logging.

Author
Otto Link (otto..nosp@m.link.nosp@m..bv@g.nosp@m.mail.nosp@m..com)