Line data Source code
1 :
2 : /* Copyright (c) 2009-2015, Stefan Eilemann <eile@equalizergraphics.com>
3 : * Cedric Stalder <cedric.stalder@gmail.com>
4 : *
5 : * This library is free software; you can redistribute it and/or modify it under
6 : * the terms of the GNU Lesser General Public License version 2.1 as published
7 : * by the Free Software Foundation.
8 : *
9 : * This library is distributed in the hope that it will be useful, but WITHOUT
10 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 : * details.
13 : *
14 : * You should have received a copy of the GNU Lesser General Public License
15 : * along with this library; if not, write to the Free Software Foundation, Inc.,
16 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 : */
18 :
19 : #ifndef EQSERVER_CANVAS_H
20 : #define EQSERVER_CANVAS_H
21 :
22 : #include "types.h"
23 : #include "visitorResult.h" // enum
24 : #include <eq/server/api.h>
25 :
26 : #include <eq/fabric/canvas.h> // base class
27 :
28 : #include <lunchbox/api.h>
29 : #include <string>
30 :
31 : namespace eq
32 : {
33 : namespace server
34 : {
35 : /** The canvas. @sa eq::Canvas */
36 : class Canvas : public fabric::Canvas<Config, Canvas, Segment, Layout>
37 : {
38 : public:
39 : /** Construct a new Canvas. */
40 : EQSERVER_API explicit Canvas(Config* parent);
41 :
42 : /** Destruct this canvas. */
43 : virtual ~Canvas();
44 :
45 : /** @name Data Access */
46 : //@{
47 : /** @return the Server of this canvas. @version 1.0 */
48 : ServerPtr getServer();
49 :
50 : /** @return the segment of the given path. */
51 : Segment* getSegment(const SegmentPath& path);
52 :
53 : /** @return true if this canvas is initialized. */
54 420 : bool isStopped() const { return _state == STATE_STOPPED; }
55 : /** @return true if this canvas is initialized. */
56 : bool isRunning() const { return _state == STATE_RUNNING; }
57 : /** @return true if this canvas should be deleted. */
58 8 : bool needsDelete() const { return _state == STATE_DELETE; }
59 : //@}
60 :
61 : /**
62 : * @name Operations
63 : */
64 : //@{
65 : void init();
66 : void exit();
67 :
68 : /** Schedule deletion of this canvas. */
69 : void postDelete();
70 : //@}
71 :
72 : protected:
73 : virtual void activateLayout(const uint32_t index);
74 :
75 : private:
76 : enum State
77 : {
78 : STATE_STOPPED = 0, // next: RUNNING
79 : STATE_RUNNING, // next: STOPPED or DELETE
80 : STATE_DELETE, // next: destructor
81 : } _state;
82 :
83 : struct Private;
84 : Private* _private; // placeholder for binary-compatible changes
85 :
86 : /** Run-time layout switch */
87 : void _switchLayout(const uint32_t oldIndex, const uint32_t newIndex);
88 : };
89 : }
90 : }
91 : #endif // EQSERVER_CANVAS_H
|