Turi Create  4.0
io_buffer.hpp
1 /* Copyright © 2017 Apple Inc. All rights reserved.
2  *
3  * Use of this source code is governed by a BSD-3-clause license that can
4  * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5  */
6 #ifndef __TC_VISUALIZATION_IO_BUFFER
7 #define __TC_VISUALIZATION_IO_BUFFER
8 
9 #include <mutex>
10 #include <string>
11 #include <queue>
12 
13 namespace turi {
14  namespace visualization {
15  class io_buffer {
16  private:
17  std::mutex m_mutex;
18  std::queue<std::string> m_queue;
19 
20  public:
21  std::string read();
22  void write(const std::string&);
23  size_t size() const;
24  };
25 
26  }
27 }
28 
29 #endif // __TC_VISUALIZATION_IO_BUFFER