Changeset 2681 for branches/blt4/packages/vizservers/vtkvis/ResponseQueue.h
- Timestamp:
- Nov 15, 2011 11:56:51 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/packages/vizservers/vtkvis/ResponseQueue.h
r2543 r2681 17 17 namespace VtkVis { 18 18 19 /** 20 * \brief Holds data for a response to be sent to client 21 */ 19 22 class Response 20 23 { … … 40 43 virtual ~Response() 41 44 { 42 if (_length > 0) { 43 if (_allocType == DYNAMIC) { 44 free(_mesg); 45 } 45 if ((_length > 0) && (_mesg != NULL) && (_allocType == DYNAMIC)) { 46 free(_mesg); 46 47 } 47 48 } 48 49 50 /// Get the ResponseType 49 51 ResponseType type() 50 52 { … … 52 54 } 53 55 56 /// Get the Response data 54 57 unsigned char *message() 55 58 { … … 57 60 } 58 61 62 /// Get the number of bytes in the Response data 59 63 size_t length() 60 64 { … … 62 66 } 63 67 68 /// Set the message/data making up the Response 69 /** 70 * If the AllocationType is DYNAMIC, the message data will be free()d 71 * by the destructor. If the AllocationType is VOLATILE, a copy of 72 * the message data will be made. 73 * 74 * \param[in] mesg The Response data, can be a command and/or binary data 75 * \param[in] length The number of bytes in mesg 76 * \param[in] type Specify how the memory was allocated for mesg 77 */ 64 78 void setMessage(unsigned char *mesg, size_t length, AllocationType type) 65 79 { … … 86 100 }; 87 101 102 /** 103 * \brief Queue to hold pending Responses to be sent to the client 104 * 105 * A semaphore and mutex are used to control access to the 106 * queue by a reader and writer thread 107 */ 88 108 class ResponseQueue 89 109 { … … 93 113 virtual ~ResponseQueue(); 94 114 115 /// A place to store a data pointer. Not used internally. 116 /* XXX: This probably doesn't belong here */ 95 117 void *clientData() 96 118 { … … 98 120 } 99 121 122 /// Add a response to the end of the queue 100 123 void enqueue(Response *response); 101 124 125 /// Remove a response from the front of the queue 102 126 Response *dequeue(); 103 127
Note: See TracChangeset
for help on using the changeset viewer.