![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtEventLoop.h,v $ $Revision: 1.14 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #ifndef DtEventLoop_H_ 00014 #define DtEventLoop_H_ 00015 00016 #include <vrvCore/vrvCore.h> 00017 #include <vrvUtil/DtVirtualBaseClass.h> 00018 00019 class DtTimedSection; 00020 00021 namespace makVrv 00022 { 00023 class DtDe; 00024 00027 class DT_DLL_VRVCORE DtEventLoop 00028 { 00029 00030 public: 00032 typedef void (*RunFunction)(DtDe&); 00033 00034 public: 00035 00039 static void runOnce(DtDe&); 00040 00045 static DtEventLoop* create(DtDe& theIG); 00046 00048 virtual ~DtEventLoop(); 00049 00055 void setAlternateRunFunction(RunFunction aFunction); 00056 00059 void run(); 00060 00061 00062 protected: 00063 00065 DtEventLoop(DtDe& de); 00066 00070 void defaultRun(); 00071 00072 protected: 00073 00074 DtDe& myDe; 00075 DtTimedSection* myTimer; 00076 RunFunction myRunnerFunction; 00077 00078 }; 00079 00082 class DT_DLL_VRVCORE DtEventLoopCreator : public DtVirtualBaseClass 00083 { 00084 00085 public: 00086 00089 static DtEventLoopCreator& instance(DtDe& theIG); 00090 00092 static void registerInstance(DtDe& theIG, DtEventLoopCreator* anInstance); 00093 00095 virtual DtEventLoop* create(DtDe& theIG) = 0; 00096 00097 }; 00098 } 00099 00100 #endif 00101