Remove dynamic exceptions
[anna.git] / source / http / MessageFactory.cpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 #include <anna/http/MessageFactory.hpp>
10
11 using namespace anna;
12
13 http::Message* http::MessageFactory::create(const http::Message::Type::_v type)
14 noexcept(false) {
15   if(type == Message::Type::Request)
16     return a_requests.create();
17   else
18     return a_responses.create();
19 }
20
21 void http::MessageFactory::release(http::Message* message)
22 {
23   if(message == NULL)
24     return;
25
26   message->clear();
27
28   if(message->getType() == Message::Type::Request)
29     a_requests.release(static_cast <Request*>(message));
30   else
31     a_responses.release(static_cast <Response*>(message));
32 }
33