PCMContext.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_CONTEXT_H__
00029 #  define __PCM_CONTEXT_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 
00065   class Context
00066   {
00067 
00068         //
00069         // Unit test class
00070         //
00071 #  ifdef PARCOMPMARK_TEST
00072         friend class ParCompMarkTest::TestContext;
00073 #  endif
00074 
00075         //
00076         // Scripting binding (for Squirrel)
00077         //
00078 
00080 
00081 
00089    public:static void squirrelGlue()
00090         {
00091          ::SqPlus::SQClassDef < Context > (_T("Context")).func(&Context::setProcesses,
00092                                                                 _T("setProcesses")).func(&Context::setContextTypeSq,
00093                                                                                          _T("setContextTypeSq")).
00094                 func(&Context::getContextTypeSq, _T("getContextTypeSq")).func(&Context::getUseGLFrameletEXT,
00095                                                                           _T("getUseGLFrameletEXT")).
00096                 func(&Context::setUseGLFrameletEXT, _T("setUseGLFrameletEXT")).func(&Context::getContextType,
00097                                                                                  _T("getContextType")).
00098                 func(&Context::setContextType, _T("setContextType")).func(&Context::getFrameWidth,
00099                                                                         _T("getFrameWidth")).
00100                 func(&Context::setFrameWidth, _T("setFrameWidth")).func(&Context::getFrameHeight,
00101                                                                         _T("getFrameHeight")).
00102                 func(&Context::setFrameHeight, _T("setFrameHeight")).func(&Context::getColourFormat,
00103                                                                         _T("getColourFormat")).
00104                 func(&Context::setColourFormat, _T("setColourFormat")).func(&Context::getDepthFormat,
00105                                                                          _T("getDepthFormat")).
00106                 func(&Context::setDepthFormat, _T("setDepthFormat")).func(&Context::getCompositeType,
00107                                                                         _T("getCompositeType")).
00108                 func(&Context::setCompositeType, _T("setCompositeType")).func(&Context::getCompressionHint,
00109                                                                           _T("getCompressionHint")).
00110                 func(&Context::setCompressionHint, _T("setCompressionHint")).func(&Context::getRetainOutputCount,
00111                                                                                 _T("getRetainOutputCount")).
00112                 func(&Context::setRetainOutputCount,
00113                   _T("setRetainOutputCount")).func(&Context::getVolatileFrameletCount,
00114                                                   _T("getVolatileFrameletCount")).
00115                 func(&Context::setVolatileFrameletCount, _T("setVolatileFrameletCount")).func(&Context::getOutputDepth,
00116                                                                                           _T("getOutputDepth")).
00117                 func(&Context::setOutputDepth, _T("setOutputDepth")).func(&Context::getProcessIndex,
00118                                                                         _T("getProcessIndex")).
00119                 func(&Context::setProcessIndex, _T("setProcessIndex")).func(&Context::getNetworkID,
00120                                                                          _T("getNetworkID")).
00121                 func(&Context::setNetworkID, _T("setNetworkID")).enumInt(Context::MASTER,
00122                                                                          _T("MASTER")).enumInt(Context::SLAVE,
00123                                                                                            _T("SLAVE"));
00124         }
00125 
00127 
00128         //
00129         // Enumerations
00130         //
00131 
00132    public:
00133 
00135         enum ContextType
00136         {
00137 
00139          MASTER = 0,
00140 
00142          SLAVE = 1
00143         };
00144 
00145         //
00146         // Typedefs
00147         //
00148 
00149    public:
00150 
00152         typedef Pointer < Context,
00153         DummyLock > Pointer;
00154 
00155         //
00156         // Variables
00157         //
00158 
00160 
00161 
00162    protected:
00163 
00170         int mID;
00171 
00177         bool mUseGLFrameletEXT;
00178 
00184         ContextType mContextType;
00185 
00191         PCid mFrameID;
00192 
00198         PCint mFrameWidth;
00199 
00205         PCint mFrameHeight;
00206 
00212         PCint mColourFormat;
00213 
00219         PCint mDepthFormat;
00220 
00226         PCint mPixelFormat;
00227 
00233         PCint mCompositeType;
00234 
00240         PCint mCompressionHint;
00241 
00247         PCint mRetainOutputCount;
00248 
00254         PCint mVolatileFrameletCount;
00255 
00261         bool mOutputDepth;
00262 
00268         PCstring *mProcesses;
00269 
00275         PCint mProcessCount;
00276 
00282         int mProcessIndex;
00283 
00289         PCint mHostIndex;
00290 
00296         PCint mNetworkID;
00297 
00303         PCcontext mContext;
00304 
00310         Process *mParent;
00311 
00317         bool mInitialized;
00318 
00320 
00321         //
00322         // Constructors & destructor
00323         //
00324 
00326 
00327 
00328    public:
00329 
00333         Context();
00334 
00339         Context(Process * parent);
00340 
00344         virtual ~ Context();
00345 
00347 
00348         //
00349         // Getters & setters
00350         //
00351 
00353 
00354 
00355    public:
00356 
00362         const int &getID() const;
00363 
00369         void setID(const int &id);
00370 
00376         bool & getUseGLFrameletEXT();
00377 
00383         void setUseGLFrameletEXT(const bool useglframeletext);
00384 
00390         Context::ContextType & getContextType();
00391 
00397         void setContextType(const Context::ContextType & contexttype);
00398 
00404         PCid & getFrameID();
00405 
00411         PCint & getFrameWidth();
00412 
00418         void setFrameWidth(const PCint framewidth);
00419 
00425         PCint & getFrameHeight();
00426 
00432         void setFrameHeight(const PCint frameheight);
00433 
00439         PCint & getColourFormat();
00440 
00446         void setColourFormat(const PCint colourformat);
00447 
00453         PCint & getDepthFormat();
00454 
00460         void setDepthFormat(const PCint depthformat);
00461 
00467         const PCint & getPixelFormat() const;
00468 
00474         PCint & getCompositeType();
00475 
00481         void setCompositeType(const PCint compositetype);
00482 
00488         PCint & getCompressionHint();
00489 
00495         void setCompressionHint(const PCint compressionhint);
00496 
00502         PCint & getRetainOutputCount();
00503 
00509         void setRetainOutputCount(const PCint retainoutputcount);
00510 
00516         PCint & getVolatileFrameletCount();
00517 
00523         void setVolatileFrameletCount(const PCint volatileframeletcount);
00524 
00530         bool & getOutputDepth();
00531 
00537         void setOutputDepth(const bool outputdepth);
00538 
00544         PCstring *getProcesses() const;
00545 
00551         const PCint & getProcessCount() const;
00552 
00558         int &getProcessIndex();
00559 
00565         void setProcessIndex(const int processindex);
00566 
00572         const PCint & getHostIndex() const;
00573 
00579         PCint & getNetworkID();
00580 
00586         void setNetworkID(const PCint networkid);
00587 
00593         const PCcontext & getContext() const;
00594 
00600         Process *getParent();
00601 
00607         const bool & getInitialized() const;
00608 
00610 
00611         //
00612         // Methods
00613         //
00614 
00616 
00617 
00618    public:
00619 
00624         virtual void setProcesses(const char *processList);
00625 
00629         virtual void initialize();
00630 
00634         virtual void finalize();
00635 
00640         virtual void setContextTypeSq(const int contextType);
00641 
00646         virtual int getContextTypeSq();
00647 
00649 
00650   };
00651 
00652   //
00653   // Include header implementation
00654   //
00655 
00656 #  include "PCMContext_impl.h"
00657 
00658 }
00659 
00660 // Declare Context class (and its enums) for SqPlus binding
00662 DECLARE_INSTANCE_TYPE_NAME(ParCompMark::Context, Context);
00663 
00664 DECLARE_INSTANCE_TYPE_NAME(ParCompMark::Context::ContextType, Context::ContextType);
00665 
00666 #endif