Collage  0.6.1
compressor.h
00001 
00002 /* Copyright (c) 2010, Cedric Stalder <cedric.stalder@gmail.com>
00003  *               2010-2012, Stefan Eilemann <eile@eyescale.ch>
00004  *
00005  * This library is free software; you can redistribute it and/or modify it under
00006  * the terms of the GNU Lesser General Public License version 2.1 as published
00007  * by the Free Software Foundation.
00008  *  
00009  * This library is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00012  * details.
00013  * 
00014  * You should have received a copy of the GNU Lesser General Public License
00015  * along with this library; if not, write to the Free Software Foundation, Inc.,
00016  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00017  */
00018 
00019 #ifndef CO_COMPRESSOR_H
00020 #define CO_COMPRESSOR_H
00021 
00022 #include <co/api.h>
00023 #include <co/types.h>
00024 #include <lunchbox/thread.h>         // thread-safety macros
00025 
00026 namespace co
00027 {
00029     class Compressor
00030     {
00031     public:
00032 
00034         CO_API Compressor();
00035 
00037         CO_API virtual ~Compressor();
00038 
00045         CO_API bool initCompressor( uint32_t name );
00046 
00053         CO_API bool initDecompressor( uint32_t name );
00054 
00056         Plugin* getPlugin() { return _plugin; }
00057         
00059         uint32_t getName() const { return _name; }
00060 
00063         virtual CO_API bool isValid( uint32_t name ) const;
00064 
00066         CO_API void reset();
00067 
00069         CO_API float getQuality() const;
00070 
00072         const CompressorInfo& getInfo() const
00073             { LBASSERT( _info ); return *_info; }
00074 
00075     protected:
00077         uint32_t _name;    
00078 
00080         Plugin* _plugin;  
00081         
00083         void* _instance;
00084 
00086         const CompressorInfo* _info;
00087 
00089         enum State
00090         {
00091             STATE_FREE,
00092             STATE_COMPRESSOR,
00093             STATE_DECOMPRESSOR
00094         } _state;
00095 
00101         Plugin* _findPlugin( uint32_t name );
00102 
00103         LB_TS_VAR( _thread );
00104     };
00105 }
00106 #endif  // CO_COMPRESSOR_H
Generated on Mon Nov 26 2012 14:41:44 for Collage 0.6.1 by  doxygen 1.7.6.1