Skip to content

Commit

Permalink
retake work on fabko
Browse files Browse the repository at this point in the history
  • Loading branch information
FyS committed Mar 10, 2024
1 parent a3d5fa4 commit a0be09c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions fabko/agent/agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

namespace fabko {

constexpr std::size_t MAX_QUEUED_SIZE = 10;
static constexpr std::size_t MAX_QUEUED_SIZE = 10;

struct agent::impl {

Expand All @@ -29,8 +29,8 @@ agent::~agent() = default;

void agent_runner::run() {
_runner_thread.request_stop();
std::jthread([this](const std::stop_token& stoken) {
while (!stoken.stop_requested()) {
std::jthread([this](const std::stop_token& token) {
while (!token.stop_requested()) {
for (auto& agent : this->_agents) {
agent.execute();
}
Expand Down
6 changes: 6 additions & 0 deletions fabko/agent/agent.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ namespace acl {
struct message;
}

/**
* @brief agent
*/
class agent {
struct impl;

Expand All @@ -41,6 +44,9 @@ class agent {
std::function<std::vector<fabko::acl::message>(agent&, std::optional<fabko::acl::message>)> _callback_on_action;
};

/**
* @brief agent_runner
*/
class agent_runner {

public:
Expand Down
4 changes: 2 additions & 2 deletions fabko/agent/protocol/acl.hh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

namespace fabko::acl {

// ACL standard is followed in a binary format (and a backward compatibility should be following afterwards on the actual
// ACL standard is followed in a binary format (and a backward compatibility should be following afterward on the actual
// textual standard:
// reference to the standard used for the Agent Communication Language (ACL):
// http://www.fipa.org/specs/fipa00018/OC00018.pdf
Expand Down Expand Up @@ -177,7 +177,7 @@ struct message {
std::string s{};
for (std::uint8_t c : content) {
if (c >= 32 && c <= 126) {
s += static_cast<char>(c);
s += static_cast<char>(c);
}
else {
s += '.';
Expand Down

0 comments on commit a0be09c

Please sign in to comment.