Audacity  2.3.1
ResponseQueue.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity - A Digital Audio Editor
4  Copyright 1999-2009 Audacity Team
5  License: wxWidgets
6 
7  Dan Horgan
8 
9 ******************************************************************//****************************************************************//****************************************************************//*******************************************************************/
33 
34 #ifndef __RESPONSEQUEUE__
35 #define __RESPONSEQUEUE__
36 
37 #include <queue>
38 #include <string>
39 #include <wx/thread.h>
40 #include <wx/string.h>
41 
42 class wxMutex;
43 class wxCondition;
44 class wxMutexLocker;
45 
46 class Response {
47  private:
48  std::string mMessage;
49  public:
50  Response(const wxString &response)
51  : mMessage(response.utf8_str())
52  { }
53 
54  wxString GetMessage()
55  {
56  return wxString(mMessage.c_str(), wxConvUTF8);
57  }
58 };
59 
61  private:
62  std::queue<Response> mResponses;
63  wxMutex mMutex;
64  wxCondition mCondition;
65 
66  public:
67  ResponseQueue();
69 
70  void AddResponse(Response response);
72 };
73 
74 #endif /* End of include guard: __RESPONSEQUEUE__ */
void AddResponse(Response response)
wxMutex mMutex
Definition: ResponseQueue.h:63
std::string mMessage
Definition: ResponseQueue.h:48
wxCondition mCondition
Definition: ResponseQueue.h:64
Response WaitAndGetResponse()
std::queue< Response > mResponses
Definition: ResponseQueue.h:62
Allow messages to be sent from the main thread to the script thread.
Definition: ResponseQueue.h:60
wxString GetMessage()
Definition: ResponseQueue.h:54
Stores a command response string (and other response data if it becomes necessary) ...
Definition: ResponseQueue.h:46
Response(const wxString &response)
Definition: ResponseQueue.h:50