libt2n: (gerd) basic command handling (still some todos)
[libt2n] / src / command.hxx
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#ifndef __LIBT2N_COMMAND
20#define __LIBT2N_COMMAND
21
22#include <boost/serialization/serialization.hpp>
23#include <boost/serialization/export.hpp>
24
25namespace libt2n
26{
27
28/** @brief base class for the results that are returned from commands.
29*/
30class result
31{
32 private:
33 friend class boost::serialization::access;
34 template<class Archive>
35 void serialize(Archive & ar, const unsigned int version)
36 { }
37
38 public:
39 result() {}
40 virtual ~result() {}
41};
42}
43//BOOST_IS_ABSTRACT(libt2n::result)
44
45namespace libt2n
46{
47/** @brief a command that can be serialized. abstract.
48*/
49class command
50{
51 private:
52 friend class boost::serialization::access;
53 template<class Archive>
54 void serialize(Archive & ar, const unsigned int version)
55 { }
56
57 public:
58 /// this calls the wanted target function on the server
59 virtual result* operator()() = 0;
60 virtual ~command() {}
61};
62} // namespace libt2n
63//BOOST_IS_ABSTRACT(libt2n::command)
64
65
66
67#endif
68