|
AndroMeta
2.0.0
|
00001 /* 00002 * Copyright 2009-2012 AndroMeta LLC. All rights reserved. 00003 * 00004 * AndroMeta LLC retains all intellectual property and proprietary 00005 * rights to this software and related documentation and any modifications 00006 * thereto. Any use, reproduction, disclosure, or distribution of this 00007 * software and related documentation without an express license agreement 00008 * from AndroMeta LLC is strictly prohibited. 00009 * 00010 */ 00011 00019 #ifndef ANDROMETA_M_MESSAGE_HANDLER_H 00020 #define ANDROMETA_M_MESSAGE_HANDLER_H 00021 00022 #include <AndroMeta/MTime.h> 00023 00024 namespace Meta{ 00025 00026 class MMessageBuffer; 00027 class MMessage; 00028 00046 class MMessageHandler{ 00047 public: 00048 00052 enum Action{ 00053 ReleaseContinue, 00054 SaveContinue, 00055 SaveStop, 00056 ReleaseStop 00057 }; 00058 00062 MMessageHandler(); 00063 00067 virtual ~MMessageHandler(); 00068 00072 void addBuffer(MMessageBuffer* buf); 00073 00080 void removeBuffer(MMessageBuffer* buf, bool all=true); 00081 00085 void clearBuffers(); 00086 00091 void setStartIndex(const mvar& index); 00092 00097 void setEndIndex(const mvar& index); 00098 00103 const mvar& startIndex() const; 00104 00109 const mvar& endIndex() const; 00110 00117 bool await(MMessageBuffer* buf); 00118 00126 bool await(MMessageBuffer* buf, const mtime& timeout); 00127 00131 void interrupt(); 00132 00136 void setAllowInterrupt(bool flag); 00137 00141 bool allowInterrupt(); 00142 00147 void handleMessages(); 00148 00159 virtual Action handleMessage(const MMessage* msg) = 0; 00160 00161 friend class MMessageHandler_; 00162 00163 private: 00164 MMessageHandler& operator=(const MMessageHandler&); 00165 MMessageHandler(const MMessageHandler&); 00166 00167 class MMessageHandler_* x_; 00168 }; 00169 00170 } // end namespace Meta 00171 00172 #endif // ANDROMETA_M_MESSAGE_HANDLER_H
1.7.6.1