| 1 | /* |
| 2 | Copyright (C) 2006 by Intra2net AG - Gerd v. Egidy |
| 3 | |
| 4 | The software in this package is distributed under the GNU General |
| 5 | Public License version 2 (with a special exception described below). |
| 6 | |
| 7 | A copy of GNU General Public License (GPL) is included in this distribution, |
| 8 | in the file COPYING.GPL. |
| 9 | |
| 10 | As a special exception, if other files instantiate templates or use macros |
| 11 | or inline functions from this file, or you compile this file and link it |
| 12 | with other works to produce a work based on this file, this file |
| 13 | does not by itself cause the resulting work to be covered |
| 14 | by the GNU General Public License. |
| 15 | |
| 16 | However the source code for this file must still be made available |
| 17 | in accordance with section (3) of the GNU General Public License. |
| 18 | |
| 19 | This exception does not invalidate any other reasons why a work based |
| 20 | on this file might be covered by the GNU General Public License. |
| 21 | */ |
| 22 | |
| 23 | #include <boost/archive/binary_oarchive.hpp> |
| 24 | #include <boost/archive/binary_iarchive.hpp> |
| 25 | #include <boost/archive/xml_oarchive.hpp> |
| 26 | #include <boost/archive/xml_iarchive.hpp> |
| 27 | |
| 28 | #include "container.hxx" |
| 29 | |
| 30 | #include <boost/serialization/export.hpp> |
| 31 | |
| 32 | BOOST_CLASS_EXPORT(libt2n::result_container) |
| 33 | BOOST_CLASS_EXPORT(libt2n::command_container) |
| 34 | |
| 35 | namespace libt2n |
| 36 | { |
| 37 | |
| 38 | |
| 39 | /// deletes the carried result or exception objects |
| 40 | result_container::~result_container() |
| 41 | { |
| 42 | if (res) |
| 43 | delete res; |
| 44 | if (ex) |
| 45 | delete ex; |
| 46 | |
| 47 | res = NULL; |
| 48 | ex = NULL; |
| 49 | } |
| 50 | |
| 51 | /** @brief returns the result or throw the carried exception. |
| 52 | ATTENTION: the result object is deleted in the destructor |
| 53 | */ |
| 54 | result* result_container::get_result(void) |
| 55 | { |
| 56 | if (result_type==exception) |
| 57 | ex->do_throw(); |
| 58 | |
| 59 | return res; |
| 60 | } |
| 61 | |
| 62 | /// deletes the carried command |
| 63 | command_container::~command_container() |
| 64 | { |
| 65 | if (cmd) |
| 66 | delete cmd; |
| 67 | |
| 68 | cmd = NULL; |
| 69 | } |
| 70 | |
| 71 | } // namespace libt2n |