Line data Source code
1 :
2 : /* Copyright (c) 2008-2011, Stefan Eilemann <eile@equalizergraphics.com>
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_EQUALIZER_H
19 : #define EQSERVER_EQUALIZER_H
20 :
21 : #include "../api.h"
22 : #include "../compoundListener.h" // base class
23 : #include "../types.h"
24 : #include <eq/fabric/equalizer.h> // base class
25 : #include <eq/fabric/equalizerTypes.h>
26 :
27 : namespace eq
28 : {
29 : namespace server
30 : {
31 : /**
32 : * A generic equalizer interface.
33 : *
34 : * An equalizer is attached to a compound tree, on which it balances render
35 : * tasks. It can update its compound tree on the beginnning of each
36 : * frame. It has to subscribe to the statistics events needed to perform its
37 : * tasks itself.
38 : */
39 : class Equalizer : public fabric::Equalizer, protected CompoundListener
40 : {
41 : public:
42 : Equalizer();
43 : Equalizer( const fabric::Equalizer& );
44 : Equalizer( const Equalizer& );
45 : Equalizer& operator=( const fabric::Equalizer& );
46 : virtual ~Equalizer();
47 :
48 : /** Output to a stream. */
49 : virtual void toStream( std::ostream& os ) const = 0;
50 :
51 : /** @return the compound attached to. */
52 0 : const Compound* getCompound() const { return _compound; }
53 75 : Compound* getCompound() { return _compound; }
54 :
55 : /** @return the config. */
56 : const Config* getConfig() const;
57 :
58 : /** Attach to a compound and detach the previous compound. */
59 : virtual void attach( Compound* );
60 :
61 0 : void setActive( bool flag ) { _active = flag; }
62 9 : bool isActive() const { return _active; }
63 :
64 : virtual uint32_t getType() const = 0;
65 :
66 : private:
67 : // override in sub-classes to handle dynamic compounds.
68 0 : void notifyChildAdded( Compound*, Compound* ) override
69 0 : { LBUNIMPLEMENTED }
70 0 : void notifyChildRemove( Compound*, Compound* ) override
71 0 : { LBUNIMPLEMENTED }
72 :
73 : Compound* _compound; //!< The attached compound
74 : bool _active;
75 : };
76 :
77 164 : inline std::ostream& operator << ( std::ostream& os, const Equalizer* eq )
78 : {
79 164 : if( eq )
80 164 : eq->toStream( os );
81 164 : return os;
82 : }
83 : }
84 : }
85 :
86 : #endif // EQSERVER_EQUALIZER_H
|