mirror of
https://github.com/mutouyun/cpp-ipc.git
synced 2025-12-07 09:16:46 +08:00
fine-tune code
This commit is contained in:
parent
c69b351ae9
commit
6a3c3cde23
@ -291,5 +291,11 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <relat Rp, relat Rc, trans Ts>
|
||||||
|
struct prod_cons {
|
||||||
|
template <std::size_t DataSize>
|
||||||
|
using elems_t = elem_array<DataSize, prod_cons_circ<Rp, Rc, Ts>>;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace circ
|
} // namespace circ
|
||||||
} // namespace ipc
|
} // namespace ipc
|
||||||
|
|||||||
@ -138,7 +138,7 @@ public:
|
|||||||
* (one producer/server/sender to multi consumers/clients/receivers)
|
* (one producer/server/sender to multi consumers/clients/receivers)
|
||||||
*/
|
*/
|
||||||
using route = channel_impl<channel_detail<
|
using route = channel_impl<channel_detail<
|
||||||
ipc::queue, ipc::prod_cons_circ<relat::single, relat::multi, trans::broadcast>
|
ipc::queue, ipc::circ::prod_cons<relat::single, relat::multi, trans::broadcast>
|
||||||
>>;
|
>>;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -150,7 +150,7 @@ using route = channel_impl<channel_detail<
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
using channel = channel_impl<channel_detail<
|
using channel = channel_impl<channel_detail<
|
||||||
ipc::queue, ipc::prod_cons_circ<relat::multi, relat::multi, trans::broadcast>
|
ipc::queue, ipc::circ::prod_cons<relat::multi, relat::multi, trans::broadcast>
|
||||||
>>;
|
>>;
|
||||||
|
|
||||||
} // namespace ipc
|
} // namespace ipc
|
||||||
|
|||||||
@ -19,10 +19,10 @@
|
|||||||
namespace ipc {
|
namespace ipc {
|
||||||
|
|
||||||
template <typename T,
|
template <typename T,
|
||||||
typename Policy = ipc::prod_cons_circ<relat::single, relat::multi, trans::broadcast>>
|
typename Policy = ipc::circ::prod_cons<relat::single, relat::multi, trans::broadcast>>
|
||||||
class queue {
|
class queue {
|
||||||
public:
|
public:
|
||||||
using elems_t = circ::elem_array<sizeof(T), Policy>;
|
using elems_t = typename Policy::template elems_t<sizeof(T)>;
|
||||||
using policy_t = typename elems_t::policy_t;
|
using policy_t = typename elems_t::policy_t;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
10
src/ipc.cpp
10
src/ipc.cpp
@ -263,10 +263,10 @@ buff_t channel_detail<Queue, Policy>::recv(handle_t h) {
|
|||||||
return detail_impl<Queue, Policy>::recv(h);
|
return detail_impl<Queue, Policy>::recv(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
template struct channel_detail<ipc::queue, ipc::prod_cons_circ<relat::single, relat::single, trans::unicast >>;
|
template struct channel_detail<ipc::queue, ipc::circ::prod_cons<relat::single, relat::single, trans::unicast >>;
|
||||||
template struct channel_detail<ipc::queue, ipc::prod_cons_circ<relat::single, relat::multi , trans::unicast >>;
|
template struct channel_detail<ipc::queue, ipc::circ::prod_cons<relat::single, relat::multi , trans::unicast >>;
|
||||||
template struct channel_detail<ipc::queue, ipc::prod_cons_circ<relat::multi , relat::multi , trans::unicast >>;
|
template struct channel_detail<ipc::queue, ipc::circ::prod_cons<relat::multi , relat::multi , trans::unicast >>;
|
||||||
template struct channel_detail<ipc::queue, ipc::prod_cons_circ<relat::single, relat::multi , trans::broadcast>>;
|
template struct channel_detail<ipc::queue, ipc::circ::prod_cons<relat::single, relat::multi , trans::broadcast>>;
|
||||||
template struct channel_detail<ipc::queue, ipc::prod_cons_circ<relat::multi , relat::multi , trans::broadcast>>;
|
template struct channel_detail<ipc::queue, ipc::circ::prod_cons<relat::multi , relat::multi , trans::broadcast>>;
|
||||||
|
|
||||||
} // namespace ipc
|
} // namespace ipc
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user