SLikeNet 0.1.3

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CloudCommon.h
Go to the documentation of this file.
1 /*
2 * Original work: Copyright (c) 2014, Oculus VR, Inc.
3 * All rights reserved.
4 *
5 * This source code is licensed under the BSD-style license found in the
6 * RakNet License.txt file in the licenses directory of this source tree. An additional grant
7 * of patent rights can be found in the RakNet Patents.txt file in the same directory.
8 *
9 *
10 * Modified work: Copyright (c) 2017, SLikeSoft UG (haftungsbeschränkt)
11 *
12 * This source code was modified by SLikeSoft. Modifications are licensed under the MIT-style
13 * license found in the license.txt file in the root directory of this source tree.
14 */
15
16 #include "NativeFeatureIncludes.h"
17 #if _RAKNET_SUPPORT_CloudClient==1 || _RAKNET_SUPPORT_CloudServer==1
18
19 #ifndef __CLOUD_COMMON_H
20 #define __CLOUD_COMMON_H
21
22 #include "types.h"
23 #include "string.h"
24
25 namespace SLNet
26 {
27
28 class BitStream;
29 struct CloudQueryRow;
30
33 class RAK_DLL_EXPORT CloudAllocator
34 {
35 public:
36 CloudAllocator() {}
37 virtual ~CloudAllocator() {}
38
40 virtual CloudQueryRow* AllocateCloudQueryRow(void);
42 virtual void DeallocateCloudQueryRow(CloudQueryRow *row);
44 virtual unsigned char *AllocateRowData(uint32_t bytesNeededForData);
46 virtual void DeallocateRowData(void *data);
47 };
48
51 struct RAK_DLL_EXPORT CloudKey
52 {
53 CloudKey() {}
54 CloudKey(SLNet::RakString _primaryKey, uint32_t _secondaryKey) : primaryKey(_primaryKey), secondaryKey(_secondaryKey) {}
55 ~CloudKey() {}
56
59 SLNet::RakString primaryKey;
60
62 uint32_t secondaryKey;
63
65 void Serialize(bool writeToBitstream, BitStream *bitStream);
66 };
67
69 int CloudKeyComp(const CloudKey &key, const CloudKey &data);
70
73 struct RAK_DLL_EXPORT CloudQuery
74 {
75 CloudQuery() {startingRowIndex=0; maxRowsToReturn=0; subscribeToResults=false;}
76
80 DataStructures::List<CloudKey> keys;
81
83 uint32_t startingRowIndex;
84
86 uint32_t maxRowsToReturn;
87
89 bool subscribeToResults;
90
92 void Serialize(bool writeToBitstream, BitStream *bitStream);
93 };
94
96 struct RAK_DLL_EXPORT CloudQueryRow
97 {
99 CloudKey key;
100
102 unsigned char *data;
103
105 uint32_t length;
106
108 SystemAddress serverSystemAddress;
109
111 SystemAddress clientSystemAddress;
112
114 RakNetGUID serverGUID;
115
117 RakNetGUID clientGUID;
118
120 void Serialize(bool writeToBitstream, BitStream *bitStream, CloudAllocator *allocator);
121 };
122
124 struct RAK_DLL_EXPORT CloudQueryResult
125 {
127 CloudQuery cloudQuery;
128
130 DataStructures::List<CloudQueryRow*> rowsReturned;
131
136 DataStructures::List<uint32_t> resultKeyIndices;
137
139 bool subscribeToResults;
140
142 void Serialize(bool writeToBitstream, BitStream *bitStream, CloudAllocator *allocator);
144 void SerializeHeader(bool writeToBitstream, BitStream *bitStream);
146 void SerializeNumRows(bool writeToBitstream, uint32_t &numRows, BitStream *bitStream);
148 void SerializeCloudQueryRows(bool writeToBitstream, uint32_t &numRows, BitStream *bitStream, CloudAllocator *allocator);
149 };
150
151 } // Namespace SLikeNet
152
153 #endif // __CLOUD_COMMON_H
154
155 #endif // #if _RAKNET_SUPPORT_CloudClient==1 || _RAKNET_SUPPORT_CloudServer==1