| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "zhurin_i_ring_topology/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <chrono> | ||
| 4 | #include <cstdint> | ||
| 5 | #include <cstdlib> | ||
| 6 | #include <thread> | ||
| 7 | #include <vector> | ||
| 8 | |||
| 9 | #include "zhurin_i_ring_topology/common/include/common.hpp" | ||
| 10 | |||
| 11 | namespace zhurin_i_ring_topology { | ||
| 12 | |||
| 13 |
1/2✓ Branch 1 taken 224 times.
✗ Branch 2 not taken.
|
224 | ZhurinIRingTopologySEQ::ZhurinIRingTopologySEQ(const InType &in) { |
| 14 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 15 | GetInput() = in; | ||
| 16 | GetOutput().clear(); | ||
| 17 | 224 | } | |
| 18 | |||
| 19 | 224 | bool ZhurinIRingTopologySEQ::ValidationImpl() { | |
| 20 | const auto &input = GetInput(); | ||
| 21 |
2/4✓ Branch 0 taken 224 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 224 times.
|
224 | return input.source >= 0 && input.dest >= 0; |
| 22 | } | ||
| 23 | |||
| 24 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 224 times.
|
224 | bool ZhurinIRingTopologySEQ::PreProcessingImpl() { |
| 25 | GetOutput().clear(); | ||
| 26 | 224 | return true; | |
| 27 | } | ||
| 28 | |||
| 29 | 224 | bool ZhurinIRingTopologySEQ::RunImpl() { | |
| 30 | const auto &input = GetInput(); | ||
| 31 | 224 | GetOutput() = input.data; | |
| 32 | |||
| 33 |
2/2✓ Branch 0 taken 168 times.
✓ Branch 1 taken 56 times.
|
224 | if (input.source != input.dest) { |
| 34 | 168 | int distance = std::abs(input.dest - input.source); | |
| 35 | 168 | std::chrono::microseconds delay(static_cast<int64_t>(distance)); | |
| 36 | 168 | std::this_thread::sleep_for(delay); | |
| 37 | } | ||
| 38 | |||
| 39 | 224 | return true; | |
| 40 | } | ||
| 41 | |||
| 42 | 224 | bool ZhurinIRingTopologySEQ::PostProcessingImpl() { | |
| 43 | 224 | return true; | |
| 44 | } | ||
| 45 | |||
| 46 | } // namespace zhurin_i_ring_topology | ||
| 47 |