This is an automated email from the ASF dual-hosted git repository.

lordgamez pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit faa16d683a9e2298dbda9e794d2edf46d7d876ef
Author: Marton Szasz <[email protected]>
AuthorDate: Tue Aug 16 02:16:54 2022 +0200

    MINIFICPP-1907 Add description to monadic operation wrappers
    
    Signed-off-by: Gabor Gyimesi <[email protected]>
    
    This closes #1389
---
 .../utils/detail/MonadicOperationWrappers.h        | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/libminifi/include/utils/detail/MonadicOperationWrappers.h 
b/libminifi/include/utils/detail/MonadicOperationWrappers.h
index 6548ef4ed..f8e088621 100644
--- a/libminifi/include/utils/detail/MonadicOperationWrappers.h
+++ b/libminifi/include/utils/detail/MonadicOperationWrappers.h
@@ -46,18 +46,47 @@ struct filter_wrapper {
 };
 }  // namespace detail
 
+/**
+ * Transforms a wrapped value of T by calling the provided function T -> U, 
returning wrapped U.
+ * @param func Function that takes a wrapped value and returns a new value to 
be wrapped.
+ * @see flatMap if your transformation function itself returns a wrapped value
+ * @return Wrapped result of func
+ */
 template<typename T>
 detail::map_wrapper<T&&> map(T&& func) noexcept { return 
{std::forward<T>(func)}; }
 
+/**
+ * Transforms a wrapped value of T by calling the provided function T -> 
wrapped U, returning wrapped U.
+ * @param func Transforms the wrapped value using a function that itself 
returns a new wrapped value.
+ * @return Transformed value
+ */
 template<typename T>
 detail::flat_map_wrapper<T&&> flatMap(T&& func) noexcept { return 
{std::forward<T>(func)}; }
 
+/**
+ * For optional-like types, possibly provides a value for an empty object to 
be replaced with.
+ * @param func A value (function with no parameters) to replace a missing 
value with, or an action to be executed if the value is missing.
+ *     The value must be wrapped, and of the same type as the contained value.
+ * @see valueOrElse if the new value is always present, i.e. the function 
returns an unwrapped value.
+ * @return The old value if present, or the new value if missing.
+ */
 template<typename T>
 detail::or_else_wrapper<T&&> orElse(T&& func) noexcept { return 
{std::forward<T>(func)}; }
 
+/**
+ * For optional-like types, returns the present value or the provided value if 
missing.
+ * @param func A value (function with no parameters) to replace a missing 
value with. The value must not be wrapped.
+ * @see orElse if the new value may not be present, i.e. the function returns 
a wrapped value.
+ * @return The old value if present, or the new value if missing. Like 
std::optional::value_or, but lazily evaluated
+ */
 template<typename T>
 detail::value_or_else_wrapper<T&&> valueOrElse(T&& func) noexcept { return 
{std::forward<T>(func)}; }
 
+/**
+ * For optional-like types, only keep the present value if it satisfies the 
predicate
+ * @param func A predicate to filter on
+ * @return The value if it was present and satisfied the predicate, empty 
otherwise.
+ */
 template<typename T>
 detail::filter_wrapper<T&&> filter(T&& func) noexcept { return 
{std::forward<T>(func)}; }
 }  // namespace org::apache::nifi::minifi::utils

Reply via email to