TDME2 1.9.121
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ServerRequest.h
Go to the documentation of this file.
1#pragma once
2
3#include <stdint.h>
4
5#include <sstream>
6#include <string>
7
8#include <tdme/tdme.h>
11
12using std::string;
13using std::stringstream;
14
15namespace tdme {
16namespace network {
17namespace udpserver {
18
19class ServerClient;
20
21/**
22 * @brief Server request bean
23 * @author Andreas Drewke
24 */
26
27public:
36 };
37 static const uint32_t MESSAGE_ID_UNSUPPORTED = 0;
38 static const uint8_t MESSAGE_RETRIES_NONE = 0;
39 static const string EVENT_CUSTOM_NONE;
40
41 /**
42 * @brief Public constructor
43 * @param requestType request type
44 * @param object object
45 * @param custom custom event type if any
46 * @param messageFrame request frame stream
47 * @param messageId message id (udp server only)
48 * @param messageRetries message retries (udp server only)
49 */
50 inline ServerRequest(const RequestType requestType, void* object, const string& custom = EVENT_CUSTOM_NONE, stringstream* messageFrame = NULL, const uint32_t messageId = MESSAGE_ID_UNSUPPORTED, const uint8_t messageRetries = MESSAGE_RETRIES_NONE) :
52 //
53 }
54
55 /**
56 * @brief Public destructor
57 */
58 inline ~ServerRequest() {
59 }
60
61 /**
62 * @brief Returns the request type
63 * @return request type
64 */
65 inline const RequestType getRequestType() {
66 return requestType;
67 }
68
69 /**
70 * @brief Returns the associated object
71 * @return client
72 */
73 inline void* getObject() {
74 return object;
75 }
76
77 /**
78 * @return custom event name
79 */
80 inline const string& getCustomEvent() {
81 return customEvent;
82 }
83
84 /**
85 * @brief Returns the associated request message frame stream
86 * @return frame stream
87 */
88 inline stringstream* getMessageFrame() {
89 return messageFrame;
90 }
91
92 /**
93 * @brief Returns associated message id (udp server only)
94 * @return message id
95 */
96 inline const uint32_t getMessageId() {
97 return messageId;
98 }
99
100 /**
101 * @brief Returns number of message retries (udp server only)
102 * @return retries
103 */
104 inline const uint8_t getMessageRetries() {
105 return messageRetries;
106 }
107private:
109 void* object;
111 stringstream* messageFrame;
112 uint32_t messageId;
114};
115
116};
117};
118};
const uint32_t getMessageId()
Returns associated message id (udp server only)
Definition: ServerRequest.h:96
ServerRequest(const RequestType requestType, void *object, const string &custom=EVENT_CUSTOM_NONE, stringstream *messageFrame=NULL, const uint32_t messageId=MESSAGE_ID_UNSUPPORTED, const uint8_t messageRetries=MESSAGE_RETRIES_NONE)
Public constructor.
Definition: ServerRequest.h:50
const RequestType getRequestType()
Returns the request type.
Definition: ServerRequest.h:65
static const uint32_t MESSAGE_ID_UNSUPPORTED
Definition: ServerRequest.h:37
static const uint8_t MESSAGE_RETRIES_NONE
Definition: ServerRequest.h:38
void * getObject()
Returns the associated object.
Definition: ServerRequest.h:73
const uint8_t getMessageRetries()
Returns number of message retries (udp server only)
stringstream * getMessageFrame()
Returns the associated request message frame stream.
Definition: ServerRequest.h:88
Definition: fwd-tdme.h:4