SEGS  0.4.2
Super Entity Game Server
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ChatServer.hpp
Go to the documentation of this file.
1 /*
2  * SEGS - Super Entity Game Server
3  * http://www.segs.io/
4  * Copyright (c) 2006 - 2018 SEGS Team (see Authors.txt)
5  * This software is licensed! (See License.txt for details)
6  */
7 
8 #ifndef MPRPC_ChatServer_e916179d_HPP__
9 #define MPRPC_ChatServer_e916179d_HPP__
10 
11 #include "types.hpp"
12 
13 namespace StickWorld {
14 
15 namespace ChatServer {
16 
17 
18 struct subscribe {
19 
21  :
22  my_id(0)
23  {
24  }
25 
26  int64_t my_id;
27 
28  template <typename Packer>
29  void msgpack_pack(Packer& _Pk) const {
30  _Pk.pack_array(1);
31  _Pk.pack(my_id);
32  }
33 
34  void msgpack_unpack(msgpack::object _Obj) {
35  if(_Obj.type != msgpack::type::ARRAY) {
36  throw msgpack::type_error();
37  }
38  const size_t _Length = _Obj.via.array.size;
39  msgpack::object* const _Array = _Obj.via.array.ptr;
40 
41  if(_Length < 0) {
42  throw msgpack::type_error();
43  }
44 
45 
46  if(_Length <= 0) { return; }
47  if(!_Array[0].is_nil()) {
48  _Array[0].convert(&my_id);
49  }
50 
51  }
52 };
53 struct publish {
54 
56  {
57  }
58 
60 
61  template <typename Packer>
62  void msgpack_pack(Packer& _Pk) const {
63  _Pk.pack_array(1);
64  _Pk.pack(x);
65  }
66 
67  void msgpack_unpack(msgpack::object _Obj) {
68  if(_Obj.type != msgpack::type::ARRAY) {
69  throw msgpack::type_error();
70  }
71  const size_t _Length = _Obj.via.array.size;
72  msgpack::object* const _Array = _Obj.via.array.ptr;
73 
74  if(_Length < 0) {
75  throw msgpack::type_error();
76  }
77 
78 
79  if(_Length <= 0) { return; }
80  if(!_Array[0].is_nil()) {
81  _Array[0].convert(&x);
82  }
83 
84  }
85 };
86 struct unsubscribe {
87 
89  :
90  my_id(0)
91  {
92  }
93 
94  int64_t my_id;
95 
96  template <typename Packer>
97  void msgpack_pack(Packer& _Pk) const {
98  _Pk.pack_array(1);
99  _Pk.pack(my_id);
100  }
101 
102  void msgpack_unpack(msgpack::object _Obj) {
103  if(_Obj.type != msgpack::type::ARRAY) {
104  throw msgpack::type_error();
105  }
106  const size_t _Length = _Obj.via.array.size;
107  msgpack::object* const _Array = _Obj.via.array.ptr;
108 
109  if(_Length < 0) {
110  throw msgpack::type_error();
111  }
112 
113 
114  if(_Length <= 0) { return; }
115  if(!_Array[0].is_nil()) {
116  _Array[0].convert(&my_id);
117  }
118 
119  }
120 };
121 
122 
123 } // namespace ChatServer
124 
125 } // namespace StickWorld
126 #endif
Definition: ChatServer.hpp:18
Definition: ChatServer.hpp:53
int64_t my_id
Definition: ChatServer.hpp:26
Definition: ChatServer.hpp:86
void msgpack_pack(Packer &_Pk) const
Definition: ChatServer.hpp:29
void msgpack_unpack(msgpack::object _Obj)
Definition: ChatServer.hpp:102
void msgpack_pack(Packer &_Pk) const
Definition: ChatServer.hpp:97
subscribe()
Definition: ChatServer.hpp:20
Definition: types.hpp:18
void msgpack_pack(Packer &_Pk) const
Definition: ChatServer.hpp:62
unsubscribe()
Definition: ChatServer.hpp:88
int64_t my_id
Definition: ChatServer.hpp:94
Definition: stickworld_server.idl:10
void msgpack_unpack(msgpack::object _Obj)
Definition: ChatServer.hpp:67
publish()
Definition: ChatServer.hpp:55
ChatMessage x
Definition: ChatServer.hpp:59
void msgpack_unpack(msgpack::object _Obj)
Definition: ChatServer.hpp:34