1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#ifndef Subsystem_Package_FWTEveViewer_h
#define Subsystem_Package_FWTEveViewer_h
// -*- C++ -*-
//
// Package: Subsystem/Package
// Class : FWTEveViewer
//
/**\class FWTEveViewer FWTEveViewer.h "FWTEveViewer.h"
Description: [one line class summary]
Usage:
<usage>
*/
//
// Original Author:
// Created: Tue, 03 Feb 2015 21:46:04 GMT
//
// system include files
#include <thread>
#include <future>
#include <mutex>
#include <condition_variable>
// user include files
#include "TEveViewer.h"
// forward declarations
class FWTGLViewer;
class FWTEveViewer : public TEveViewer {
public:
FWTEveViewer(const char* n = "FWTEveViewer", const char* t = "");
~FWTEveViewer() override;
// ---------- const member functions ---------------------
// ---------- static member functions --------------------
static bool SavePng(const TString& file, UChar_t* xx, int ww, int hh);
static bool SaveJpg(const TString& file, UChar_t* xx, int ww, int hh);
// ---------- member functions ---------------------------
FWTGLViewer* fwGlViewer() { return m_fwGlViewer; }
FWTGLViewer* SpawnFWTGLViewer();
std::future<int> CaptureAndSaveImage(const TString& file, int height = -1);
FWTEveViewer(const FWTEveViewer&) = delete; // stop default
const FWTEveViewer& operator=(const FWTEveViewer&) = delete; // stop default
private:
void spawn_image_thread();
// ---------- member data --------------------------------
FWTGLViewer* m_fwGlViewer;
std::vector<unsigned char> m_imgBuffer;
TString m_name;
int m_ww, m_hh;
bool m_thr_exit = false;
std::thread* m_thr = nullptr;
std::promise<int> m_prom;
std::mutex m_moo;
std::condition_variable m_cnd;
};
#endif
|