Audacity 3.2.0
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> // member variable
40#include <wx/string.h> // member variable
41
42class wxMutex;
43class wxCondition;
44class wxMutexLocker;
45
46class 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:
69
70 void AddResponse(Response response);
72};
73
74#endif /* End of include guard: __RESPONSEQUEUE__ */
Stores a command response string (and other response data if it becomes necessary)
Definition: ResponseQueue.h:46
wxString GetMessage()
Definition: ResponseQueue.h:54
std::string mMessage
Definition: ResponseQueue.h:48
Response(const wxString &response)
Definition: ResponseQueue.h:50
Allow messages to be sent from the main thread to the script thread.
Definition: ResponseQueue.h:60
std::queue< Response > mResponses
Definition: ResponseQueue.h:62
Response WaitAndGetResponse()
void AddResponse(Response response)
wxMutex mMutex
Definition: ResponseQueue.h:63
wxCondition mCondition
Definition: ResponseQueue.h:64