VR-Link API Documentation for DIS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cmdVersionVisitor.h
Go to the documentation of this file.
1 
2 /******************************************************************************
3  *
4  * file: VersionVisitor.h
5  *
6  * Copyright (c) 2003, Michael E. Smoot .
7  * All rights reverved.
8  *
9  * See the file COPYING in the top directory of this distribution for
10  * more information.
11  *
12  * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
13  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
15  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
17  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
18  * DEALINGS IN THE SOFTWARE.
19  *
20  *****************************************************************************/
21 
22 
23 #ifndef DtCmdLine_VERSION_VISITOR_H
24 #define DtCmdLine_VERSION_VISITOR_H
25 
29 
30 #include "cmdLineInterface.h"
31 #include "cmdLineOutput.h"
32 #include "cmdVisitor.h"
33 
34 #include <vlutil/vlPrint.h>
35 #include <vlutil/vlKeyboard.h>
37 
38 #ifdef DtUSE_UTILITIES_NAMESPACE
39 namespace DtUSE_UTILITIES_NAMESPACE
40 {
41 #endif
42 
43  namespace DtCmdLine {
44 
49  class VersionVisitor: public Visitor
51  {
52  protected:
53 
58 
63 
65 
66  public:
67 
74 #ifdef _WIN32
75  bool pressAnyKey = true )
76 #else
77  bool pressAnyKey = false )
78 #endif
79  : Visitor(), _cmd( cmd ), _out( out ), myPressAnyKey(pressAnyKey) { }
80 
85  virtual ~VersionVisitor() { }
86  void visit();
87 
88  };
89 
90  inline void VersionVisitor::visit()
91  {
92  (*_out)->version(*_cmd);
93 
94  int oldNotifyLevel = DtNotifyLevel;
95  DtNotifyLevel = 3;
96 
97  if (myPressAnyKey)
98  {
99  DtInfo << "Press any key to continue" << std::endl;
100 
101  while (DtPollBlockingInputChar() == '\0')
102  {
103  DtSleep(0.1);
104  }
105  }
106 
107  DtNotifyLevel = oldNotifyLevel;
108 
109  exit(0);
110  }
111 
112  }
113 
114 #ifdef DtUSE_UTILITIES_NAMESPACE
115 }
116 #endif
117 
118 #endif
A base class that defines the interface for visitors.
Definition: cmdVisitor.h:41
This file declares the class DtCmdLine::CmdLineOutput.
char DtPollBlockingInputChar(void)
Polls standard input for a single character.
This file declares the class DtCmdLine::CmdLineInterface.
Functions in vlPrint.h provide an error and print facility for vrlink.
CmdLineInterface * _cmd
The CmdLine of interest.
Definition: cmdVersionVisitor.h:57
void DtSleep(DtTime sleep_period)
Puts the process to sleep for the specified number of seconds.
VersionVisitor(CmdLineInterface *cmd, CmdLineOutput **out, bool pressAnyKey=false)
Constructor.
Definition: cmdVersionVisitor.h:73
CmdLineOutput ** _out
The output object.
Definition: cmdVersionVisitor.h:62
int DtNotifyLevel
DtNotifyLevel is used to control the level of diagnostics output by VR-Link.
This file declares the class DtCmdLine::Visitor.
DtOutputStream DtInfo
DtInfo is an global instance of a DtOutputStream.
The base class that manages the command line definition and passes along the parsing to the appropria...
Definition: cmdLineInterface.h:52
virtual ~VersionVisitor()
Calls the version method of the output object using the specified CmdLine.
Definition: cmdVersionVisitor.h:85
This file contains declarations of classes and functions which aid in keyboard input.
bool myPressAnyKey
Definition: cmdVersionVisitor.h:64
ProcControl.h provides operating system independent methods to control processes. ...
The interface that any output object must implement.
Definition: cmdLineOutput.h:51

Document ID: Generated on Wed Mar 27 02:04:30 EDT 2024 from SVN revision 264570
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)