Equalizer  1.6.1
equalizer.h
1 
2 /* Copyright (c) 2012, Daniel Nachbaur <danielnachbaur@gmail.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 EQFABRIC_EQUALIZER_H
19 #define EQFABRIC_EQUALIZER_H
20 
21 #include <eq/fabric/api.h>
22 #include <eq/fabric/vmmlib.h>
23 
24 namespace co
25 {
26  class DataOStream;
27  class DataIStream;
28 }
29 
30 
31 namespace eq
32 {
33 namespace fabric
34 {
35 namespace detail { class Equalizer; }
36 
38  class Equalizer
39  {
40  public:
42  EQFABRIC_API Equalizer();
43 
45  EQFABRIC_API Equalizer( const Equalizer& rhs );
46 
48  EQFABRIC_API Equalizer& operator=( const Equalizer& rhs );
49 
51  EQFABRIC_API virtual ~Equalizer();
52 
53  enum Mode
54  {
55  MODE_DB = 0,
59  };
60 
64  EQFABRIC_API void setFrozen( const bool onOff );
65 
67  EQFABRIC_API bool isFrozen() const;
68 
70  EQFABRIC_API void setMode( const Mode mode );
71 
73  EQFABRIC_API Mode getMode() const;
74 
76  EQFABRIC_API void setDamping( const float damping );
77 
79  EQFABRIC_API float getDamping() const;
80 
82  EQFABRIC_API void setFrameRate( const float frameRate );
83 
85  EQFABRIC_API float getFrameRate() const;
86 
88  EQFABRIC_API void setBoundary( const Vector2i& boundary );
89 
91  EQFABRIC_API void setBoundary( const float boundary );
92 
94  EQFABRIC_API const Vector2i& getBoundary2i() const;
95 
97  EQFABRIC_API float getBoundaryf() const;
98 
100  EQFABRIC_API void setResistance( const Vector2i& resistance );
101 
103  EQFABRIC_API void setResistance( const float resistance );
104 
106  EQFABRIC_API const Vector2i& getResistance2i() const;
107 
109  EQFABRIC_API float getResistancef() const;
110 
112  EQFABRIC_API void setAssembleOnlyLimit( const float limit );
113 
115  EQFABRIC_API float getAssembleOnlyLimit() const;
116 
118  EQFABRIC_API void setTileSize( const Vector2i& size );
119 
121  EQFABRIC_API const Vector2i& getTileSize() const;
123 
124  EQFABRIC_API void serialize( co::DataOStream& os ) const;
125  EQFABRIC_API void deserialize( co::DataIStream& is );
126 
127  EQFABRIC_API void backup();
128  EQFABRIC_API void restore();
129 
130  private:
131  detail::Equalizer* _data;
132  detail::Equalizer* _backup;
133  };
134 
135  EQFABRIC_API co::DataOStream& operator << ( co::DataOStream& os,
136  const Equalizer& );
137 
138  EQFABRIC_API co::DataIStream& operator >> ( co::DataIStream& is,
139  Equalizer& );
140 
141  EQFABRIC_API std::ostream& operator << ( std::ostream& os,
142  const Equalizer::Mode );
143 }
144 }
145 
146 namespace lunchbox
147 {
148 template<> inline void byteswap( eq::fabric::Equalizer::Mode& value )
149  { byteswap( reinterpret_cast< uint32_t& >( value )); }
150 }
151 
152 #endif // EQFABRIC_EQUALIZER_H
void setBoundary(const Vector2i &boundary)
Set a boundary for 2D tiles.
void setMode(const Mode mode)
Set the load balancer adaptation mode.
float getDamping() const
bool isFrozen() const
Adapt for sort-first using vertical stripes.
Definition: equalizer.h:57
float getFrameRate() const
float getBoundaryf() const
Adapt for a sort-last decomposition.
Definition: equalizer.h:55
const Vector2i & getTileSize() const
float getResistancef() const
const Vector2i & getResistance2i() const
Adapt for sort-first using horizontal stripes.
Definition: equalizer.h:56
float getAssembleOnlyLimit() const
void setResistance(const Vector2i &resistance)
Set a resistance for 2D tiles.
Mode getMode() const
Base data transport class for equalizers.
Definition: equalizer.h:38
void setTileSize(const Vector2i &size)
Set the tile size for the TileEqualizer.
Adapt for a sort-first decomposition.
Definition: equalizer.h:58
void setDamping(const float damping)
Set the damping factor for the viewport, range or zoom adjustment.
void setFrameRate(const float frameRate)
Set the average frame rate for the DFREqualizer.
void setAssembleOnlyLimit(const float limit)
Set the limit when to assign assemble tasks only.
const Vector2i & getBoundary2i() const
void setFrozen(const bool onOff)
Set the equalizer to freeze the current state.
vmml::vector< 2, int > Vector2i
A two-component integer vector.
Definition: vmmlib.h:40