Line data Source code
1 :
2 : /* Copyright (c) 2009-2011, Stefan Eilemann <eile@equalizergraphics.com>
3 : * 2010, 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 "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 Canvas( Config* parent );
41 :
42 : /** Destruct this canvas. */
43 : virtual ~Canvas();
44 :
45 : /**
46 : * @name Data Access
47 : */
48 : //@{
49 : /** @return the Server of this canvas. @version 1.0 */
50 : ServerPtr getServer();
51 :
52 : /** @return the segment of the given path. */
53 : Segment* getSegment( const SegmentPath& path );
54 :
55 : /** @return true if this canvas is initialized. */
56 223 : bool isStopped() const { return _state == STATE_STOPPED; }
57 :
58 : /** @return true if this canvas is initialized. */
59 : bool isRunning() const { return _state == STATE_RUNNING; }
60 :
61 : /** @return true if this canvas should be deleted. */
62 32 : bool needsDelete() const { return _state == STATE_DELETE; }
63 : //@}
64 :
65 : /**
66 : * @name Operations
67 : */
68 : //@{
69 : void init();
70 : void exit();
71 :
72 : /** Schedule deletion of this canvas. */
73 : void postDelete();
74 : //@}
75 :
76 : protected:
77 : virtual void activateLayout( const uint32_t index );
78 :
79 : private:
80 : enum State
81 : {
82 : STATE_STOPPED = 0, // next: RUNNING
83 : STATE_RUNNING, // next: STOPPED or DELETE
84 : STATE_DELETE, // next: destructor
85 : }
86 : _state;
87 :
88 : struct Private;
89 : Private* _private; // placeholder for binary-compatible changes
90 :
91 : /** Run-time layout switch */
92 : void _switchLayout( const uint32_t oldIndex, const uint32_t newIndex );
93 :
94 : };
95 :
96 : }
97 : }
98 : #endif // EQSERVER_CANVAS_H
|