Line data Source code
1 :
2 : /* Copyright (c) 2010-2013, Stefan Eilemann <eile@eyescale.ch>
3 : *
4 : * This library is free software; you can redistribute it and/or modify it under
5 : * the terms of the GNU Lesser General Public License version 2.1 as published
6 : * by the Free Software Foundation.
7 : *
8 : * This library is distributed in the hope that it will be useful, but WITHOUT
9 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 : * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
11 : * details.
12 : *
13 : * You should have received a copy of the GNU Lesser General Public License
14 : * along with this library; if not, write to the Free Software Foundation, Inc.,
15 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
16 : */
17 :
18 : #ifndef EQSERVER_STATE_H
19 : #define EQSERVER_STATE_H
20 :
21 : #include <lunchbox/log.h>
22 : #include <lunchbox/types.h>
23 :
24 : namespace eq
25 : {
26 : namespace server
27 : {
28 : /**
29 : * Running state of a resource entity.
30 : * <img src="http://www.equalizergraphics.com/documents/design/images/serverState.png">
31 : */
32 : enum State
33 : {
34 : STATE_UNUSED = LB_BIT1, //!< next: STOPPED
35 : STATE_STOPPED = LB_BIT2, //!< next: INITIALIZING or UNUSED
36 : STATE_INITIALIZING = LB_BIT3, //!< next: INIT_FAILED or INIT_SUCCESS
37 : STATE_INIT_SUCCESS = LB_BIT4, //!< next: RUNNING
38 : STATE_INIT_FAILED = LB_BIT5, //!< next: EXITING
39 : STATE_RUNNING = LB_BIT6, //!< next: EXITING
40 : STATE_EXITING = LB_BIT7, //!< next: EXIT_FAILED or EXIT_SUCCESS
41 : STATE_EXIT_SUCCESS = LB_BIT8, //!< next: STOPPED or FAILED
42 : STATE_EXIT_FAILED = LB_BIT9, //!< next: STOPPED or FAILED
43 : STATE_FAILED = LB_BIT10, //!< next: STOPPED
44 : STATE_DELETE = LB_BIT16 //!< additional modifier
45 : };
46 :
47 0 : inline std::ostream& operator << ( std::ostream& os, const State& state )
48 : {
49 0 : if( state & STATE_UNUSED )
50 0 : os << "unused";
51 0 : if( state & STATE_STOPPED )
52 0 : os << "stopped";
53 0 : if( state & STATE_INITIALIZING )
54 0 : os << "initializing";
55 0 : if( state & STATE_INIT_SUCCESS )
56 0 : os << "init successful";
57 0 : if( state & STATE_INIT_FAILED )
58 0 : os << "failed";
59 0 : if( state & STATE_RUNNING )
60 0 : os << "running";
61 0 : if( state & STATE_EXITING )
62 0 : os << "exiting";
63 0 : if( state & STATE_EXIT_SUCCESS )
64 0 : os << "exit successful";
65 0 : if( state & STATE_EXIT_FAILED )
66 0 : os << "exit failed";
67 0 : if( state & STATE_FAILED )
68 0 : os << "failed";
69 0 : if( state & STATE_DELETE )
70 0 : os << "scheduled for deletion";
71 :
72 0 : return os;
73 : }
74 : }
75 : }
76 : #endif // EQ_STATE_H
|