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