martinzink commented on code in PR #1543:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1543#discussion_r1155847706
##########
libminifi/include/core/TypedValues.h:
##########
@@ -110,20 +110,26 @@ class DataSizeValue : public TransformableValue, public
state::response::UInt64V
: state::response::UInt64Value(0) {
}
-
- // Convert String to Integer
- template<typename T, typename std::enable_if<
- std::is_integral<T>::value>::type* = nullptr>
- static bool StringToInt(const std::string &input, T &output) {
+ static std::optional<uint64_t> getUnitMultiplier(std::string unit_str) {
// TODO(adebreceni): this mapping is to preserve backwards compatibility,
// we should entertain the idea of moving to standardized units in
// the configuration (i.e. K = 1000, Ki = 1024)
static std::map<std::string, int64_t> unit_map{
- {"B", 1},
- {"K", 1_KB}, {"M", 1_MB}, {"G", 1_GB}, {"T", 1_TB}, {"P", 1_PB},
- {"KB", 1_KiB}, {"MB", 1_MiB}, {"GB", 1_GiB}, {"TB", 1_TiB}, {"PB",
1_PiB},
+ {"B", 1},
+ {"K", 1_KB}, {"M", 1_MB}, {"G", 1_GB}, {"T", 1_TB}, {"P", 1_PB},
+ {"KB", 1_KiB}, {"MB", 1_MiB}, {"GB", 1_GiB}, {"TB", 1_TiB}, {"PB",
1_PiB},
};
+ std::transform(unit_str.begin(), unit_str.end(), unit_str.begin(),
::toupper);
Review Comment:
good idea, changed these in
https://github.com/apache/nifi-minifi-cpp/pull/1543/commits/64c5975e3fda0911820465778fa4d73f16d12002#diff-e2999aedfde011241ca9ddcd8081eec97c6bd96a5b1f6f883aeb2c13985be13fR122
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]