diff --git a/algorithms_cpp/include/embb/algorithms/internal/count-inl.h b/algorithms_cpp/include/embb/algorithms/internal/count-inl.h index 1a89751..51aa34a 100644 --- a/algorithms_cpp/include/embb/algorithms/internal/count-inl.h +++ b/algorithms_cpp/include/embb/algorithms/internal/count-inl.h @@ -46,8 +46,7 @@ class ValueComparisonFunction{ int operator()(ElementType element) { if (element == value_) { return 1; - } - else { + } else { return 0; } } @@ -69,8 +68,7 @@ class FunctionComparisonFunction{ int operator()(ElementType element) { if (function_(element)) { return 1; - } - else { + } else { return 0; } } diff --git a/algorithms_cpp/include/embb/algorithms/internal/for_each-inl.h b/algorithms_cpp/include/embb/algorithms/internal/for_each-inl.h index 7b82b03..938ace0 100644 --- a/algorithms_cpp/include/embb/algorithms/internal/for_each-inl.h +++ b/algorithms_cpp/include/embb/algorithms/internal/for_each-inl.h @@ -41,14 +41,12 @@ namespace internal { template class ForEachFunctor { - private: - typedef ForEachFunctor self_t; public: /** * Constructs a for-each functor with arguments. */ ForEachFunctor(size_t chunk_first, size_t chunk_last, Function unary, - const embb::mtapi::ExecutionPolicy& policy, + const embb::mtapi::ExecutionPolicy& policy, const BlockSizePartitioner& partitioner) : chunk_first_(chunk_first), chunk_last_(chunk_last), unary_(unary), policy_(policy), partitioner_(partitioner) { @@ -63,15 +61,14 @@ class ForEachFunctor { for (RAI it = first; it != last; ++it) { unary_(*it); } - } - else { + } else { // Recurse further: size_t chunk_split_index = (chunk_first_ + chunk_last_) / 2; // Split chunks into left / right branches: - self_t functor_l(chunk_first_, + self_t functor_l(chunk_first_, chunk_split_index, unary_, policy_, partitioner_); - self_t functor_r(chunk_split_index + 1, + self_t functor_r(chunk_split_index + 1, chunk_last_, unary_, policy_, partitioner_); mtapi::Task task_l = mtapi::Node::GetInstance().Spawn( @@ -88,6 +85,9 @@ class ForEachFunctor { } private: + typedef ForEachFunctor self_t; + + private: size_t chunk_first_; size_t chunk_last_; Function unary_; @@ -123,8 +123,8 @@ void ForEachRecursive(RAI first, RAI last, Function unary, } BlockSizePartitioner partitioner(first, last, block_size); - ForEachFunctor functor(0, - partitioner.Size() - 1, + ForEachFunctor functor(0, + partitioner.Size() - 1, unary, policy, partitioner); mtapi::Task task = node.Spawn(mtapi::Action( base::MakeFunction(functor, diff --git a/algorithms_cpp/include/embb/algorithms/internal/merge_sort-inl.h b/algorithms_cpp/include/embb/algorithms/internal/merge_sort-inl.h index af399c9..db0e7fe 100644 --- a/algorithms_cpp/include/embb/algorithms/internal/merge_sort-inl.h +++ b/algorithms_cpp/include/embb/algorithms/internal/merge_sort-inl.h @@ -171,7 +171,7 @@ void MergeSort( assert(distance >= 0); if (block_size == 0) { - block_size= (static_cast(distance) / node.GetCoreCount()); + block_size = (static_cast(distance) / node.GetCoreCount()); if (block_size == 0) block_size = 1; } diff --git a/algorithms_cpp/include/embb/algorithms/internal/quick_sort-inl.h b/algorithms_cpp/include/embb/algorithms/internal/quick_sort-inl.h index 47ef9ae..dc4f64a 100644 --- a/algorithms_cpp/include/embb/algorithms/internal/quick_sort-inl.h +++ b/algorithms_cpp/include/embb/algorithms/internal/quick_sort-inl.h @@ -195,7 +195,7 @@ void QuickSort(RAI first, RAI last, ComparisonFunction comparison, typename std::iterator_traits::difference_type distance = last - first; assert(distance > 0); if (block_size == 0) { - block_size= (static_cast(distance) / node.GetCoreCount()); + block_size = (static_cast(distance) / node.GetCoreCount()); if (block_size == 0) block_size = 1; } diff --git a/algorithms_cpp/include/embb/algorithms/internal/reduce-inl.h b/algorithms_cpp/include/embb/algorithms/internal/reduce-inl.h index a687dcb..c16a513 100644 --- a/algorithms_cpp/include/embb/algorithms/internal/reduce-inl.h +++ b/algorithms_cpp/include/embb/algorithms/internal/reduce-inl.h @@ -41,10 +41,6 @@ namespace internal { template class ReduceFunctor { - private: - typedef ReduceFunctor self_t; public: ReduceFunctor(size_t chunk_first, size_t chunk_last, ReturnType neutral, @@ -53,7 +49,7 @@ class ReduceFunctor { const embb::mtapi::ExecutionPolicy& policy, const BlockSizePartitioner& partitioner, ReturnType& result) - : chunk_first_(chunk_first), chunk_last_(chunk_last), neutral_(neutral), + : chunk_first_(chunk_first), chunk_last_(chunk_last), neutral_(neutral), reduction_(reduction), transformation_(transformation), policy_(policy), partitioner_(partitioner), result_(result) { } @@ -69,8 +65,7 @@ class ReduceFunctor { result = reduction_(result, transformation_(*it)); } result_ = result; - } - else { + } else { // Recurse further: size_t chunk_split_index = (chunk_first_ + chunk_last_) / 2; // Split chunks into left / right branches: @@ -94,7 +89,7 @@ class ReduceFunctor { mtapi::Task task_r = mtapi::Node::GetInstance().Spawn( mtapi::Action( base::MakeFunction( - functor_r, &self_t::Action), + functor_r, &self_t::Action), policy_)); task_l.Wait(MTAPI_INFINITE); task_r.Wait(MTAPI_INFINITE); @@ -103,6 +98,11 @@ class ReduceFunctor { } private: + typedef ReduceFunctor self_t; + + private: size_t chunk_first_; size_t chunk_last_; ReturnType neutral_; @@ -145,17 +145,16 @@ ReturnType ReduceRecursive(RAI first, RAI last, ReturnType neutral, "Number of computation tasks required in reduction would " "exceed MTAPI maximum number of tasks"); } - typedef ReduceFunctor Functor; BlockSizePartitioner partitioner(first, last, block_size); ReturnType result = neutral; Functor functor(0, partitioner.Size() - 1, - neutral, - reduction, transformation, + neutral, + reduction, transformation, policy, - partitioner, + partitioner, result); mtapi::Task task = node.Spawn( mtapi::Action(base::MakeFunction( diff --git a/algorithms_cpp/include/embb/algorithms/internal/scan-inl.h b/algorithms_cpp/include/embb/algorithms/internal/scan-inl.h index 571c68d..6964f52 100644 --- a/algorithms_cpp/include/embb/algorithms/internal/scan-inl.h +++ b/algorithms_cpp/include/embb/algorithms/internal/scan-inl.h @@ -45,7 +45,7 @@ class ScanFunctor { ReturnType neutral, ScanFunction scan, TransformationFunction transformation, const embb::mtapi::ExecutionPolicy& policy, - const BlockSizePartitioner& partitioner, + const BlockSizePartitioner& partitioner, ReturnType* tree_values, size_t node_id, bool going_down) : policy_(policy), chunk_first_(chunk_first), chunk_last_(chunk_last), @@ -72,15 +72,13 @@ class ScanFunctor { *iter_out = result; } SetTreeValue(result); - } - else { + } else { // Second pass for (; iter_in != last_in; ++iter_in, ++iter_out) { *iter_out = scan_(parent_value_, *iter_out); } } - } - else { + } else { // recurse further size_t chunk_split_index = (chunk_first_ + chunk_last_) / 2; // Split chunks into left / right branches: @@ -99,14 +97,14 @@ class ScanFunctor { // Advance output iterator of right branch: ChunkDescriptor chunk_left = partitioner_[chunk_first_]; ChunkDescriptor chunk_right = partitioner_[chunk_split_index + 1]; - long long dist = std::distance(chunk_left.GetFirst(), chunk_right.GetFirst()); - std::advance(functor_r.output_iterator_, dist); + std::advance(functor_r.output_iterator_, + std::distance(chunk_left.GetFirst(), chunk_right.GetFirst())); if (!is_first_pass_) { functor_l.parent_value_ = parent_value_; functor_r.parent_value_ = functor_l.GetTreeValue() + parent_value_; } // Spawn tasks to recurse: - mtapi::Node& node = mtapi::Node::GetInstance(); + mtapi::Node& node = mtapi::Node::GetInstance(); mtapi::Task task_l = node.Spawn( mtapi::Action( base::MakeFunction(functor_l, &ScanFunctor::Action), @@ -149,8 +147,7 @@ class ScanFunctor { void SetID(int branch) { if (branch == LEFT) { node_id_ = 2 * node_id_ + 1; - } - else if (branch == RIGHT) { + } else if (branch == RIGHT) { node_id_ = 2 * node_id_ + 2; } } @@ -198,9 +195,9 @@ void ScanIteratorCheck(RAIIn first, RAIIn last, RAIOut output_iterator, TransformationFunction> Functor; BlockSizePartitioner partitioner_down(first, last, block_size); - Functor functor_down(0, partitioner_down.Size() - 1, output_iterator, neutral, - scan, transformation, policy, partitioner_down, values, 0, - true); + Functor functor_down(0, partitioner_down.Size() - 1, output_iterator, + neutral, scan, transformation, policy, partitioner_down, + values, 0, true); mtapi::Task task_down = node.Spawn(mtapi::Action(base::MakeFunction( functor_down, &Functor::Action), policy)); @@ -208,9 +205,9 @@ void ScanIteratorCheck(RAIIn first, RAIIn last, RAIOut output_iterator, // Second pass. Gives to each leaf the part of the prefix missing BlockSizePartitioner partitioner_up(first, last, block_size); - Functor functor_up(0, partitioner_up.Size() - 1, output_iterator, neutral, - scan, transformation, policy, partitioner_up, values, 0, - false); + Functor functor_up(0, partitioner_up.Size() - 1, output_iterator, + neutral, scan, transformation, policy, partitioner_up, + values, 0, false); mtapi::Task task_up = node.Spawn(mtapi::Action(base::MakeFunction( functor_up, &Functor::Action), policy)); diff --git a/algorithms_cpp/test/count_test.cc b/algorithms_cpp/test/count_test.cc index 7ded684..e28acd0 100644 --- a/algorithms_cpp/test/count_test.cc +++ b/algorithms_cpp/test/count_test.cc @@ -59,8 +59,8 @@ CountTest::CountTest() { void CountTest::TestDataStructures() { using embb::algorithms::Count; - const int size =10; - int array[] = {10, 20, 30, 30, 20, 10, 10, 20, 20, 20}; + const int size = 10; + int array[] = { 10, 20, 30, 30, 20, 10, 10, 20, 20, 20 }; std::vector vector(array, array + size); std::deque deque(array, array + size); const std::vector const_vector(array, array + size); @@ -73,8 +73,8 @@ void CountTest::TestDataStructures() { void CountTest::TestCountIf() { using embb::algorithms::CountIf; - const int size =10; - int array[] = {10, 21, 30, 31, 20, 11, 10, 21, 20, 20}; + const int size = 10; + int array[] = { 10, 21, 30, 31, 20, 11, 10, 21, 20, 20 }; PT_EXPECT_EQ(CountIf(array, array + size, IsEven()), 6); PT_EXPECT_EQ(CountIf(array, array + size, &IsEvenFunction), 6); } diff --git a/base_c/include/embb/base/c/internal/platform.h b/base_c/include/embb/base/c/internal/platform.h index e7e3759..7f025fc 100644 --- a/base_c/include/embb/base/c/internal/platform.h +++ b/base_c/include/embb/base/c/internal/platform.h @@ -105,4 +105,4 @@ typedef pthread_cond_t embb_condition_t; } /* Close extern "C" { */ #endif -#endif /* EMBB_BASE_C_INTERNAL_PLATFORM_H_ */ +#endif // EMBB_BASE_C_INTERNAL_PLATFORM_H_ diff --git a/base_c/test/alloc_test.h b/base_c/test/alloc_test.h index 70488cc..b83c8bf 100644 --- a/base_c/test/alloc_test.h +++ b/base_c/test/alloc_test.h @@ -81,4 +81,4 @@ class AllocTest : public partest::TestCase { } // namespace base } // namespace embb -#endif /* BASE_C_TEST_ALLOC_TEST_H_ */ +#endif // BASE_C_TEST_ALLOC_TEST_H_ diff --git a/base_c/test/condition_var_test.h b/base_c/test/condition_var_test.h index 3bf72d6..23b56be 100644 --- a/base_c/test/condition_var_test.h +++ b/base_c/test/condition_var_test.h @@ -65,4 +65,4 @@ class ConditionVarTest : public partest::TestCase { } // namespace base } // namespace embb -#endif /* BASE_C_TEST_CONDITION_VAR_TEST_H_ */ +#endif // BASE_C_TEST_CONDITION_VAR_TEST_H_ diff --git a/base_c/test/core_set_test.h b/base_c/test/core_set_test.h index 66b45f8..1c6dbfb 100644 --- a/base_c/test/core_set_test.h +++ b/base_c/test/core_set_test.h @@ -51,4 +51,4 @@ class CoreSetTest : public partest::TestCase { } // namespace base } // namespace embb -#endif /* BASE_C_TEST_CORE_SET_TEST_H_ */ +#endif // BASE_C_TEST_CORE_SET_TEST_H_ diff --git a/base_c/test/counter_test.h b/base_c/test/counter_test.h index 679dc54..cf3297b 100644 --- a/base_c/test/counter_test.h +++ b/base_c/test/counter_test.h @@ -97,4 +97,4 @@ class CounterTest : public partest::TestCase { } // namespace base } // namespace embb -#endif /* BASE_C_TEST_COUNTER_TEST_H_ */ +#endif // BASE_C_TEST_COUNTER_TEST_H_ diff --git a/base_c/test/duration_test.h b/base_c/test/duration_test.h index f93ea98..d2a7d2f 100644 --- a/base_c/test/duration_test.h +++ b/base_c/test/duration_test.h @@ -73,4 +73,4 @@ class DurationTest : public partest::TestCase { } // namespace base } // namespace embb -#endif /* BASE_C_TEST_DURATION_TEST_H_ */ +#endif // BASE_C_TEST_DURATION_TEST_H_ diff --git a/base_c/test/thread_index_test.h b/base_c/test/thread_index_test.h index f60691a..1f07630 100644 --- a/base_c/test/thread_index_test.h +++ b/base_c/test/thread_index_test.h @@ -78,4 +78,4 @@ int ThreadStart(void* arg); -#endif /* BASE_C_TEST_THREAD_INDEX_TEST_H_ */ +#endif // BASE_C_TEST_THREAD_INDEX_TEST_H_ diff --git a/base_c/test/thread_specific_storage_test.h b/base_c/test/thread_specific_storage_test.h index 43a0697..1d77e3e 100644 --- a/base_c/test/thread_specific_storage_test.h +++ b/base_c/test/thread_specific_storage_test.h @@ -61,4 +61,4 @@ class ThreadSpecificStorageTest : public partest::TestCase { -#endif /* BASE_C_TEST_THREAD_SPECIFIC_STORAGE_TEST_H_ */ +#endif // BASE_C_TEST_THREAD_SPECIFIC_STORAGE_TEST_H_ diff --git a/base_c/test/thread_test.h b/base_c/test/thread_test.h index 69f94f9..6cdd684 100644 --- a/base_c/test/thread_test.h +++ b/base_c/test/thread_test.h @@ -66,4 +66,4 @@ int ThreadStartFunction(void* arg); } // namespace base } // namespace embb -#endif /* BASE_C_TEST_THREAD_TEST_H_ */ +#endif // BASE_C_TEST_THREAD_TEST_H_ diff --git a/base_c/test/time_test.h b/base_c/test/time_test.h index 86f79d5..629befc 100644 --- a/base_c/test/time_test.h +++ b/base_c/test/time_test.h @@ -53,4 +53,4 @@ class TimeTest : public partest::TestCase { -#endif /* BASE_C_TEST_TIME_TEST_H_ */ +#endif // BASE_C_TEST_TIME_TEST_H_ diff --git a/base_cpp/include/embb/base/core_set.h b/base_cpp/include/embb/base/core_set.h index 984f0f6..74c1360 100644 --- a/base_cpp/include/embb/base/core_set.h +++ b/base_cpp/include/embb/base/core_set.h @@ -201,4 +201,4 @@ class CoreSet { -#endif /* EMBB_BASE_CORE_SET_H_ */ +#endif // EMBB_BASE_CORE_SET_H_ diff --git a/base_cpp/include/embb/base/duration.h b/base_cpp/include/embb/base/duration.h index ec64176..5c6d2e8 100644 --- a/base_cpp/include/embb/base/duration.h +++ b/base_cpp/include/embb/base/duration.h @@ -522,4 +522,4 @@ class Nanoseconds : public Tick { #include -#endif /* EMBB_BASE_DURATION_H_ */ +#endif // EMBB_BASE_DURATION_H_ diff --git a/base_cpp/include/embb/base/exceptions.h b/base_cpp/include/embb/base/exceptions.h index 7d503bf..abcc09d 100644 --- a/base_cpp/include/embb/base/exceptions.h +++ b/base_cpp/include/embb/base/exceptions.h @@ -276,4 +276,4 @@ class ErrorException : public Exception { } // namespace base } // namespace embb -#endif /* EMBB_BASE_EXCEPTIONS_H_ */ +#endif // EMBB_BASE_EXCEPTIONS_H_ diff --git a/base_cpp/include/embb/base/internal/duration-inl.h b/base_cpp/include/embb/base/internal/duration-inl.h index 87f215d..2d502fd 100644 --- a/base_cpp/include/embb/base/internal/duration-inl.h +++ b/base_cpp/include/embb/base/internal/duration-inl.h @@ -112,4 +112,4 @@ Duration::Duration(const embb_duration_t& duration) : rep_() { } // namespace base } // namespace embb -#endif /* EMBB_BASE_INTERNAL_DURATION_INL_H_ */ +#endif // EMBB_BASE_INTERNAL_DURATION_INL_H_ diff --git a/base_cpp/include/embb/base/internal/mutex-inl.h b/base_cpp/include/embb/base/internal/mutex-inl.h index 3d07600..0d9b336 100644 --- a/base_cpp/include/embb/base/internal/mutex-inl.h +++ b/base_cpp/include/embb/base/internal/mutex-inl.h @@ -116,4 +116,4 @@ bool UniqueLock::OwnsLock() const { } // namespace base } // namespace embb -#endif /* EMBB_BASE_INTERNAL_MUTEX_INL_H_ */ +#endif // EMBB_BASE_INTERNAL_MUTEX_INL_H_ diff --git a/base_cpp/include/embb/base/internal/thread-inl.h b/base_cpp/include/embb/base/internal/thread-inl.h index a27fd01..454f75a 100644 --- a/base_cpp/include/embb/base/internal/thread-inl.h +++ b/base_cpp/include/embb/base/internal/thread-inl.h @@ -107,4 +107,4 @@ std::basic_ostream& } // namespace base } // namespace embb -#endif /* EMBB_BASE_INTERNAL_THREAD_INL_H_ */ +#endif // EMBB_BASE_INTERNAL_THREAD_INL_H_ diff --git a/base_cpp/include/embb/base/internal/thread_closures.h b/base_cpp/include/embb/base/internal/thread_closures.h index b18a202..214cb6e 100644 --- a/base_cpp/include/embb/base/internal/thread_closures.h +++ b/base_cpp/include/embb/base/internal/thread_closures.h @@ -103,4 +103,4 @@ struct ThreadClosureArg2 { } // namespace base } // namespace embb -#endif /* EMBB_BASE_INTERNAL_THREAD_CLOSURES_H_ */ +#endif // EMBB_BASE_INTERNAL_THREAD_CLOSURES_H_ diff --git a/base_cpp/include/embb/base/internal/thread_specific_storage-inl.h b/base_cpp/include/embb/base/internal/thread_specific_storage-inl.h index 0786c82..00b81c3 100644 --- a/base_cpp/include/embb/base/internal/thread_specific_storage-inl.h +++ b/base_cpp/include/embb/base/internal/thread_specific_storage-inl.h @@ -149,4 +149,4 @@ void ThreadSpecificStorage::Prepare() { } // namespace base } // namespace embb -#endif /* EMBB_BASE_INTERNAL_THREAD_SPECIFIC_STORAGE_INL_H_ */ +#endif // EMBB_BASE_INTERNAL_THREAD_SPECIFIC_STORAGE_INL_H_ diff --git a/base_cpp/include/embb/base/thread_specific_storage.h b/base_cpp/include/embb/base/thread_specific_storage.h index d8e30d8..fa2191e 100644 --- a/base_cpp/include/embb/base/thread_specific_storage.h +++ b/base_cpp/include/embb/base/thread_specific_storage.h @@ -35,10 +35,10 @@ namespace embb { namespace base { namespace test { - /** - * Forward declaration for friending. - */ - class ThreadSpecificStorageTest; +/** + * Forward declaration for friending. + */ +class ThreadSpecificStorageTest; } /** @@ -176,4 +176,4 @@ class ThreadSpecificStorage { #include -#endif /* EMBB_BASE_THREAD_SPECIFIC_STORAGE_H_ */ +#endif // EMBB_BASE_THREAD_SPECIFIC_STORAGE_H_ diff --git a/base_cpp/include/embb/base/time.h b/base_cpp/include/embb/base/time.h index e2e0927..06f9ee8 100644 --- a/base_cpp/include/embb/base/time.h +++ b/base_cpp/include/embb/base/time.h @@ -78,4 +78,4 @@ class Time { } // namespace base } // namespace embb -#endif /* EMBB_BASE_TIME_H_ */ +#endif // EMBB_BASE_TIME_H_ diff --git a/base_cpp/test/thread_specific_storage_test.h b/base_cpp/test/thread_specific_storage_test.h index 7de0332..1c94e2a 100644 --- a/base_cpp/test/thread_specific_storage_test.h +++ b/base_cpp/test/thread_specific_storage_test.h @@ -42,7 +42,7 @@ class ThreadSpecificStorageTest : public partest::TestCase { /** * Adds test units. */ - explicit ThreadSpecificStorageTest(); + ThreadSpecificStorageTest(); private: /** diff --git a/base_cpp/test/thread_test.h b/base_cpp/test/thread_test.h index 0ae4bf8..3d27579 100644 --- a/base_cpp/test/thread_test.h +++ b/base_cpp/test/thread_test.h @@ -43,8 +43,7 @@ class ThreadTest : public partest::TestCase { /** * Adds test methods. */ - explicit ThreadTest(); /**< - number of threads concurrently running test methods */ + ThreadTest(); private: /** diff --git a/dataflow_cpp/include/embb/dataflow/internal/inputs.h b/dataflow_cpp/include/embb/dataflow/internal/inputs.h index a118a1a..afcb011 100644 --- a/dataflow_cpp/include/embb/dataflow/internal/inputs.h +++ b/dataflow_cpp/include/embb/dataflow/internal/inputs.h @@ -87,9 +87,10 @@ class InputsOnClock(clock); @@ -132,9 +133,10 @@ class InputsOnClock(clock); @@ -181,10 +183,11 @@ class InputsOnClock(clock); } @@ -233,9 +236,10 @@ class Inputs } virtual void OnClock(int clock) { const int idx = clock % Slices; - if (count_[idx] == 0) + if (count_[idx] == 0) { EMBB_THROW(embb::base::ErrorException, - "All inputs already fired for this clock.") + "All inputs already fired for this clock."); + } if (--count_[idx] == 0) { count_[idx] = 4; listener_->OnClock(clock); @@ -290,9 +294,10 @@ class Inputs } virtual void OnClock(int clock) { const int idx = clock % Slices; - if (count_[idx] == 0) + if (count_[idx] == 0) { EMBB_THROW(embb::base::ErrorException, - "All inputs already fired for this clock.") + "All inputs already fired for this clock."); + } if (--count_[idx] == 0) { count_[idx] = 5; listener_->OnClock(clock);