test to pass group as attribute to gccxml
[libt2n] / examples / minimalistic-stub.hxx
1 #ifndef MINIMALISTIC_STUB_HXX
2 #define MINIMALISTIC_STUB_HXX
3
4
5 /*
6   stubs to be generated
7   header is used by the client library and the server
8 */
9
10 // todo: why do we have to include the boost headers first?
11 // do we have to know which archive format we will use?
12
13 #include <boost/archive/binary_oarchive.hpp>
14 #include <boost/archive/binary_iarchive.hpp>
15 #include <boost/archive/xml_oarchive.hpp>
16 #include <boost/archive/xml_iarchive.hpp>
17 #include <boost/serialization/serialization.hpp>
18 #include <boost/serialization/string.hpp>
19
20 #include <string>
21 #include <t2n_exception.hxx>
22 #include <command.hxx>
23
24 #ifdef __GCCXML__
25 #define LIBT2N_EXPORT __attribute((gccxml("libt2n")))
26 #define LIBT2N_EXPORT_GROUP(group) __attribute((gccxml("libt2n-"#group)))
27 #else
28 #define LIBT2N_EXPORT
29 #define LIBT2N_EXPORT_GROUP(group)
30 #endif
31
32 class cmd_group_example : public libt2n::command
33 {
34     private:
35         friend class boost::serialization::access;
36         template<class Archive>
37         void serialize(Archive & ar, const unsigned int version)
38         {
39             ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(libt2n::command);
40         }
41 };
42
43
44 class testfunc_res : public libt2n::result
45 {
46     private:
47         std::string res;
48
49         friend class boost::serialization::access;
50         template<class Archive>
51         void serialize(Archive & ar, const unsigned int version)
52         {
53             ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(libt2n::result);
54             ar & BOOST_SERIALIZATION_NVP(res);
55         }
56
57     public:
58         testfunc_res()
59             { }
60
61         testfunc_res(const std::string& str)
62         {
63             res=str;
64         }
65
66         std::string get_data()
67         {
68             return res;
69         }
70 };
71
72
73 class testfunc_cmd : public cmd_group_example
74 {
75     private:
76         std::string param;
77
78         friend class boost::serialization::access;
79         template<class Archive>
80         void serialize(Archive & ar, const unsigned int version)
81         {
82             ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(cmd_group_example);
83             ar & BOOST_SERIALIZATION_NVP(param);
84         }
85
86     public:
87         testfunc_cmd()
88             { }
89
90         testfunc_cmd(const std::string& str)
91         {
92             param=str;
93         }
94
95         libt2n::result* operator()();
96 };
97
98 void
99 extended_type_info_test();
100
101 #endif