PCMProcess.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00027
00028 #ifndef __PCM_PROCESS_H__
00029 # define __PCM_PROCESS_H__
00030
00031
00032
00033
00034
00035 # include "PCMPremeditations.h"
00036
00037 # include "PCMThread.h"
00038
00039 # include "PCMName.h"
00040
00041 # include "PCMException.h"
00042
00043 # include "PCMLogger.h"
00044
00045 # include "PCMOpenGLRenderingEngine.h"
00046
00047 # include "PCMContext.h"
00048
00049 # include "PCMThread.h"
00050
00051 # include "PCMName.h"
00052
00053 # include "PCMBuffer.h"
00054
00055 # include "PCMGLXRenderWindow.h"
00056
00057 # include "PCMSqVM.h"
00058
00059 # include "PCMOutputNode.h"
00060
00061 # include "PCMStringConverter.h"
00062
00063
00064
00065
00066
00067 # include <pcapi.h>
00068
00069 # include <string>
00070
00071 # include <sstream>
00072
00073 # include <list>
00074
00075
00076
00077
00078
00079 # include <squirrel/squirrel.h>
00080 # include <squirrel/sqstdio.h>
00081 # include <squirrel/sqstdaux.h>
00082 # include <squirrel/sqplus.h>
00083
00084 namespace ParCompMark
00085 {
00086
00091 class Process:public Thread,
00092 public Name
00093 {
00094
00095
00096
00097
00098 # ifdef PARCOMPMARK_TEST
00099 friend class ParCompMarkTest::TestProcess;
00100 # endif
00101
00102
00103
00104
00105
00107
00108
00116 public:static void squirrelGlue()
00117 {
00118 ::SqPlus::SQClassDef < Process > (_T("Process")).func(&Process::addContext,
00119 _T("addContext")).func(&Process::setProcessTypeSq,
00120 _T("setProcessTypeSq")).
00121 func(&Process::getProcessTypeSq, _T("getProcessTypeSq")).func(&Process::setBufferByName,
00122 _T("setBufferByName")).
00123 func(&Process::getInitProcCode, _T("getInitProcCode")).func(&Process::setInitProcCode,
00124 _T("setInitProcCode")).
00125 func(&Process::getRunningProcCode, _T("getRunningProcCode")).func(&Process::setRunningProcCode,
00126 _T("setRunningProcCode")).
00127 func(&Process::getSortOrder, _T("getSortOrder")).func(&Process::setSortOrder,
00128 _T("setSortOrder")).func(&Process::getStopID,
00129 _T("getStopID")).
00130 func(&Process::setStopID, _T("setStopID")).func(&Process::getOperate,
00131 _T("getOperate")).func(&Process::setOperate,
00132 _T("setOperate")).
00133 func(&Process::getDisplayOutput, _T("getDisplayOutput")).func(&Process::setDisplayOutput,
00134 _T("setDisplayOutput")).
00135 func(&Process::getGatherStatistics, _T("getGatherStatistics")).func(&Process::setGatherStatistics,
00136 _T("setGatherStatistics")).
00137 func(&Process::getExportFrameStep, _T("getExportFrameStep")).func(&Process::setExportFrameStep,
00138 _T("setExportFrameStep")).
00139 func(&Process::getFrameFilenamePattern,
00140 _T("getFrameFilenamePattern")).func(&Process::setFrameFilenamePattern,
00141 _T("setFrameFilenamePattern")).enumInt(Process::COMPOSITE,
00142 _T("COMPOSITE")).
00143 enumInt(Process::RENDER, _T("RENDER"));
00144 }
00145
00147
00148
00149
00150
00151
00152 public:
00153
00155 enum ProcessType
00156 {
00157
00159 COMPOSITE = 0,
00160
00162 RENDER = 1
00163 };
00164
00165
00166
00167
00168
00169 public:
00170
00172 typedef Pointer < Process,
00173 Mutex > Pointer;
00174
00176 typedef std::list < Context::Pointer > ContextList;
00177
00179 typedef ContextList::iterator ContextListIterator;
00180
00181
00182
00183
00184
00186
00187
00188 public:
00189
00195 static const std::string PROCESSINITNUT;
00196
00202 static const std::string DEFAULTEXPORTPATTERN;
00203
00205
00206
00207
00208
00209
00211
00212
00213 protected:
00214
00220 ContextList mContexts;
00221
00227 ProcessType mProcessType;
00228
00234 Node *mParent;
00235
00241 GLXRenderWindow::Pointer mRenderWindow;
00242
00248 OpenGLRenderingEngine::Pointer mRenderingEngine;
00249
00255 SqVM::Pointer mSqVM;
00256
00262 char *mInitProcCode;
00263
00269 char *mRunningProcCode;
00270
00276 Buffer::Pointer mBuffer;
00277
00283 bool mInitialized;
00284
00290 PCuint mSortOrder;
00291
00297 PCid mStopID;
00298
00306 bool mOperate;
00307
00315 bool mDisplayOutput;
00316
00322 bool mGatherStatistics;
00323
00329 u32 mFrameNumber;
00330
00336 Real mFrameTime;
00337
00343 Real mStartTime;
00344
00350 bool mStop;
00351
00357 bool mStopAble;
00358
00364 bool mCountedStop;
00365
00371 OutputNode::Pointer mOutputDocument;
00372
00378 bool mShowFrameletIcon;
00379
00385 int mExportFrameStep;
00386
00393 char *mFrameFilenamePattern;
00394
00396
00397
00398
00399
00400
00402
00403
00404 public:
00405
00409 Process();
00410
00416 Process(const std::string & name, Node * parent);
00417
00421 virtual ~ Process();
00422
00424
00425
00426
00427
00428
00430
00431
00432 public:
00433
00439 Process::ContextList & getContexts();
00440
00446 Process::ProcessType & getProcessType();
00447
00453 void setProcessType(const Process::ProcessType & processtype);
00454
00460 Node *getParent() const;
00461
00467 GLXRenderWindow::Pointer & getRenderWindow();
00468
00474 OpenGLRenderingEngine::Pointer & getRenderingEngine();
00475
00481 char *getInitProcCode();
00482
00488 void setInitProcCode(const char *initproccode);
00489
00495 char *getRunningProcCode();
00496
00502 void setRunningProcCode(const char *runningproccode);
00503
00509 Buffer::Pointer & getBuffer();
00510
00516 const bool & getInitialized() const;
00517
00523 PCuint & getSortOrder();
00524
00530 void setSortOrder(const PCuint sortorder);
00531
00537 PCid & getStopID();
00538
00544 void setStopID(const PCid stopid);
00545
00551 bool & getOperate();
00552
00558 void setOperate(const bool operate);
00559
00565 bool & getDisplayOutput();
00566
00572 void setDisplayOutput(const bool displayoutput);
00573
00579 bool & getGatherStatistics();
00580
00586 void setGatherStatistics(const bool gatherstatistics);
00587
00593 const u32 & getFrameNumber() const;
00594
00600 const Real & getFrameTime() const;
00601
00607 const Real & getStartTime() const;
00608
00614 void setStartTime(const Real & starttime);
00615
00621 const bool & getStop() const;
00622
00628 void setStop(const bool & stop);
00629
00635 const bool & getStopAble() const;
00636
00642 void setStopAble(const bool & stopable);
00643
00649 const bool & getCountedStop() const;
00650
00656 void setCountedStop(const bool & countedstop);
00657
00663 OutputNode::Pointer & getOutputDocument();
00664
00670 const bool & getShowFrameletIcon() const;
00671
00677 int &getExportFrameStep();
00678
00684 void setExportFrameStep(const int exportframestep);
00685
00691 char *getFrameFilenamePattern();
00692
00698 void setFrameFilenamePattern(const char *framefilenamepattern);
00699
00701
00702
00703
00704
00705
00707
00708
00709 public:
00710
00714 virtual void threadInitialize();
00715
00719 virtual void threadFinalize();
00720
00724 virtual void start();
00725
00730 virtual u32 stop();
00731
00736 virtual Context *addContext();
00737
00741 virtual void initPC();
00742
00755 virtual void openRenderWindow(const std::string caption =
00756 "PCM Framework", const std::string & displayName =
00757 "", const bool & fullScreen = true, const u32 & colourDepth =
00758 0, const u32 & width =
00759 GLXRenderWindow::MAXIMALSIZE, const u32 & height =
00760 GLXRenderWindow::MAXIMALSIZE, const s32 & left =
00761 GLXRenderWindow::CENTERED, const s32 & top =
00762 GLXRenderWindow::CENTERED, const u32 & fsaaSamples = 0);
00763
00767 virtual void actualizeRenderWindow();
00768
00772 virtual void setViewportForRendering();
00773
00778 virtual void displayFrameletIcon();
00779
00786 virtual void initProcess();
00787
00794 virtual void runningProcess();
00795
00800 virtual void setProcessTypeSq(const int processType);
00801
00806 virtual int getProcessTypeSq();
00807
00812 virtual void setBufferByName(const char *name);
00813
00818 virtual void setFinito(const u32 & frameID);
00819
00820 protected:
00821
00825 virtual void task();
00826
00830 virtual void refreshSortOrder();
00831
00835 virtual void gatherStatistics();
00836
00838
00839 };
00840
00841
00842
00843
00844
00845 # include "PCMProcess_impl.h"
00846
00847 }
00848
00849
00851 DECLARE_INSTANCE_TYPE_NAME(ParCompMark::Process, Process);
00852
00853 DECLARE_INSTANCE_TYPE_NAME(ParCompMark::Process::ProcessType, Process::ProcessType);
00854
00855 #endif