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 "../compoundListener.h" // base class
22 : #include "../types.h"
23 : #include <eq/fabric/equalizer.h> // base class
24 : #include <eq/fabric/equalizerTypes.h>
25 : #include <eq/server/api.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 4 : const Compound* getCompound() const { return _compound; }
54 162 : Compound* getCompound() { return _compound; }
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 4 : bool isActive() const { return _active; }
63 : virtual uint32_t getType() const = 0;
64 :
65 : private:
66 : // override in sub-classes to handle dynamic compounds.
67 0 : void notifyChildAdded(Compound*, Compound*) override { LBUNIMPLEMENTED }
68 0 : void notifyChildRemove(Compound*, Compound*) override { LBUNIMPLEMENTED }
69 : Compound* _compound; //!< The attached compound
70 : bool _active;
71 : };
72 :
73 174 : inline std::ostream& operator<<(std::ostream& os, const Equalizer* eq)
74 : {
75 174 : if (eq)
76 174 : eq->toStream(os);
77 174 : return os;
78 : }
79 : }
80 : }
81 :
82 : #endif // EQSERVER_EQUALIZER_H
|