Line data Source code
1 :
2 : /* Copyright (c) 2008-2015, 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 <eq/server/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 frame. It
36 : * has to subscribe to the statistics events needed to perform its tasks itself.
37 : */
38 : class Equalizer : public fabric::Equalizer, protected CompoundListener
39 : {
40 : public:
41 : Equalizer();
42 : explicit Equalizer( const fabric::Equalizer& );
43 : explicit Equalizer( const Equalizer& );
44 :
45 : // cppcheck-suppress passedByValue
46 : Equalizer& operator = ( const fabric::Equalizer& );
47 : virtual ~Equalizer();
48 :
49 : /** Output to a stream. */
50 : virtual void toStream( std::ostream& os ) const = 0;
51 :
52 : /** @return the compound attached to. */
53 0 : const Compound* getCompound() const { return _compound; }
54 132 : Compound* getCompound() { return _compound; }
55 :
56 : /** @return the config. */
57 : const Config* getConfig() const;
58 :
59 : /** Attach to a compound and detach the previous compound. */
60 : virtual void attach( Compound* );
61 :
62 0 : void setActive( bool flag ) { _active = flag; }
63 0 : bool isActive() const { return _active; }
64 :
65 : virtual uint32_t getType() const = 0;
66 :
67 : private:
68 : // override in sub-classes to handle dynamic compounds.
69 0 : void notifyChildAdded( Compound*, Compound* ) override
70 0 : { LBUNIMPLEMENTED }
71 0 : void notifyChildRemove( Compound*, Compound* ) override
72 0 : { LBUNIMPLEMENTED }
73 :
74 : Compound* _compound; //!< The attached compound
75 : bool _active;
76 : };
77 :
78 138 : inline std::ostream& operator << ( std::ostream& os, const Equalizer* eq )
79 : {
80 138 : if( eq )
81 138 : eq->toStream( os );
82 138 : return os;
83 : }
84 : }
85 : }
86 :
87 : #endif // EQSERVER_EQUALIZER_H
|