Commit f4dfa77f authored by Dominik Charousset's avatar Dominik Charousset

Adhere to coding conventions

parent 93f87bf4
......@@ -18,17 +18,17 @@
#pragma once
#include <mutex>
#include <utility>
#include <functional>
#include <mutex>
#include <unordered_map>
#include <utility>
#include "caf/fwd.hpp"
#include "caf/node_id.hpp"
#include "caf/actor_addr.hpp"
#include "caf/actor_cast.hpp"
#include "caf/actor_proxy.hpp"
#include "caf/exit_reason.hpp"
#include "caf/fwd.hpp"
#include "caf/node_id.hpp"
namespace caf {
......
......@@ -16,18 +16,18 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include <utility>
#include <algorithm>
#include <utility>
#include "caf/node_id.hpp"
#include "caf/actor_addr.hpp"
#include "caf/serializer.hpp"
#include "caf/actor_system.hpp"
#include "caf/deserializer.hpp"
#include "caf/node_id.hpp"
#include "caf/proxy_registry.hpp"
#include "caf/serializer.hpp"
#include "caf/logger.hpp"
#include "caf/actor_registry.hpp"
#include "caf/logger.hpp"
namespace caf {
......@@ -36,8 +36,7 @@ proxy_registry::backend::~backend() {
}
proxy_registry::proxy_registry(actor_system& sys, backend& be)
: system_(sys),
backend_(be) {
: system_(sys), backend_(be) {
// nop
}
......@@ -46,7 +45,7 @@ proxy_registry::~proxy_registry() {
}
size_t proxy_registry::count_proxies(const node_id& node) const {
std::unique_lock<std::mutex> guard {mtx_};
std::unique_lock<std::mutex> guard{mtx_};
auto i = proxies_.find(node);
return i != proxies_.end() ? i->second.size() : 0;
}
......@@ -69,7 +68,7 @@ strong_actor_ptr proxy_registry::get_or_put(const node_id& nid, actor_id aid) {
return result;
}
std::vector<strong_actor_ptr>
std::vector<strong_actor_ptr>
proxy_registry::get_all(const node_id& node) const {
// Reserve at least some memory outside of the critical section.
std::vector<strong_actor_ptr> result;
......
This diff is collapsed.
......@@ -454,9 +454,10 @@ bool instance::handle(execution_unit* ctx, connection_handle hdl, header& hdr,
if (dest_node == this_node_) {
// Delay this message to make sure we don't skip in-flight messages.
auto msg_id = queue_.new_id();
auto ptr = make_mailbox_element(
nullptr, make_message_id(), {}, delete_atom::value, source_node,
hdr.source_actor, std::move(fail_state));
auto ptr = make_mailbox_element(nullptr, make_message_id(), {},
delete_atom::value, source_node,
hdr.source_actor,
std::move(fail_state));
queue_.push(callee_.current_execution_unit(), msg_id,
callee_.this_actor(), std::move(ptr));
} else {
......
......@@ -58,9 +58,7 @@ void message_queue::push(execution_unit* ctx, uint64_t id,
return;
}
// Get the insertion point.
auto pred = [&](const actor_msg& x) {
return x.id >= id;
};
auto pred = [&](const actor_msg& x) { return x.id >= id; };
pending.emplace(std::find_if(first, last, pred),
actor_msg{id, std::move(receiver), std::move(content)});
}
......
......@@ -31,11 +31,11 @@ namespace basp {
// -- constructors, destructors, and assignment operators ----------------------
worker::worker(worker_hub& hub, message_queue& queue, proxy_registry& proxies)
: next_(nullptr),
hub_(&hub),
queue_(&queue),
proxies_(&proxies),
system_(&proxies.system()) {
: next_(nullptr),
hub_(&hub),
queue_(&queue),
proxies_(&proxies),
system_(&proxies.system()) {
CAF_IGNORE_UNUSED(pad_);
}
......
......@@ -31,11 +31,9 @@ using namespace caf;
namespace {
behavior testee_impl() {
return {
[](ok_atom, int) {
// nop
}
};
return {[](ok_atom, int) {
// nop
}};
}
struct fixture : test_coordinator_fixture<> {
......@@ -59,8 +57,7 @@ struct fixture : test_coordinator_fixture<> {
}
};
} // namespace <anonymous>
} // namespace
CAF_TEST_FIXTURE_SCOPE(message_queue_tests, fixture)
......@@ -77,7 +74,7 @@ CAF_TEST(ascending IDs) {
CAF_CHECK_EQUAL(queue.next_undelivered, 0u);
}
CAF_TEST(push order 0-1-2) {
CAF_TEST(push order 0 - 1 - 2) {
acquire_ids(3);
push(0);
expect((ok_atom, int), from(self).to(testee).with(_, 0));
......@@ -87,7 +84,7 @@ CAF_TEST(push order 0-1-2) {
expect((ok_atom, int), from(self).to(testee).with(_, 2));
}
CAF_TEST(push order 0-2-1) {
CAF_TEST(push order 0 - 2 - 1) {
acquire_ids(3);
push(0);
expect((ok_atom, int), from(self).to(testee).with(_, 0));
......@@ -98,7 +95,7 @@ CAF_TEST(push order 0-2-1) {
expect((ok_atom, int), from(self).to(testee).with(_, 2));
}
CAF_TEST(push order 1-0-2) {
CAF_TEST(push order 1 - 0 - 2) {
acquire_ids(3);
push(1);
disallow((ok_atom, int), from(self).to(testee));
......@@ -109,8 +106,7 @@ CAF_TEST(push order 1-0-2) {
expect((ok_atom, int), from(self).to(testee).with(_, 2));
}
CAF_TEST(push order 1-2-0) {
CAF_TEST(push order 1 - 2 - 0) {
acquire_ids(3);
push(1);
disallow((ok_atom, int), from(self).to(testee));
......@@ -122,7 +118,7 @@ CAF_TEST(push order 1-2-0) {
expect((ok_atom, int), from(self).to(testee).with(_, 2));
}
CAF_TEST(push order 2-0-1) {
CAF_TEST(push order 2 - 0 - 1) {
acquire_ids(3);
push(2);
disallow((ok_atom, int), from(self).to(testee));
......@@ -133,7 +129,7 @@ CAF_TEST(push order 2-0-1) {
expect((ok_atom, int), from(self).to(testee).with(_, 2));
}
CAF_TEST(push order 2-1-0) {
CAF_TEST(push order 2 - 1 - 0) {
acquire_ids(3);
push(2);
disallow((ok_atom, int), from(self).to(testee));
......
......@@ -36,11 +36,9 @@ using namespace caf;
namespace {
behavior testee_impl() {
return {
[](ok_atom) {
// nop
}
};
return {[](ok_atom) {
// nop
}};
}
class mock_actor_proxy : public actor_proxy {
......@@ -61,7 +59,7 @@ public:
class mock_proxy_registry_backend : public proxy_registry::backend {
public:
mock_proxy_registry_backend(actor_system& sys) : sys_(sys) {
//nop
// nop
}
strong_actor_ptr make_proxy(node_id nid, actor_id aid) override {
......@@ -86,9 +84,9 @@ struct fixture : test_coordinator_fixture<> {
actor testee;
fixture()
: proxies_backend(sys),
proxies(sys, proxies_backend),
last_hop(123, "0011223344556677889900112233445566778899") {
: proxies_backend(sys),
proxies(sys, proxies_backend),
last_hop(123, "0011223344556677889900112233445566778899") {
testee = sys.spawn<lazy_init>(testee_impl);
sys.registry().put(testee.id(), testee);
}
......@@ -98,7 +96,7 @@ struct fixture : test_coordinator_fixture<> {
}
};
} // namespace <anonymous>
} // namespace
CAF_TEST_FIXTURE_SCOPE(worker_tests, fixture)
......
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 to comment