libt2n: (tomj) fix uninitialized variable "result_type" in result_container
[libt2n] / src / container.cpp
CommitLineData
7087e187
GE
1/***************************************************************************
2 * Copyright (C) 2006 by Gerd v. Egidy *
3 * gve@intra2net.com *
4 * *
5 * This library is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU Lesser General Public License version *
7 * 2.1 as published by the Free Software Foundation. *
8 * *
9 * This library is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU Lesser General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/
19
a7170401
GE
20#include <boost/archive/binary_oarchive.hpp>
21#include <boost/archive/binary_iarchive.hpp>
22#include <boost/archive/xml_oarchive.hpp>
23#include <boost/archive/xml_iarchive.hpp>
24
7087e187
GE
25#include "container.hxx"
26
d184c648
GE
27#include <boost/serialization/export.hpp>
28
a7170401
GE
29BOOST_CLASS_EXPORT(libt2n::result_container)
30BOOST_CLASS_EXPORT(libt2n::command_container)
31
32namespace libt2n
33{
34
a7170401
GE
35
36/// deletes the carried result or exception objects
37result_container::~result_container()
38{
39 if (res)
40 delete res;
41 if (ex)
42 delete ex;
c72238fb
TJ
43
44 res = NULL;
45 ex = NULL;
a7170401
GE
46}
47
48/** @brief returns the result or throw the carried exception.
49 ATTENTION: the result object is deleted in the destructor
50*/
51result* result_container::get_result(void)
52{
53 if (result_type==exception)
54 ex->do_throw();
c72238fb 55
a7170401
GE
56 return res;
57}
58
a7170401
GE
59/// deletes the carried command
60command_container::~command_container()
61{
62 if (cmd)
63 delete cmd;
c72238fb
TJ
64
65 cmd = NULL;
a7170401 66}
d184c648 67
a7170401 68} // namespace libt2n