1*e6d48874SKrzysztof Grobelny #include "messanger_service.hpp" 2*e6d48874SKrzysztof Grobelny 3*e6d48874SKrzysztof Grobelny namespace utils 4*e6d48874SKrzysztof Grobelny { 5*e6d48874SKrzysztof Grobelny 6*e6d48874SKrzysztof Grobelny MessangerService::MessangerService( 7*e6d48874SKrzysztof Grobelny boost::asio::execution_context& execution_context) : 8*e6d48874SKrzysztof Grobelny boost::asio::execution_context::service(execution_context) 9*e6d48874SKrzysztof Grobelny {} 10*e6d48874SKrzysztof Grobelny 11*e6d48874SKrzysztof Grobelny MessangerService::Context& MessangerService::create() 12*e6d48874SKrzysztof Grobelny { 13*e6d48874SKrzysztof Grobelny contexts_.emplace_back(std::make_unique<Context>()); 14*e6d48874SKrzysztof Grobelny return *contexts_.back(); 15*e6d48874SKrzysztof Grobelny } 16*e6d48874SKrzysztof Grobelny 17*e6d48874SKrzysztof Grobelny void MessangerService::destroy(MessangerService::Context& context) 18*e6d48874SKrzysztof Grobelny { 19*e6d48874SKrzysztof Grobelny contexts_.erase(std::remove_if(contexts_.begin(), contexts_.end(), 20*e6d48874SKrzysztof Grobelny [&context](const auto& item) { 21*e6d48874SKrzysztof Grobelny return item.get() == &context; 22*e6d48874SKrzysztof Grobelny }), 23*e6d48874SKrzysztof Grobelny contexts_.end()); 24*e6d48874SKrzysztof Grobelny } 25*e6d48874SKrzysztof Grobelny 26*e6d48874SKrzysztof Grobelny boost::asio::execution_context::id MessangerService::id = {}; 27*e6d48874SKrzysztof Grobelny 28*e6d48874SKrzysztof Grobelny } // namespace utils 29