CMS 3D CMS Logo

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