/* * Copyright 2015 Cloudius Systems */ #ifndef API_API_HH_ #define API_API_HH_ #include "http/httpd.hh" #include "database.hh" #include namespace api { struct http_context { http_server_control http_server; distributed& db; http_context(distributed& _db) : db(_db) {} }; future<> set_server(http_context& ctx); template std::vector container_to_vec(const T& container) { std::vector res; for (auto i : container) { res.push_back(boost::lexical_cast(i)); } return res; } template std::vector map_to_key_value(const std::map& map) { std::vector res; for (auto i : map) { res.push_back(T()); res.back().key = i.first; res.back().value = i.second; } return res; } } #endif /* API_API_HH_ */