![]() |
VR-Link API Documentation for HLA 1.3
|
00001 00002 /****************************************************************************** 00003 * 00004 * file: VersionVisitor.h 00005 * 00006 * Copyright (c) 2003, Michael E. Smoot . 00007 * All rights reverved. 00008 * 00009 * See the file COPYING in the top directory of this distribution for 00010 * more information. 00011 * 00012 * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 00013 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00014 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00015 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00016 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00017 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00018 * DEALINGS IN THE SOFTWARE. 00019 * 00020 *****************************************************************************/ 00021 00022 00023 #ifndef DtCmdLine_VERSION_VISITOR_H 00024 #define DtCmdLine_VERSION_VISITOR_H 00025 00029 00030 #include "cmdLineInterface.h" 00031 #include "cmdLineOutput.h" 00032 #include "cmdVisitor.h" 00033 00034 #include <vlutil/vlPrint.h> 00035 #include <vlutil/vlKeyboard.h> 00036 #include <vlutil/vlProcessControl.h> 00037 00038 #ifdef DtUSE_UTILITIES_NAMESPACE 00039 namespace DtUSE_UTILITIES_NAMESPACE 00040 { 00041 #endif 00042 00043 namespace DtCmdLine { 00044 00049 00050 class VersionVisitor: public Visitor 00051 { 00052 protected: 00053 00057 CmdLineInterface* _cmd; 00058 00062 CmdLineOutput** _out; 00063 00064 bool myPressAnyKey; 00065 00066 public: 00067 00073 VersionVisitor( CmdLineInterface* cmd, CmdLineOutput** out, 00074 #ifdef _WIN32 00075 bool pressAnyKey = true ) 00076 #else 00077 bool pressAnyKey = false ) 00078 #endif 00079 : Visitor(), _cmd( cmd ), _out( out ), myPressAnyKey(pressAnyKey) { } 00080 00085 virtual ~VersionVisitor() { } 00086 void visit(); 00087 00088 }; 00089 00090 inline void VersionVisitor::visit() 00091 { 00092 (*_out)->version(*_cmd); 00093 00094 int oldNotifyLevel = DtNotifyLevel; 00095 DtNotifyLevel = 3; 00096 00097 if (myPressAnyKey) 00098 { 00099 DtInfo << "Press any key to continue" << std::endl; 00100 00101 while (DtPollBlockingInputChar() == '\0') 00102 { 00103 DtSleep(0.1); 00104 } 00105 } 00106 00107 DtNotifyLevel = oldNotifyLevel; 00108 00109 exit(0); 00110 } 00111 00112 } 00113 00114 #ifdef DtUSE_UTILITIES_NAMESPACE 00115 } 00116 #endif 00117 00118 #endif