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