Free Electron
MOAViewer.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #pragma once
8 
9 namespace fe
10 {
11 namespace ext
12 {
13 
14 /**
15  * MOA compatible Viewer.
16  */
17 class FE_DL_EXPORT MOAViewer :
18  public ThreadedViewerI,
19  public Initialize<MOAViewer>
20 {
21 public:
22  MOAViewer() : viewerTask(*this), isOpen(false) {};
23  ~MOAViewer();
24  void initialize();
25 
26  void open(sp<OrchestratorI> orchestrator) override;
27  void close() override;
28 
29  Real frameRate(void) const override { return 24; }; //temp implementation
30 
31 private:
32  /**
33  * Worker object for the internal viewer worker.
34  */
35  class ViewerTask : public Thread::Functor
36  {
37  public:
38  ViewerTask(MOAViewer& a_parent) : parent(a_parent) {};
39 
40  /** Setup the task. Creates everything neccessary. */
41  void setup();
42 
43  virtual void operate(void) override;
44 
45  /** Poison to kill the thread */
47 
48  /** Used for signalling, scope and dataset. */
50 
51  private:
52  /** A reference to the outer component. Required to access the registry. */
54 
55  /** Accessors for viewport data. */
57  /** Heartbeat layout for window event signaling. */
59 
60  sp<WindowI> window;
61  sp<CameraI> camera;
62  sp<CameraControllerI> controller;
63  sp<SignalerI> signaler;
64  };
65 
66  /** Is the viewer window open? */
67  bool isOpen;
68  /** The worker object. */
70  /** The worker thread. */
71  Thread *viewerThread;
72 
73  /** The window events run on their own scope for now. */
75 
76  /**
77  * Get the default background color.
78  *
79  * Can be set using the FE_VIEWER_BG_COLOR environment variable.
80  */
81  Color getDefaultBgColor() const;
82 };
83 
84 } /* namespace ext */
85 } /* namespace fe */
bool isOpen
Is the viewer window open?
Definition: MOAViewer.h:67
Viewer that runs on it&#39;s own thread.
Definition: ThreadedViewerI.h:17
Accessor Set for a viewport.
Definition: AsViewport.h:17
AsViewport viewportAccessorSet
Accessors for viewport data.
Definition: MOAViewer.h:56
kernel
Definition: namespace.dox:3
MOA compatible Viewer.
Definition: MOAViewer.h:17
Poison poison
Poison to kill the thread.
Definition: MOAViewer.h:46
Per-class participation in the Initialized <> mechanism.
Definition: Initialized.h:117
Special vector for color (RGBA)
Definition: Color.h:21
sp< OrchestratorI > orchestrator
Used for signalling, scope and dataset.
Definition: MOAViewer.h:49
sp< Layout > heartbeatLayout
Heartbeat layout for window event signaling.
Definition: MOAViewer.h:58
Real frameRate(void) const override
Returns frames per seconds.
Definition: MOAViewer.h:29
sp< Scope > windowScope
The window events run on their own scope for now.
Definition: MOAViewer.h:74
Death pill for threads.
Definition: Poison.h:15
ViewerTask viewerTask
The worker object.
Definition: MOAViewer.h:69
Thread * viewerThread
The worker thread.
Definition: MOAViewer.h:71
Intrusive Smart Pointer.
Definition: src/core/ptr.h:53
Worker object for the internal viewer worker.
Definition: MOAViewer.h:35
MOAViewer & parent
A reference to the outer component.
Definition: MOAViewer.h:53