summaryrefslogtreecommitdiff
path: root/src/bindings/eina_cxx/eina_integer_sequence.hh
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2014-07-03 16:28:22 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2014-07-03 16:28:23 +0900
commit30df128be5dd3d2cea4c976ed5d5c9b85a15aa77 (patch)
tree8fe7a9c6c61677f46e82199075856a45717b4e98 /src/bindings/eina_cxx/eina_integer_sequence.hh
parentddac21534f9eaa8bc01f8c72c1bff5926de27bd6 (diff)
eldbus-cxx: Implementation of eldbus C++ API
Summary: Applications can: void method_callback(void* data, const Eldbus_Service_Interface* iface, const Eldbus_Message* message); struct { ... } data_struct; Eldbus_Method methods[] = { "method1", ELDBUS_ARGS("b", "bool"), ELDBUS_ARGS("b", "bool"), ELDBUS_METHOD_FLAG_HAS_DATA , (Eldbus_Method_Cb)&method_callback, &data_struct }; And method_callback will be called with data parameter pointing to data_struct global object. Also, Eldbus-cxx supports registering an interface passing a lambda or function object as method. For example: edb::service_interface iface = edb::service_interface_register (c, path, interface , es::method("SendStringAndBool" , [expected_string, expected_bool] (std::string const& n, bool b , bool* out) { std::cout << "Running SendStringAndBool" << std::endl; ck_assert(n == expected_string); ck_assert(b == expected_bool); *out = b; return n; } , es::ins<std::string, bool>("string", "bool") , es::outs<std::string, bool>("string", "bool") ) ); When a request for "SendStringAndBool" with the proper signature is called, executes the lambda and replies with the return value and its bool* out parameter value. Reviewers: cedric, woohyun, raster CC: savio, cedric Differential Revision: https://phab.enlightenment.org/D1052
Diffstat (limited to 'src/bindings/eina_cxx/eina_integer_sequence.hh')
-rw-r--r--src/bindings/eina_cxx/eina_integer_sequence.hh30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/bindings/eina_cxx/eina_integer_sequence.hh b/src/bindings/eina_cxx/eina_integer_sequence.hh
index b1f98a0..854bb8f 100644
--- a/src/bindings/eina_cxx/eina_integer_sequence.hh
+++ b/src/bindings/eina_cxx/eina_integer_sequence.hh
@@ -70,6 +70,36 @@ using index_sequence = integer_sequence<std::size_t, I...>;
70template <std::size_t I> 70template <std::size_t I>
71using make_index_sequence = make_integer_sequence<std::size_t, I>; 71using make_index_sequence = make_integer_sequence<std::size_t, I>;
72 72
73template <typename T, typename U>
74struct pop_integer_sequence_t;
75
76template <typename T>
77struct pop_integer_sequence_t<integer_sequence<T>, integer_sequence<T> >
78{
79 typedef integer_sequence<T> type;
80};
81
82template <typename T, T S0, T... S>
83struct pop_integer_sequence_t<integer_sequence<T>, integer_sequence<T, S0, S...> >
84{
85 typedef integer_sequence<T, S...> type;
86};
87
88template <typename T, T S0, T... S>
89struct pop_integer_sequence_t<integer_sequence<T, S0, S...>, integer_sequence<T> >
90{
91 typedef integer_sequence<T> type;
92};
93
94template <typename T, T S, T... Ss1, T... Ss2>
95struct pop_integer_sequence_t<integer_sequence<T, S, Ss1...>, integer_sequence<T, S, Ss2...> >
96 : pop_integer_sequence_t<integer_sequence<T, Ss1...>, integer_sequence<T, Ss2...> >
97{
98};
99
100template <typename T, typename U>
101using pop_integer_sequence = typename pop_integer_sequence_t<T, U>::type;
102
73/** 103/**
74 * @} 104 * @}
75 */ 105 */