-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9dcbee9
commit ff7c733
Showing
77 changed files
with
1,474 additions
and
1,335 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,63 @@ | ||
[![Build Status](https://travis-ci.org/smart-cloud/actor-zeta.svg?branch=master)](https://travis-ci.org/smart-cloud/actor-zeta) | ||
[![Build Status](https://travis-ci.org/jinntechio/actor-zeta.svg?branch=master)](https://travis-ci.org/jinntechio/actor-zeta) | ||
|
||
actor-zeta | ||
======================== | ||
|
||
actor-zeta is an open source C++11 virtual actor model implementation featuring lightweight & fast and more. | ||
|
||
The libraray uses a standard practice for its versioning: major.minor.patchlevel. example : 0.0.1 | ||
### Example | ||
|
||
This project is in a very early / experimental stage. | ||
```C++ | ||
|
||
#include <actor-zeta/core.hpp> | ||
|
||
using actor_zeta::context; | ||
using actor_zeta::basic_async_actor; | ||
|
||
|
||
class storage_t final : public basic_async_actor { | ||
public: | ||
storage_t() : basic_async_actor(nullptr, "storage") { | ||
add_handler( | ||
"update", | ||
[](context & /*ctx*/, query_t& query) -> void { | ||
|
||
} | ||
); | ||
|
||
add_handler( | ||
"find", | ||
[](context & /*ctx*/, query_t& query) -> void { | ||
} | ||
); | ||
|
||
add_handler( | ||
"remove", | ||
[](context & /*ctx*/, query_t& query) -> void { | ||
} | ||
); | ||
} | ||
|
||
~storage_t() override = default; | ||
}; | ||
|
||
``` | ||
## Dependencies | ||
* CMake | ||
## Supported Compilers | ||
* GCC >= 4.8 | ||
* GCC >= 4.8.5 | ||
* Clang >= 3.3 | ||
* Microsoft Visual Studio >= 2015 | ||
## Supported Operating Systems | ||
* Linux | ||
* Mac OS X | ||
* Windows | ||
* FreeBSD 10 | ||
* Windows >= 7 (static builds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
#include <unordered_map> | ||
|
||
#include <actor-zeta/forwards.hpp> | ||
#include <actor-zeta/actor/abstract_actor.hpp> | ||
#include <actor-zeta/actor/context.hpp> | ||
#include <actor-zeta/actor/dispatcher.hpp> | ||
|
||
namespace actor_zeta { namespace actor { | ||
/// | ||
/// @brief A generic actor | ||
/// | ||
class base_actor | ||
: public abstract_actor | ||
, public context_t { | ||
public: | ||
~base_actor() override; | ||
protected: | ||
/** | ||
* debug method | ||
*/ | ||
auto all_view_address() const -> void; | ||
|
||
base_actor(detail::string_view name); | ||
|
||
/// sync -> async | ||
void add_link(actor_address); | ||
/// sync -> async | ||
void remove_link(const actor_address&); | ||
/// sync -> async | ||
void remove_link(detail::string_view); | ||
|
||
auto message_types() const -> std::set<std::string> final; | ||
|
||
auto addresses(detail::string_view) -> actor_address & final; | ||
|
||
auto self() -> actor_address override; | ||
|
||
template<std::size_t N, typename F> | ||
inline auto add_handler(const char(&name)[N], F &&f) -> void { | ||
dispatch().on(detail::string_view(name), make_handler(std::forward<F>(f))); | ||
} | ||
|
||
auto dispatch() -> dispatcher_t &; | ||
|
||
auto dispatch() const -> const dispatcher_t &; | ||
|
||
std::unordered_map<detail::string_view, actor_address> contacts; | ||
|
||
private: | ||
void initialize(); | ||
|
||
dispatcher_t dispatcher_; | ||
|
||
}; | ||
|
||
}} |
Oops, something went wrong.