Skip to content

Commit 4b1b508

Browse files
tstennercboulay
authored andcommitted
Remove forward declarations
1 parent b434960 commit 4b1b508

File tree

5 files changed

+13
-14
lines changed

5 files changed

+13
-14
lines changed

src/forward.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ class portable_iarchive;
2424

2525
namespace lsl {
2626
/// shared pointers to various classes
27-
using consumer_queue_p = std::shared_ptr<class consumer_queue>;
2827
using factory_p = std::shared_ptr<class factory>;
29-
using resolve_attempt_udp_p = std::shared_ptr<class resolve_attempt_udp>;
3028
using sample_p = lslboost::intrusive_ptr<class sample>;
3129
using send_buffer_p = std::shared_ptr<class send_buffer>;
3230
using stream_info_impl_p = std::shared_ptr<class stream_info_impl>;

src/resolver_impl.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,12 @@ void resolver_impl::next_resolve_wave() {
186186

187187
void resolver_impl::udp_multicast_burst() {
188188
// start one per IP stack under consideration
189-
for (std::size_t k = 0, failures = 0; k < udp_protocols_.size(); k++) {
189+
int failures = 0;
190+
for (auto protocol: udp_protocols_) {
190191
try {
191-
resolve_attempt_udp_p attempt(
192-
std::make_shared<resolve_attempt_udp>(*io_, udp_protocols_[k], mcast_endpoints_,
193-
query_, results_, results_mut_, cfg_->multicast_max_rtt(), this));
194-
attempt->begin();
192+
std::make_shared<resolve_attempt_udp>(*io_, protocol, mcast_endpoints_, query_,
193+
results_, results_mut_, cfg_->multicast_max_rtt(), this)
194+
->begin();
195195
} catch (std::exception &e) {
196196
if (++failures == udp_protocols_.size())
197197
LOG_F(ERROR,
@@ -205,12 +205,13 @@ void resolver_impl::udp_multicast_burst() {
205205
void resolver_impl::udp_unicast_burst(error_code err) {
206206
if (err == error::operation_aborted) return;
207207

208+
int failures = 0;
208209
// start one per IP stack under consideration
209-
for (std::size_t k = 0, failures = 0; k < udp_protocols_.size(); k++) {
210+
for (auto protocol: udp_protocols_) {
210211
try {
211-
resolve_attempt_udp_p attempt(new resolve_attempt_udp(*io_, udp_protocols_[k],
212-
ucast_endpoints_, query_, results_, results_mut_, cfg_->unicast_max_rtt(), this));
213-
attempt->begin();
212+
std::make_shared<resolve_attempt_udp>(*io_, protocol, ucast_endpoints_, query_,
213+
results_, results_mut_, cfg_->unicast_max_rtt(), this)
214+
->begin();
214215
} catch (std::exception &e) {
215216
if (++failures == udp_protocols_.size())
216217
LOG_F(WARNING,

src/send_buffer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ using namespace lsl;
1414
*the send_buffer (so this is a global limit).
1515
* @return Shared pointer to the newly created queue.
1616
*/
17-
consumer_queue_p send_buffer::new_consumer(int max_buffered) {
17+
std::shared_ptr<consumer_queue> send_buffer::new_consumer(int max_buffered) {
1818
max_buffered = max_buffered ? std::min(max_buffered, max_capacity_) : max_capacity_;
1919
return std::make_shared<consumer_queue>(max_buffered, shared_from_this());
2020
}

src/send_buffer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class send_buffer : public std::enable_shared_from_this<send_buffer> {
4040
* of the send_buffer (so this is a global limit).
4141
* @return Shared pointer to the newly created consumer.
4242
*/
43-
consumer_queue_p new_consumer(int max_buffered = 0);
43+
std::shared_ptr<consumer_queue> new_consumer(int max_buffered = 0);
4444

4545
/// Push a sample onto the send buffer that will subsequently be received by all consumers.
4646
void push_sample(const sample_p &s);

src/tcp_server.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ void client_session::transfer_samples_thread(std::shared_ptr<client_session>) {
507507
if (max_buffered_ <= 0) return;
508508
try {
509509
// make a new consumer queue
510-
consumer_queue_p queue = serv_->send_buffer_->new_consumer(max_buffered_);
510+
auto queue = serv_->send_buffer_->new_consumer(max_buffered_);
511511
// the sequence # is merely used to determine chunk boundaries (no need for int64)
512512
uint32_t seqn = 0;
513513
while (!serv_->shutdown_) {

0 commit comments

Comments
 (0)