nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #773: MINIFICPP-1202 - Extend interface and add new tests for MinifiConcurrentQueue
Date Mon, 04 May 2020 14:52:28 GMT

szaszm commented on a change in pull request #773:
URL: https://github.com/apache/nifi-minifi-cpp/pull/773#discussion_r419481789



##########
File path: libminifi/include/utils/Void_t.h
##########
@@ -0,0 +1,17 @@
+#pragma once

Review comment:
       I feel it a bit of overkill to have a separate file for such a tiny utility. I would
just put `void_t` in GeneralUtils.h next to the other polyfills.

##########
File path: libminifi/include/utils/Void_t.h
##########
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace utils {
+
+// ppartial detection idiom impl

Review comment:
       `void_t` is used by, but not really part of the detection idiom. Could you move the
comment line back to StringUtils.h?
   
   I forgot to add a reference to cppreference.com in the original. When moving it back, could
you please append `, from cppreference.com` to the comment and fix the typo (`s/ppartial/partial/`)?
   
   So my ask summarized:
   - remove this comment line
   - Add the line below to where it was removed from:
   ```
   // partial detection idiom impl, from cppreference.com
   ```

##########
File path: libminifi/include/utils/TryMoveCall.h
##########
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <utility>
+
+#include <utils/Void_t.h> // NOLINT
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace utils {
+
+// TryMoveCall calls an
+//  - unary function of a lvalue reference-type argument by passing a ref
+//  - unary function of any other argument type by moving into it
+template<typename /* FunType */, typename T, typename = void>
+struct TryMoveCall {

Review comment:
       If we decouple this from the queue, we should consider making it handle return values
(other than `void`).

##########
File path: libminifi/include/utils/MinifiConcurrentQueue.h
##########
@@ -21,20 +21,23 @@
 #include <deque>
 #include <mutex>
 #include <condition_variable>
+#include <utility>
 #include <stdexcept>
+#include <type_traits>

Review comment:
       `<type_traits>` is no longer used since `TryMoveCall` and `void_t` were extracted.
Please fix headers to follow `include-what-you-use`
   
   rationale:
   https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#sf11-header-files-should-be-self-contained
   If `utils/TryMoveCall.h` were not self-contained, following iwyu would more likely expose
the issue in the form of compilation caure.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message