2019-10-24 06:36:42 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2019 by its authors. See AUTHORS.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
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
2014-07-03 00:28:22 -07:00
|
|
|
#ifndef EFL_EINA_FOLD_HH_
|
|
|
|
#define EFL_EINA_FOLD_HH_
|
eet-cxx: add implementation for eet C++.
Usage example:
struct type
{
int foo;
float bar;
};
type t0;
auto descriptor = make_descriptor("type", &type::ofo, &type::bar);
eet_data_write(file, descriptor.native_handle(), "type", &t0, false);
std::unique_ptr<type> p = read_by_ptr(file, "type", descriptor);
type t = read(file, "type", descriptor);
@feature
Reviewers: cedric, smohanty
Reviewed By: cedric
CC: savio, cedric
Differential Revision: https://phab.enlightenment.org/D659
Signed-off-by: Cedric BAIL <cedric.bail@free.fr>
2014-04-01 03:08:07 -07:00
|
|
|
|
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
2014-07-03 00:28:22 -07:00
|
|
|
#include <eina_tuple.hh>
|
eet-cxx: add implementation for eet C++.
Usage example:
struct type
{
int foo;
float bar;
};
type t0;
auto descriptor = make_descriptor("type", &type::ofo, &type::bar);
eet_data_write(file, descriptor.native_handle(), "type", &t0, false);
std::unique_ptr<type> p = read_by_ptr(file, "type", descriptor);
type t = read(file, "type", descriptor);
@feature
Reviewers: cedric, smohanty
Reviewed By: cedric
CC: savio, cedric
Differential Revision: https://phab.enlightenment.org/D659
Signed-off-by: Cedric BAIL <cedric.bail@free.fr>
2014-04-01 03:08:07 -07:00
|
|
|
|
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
2014-07-03 00:28:22 -07:00
|
|
|
namespace efl { namespace eina {
|
eet-cxx: add implementation for eet C++.
Usage example:
struct type
{
int foo;
float bar;
};
type t0;
auto descriptor = make_descriptor("type", &type::ofo, &type::bar);
eet_data_write(file, descriptor.native_handle(), "type", &t0, false);
std::unique_ptr<type> p = read_by_ptr(file, "type", descriptor);
type t = read(file, "type", descriptor);
@feature
Reviewers: cedric, smohanty
Reviewed By: cedric
CC: savio, cedric
Differential Revision: https://phab.enlightenment.org/D659
Signed-off-by: Cedric BAIL <cedric.bail@free.fr>
2014-04-01 03:08:07 -07:00
|
|
|
|
|
|
|
namespace _mpl {
|
|
|
|
|
|
|
|
template <typename T, typename F, typename A0, bool B = std::is_same<T, std::tuple<> >::value>
|
|
|
|
struct fold_impl
|
|
|
|
{
|
|
|
|
typedef typename F::template apply<A0, typename std::tuple_element<0, T>::type>::type result;
|
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
2014-07-03 00:28:22 -07:00
|
|
|
typedef typename fold_impl<typename _mpl::pop_front<T>::type
|
eet-cxx: add implementation for eet C++.
Usage example:
struct type
{
int foo;
float bar;
};
type t0;
auto descriptor = make_descriptor("type", &type::ofo, &type::bar);
eet_data_write(file, descriptor.native_handle(), "type", &t0, false);
std::unique_ptr<type> p = read_by_ptr(file, "type", descriptor);
type t = read(file, "type", descriptor);
@feature
Reviewers: cedric, smohanty
Reviewed By: cedric
CC: savio, cedric
Differential Revision: https://phab.enlightenment.org/D659
Signed-off-by: Cedric BAIL <cedric.bail@free.fr>
2014-04-01 03:08:07 -07:00
|
|
|
, F, result
|
|
|
|
>::type
|
|
|
|
type;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T, typename F, typename A0>
|
|
|
|
struct fold_impl<T, F, A0, true>
|
|
|
|
{
|
|
|
|
typedef A0 type;
|
|
|
|
};
|
|
|
|
|
|
|
|
template <typename T, typename F, typename A0>
|
|
|
|
struct fold : fold_impl<T, F, A0>
|
|
|
|
{};
|
|
|
|
|
|
|
|
} } }
|
|
|
|
|
|
|
|
#endif
|