summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
3f367d8)
Base the class afb::base_api_t on the raw wrapper
class afb::api
Change-Id: Idbc4786d548ffcb0062a85b686c196758e49823c
Signed-off-by: Loïc Collignon <loic.collignon@iot.bzh>
* limitations under the License.
*/
* limitations under the License.
*/
-extern "C" {
-#include <afb/afb-binding.h>
-}
+#include <afb/c++/binding-wrap.hpp>
#include <cassert>
#include <string>
#include <cassert>
#include <string>
return api->preinit(handle);
}
return api->preinit(handle);
}
typename TTraits = ApiTraits<TApi>
>
class base_api_t
typename TTraits = ApiTraits<TApi>
>
class base_api_t
base_api_t& operator=(const base_api_t&) = delete;
protected:
base_api_t& operator=(const base_api_t&) = delete;
protected:
/**
* @brief Default constructor.
*/
/**
* @brief Default constructor.
*/
int add_verb(const std::string& verb, const std::string& info, void* vcbdata = nullptr, const struct afb_auth* auth = nullptr, uint32_t session = AFB_SESSION_NONE_X2, int glob = 0)
{
return afb_api_add_verb(
int add_verb(const std::string& verb, const std::string& info, void* vcbdata = nullptr, const struct afb_auth* auth = nullptr, uint32_t session = AFB_SESSION_NONE_X2, int glob = 0)
{
return afb_api_add_verb(
verb.c_str(),
info == "" ? nullptr : info.c_str(),
TTraits::template verb<Callback>,
verb.c_str(),
info == "" ? nullptr : info.c_str(),
TTraits::template verb<Callback>,
int add_verb(const std::string& verb, const std::string& info, void* vcbdata = nullptr, const struct afb_auth* auth = nullptr, uint32_t session = AFB_SESSION_NONE_X2, int glob = 0)
{
return afb_api_add_verb(
int add_verb(const std::string& verb, const std::string& info, void* vcbdata = nullptr, const struct afb_auth* auth = nullptr, uint32_t session = AFB_SESSION_NONE_X2, int glob = 0)
{
return afb_api_add_verb(
verb.c_str(),
info == "" ? nullptr : info.c_str(),
TTraits::template verb<Callback>,
verb.c_str(),
info == "" ? nullptr : info.c_str(),
TTraits::template verb<Callback>,
* @brief Get the API's handle.
* @return The API's handle.
*/
* @brief Get the API's handle.
* @return The API's handle.
*/
- afb_api_t handle() const { return handle_; }
+ afb_api_t handle() const { return api_; }
/**
* @brief Implicit conversion to C handle.
* @return The API's handle.
*/
/**
* @brief Implicit conversion to C handle.
* @return The API's handle.
*/
- operator afb_api_t() const { return handle_; }
+ operator afb_api_t() const { return api_; }
/**
* @brief Destructor.
*/
virtual ~base_api_t()
{
/**
* @brief Destructor.
*/
virtual ~base_api_t()
{
- if (handle_ && afb_api_delete_api(handle_))
- AFB_API_ERROR(handle_, "Failed to delete API.");
+ if (api_ && afb_api_delete_api(api_))
+ AFB_API_ERROR(api_, "Failed to delete API.");