2 Copyright (C) 2006 by Intra2net AG - Gerd v. Egidy
4 The software in this package is distributed under the GNU General
5 Public License version 2 (with a special exception described below).
7 A copy of GNU General Public License (GPL) is included in this distribution,
8 in the file COPYING.GPL.
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.
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.
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.
22 #ifndef __LIBT2N_CONTAINER
23 #define __LIBT2N_CONTAINER
25 #include <boost/archive/binary_oarchive.hpp>
26 #include <boost/archive/binary_iarchive.hpp>
27 #include <boost/archive/xml_oarchive.hpp>
28 #include <boost/archive/xml_iarchive.hpp>
29 #include <boost/serialization/serialization.hpp>
31 #include "command.hxx"
32 #include "t2n_exception.hxx"
39 /** @brief contains the result (return value as libt2n::result or an libt2n::t2n_exception) of a executed command
41 class result_container
47 enum result_type_t { regular, exception } result_type;
49 friend class boost::serialization::access;
50 template<class Archive>
51 void serialize(Archive & ar, const unsigned int version);
57 , result_type(regular)
61 result_container(result *_res)
64 , result_type(regular)
68 result_container(t2n_exception *_ex)
71 , result_type(exception)
77 void set_result(result *_res)
78 { res=_res; ex=0; result_type=regular; }
80 void set_exception(t2n_exception *_ex)
81 { res=0; ex=_ex; result_type=exception; }
83 result* get_result(void);
86 { return (result_type==exception && ex != NULL); }
88 { return (result_type==regular && res != NULL); }
91 /** @brief contains a libt2n::command
93 class command_container
98 friend class boost::serialization::access;
99 template<class Archive>
100 void serialize(Archive & ar, const unsigned int version);
107 command_container(command *_cmd)
111 ~command_container();
113 /// return the contained command
114 command* get_command()
118 } // namespace libt2n
120 BOOST_CLASS_TRACKING(libt2n::result_container, boost::serialization::track_never)
121 BOOST_CLASS_TRACKING(libt2n::command_container, boost::serialization::track_never)
123 #include "container.tcc"