A trivial example program.
A trivial example program.
#include "caf/actor_ostream.hpp"
#include "caf/actor_system.hpp"
#include "caf/caf_main.hpp"
#include "caf/event_based_actor.hpp"
#include <iostream>
#include <string>
return {
[=](const std::string& what) -> std::string {
aout(self) << what << std::endl;
return std::string{what.rbegin(), what.rend()};
},
};
}
self->request(buddy, std::chrono::seconds(10), "Hello World!")
.then(
[=](const std::string& what) {
aout(self) << what << std::endl;
});
}
auto mirror_actor = sys.
spawn(mirror);
sys.
spawn(hello_world, mirror_actor);
}
CAF_MAIN()
Actor environment including scheduler, registry, and optional components such as a middleman.
Definition actor_system.hpp:90
infer_handle_from_class_t< C > spawn(Ts &&... xs)
Returns a new actor of type C using xs... as constructor arguments.
Definition actor_system.hpp:395
Identifies an untyped actor.
Definition actor.hpp:29
Describes the behavior of an actor, i.e., provides a message handler and an optional timeout.
Definition behavior.hpp:25
A cooperatively scheduled, event-based actor implementation.
Definition event_based_actor.hpp:40
Root namespace of libcaf.
Definition abstract_actor.cpp:25