GikoMonaのソフトウェアの基幹部分を集めて1つのライブラリに集約したものです。gikomona/pnutsのコンパイルにはこのライブラリが必須です。
リビジョン | 1059bd3228e28580442eb8b2c9e240c47f383b0e (tree) |
---|---|
日時 | 2014-04-29 21:13:00 |
作者 | caprice <caprice@user...> |
コミッター | caprice |
namespace、typdefの変更など
@@ -14,31 +14,31 @@ | ||
14 | 14 | |
15 | 15 | namespace monazilla { namespace GikoMona { namespace core { namespace communication { |
16 | 16 | |
17 | -namespace process = boost::interprocess; | |
17 | +namespace ipc = boost::interprocess; | |
18 | 18 | |
19 | -typedef process::managed_shared_memory shared_memory; | |
19 | +typedef ipc::managed_shared_memory shared_memory; | |
20 | +typedef ipc::shared_memory_object shared_object; | |
20 | 21 | typedef shared_memory::segment_manager segment_manager; |
21 | 22 | |
22 | 23 | template <typename T> |
23 | -using shared_memory_allocator = process::allocator<T, segment_manager>; | |
24 | +using shared_memory_allocator = ipc::allocator<T, segment_manager>; | |
24 | 25 | |
25 | 26 | template <typename T> |
26 | -using shared_list = process::list<T, shared_memory_allocator<T>>; | |
27 | +using shared_list = ipc::list<T, shared_memory_allocator<T>>; | |
27 | 28 | |
28 | -template <class MessageType> | |
29 | -bool communication::send(const communicate_id to, MessageType&& msg) { | |
30 | - static_assert(is_satisfied_message_concept_v<MessageType>(), | |
31 | - "`MessageType' does not satisfy the `message_concept'"); | |
32 | - | |
33 | - return send_string(to, msg.to_string()); | |
29 | +template <typename T> | |
30 | +T *find(shared_memory& shmem, const std::string& name) { | |
31 | + return shmem.find<T>(name.c_str()).first; | |
32 | +} | |
33 | + | |
34 | +template <typename T> | |
35 | +T *construct(shared_memory& shmem, const std::string& name) { | |
36 | + return shmem.construct<T>(name.c_str())(shm.get_segment_manager()); | |
34 | 37 | } |
35 | 38 | |
36 | -template <class MessageType> | |
37 | -bool communication::send_async(const communicate_id to, MessageType&& msg) { | |
38 | - static_assert(is_satisfied_message_concept_v<MessageType>(), | |
39 | - "`MessageType' does not satisfy the `message_concept'"); | |
40 | - | |
41 | - return send_string(to, msg.to_string()); | |
39 | +template <typename T> | |
40 | +void destruct(shared_memory& shmem, const std::string& name) { | |
41 | + shared_object::remove(name.c_str()); | |
42 | 42 | } |
43 | 43 | |
44 | 44 | } } } } |