Collage
0.6.1
|
00001 00002 /* Copyright (c) 2009-2010, Cedric Stalder <cedric.stalder@gmail.com> 00003 * 2009-2012, Stefan Eilemann <eile@equalizergraphics.com> 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_PLUGIN_H 00020 #define CO_PLUGIN_H 00021 00022 #include <co/plugins/compressor.h> // member 00023 #include <co/types.h> 00024 #include <lunchbox/dso.h> // member 00025 00026 namespace co 00027 { 00032 class Plugin : public lunchbox::NonCopyable 00033 { 00034 public: 00035 typedef size_t ( *GetNumCompressors_t ) (); 00036 typedef void ( *GetInfo_t ) ( const size_t, EqCompressorInfo* const ); 00037 typedef void* ( *NewCompressor_t ) ( const unsigned ); 00038 typedef void ( *DeleteCompressor_t ) ( void* const ); 00039 typedef void* ( *NewDecompressor_t ) ( const unsigned ); 00040 typedef void ( *DeleteDecompressor_t ) ( void* const ); 00041 typedef void ( *Compress_t ) ( void* const, const unsigned, 00042 void* const, const uint64_t*, 00043 const uint64_t ); 00044 typedef unsigned ( *GetNumResults_t ) ( void* const, const unsigned ); 00045 typedef void ( *GetResult_t ) ( void* const, const unsigned, 00046 const unsigned, void** const, 00047 uint64_t* const ); 00048 typedef void ( *Decompress_t ) ( void* const, const unsigned, 00049 const void* const*, 00050 const uint64_t* const, 00051 const unsigned, void* const, 00052 uint64_t* const, 00053 const uint64_t ); 00054 typedef bool ( *IsCompatible_t ) ( const unsigned, const GLEWContext* ); 00055 typedef void ( *Download_t )( void* const, const unsigned, 00056 const GLEWContext*, const uint64_t*, 00057 const unsigned, const uint64_t, 00058 uint64_t*, void** ); 00059 typedef void ( *StartDownload_t )( void* const, const unsigned, 00060 const GLEWContext*, const uint64_t*, 00061 const unsigned, const uint64_t ); 00062 typedef void ( *FinishDownload_t )( void* const, const unsigned, 00063 const GLEWContext*, const uint64_t*, 00064 const uint64_t, uint64_t*, void** ); 00065 typedef void ( *Upload_t )( void* const, const unsigned, 00066 const GLEWContext*, const void*, 00067 const uint64_t*, 00068 const uint64_t, const uint64_t*, 00069 const unsigned ); 00070 00071 Plugin(){} 00072 00074 bool init( const std::string& libraryName ); 00075 00077 void exit(); 00078 00080 void initChildren(); 00081 00083 GetNumCompressors_t getNumCompressors; 00084 00086 NewCompressor_t newCompressor; 00087 00089 NewDecompressor_t newDecompressor; 00090 00092 DeleteCompressor_t deleteCompressor; 00093 00095 DeleteDecompressor_t deleteDecompressor; 00096 00098 Compress_t compress; 00099 00101 Decompress_t decompress; 00102 00104 GetNumResults_t getNumResults; 00105 00107 GetResult_t getResult; 00108 00110 IsCompatible_t isCompatible; 00111 00113 Download_t download; 00114 00116 Upload_t upload; 00117 00119 StartDownload_t startDownload; 00120 00122 FinishDownload_t finishDownload; 00123 00125 bool implementsType( const uint32_t name ) const; 00126 00128 const CompressorInfos& getInfos() const { return _infos; } 00129 00131 const CompressorInfo& findInfo( const uint32_t name ) const; 00132 00133 private: 00134 CompressorInfos _infos; 00135 lunchbox::DSO _dso; 00136 }; 00137 } 00138 00139 #endif //CO_PLUGIN_H