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

dedicate-project / beast / 981fd347-025e-489d-b66a-c1bd1b057f5f

pending completion
981fd347-025e-489d-b66a-c1bd1b057f5f

Pull #9

circleci

fairlight1337
Fixed a connection buffer size bug and added conn visualization
Pull Request #9: Adding pipeline applications

1225 of 1225 new or added lines in 24 files covered. (100.0%)

2854 of 3071 relevant lines covered (92.93%)

15664.12 hits per line

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

86.0
/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)
65✔
9
    : max_candidates_{max_candidates} {
65✔
10
  inputs_.resize(input_slots);
65✔
11
  outputs_.resize(output_slots);
65✔
12
}
65✔
13

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

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

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

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

30
  return item;
1,263✔
31
}
32

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

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

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

43
  return item;
63✔
44
}
45

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

50
uint32_t Pipe::getOutputSlotAmount(uint32_t slot_index) const {
16✔
51
  return static_cast<uint32_t>(outputs_[slot_index].size());
16✔
52
}
53

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

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

76
void Pipe::storeOutput(uint32_t slot_index, const OutputItem& output) {
×
77
  if (slot_index >= outputs_.size()) {
×
78
    throw std::invalid_argument("Slot index for output too large");
×
79
  }
80
  outputs_[slot_index].push_back(output);
×
81
}
×
82

83
void Pipe::storeOutput(uint32_t slot_index, OutputItem&& output) {
88✔
84
  if (slot_index >= outputs_.size()) {
88✔
85
    throw std::invalid_argument("Slot index for output too large");
×
86
  }
87
  outputs_[slot_index].push_back(std::move(output));
88✔
88
}
88✔
89

90
} // 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