• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dedicate-project / beast / 5908912e-2396-46c2-b03d-62e16fdb292e

pending completion
5908912e-2396-46c2-b03d-62e16fdb292e

Pull #9

circleci

fairlight1337
Added [[nodiscard]] attributes and fixed code smells
Pull Request #9: Adding pipeline applications

1195 of 1195 new or added lines in 21 files covered. (100.0%)

2835 of 3040 relevant lines covered (93.26%)

16628.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

97.44
/src/pipe.cpp
1
#include <beast/pipe.hpp>
2

3
// Standard
4
#include <stdexcept>
5

6
namespace beast {
7

8
Pipe::Pipe(uint32_t max_candidates, uint32_t input_slots, uint32_t output_slots)
56✔
9
    : max_candidates_{max_candidates} {
56✔
10
  inputs_.resize(input_slots);
56✔
11
  outputs_.resize(output_slots);
56✔
12
}
56✔
13

14
void Pipe::addInput(uint32_t slot_index, const std::vector<unsigned char>& candidate) {
842✔
15
  inputs_[slot_index].push_back(candidate);
842✔
16
}
842✔
17

18
bool Pipe::inputHasSpace(uint32_t slot_index) const {
811✔
19
  return inputs_[slot_index].size() < max_candidates_;
811✔
20
}
21

22
std::vector<unsigned char> Pipe::drawInput(uint32_t slot_index) {
814✔
23
  if (inputs_[slot_index].empty()) {
814✔
24
    throw std::underflow_error("No input candidates available to draw.");
1✔
25
  }
26

27
  std::vector<unsigned char> item = inputs_[slot_index].front();
813✔
28
  inputs_[slot_index].pop_front();
813✔
29

30
  return item;
813✔
31
}
32

33
bool Pipe::hasOutput(uint32_t slot_index) const { return !outputs_[slot_index].empty(); }
93✔
34

35
Pipe::OutputItem Pipe::drawOutput(uint32_t slot_index) {
78✔
36
  if (outputs_[slot_index].empty()) {
78✔
37
    throw std::underflow_error("No output candidates available to draw.");
1✔
38
  }
39

40
  OutputItem item = outputs_[slot_index].front();
77✔
41
  outputs_[slot_index].pop_front();
77✔
42

43
  return item;
77✔
44
}
45

46
uint32_t Pipe::getInputSlotAmount(uint32_t slot_index) const { return inputs_[slot_index].size(); }
12✔
47

48
uint32_t Pipe::getOutputSlotAmount(uint32_t slot_index) const {
5✔
49
  return outputs_[slot_index].size();
5✔
50
}
51

52
bool Pipe::inputsAreSaturated() const {
2✔
53
  for (uint32_t idx = 0; idx < getInputSlotCount(); ++idx) {
3✔
54
    if (getInputSlotAmount(idx) < max_candidates_) {
2✔
55
      return false;
1✔
56
    }
57
  }
58
  return true;
1✔
59
}
60

61
bool Pipe::outputsAreSaturated() const {
2✔
62
  const uint32_t outputSlotCount = getOutputSlotCount();
2✔
63
  if (outputSlotCount == 0) {
2✔
64
    return false;
×
65
  }
66
  for (uint32_t idx = 0; idx < outputSlotCount; ++idx) {
3✔
67
    if (getOutputSlotAmount(idx) < max_candidates_) {
2✔
68
      return false;
1✔
69
    }
70
  }
71
  return true;
1✔
72
}
73

74
} // namespace beast
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc