Commit 40f92327 by Tobias Fuchs

Fixed warnings returned from recent version of cpplint

parent 77016ad7
...@@ -46,8 +46,7 @@ class ValueComparisonFunction{ ...@@ -46,8 +46,7 @@ class ValueComparisonFunction{
int operator()(ElementType element) { int operator()(ElementType element) {
if (element == value_) { if (element == value_) {
return 1; return 1;
} } else {
else {
return 0; return 0;
} }
} }
...@@ -69,8 +68,7 @@ class FunctionComparisonFunction{ ...@@ -69,8 +68,7 @@ class FunctionComparisonFunction{
int operator()(ElementType element) { int operator()(ElementType element) {
if (function_(element)) { if (function_(element)) {
return 1; return 1;
} } else {
else {
return 0; return 0;
} }
} }
......
...@@ -41,14 +41,12 @@ namespace internal { ...@@ -41,14 +41,12 @@ namespace internal {
template<typename RAI, typename Function> template<typename RAI, typename Function>
class ForEachFunctor { class ForEachFunctor {
private:
typedef ForEachFunctor<RAI, Function> self_t;
public: public:
/** /**
* Constructs a for-each functor with arguments. * Constructs a for-each functor with arguments.
*/ */
ForEachFunctor(size_t chunk_first, size_t chunk_last, Function unary, ForEachFunctor(size_t chunk_first, size_t chunk_last, Function unary,
const embb::mtapi::ExecutionPolicy& policy, const embb::mtapi::ExecutionPolicy& policy,
const BlockSizePartitioner<RAI>& partitioner) const BlockSizePartitioner<RAI>& partitioner)
: chunk_first_(chunk_first), chunk_last_(chunk_last), : chunk_first_(chunk_first), chunk_last_(chunk_last),
unary_(unary), policy_(policy), partitioner_(partitioner) { unary_(unary), policy_(policy), partitioner_(partitioner) {
...@@ -63,15 +61,14 @@ class ForEachFunctor { ...@@ -63,15 +61,14 @@ class ForEachFunctor {
for (RAI it = first; it != last; ++it) { for (RAI it = first; it != last; ++it) {
unary_(*it); unary_(*it);
} }
} } else {
else {
// Recurse further: // Recurse further:
size_t chunk_split_index = (chunk_first_ + chunk_last_) / 2; size_t chunk_split_index = (chunk_first_ + chunk_last_) / 2;
// Split chunks into left / right branches: // Split chunks into left / right branches:
self_t functor_l(chunk_first_, self_t functor_l(chunk_first_,
chunk_split_index, chunk_split_index,
unary_, policy_, partitioner_); unary_, policy_, partitioner_);
self_t functor_r(chunk_split_index + 1, self_t functor_r(chunk_split_index + 1,
chunk_last_, chunk_last_,
unary_, policy_, partitioner_); unary_, policy_, partitioner_);
mtapi::Task task_l = mtapi::Node::GetInstance().Spawn( mtapi::Task task_l = mtapi::Node::GetInstance().Spawn(
...@@ -88,6 +85,9 @@ class ForEachFunctor { ...@@ -88,6 +85,9 @@ class ForEachFunctor {
} }
private: private:
typedef ForEachFunctor<RAI, Function> self_t;
private:
size_t chunk_first_; size_t chunk_first_;
size_t chunk_last_; size_t chunk_last_;
Function unary_; Function unary_;
...@@ -123,8 +123,8 @@ void ForEachRecursive(RAI first, RAI last, Function unary, ...@@ -123,8 +123,8 @@ void ForEachRecursive(RAI first, RAI last, Function unary,
} }
BlockSizePartitioner<RAI> partitioner(first, last, block_size); BlockSizePartitioner<RAI> partitioner(first, last, block_size);
ForEachFunctor<RAI, Function> functor(0, ForEachFunctor<RAI, Function> functor(0,
partitioner.Size() - 1, partitioner.Size() - 1,
unary, policy, partitioner); unary, policy, partitioner);
mtapi::Task task = node.Spawn(mtapi::Action( mtapi::Task task = node.Spawn(mtapi::Action(
base::MakeFunction(functor, base::MakeFunction(functor,
......
...@@ -171,7 +171,7 @@ void MergeSort( ...@@ -171,7 +171,7 @@ void MergeSort(
assert(distance >= 0); assert(distance >= 0);
if (block_size == 0) { if (block_size == 0) {
block_size= (static_cast<size_t>(distance) / node.GetCoreCount()); block_size = (static_cast<size_t>(distance) / node.GetCoreCount());
if (block_size == 0) if (block_size == 0)
block_size = 1; block_size = 1;
} }
......
...@@ -195,7 +195,7 @@ void QuickSort(RAI first, RAI last, ComparisonFunction comparison, ...@@ -195,7 +195,7 @@ void QuickSort(RAI first, RAI last, ComparisonFunction comparison,
typename std::iterator_traits<RAI>::difference_type distance = last - first; typename std::iterator_traits<RAI>::difference_type distance = last - first;
assert(distance > 0); assert(distance > 0);
if (block_size == 0) { if (block_size == 0) {
block_size= (static_cast<size_t>(distance) / node.GetCoreCount()); block_size = (static_cast<size_t>(distance) / node.GetCoreCount());
if (block_size == 0) if (block_size == 0)
block_size = 1; block_size = 1;
} }
......
...@@ -41,10 +41,6 @@ namespace internal { ...@@ -41,10 +41,6 @@ namespace internal {
template<typename RAI, typename ReturnType, typename ReductionFunction, template<typename RAI, typename ReturnType, typename ReductionFunction,
typename TransformationFunction> typename TransformationFunction>
class ReduceFunctor { class ReduceFunctor {
private:
typedef ReduceFunctor<RAI, ReturnType,
ReductionFunction,
TransformationFunction> self_t;
public: public:
ReduceFunctor(size_t chunk_first, size_t chunk_last, ReduceFunctor(size_t chunk_first, size_t chunk_last,
ReturnType neutral, ReturnType neutral,
...@@ -53,7 +49,7 @@ class ReduceFunctor { ...@@ -53,7 +49,7 @@ class ReduceFunctor {
const embb::mtapi::ExecutionPolicy& policy, const embb::mtapi::ExecutionPolicy& policy,
const BlockSizePartitioner<RAI>& partitioner, const BlockSizePartitioner<RAI>& partitioner,
ReturnType& result) 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), reduction_(reduction), transformation_(transformation), policy_(policy),
partitioner_(partitioner), result_(result) { partitioner_(partitioner), result_(result) {
} }
...@@ -69,8 +65,7 @@ class ReduceFunctor { ...@@ -69,8 +65,7 @@ class ReduceFunctor {
result = reduction_(result, transformation_(*it)); result = reduction_(result, transformation_(*it));
} }
result_ = result; result_ = result;
} } else {
else {
// Recurse further: // Recurse further:
size_t chunk_split_index = (chunk_first_ + chunk_last_) / 2; size_t chunk_split_index = (chunk_first_ + chunk_last_) / 2;
// Split chunks into left / right branches: // Split chunks into left / right branches:
...@@ -94,7 +89,7 @@ class ReduceFunctor { ...@@ -94,7 +89,7 @@ class ReduceFunctor {
mtapi::Task task_r = mtapi::Node::GetInstance().Spawn( mtapi::Task task_r = mtapi::Node::GetInstance().Spawn(
mtapi::Action( mtapi::Action(
base::MakeFunction( base::MakeFunction(
functor_r, &self_t::Action), functor_r, &self_t::Action),
policy_)); policy_));
task_l.Wait(MTAPI_INFINITE); task_l.Wait(MTAPI_INFINITE);
task_r.Wait(MTAPI_INFINITE); task_r.Wait(MTAPI_INFINITE);
...@@ -103,6 +98,11 @@ class ReduceFunctor { ...@@ -103,6 +98,11 @@ class ReduceFunctor {
} }
private: private:
typedef ReduceFunctor<RAI, ReturnType,
ReductionFunction,
TransformationFunction> self_t;
private:
size_t chunk_first_; size_t chunk_first_;
size_t chunk_last_; size_t chunk_last_;
ReturnType neutral_; ReturnType neutral_;
...@@ -145,17 +145,16 @@ ReturnType ReduceRecursive(RAI first, RAI last, ReturnType neutral, ...@@ -145,17 +145,16 @@ ReturnType ReduceRecursive(RAI first, RAI last, ReturnType neutral,
"Number of computation tasks required in reduction would " "Number of computation tasks required in reduction would "
"exceed MTAPI maximum number of tasks"); "exceed MTAPI maximum number of tasks");
} }
typedef ReduceFunctor<RAI, ReturnType, ReductionFunction, typedef ReduceFunctor<RAI, ReturnType, ReductionFunction,
TransformationFunction> Functor; TransformationFunction> Functor;
BlockSizePartitioner<RAI> partitioner(first, last, block_size); BlockSizePartitioner<RAI> partitioner(first, last, block_size);
ReturnType result = neutral; ReturnType result = neutral;
Functor functor(0, Functor functor(0,
partitioner.Size() - 1, partitioner.Size() - 1,
neutral, neutral,
reduction, transformation, reduction, transformation,
policy, policy,
partitioner, partitioner,
result); result);
mtapi::Task task = node.Spawn( mtapi::Task task = node.Spawn(
mtapi::Action(base::MakeFunction( mtapi::Action(base::MakeFunction(
......
...@@ -45,7 +45,7 @@ class ScanFunctor { ...@@ -45,7 +45,7 @@ class ScanFunctor {
ReturnType neutral, ScanFunction scan, ReturnType neutral, ScanFunction scan,
TransformationFunction transformation, TransformationFunction transformation,
const embb::mtapi::ExecutionPolicy& policy, const embb::mtapi::ExecutionPolicy& policy,
const BlockSizePartitioner<RAIIn>& partitioner, const BlockSizePartitioner<RAIIn>& partitioner,
ReturnType* tree_values, size_t node_id, ReturnType* tree_values, size_t node_id,
bool going_down) bool going_down)
: policy_(policy), chunk_first_(chunk_first), chunk_last_(chunk_last), : policy_(policy), chunk_first_(chunk_first), chunk_last_(chunk_last),
...@@ -72,15 +72,13 @@ class ScanFunctor { ...@@ -72,15 +72,13 @@ class ScanFunctor {
*iter_out = result; *iter_out = result;
} }
SetTreeValue(result); SetTreeValue(result);
} } else {
else {
// Second pass // Second pass
for (; iter_in != last_in; ++iter_in, ++iter_out) { for (; iter_in != last_in; ++iter_in, ++iter_out) {
*iter_out = scan_(parent_value_, *iter_out); *iter_out = scan_(parent_value_, *iter_out);
} }
} }
} } else {
else {
// recurse further // recurse further
size_t chunk_split_index = (chunk_first_ + chunk_last_) / 2; size_t chunk_split_index = (chunk_first_ + chunk_last_) / 2;
// Split chunks into left / right branches: // Split chunks into left / right branches:
...@@ -99,14 +97,14 @@ class ScanFunctor { ...@@ -99,14 +97,14 @@ class ScanFunctor {
// Advance output iterator of right branch: // Advance output iterator of right branch:
ChunkDescriptor<RAIIn> chunk_left = partitioner_[chunk_first_]; ChunkDescriptor<RAIIn> chunk_left = partitioner_[chunk_first_];
ChunkDescriptor<RAIIn> chunk_right = partitioner_[chunk_split_index + 1]; ChunkDescriptor<RAIIn> chunk_right = partitioner_[chunk_split_index + 1];
long long dist = std::distance(chunk_left.GetFirst(), chunk_right.GetFirst()); std::advance(functor_r.output_iterator_,
std::advance(functor_r.output_iterator_, dist); std::distance(chunk_left.GetFirst(), chunk_right.GetFirst()));
if (!is_first_pass_) { if (!is_first_pass_) {
functor_l.parent_value_ = parent_value_; functor_l.parent_value_ = parent_value_;
functor_r.parent_value_ = functor_l.GetTreeValue() + parent_value_; functor_r.parent_value_ = functor_l.GetTreeValue() + parent_value_;
} }
// Spawn tasks to recurse: // Spawn tasks to recurse:
mtapi::Node& node = mtapi::Node::GetInstance(); mtapi::Node& node = mtapi::Node::GetInstance();
mtapi::Task task_l = node.Spawn( mtapi::Task task_l = node.Spawn(
mtapi::Action( mtapi::Action(
base::MakeFunction(functor_l, &ScanFunctor::Action), base::MakeFunction(functor_l, &ScanFunctor::Action),
...@@ -149,8 +147,7 @@ class ScanFunctor { ...@@ -149,8 +147,7 @@ class ScanFunctor {
void SetID(int branch) { void SetID(int branch) {
if (branch == LEFT) { if (branch == LEFT) {
node_id_ = 2 * node_id_ + 1; node_id_ = 2 * node_id_ + 1;
} } else if (branch == RIGHT) {
else if (branch == RIGHT) {
node_id_ = 2 * node_id_ + 2; node_id_ = 2 * node_id_ + 2;
} }
} }
...@@ -198,9 +195,9 @@ void ScanIteratorCheck(RAIIn first, RAIIn last, RAIOut output_iterator, ...@@ -198,9 +195,9 @@ void ScanIteratorCheck(RAIIn first, RAIIn last, RAIOut output_iterator,
TransformationFunction> Functor; TransformationFunction> Functor;
BlockSizePartitioner<RAIIn> partitioner_down(first, last, block_size); BlockSizePartitioner<RAIIn> partitioner_down(first, last, block_size);
Functor functor_down(0, partitioner_down.Size() - 1, output_iterator, neutral, Functor functor_down(0, partitioner_down.Size() - 1, output_iterator,
scan, transformation, policy, partitioner_down, values, 0, neutral, scan, transformation, policy, partitioner_down,
true); values, 0, true);
mtapi::Task task_down = node.Spawn(mtapi::Action(base::MakeFunction( mtapi::Task task_down = node.Spawn(mtapi::Action(base::MakeFunction(
functor_down, &Functor::Action), functor_down, &Functor::Action),
policy)); policy));
...@@ -208,9 +205,9 @@ void ScanIteratorCheck(RAIIn first, RAIIn last, RAIOut output_iterator, ...@@ -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 // Second pass. Gives to each leaf the part of the prefix missing
BlockSizePartitioner<RAIIn> partitioner_up(first, last, block_size); BlockSizePartitioner<RAIIn> partitioner_up(first, last, block_size);
Functor functor_up(0, partitioner_up.Size() - 1, output_iterator, neutral, Functor functor_up(0, partitioner_up.Size() - 1, output_iterator,
scan, transformation, policy, partitioner_up, values, 0, neutral, scan, transformation, policy, partitioner_up,
false); values, 0, false);
mtapi::Task task_up = node.Spawn(mtapi::Action(base::MakeFunction( mtapi::Task task_up = node.Spawn(mtapi::Action(base::MakeFunction(
functor_up, &Functor::Action), functor_up, &Functor::Action),
policy)); policy));
......
...@@ -59,8 +59,8 @@ CountTest::CountTest() { ...@@ -59,8 +59,8 @@ CountTest::CountTest() {
void CountTest::TestDataStructures() { void CountTest::TestDataStructures() {
using embb::algorithms::Count; using embb::algorithms::Count;
const int size =10; const int size = 10;
int array[] = {10, 20, 30, 30, 20, 10, 10, 20, 20, 20}; int array[] = { 10, 20, 30, 30, 20, 10, 10, 20, 20, 20 };
std::vector<int> vector(array, array + size); std::vector<int> vector(array, array + size);
std::deque<int> deque(array, array + size); std::deque<int> deque(array, array + size);
const std::vector<int> const_vector(array, array + size); const std::vector<int> const_vector(array, array + size);
...@@ -73,8 +73,8 @@ void CountTest::TestDataStructures() { ...@@ -73,8 +73,8 @@ void CountTest::TestDataStructures() {
void CountTest::TestCountIf() { void CountTest::TestCountIf() {
using embb::algorithms::CountIf; using embb::algorithms::CountIf;
const int size =10; const int size = 10;
int array[] = {10, 21, 30, 31, 20, 11, 10, 21, 20, 20}; 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, IsEven()), 6);
PT_EXPECT_EQ(CountIf(array, array + size, &IsEvenFunction), 6); PT_EXPECT_EQ(CountIf(array, array + size, &IsEvenFunction), 6);
} }
......
...@@ -105,4 +105,4 @@ typedef pthread_cond_t embb_condition_t; ...@@ -105,4 +105,4 @@ typedef pthread_cond_t embb_condition_t;
} /* Close extern "C" { */ } /* Close extern "C" { */
#endif #endif
#endif /* EMBB_BASE_C_INTERNAL_PLATFORM_H_ */ #endif // EMBB_BASE_C_INTERNAL_PLATFORM_H_
...@@ -81,4 +81,4 @@ class AllocTest : public partest::TestCase { ...@@ -81,4 +81,4 @@ class AllocTest : public partest::TestCase {
} // namespace base } // namespace base
} // namespace embb } // namespace embb
#endif /* BASE_C_TEST_ALLOC_TEST_H_ */ #endif // BASE_C_TEST_ALLOC_TEST_H_
...@@ -65,4 +65,4 @@ class ConditionVarTest : public partest::TestCase { ...@@ -65,4 +65,4 @@ class ConditionVarTest : public partest::TestCase {
} // namespace base } // namespace base
} // namespace embb } // namespace embb
#endif /* BASE_C_TEST_CONDITION_VAR_TEST_H_ */ #endif // BASE_C_TEST_CONDITION_VAR_TEST_H_
...@@ -51,4 +51,4 @@ class CoreSetTest : public partest::TestCase { ...@@ -51,4 +51,4 @@ class CoreSetTest : public partest::TestCase {
} // namespace base } // namespace base
} // namespace embb } // namespace embb
#endif /* BASE_C_TEST_CORE_SET_TEST_H_ */ #endif // BASE_C_TEST_CORE_SET_TEST_H_
...@@ -97,4 +97,4 @@ class CounterTest : public partest::TestCase { ...@@ -97,4 +97,4 @@ class CounterTest : public partest::TestCase {
} // namespace base } // namespace base
} // namespace embb } // namespace embb
#endif /* BASE_C_TEST_COUNTER_TEST_H_ */ #endif // BASE_C_TEST_COUNTER_TEST_H_
...@@ -73,4 +73,4 @@ class DurationTest : public partest::TestCase { ...@@ -73,4 +73,4 @@ class DurationTest : public partest::TestCase {
} // namespace base } // namespace base
} // namespace embb } // namespace embb
#endif /* BASE_C_TEST_DURATION_TEST_H_ */ #endif // BASE_C_TEST_DURATION_TEST_H_
...@@ -78,4 +78,4 @@ int ThreadStart(void* arg); ...@@ -78,4 +78,4 @@ int ThreadStart(void* arg);
#endif /* BASE_C_TEST_THREAD_INDEX_TEST_H_ */ #endif // BASE_C_TEST_THREAD_INDEX_TEST_H_
...@@ -61,4 +61,4 @@ class ThreadSpecificStorageTest : public partest::TestCase { ...@@ -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_
...@@ -66,4 +66,4 @@ int ThreadStartFunction(void* arg); ...@@ -66,4 +66,4 @@ int ThreadStartFunction(void* arg);
} // namespace base } // namespace base
} // namespace embb } // namespace embb
#endif /* BASE_C_TEST_THREAD_TEST_H_ */ #endif // BASE_C_TEST_THREAD_TEST_H_
...@@ -53,4 +53,4 @@ class TimeTest : public partest::TestCase { ...@@ -53,4 +53,4 @@ class TimeTest : public partest::TestCase {
#endif /* BASE_C_TEST_TIME_TEST_H_ */ #endif // BASE_C_TEST_TIME_TEST_H_
...@@ -201,4 +201,4 @@ class CoreSet { ...@@ -201,4 +201,4 @@ class CoreSet {
#endif /* EMBB_BASE_CORE_SET_H_ */ #endif // EMBB_BASE_CORE_SET_H_
...@@ -522,4 +522,4 @@ class Nanoseconds : public Tick { ...@@ -522,4 +522,4 @@ class Nanoseconds : public Tick {
#include <embb/base/internal/duration-inl.h> #include <embb/base/internal/duration-inl.h>
#endif /* EMBB_BASE_DURATION_H_ */ #endif // EMBB_BASE_DURATION_H_
...@@ -276,4 +276,4 @@ class ErrorException : public Exception { ...@@ -276,4 +276,4 @@ class ErrorException : public Exception {
} // namespace base } // namespace base
} // namespace embb } // namespace embb
#endif /* EMBB_BASE_EXCEPTIONS_H_ */ #endif // EMBB_BASE_EXCEPTIONS_H_
...@@ -112,4 +112,4 @@ Duration<Tick>::Duration(const embb_duration_t& duration) : rep_() { ...@@ -112,4 +112,4 @@ Duration<Tick>::Duration(const embb_duration_t& duration) : rep_() {
} // namespace base } // namespace base
} // namespace embb } // namespace embb
#endif /* EMBB_BASE_INTERNAL_DURATION_INL_H_ */ #endif // EMBB_BASE_INTERNAL_DURATION_INL_H_
...@@ -116,4 +116,4 @@ bool UniqueLock<Mutex>::OwnsLock() const { ...@@ -116,4 +116,4 @@ bool UniqueLock<Mutex>::OwnsLock() const {
} // namespace base } // namespace base
} // namespace embb } // namespace embb
#endif /* EMBB_BASE_INTERNAL_MUTEX_INL_H_ */ #endif // EMBB_BASE_INTERNAL_MUTEX_INL_H_
...@@ -107,4 +107,4 @@ std::basic_ostream<CharT, Traits>& ...@@ -107,4 +107,4 @@ std::basic_ostream<CharT, Traits>&
} // namespace base } // namespace base
} // namespace embb } // namespace embb
#endif /* EMBB_BASE_INTERNAL_THREAD_INL_H_ */ #endif // EMBB_BASE_INTERNAL_THREAD_INL_H_
...@@ -103,4 +103,4 @@ struct ThreadClosureArg2 { ...@@ -103,4 +103,4 @@ struct ThreadClosureArg2 {
} // namespace base } // namespace base
} // namespace embb } // namespace embb
#endif /* EMBB_BASE_INTERNAL_THREAD_CLOSURES_H_ */ #endif // EMBB_BASE_INTERNAL_THREAD_CLOSURES_H_
...@@ -149,4 +149,4 @@ void ThreadSpecificStorage<Type>::Prepare() { ...@@ -149,4 +149,4 @@ void ThreadSpecificStorage<Type>::Prepare() {
} // namespace base } // namespace base
} // namespace embb } // namespace embb
#endif /* EMBB_BASE_INTERNAL_THREAD_SPECIFIC_STORAGE_INL_H_ */ #endif // EMBB_BASE_INTERNAL_THREAD_SPECIFIC_STORAGE_INL_H_
...@@ -35,10 +35,10 @@ namespace embb { ...@@ -35,10 +35,10 @@ namespace embb {
namespace base { namespace base {
namespace test { namespace test {
/** /**
* Forward declaration for friending. * Forward declaration for friending.
*/ */
class ThreadSpecificStorageTest; class ThreadSpecificStorageTest;
} }
/** /**
...@@ -176,4 +176,4 @@ class ThreadSpecificStorage { ...@@ -176,4 +176,4 @@ class ThreadSpecificStorage {
#include <embb/base/internal/thread_specific_storage-inl.h> #include <embb/base/internal/thread_specific_storage-inl.h>
#endif /* EMBB_BASE_THREAD_SPECIFIC_STORAGE_H_ */ #endif // EMBB_BASE_THREAD_SPECIFIC_STORAGE_H_
...@@ -78,4 +78,4 @@ class Time { ...@@ -78,4 +78,4 @@ class Time {
} // namespace base } // namespace base
} // namespace embb } // namespace embb
#endif /* EMBB_BASE_TIME_H_ */ #endif // EMBB_BASE_TIME_H_
...@@ -42,7 +42,7 @@ class ThreadSpecificStorageTest : public partest::TestCase { ...@@ -42,7 +42,7 @@ class ThreadSpecificStorageTest : public partest::TestCase {
/** /**
* Adds test units. * Adds test units.
*/ */
explicit ThreadSpecificStorageTest(); ThreadSpecificStorageTest();
private: private:
/** /**
......
...@@ -43,8 +43,7 @@ class ThreadTest : public partest::TestCase { ...@@ -43,8 +43,7 @@ class ThreadTest : public partest::TestCase {
/** /**
* Adds test methods. * Adds test methods.
*/ */
explicit ThreadTest(); /**< ThreadTest();
number of threads concurrently running test methods */
private: private:
/** /**
......
...@@ -87,9 +87,10 @@ class Inputs<Slices, T1, embb::base::internal::Nil, embb::base::internal::Nil, ...@@ -87,9 +87,10 @@ class Inputs<Slices, T1, embb::base::internal::Nil, embb::base::internal::Nil,
} }
virtual void OnClock(int clock) { virtual void OnClock(int clock) {
const int idx = clock % Slices; const int idx = clock % Slices;
if (count_[idx] == 0) if (count_[idx] == 0) {
EMBB_THROW(embb::base::ErrorException, EMBB_THROW(embb::base::ErrorException,
"All inputs already fired for this clock.") "All inputs already fired for this clock.");
}
if (--count_[idx] == 0) { if (--count_[idx] == 0) {
count_[idx] = 1; count_[idx] = 1;
listener_->OnClock(clock); listener_->OnClock(clock);
...@@ -132,9 +133,10 @@ class Inputs<Slices, T1, T2, embb::base::internal::Nil, ...@@ -132,9 +133,10 @@ class Inputs<Slices, T1, T2, embb::base::internal::Nil,
} }
virtual void OnClock(int clock) { virtual void OnClock(int clock) {
const int idx = clock % Slices; const int idx = clock % Slices;
if (count_[idx] == 0) if (count_[idx] == 0) {
EMBB_THROW(embb::base::ErrorException, EMBB_THROW(embb::base::ErrorException,
"All inputs already fired for this clock.") "All inputs already fired for this clock.");
}
if (--count_[idx] == 0) { if (--count_[idx] == 0) {
count_[idx] = 2; count_[idx] = 2;
listener_->OnClock(clock); listener_->OnClock(clock);
...@@ -181,10 +183,11 @@ class Inputs<Slices, T1, T2, T3, embb::base::internal::Nil, ...@@ -181,10 +183,11 @@ class Inputs<Slices, T1, T2, T3, embb::base::internal::Nil,
} }
virtual void OnClock(int clock) { virtual void OnClock(int clock) {
const int idx = clock % Slices; const int idx = clock % Slices;
if (count_[idx] == 0) if (count_[idx] == 0) {
EMBB_THROW(embb::base::ErrorException, EMBB_THROW(embb::base::ErrorException,
"All inputs already fired for this clock.") "All inputs already fired for this clock.");
if (--count_[idx] == 0) { }
if (--count_[idx] == 0) {
count_[idx] = 3; count_[idx] = 3;
listener_->OnClock(clock); listener_->OnClock(clock);
} }
...@@ -233,9 +236,10 @@ class Inputs<Slices, T1, T2, T3, T4, embb::base::internal::Nil> ...@@ -233,9 +236,10 @@ class Inputs<Slices, T1, T2, T3, T4, embb::base::internal::Nil>
} }
virtual void OnClock(int clock) { virtual void OnClock(int clock) {
const int idx = clock % Slices; const int idx = clock % Slices;
if (count_[idx] == 0) if (count_[idx] == 0) {
EMBB_THROW(embb::base::ErrorException, EMBB_THROW(embb::base::ErrorException,
"All inputs already fired for this clock.") "All inputs already fired for this clock.");
}
if (--count_[idx] == 0) { if (--count_[idx] == 0) {
count_[idx] = 4; count_[idx] = 4;
listener_->OnClock(clock); listener_->OnClock(clock);
...@@ -290,9 +294,10 @@ class Inputs ...@@ -290,9 +294,10 @@ class Inputs
} }
virtual void OnClock(int clock) { virtual void OnClock(int clock) {
const int idx = clock % Slices; const int idx = clock % Slices;
if (count_[idx] == 0) if (count_[idx] == 0) {
EMBB_THROW(embb::base::ErrorException, EMBB_THROW(embb::base::ErrorException,
"All inputs already fired for this clock.") "All inputs already fired for this clock.");
}
if (--count_[idx] == 0) { if (--count_[idx] == 0) {
count_[idx] = 5; count_[idx] = 5;
listener_->OnClock(clock); listener_->OnClock(clock);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment