test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
37 class FWTEveViewer : public TEveViewer
38 {
39 
40 public:
41  FWTEveViewer(const char* n="FWTEveViewer", const char* t="");
42  virtual ~FWTEveViewer();
43 
44  // ---------- const member functions ---------------------
45 
46  // ---------- static member functions --------------------
47 
48  static bool SavePng(const TString& file, UChar_t* xx, int ww, int hh);
49  static bool SaveJpg(const TString& file, UChar_t* xx, int ww, int hh);
50 
51  // ---------- member functions ---------------------------
52 
54 
56 
57  std::future<int> CaptureAndSaveImage(const TString& file, int height=-1);
58 
59 private:
60  FWTEveViewer(const FWTEveViewer&); // stop default
61 
62  const FWTEveViewer& operator=(const FWTEveViewer&); // stop default
63 
64  void spawn_image_thread();
65 
66  // ---------- member data --------------------------------
67 
69 
70  std::vector<unsigned char> m_imgBuffer;
71 
72  TString m_name;
73  int m_ww, m_hh;
74  bool m_thr_exit = false;
75  std::thread *m_thr = 0;
76  std::promise<int> m_prom;
78  std::condition_variable m_cnd;
79 };
80 
81 
82 #endif
std::mutex m_moo
Definition: FWTEveViewer.h:77
TString m_name
Definition: FWTEveViewer.h:72
std::condition_variable m_cnd
Definition: FWTEveViewer.h:78
std::thread * m_thr
Definition: FWTEveViewer.h:75
static boost::mutex mutex
Definition: LHEProxy.cc:11
std::vector< unsigned char > m_imgBuffer
Definition: FWTEveViewer.h:70
const FWTEveViewer & operator=(const FWTEveViewer &)
FWTEveViewer(const char *n="FWTEveViewer", const char *t="")
Definition: FWTEveViewer.cc:39
FWTGLViewer * fwGlViewer()
Definition: FWTEveViewer.h:53
std::promise< int > m_prom
Definition: FWTEveViewer.h:76
static bool SaveJpg(const TString &file, UChar_t *xx, int ww, int hh)
virtual ~FWTEveViewer()
Definition: FWTEveViewer.cc:49
std::future< int > CaptureAndSaveImage(const TString &file, int height=-1)
FWTGLViewer * m_fwGlViewer
Definition: FWTEveViewer.h:68
static bool SavePng(const TString &file, UChar_t *xx, int ww, int hh)
FWTGLViewer * SpawnFWTGLViewer()
void spawn_image_thread()
Definition: FWTEveViewer.cc:81