PCMBuffer.h

Go to the documentation of this file.
00001 
00002 //
00003 // This source file is a part of ParCompMark
00004 // Parallel Compositing Benchmark Framework
00005 //
00006 // for latest info see http://parcompmark.sourceforge.net
00007 
00008 //
00009 // Copyright (C) 2006 IT2 ParCompMark Dev. Team
00010 // 
00011 // This program is free software; you can redistribute it and/or
00012 // modify it under the terms of the GNU General Public License
00013 // as published by the Free Software Foundation; either version 2
00014 // of the License, or (at your option) any later version.
00015 // 
00016 // This program is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00019 // GNU General Public License for more details.
00020 // 
00021 // You should have received a copy of the GNU General Public License
00022 // along with this program; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00024 
00027 
00028 #ifndef __PCM_BUFFER_H__
00029 #  define __PCM_BUFFER_H__
00030 
00031 //
00032 // Inner includes
00033 //
00034 
00035 #  include "PCMPremeditations.h"
00036 
00037 #  include "PCMException.h"
00038 
00039 #  include "PCMLogger.h"
00040 
00041 #  include "PCMPointer.h"
00042 
00043 //
00044 // Outer includes
00045 //
00046 
00047 #  include <pcapi.h>
00048 
00049 //
00050 // Scripting bind includes (for Squirrel)
00051 //
00052 
00053 #  include <squirrel/squirrel.h>
00054 #  include <squirrel/sqstdio.h>
00055 #  include <squirrel/sqstdaux.h>
00056 #  include <squirrel/sqplus.h>
00057 
00058 namespace ParCompMark
00059 {
00060 
00067   class Buffer
00068   {
00069 
00070         //
00071         // Unit test class
00072         //
00073 #  ifdef PARCOMPMARK_TEST
00074         friend class ParCompMarkTest::TestBuffer;
00075 #  endif
00076 
00077         //
00078         // Scripting binding (for Squirrel)
00079         //
00080 
00082 
00083 
00091    public:static void squirrelGlue()
00092         {
00093          ::SqPlus::SQClassDef < Buffer > (_T("Buffer")).func(&Buffer::getLeft, _T("getLeft")).func(&Buffer::setLeft,
00094                                                                                                   _T("setLeft")).
00095                 func(&Buffer::getTop, _T("getTop")).func(&Buffer::setTop, _T("setTop")).func(&Buffer::getWidth,
00096                                                                                           _T("getWidth")).
00097                 func(&Buffer::setWidth, _T("setWidth")).func(&Buffer::getHeight,
00098                                                           _T("getHeight")).func(&Buffer::setHeight,
00099                                                                                  _T("setHeight")).
00100                 func(&Buffer::getDepthFormat, _T("getDepthFormat")).func(&Buffer::setDepthFormat, _T("setDepthFormat"));
00101         }
00102 
00104 
00105         //
00106         // Typedefs
00107         //
00108 
00109    public:
00110 
00112         typedef Pointer < Buffer,
00113         Mutex > Pointer;
00114 
00115         //
00116         // Variables
00117         //
00118 
00120 
00121 
00122    protected:
00123 
00129         Node * mParent;
00130 
00136         PCuint mLeft;
00137 
00143         PCuint mTop;
00144 
00150         PCuint mWidth;
00151 
00157         PCuint mHeight;
00158 
00164         bool mOwnPointers;
00165 
00171         PCuint *mColour;
00172 
00178         void *mDepth;
00179 
00185         PCint mDepthFormat;
00186 
00192         PCint mOutputRowPixel;
00193 
00199         bool mInitialized;
00200 
00202 
00203         //
00204         // Constructors & destructor
00205         //
00206 
00208 
00209 
00210    public:
00211 
00215         Buffer();
00216 
00226         Buffer(const PCuint & left, const PCuint & top, const PCuint & width,
00227                  const PCuint & height, const PCuint & depthFormat, Node * parent);
00228 
00232         virtual ~ Buffer();
00233 
00235 
00236         //
00237         // Getters & setters
00238         //
00239 
00241 
00242 
00243    public:
00244 
00250         Node * getParent() const;
00251 
00257         const PCuint & getLeft() const;
00258 
00264         void setLeft(const PCuint left);
00265 
00271         const PCuint & getTop() const;
00272 
00278         void setTop(const PCuint top);
00279 
00285         const PCuint & getWidth() const;
00286 
00292         void setWidth(const PCuint width);
00293 
00299         const PCuint & getHeight() const;
00300 
00306         void setHeight(const PCuint height);
00307 
00313         const bool & getOwnPointers() const;
00314 
00320         PCuint *getColour();
00321 
00327         void setColour(const PCuint * colour);
00328 
00334         void *getDepth();
00335 
00341         void setDepth(const void *depth);
00342 
00348         const PCint & getDepthFormat() const;
00349 
00355         void setDepthFormat(const PCint depthformat);
00356 
00362         const PCint & getOutputRowPixel() const;
00363 
00369         void setOutputRowPixel(const PCint & outputrowpixel);
00370 
00376         const bool & getInitialized() const;
00377 
00379 
00380         //
00381         // Methods
00382         //
00383 
00385 
00386 
00387    public:
00388 
00392         virtual void initialize();
00393 
00397         virtual void finalize();
00398 
00403         virtual void saveToFile(const std::string & filename);
00404 
00405    protected:
00406 
00410         virtual void freeBuffers();
00411 
00413 
00414   };
00415 
00416   //
00417   // Include header implementation
00418   //
00419 
00420 #  include "PCMBuffer_impl.h"
00421 
00422 }
00423 
00424 // Declare Buffer class (and its enums) for SqPlus binding
00426 DECLARE_INSTANCE_TYPE_NAME(ParCompMark::Buffer, Buffer);
00427 
00428 #endif