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 <eq/server/api.h>
23 : #include "types.h"
24 : #include "visitorResult.h" // enum
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 442 : bool isStopped() const { return _state == STATE_STOPPED; }
55 :
56 : /** @return true if this canvas is initialized. */
57 : bool isRunning() const { return _state == STATE_RUNNING; }
58 :
59 : /** @return true if this canvas should be deleted. */
60 8 : bool needsDelete() const { return _state == STATE_DELETE; }
61 : //@}
62 :
63 : /**
64 : * @name Operations
65 : */
66 : //@{
67 : void init();
68 : void exit();
69 :
70 : /** Schedule deletion of this canvas. */
71 : void postDelete();
72 : //@}
73 :
74 : protected:
75 : virtual void activateLayout( const uint32_t index );
76 :
77 : private:
78 : enum State
79 : {
80 : STATE_STOPPED = 0, // next: RUNNING
81 : STATE_RUNNING, // next: STOPPED or DELETE
82 : STATE_DELETE, // next: destructor
83 : }
84 : _state;
85 :
86 : struct Private;
87 : Private* _private; // placeholder for binary-compatible changes
88 :
89 : /** Run-time layout switch */
90 : void _switchLayout( const uint32_t oldIndex, const uint32_t newIndex );
91 :
92 : };
93 :
94 : }
95 : }
96 : #endif // EQSERVER_CANVAS_H
|