Commit | Line | Data |
---|---|---|
db49c2f9 JT |
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 | ||
bfe60617 | 24 | #ifdef __GCCXML__ |
ec979c57 JT |
25 | #define LIBT2N_SET_DEFAULTGROUP(x) namespace { typedef __attribute((gccxml(#x))) int libt2n_default; } |
26 | #define LIBT2N_EXPORT __attribute((gccxml("libt2n-default"))) | |
bfe60617 | 27 | #define LIBT2N_EXPORT_GROUP(group) __attribute((gccxml("libt2n-"#group))) |
db49c2f9 | 28 | #else |
ec979c57 | 29 | #define LIBT2N_SET_DEFAULTGROUP(x) |
71def1d7 | 30 | #define LIBT2N_EXPORT |
bfe60617 | 31 | #define LIBT2N_EXPORT_GROUP(group) |
db49c2f9 JT |
32 | #endif |
33 | ||
34 | class cmd_group_example : public libt2n::command | |
35 | { | |
36 | private: | |
37 | friend class boost::serialization::access; | |
38 | template<class Archive> | |
39 | void serialize(Archive & ar, const unsigned int version) | |
40 | { | |
41 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(libt2n::command); | |
42 | } | |
43 | }; | |
44 | ||
45 | ||
46 | class testfunc_res : public libt2n::result | |
47 | { | |
48 | private: | |
49 | std::string res; | |
50 | ||
51 | friend class boost::serialization::access; | |
52 | template<class Archive> | |
53 | void serialize(Archive & ar, const unsigned int version) | |
54 | { | |
55 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(libt2n::result); | |
56 | ar & BOOST_SERIALIZATION_NVP(res); | |
57 | } | |
58 | ||
59 | public: | |
60 | testfunc_res() | |
61 | { } | |
62 | ||
63 | testfunc_res(const std::string& str) | |
64 | { | |
65 | res=str; | |
66 | } | |
67 | ||
68 | std::string get_data() | |
69 | { | |
70 | return res; | |
71 | } | |
72 | }; | |
73 | ||
74 | ||
75 | class testfunc_cmd : public cmd_group_example | |
76 | { | |
77 | private: | |
78 | std::string param; | |
79 | ||
80 | friend class boost::serialization::access; | |
81 | template<class Archive> | |
82 | void serialize(Archive & ar, const unsigned int version) | |
83 | { | |
84 | ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(cmd_group_example); | |
85 | ar & BOOST_SERIALIZATION_NVP(param); | |
86 | } | |
87 | ||
88 | public: | |
89 | testfunc_cmd() | |
90 | { } | |
91 | ||
92 | testfunc_cmd(const std::string& str) | |
93 | { | |
94 | param=str; | |
95 | } | |
96 | ||
97 | libt2n::result* operator()(); | |
98 | }; | |
99 | ||
100 | void | |
101 | extended_type_info_test(); | |
102 | ||
103 | #endif |