VR-Forces 4.0.4 Class Documentation
appsrc/vrfSim/vrfApp.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002 ** Copyright (c) 2001 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *******************************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: vrfApp.h,v $ $Revision: 1.24 $ $State: Exp $
00007 *******************************************************************************/
00008 #ifndef vrfApp_H_
00009 #define vrfApp_H_
00010 
00011 #include <vlutil/vlString.h>
00012 #include <vlutil/vlList.h>
00013 #include <vlutil/vlUtil.h>
00014 #include <vl/hostStructs.h>
00015 #include <vlutil/vlFilename.h>
00016 #include <vl/rprFomMap.h>
00017 #include <vlutil/vlTime.h>
00018 #include <vl/exerciseConn.h>
00019 
00020 class DtCgf;
00021 class DtCgfDispatcher;
00022 class DtExerciseConn;
00023 class DtFomMapper;
00024 class DtBatchManager;
00025 class DtVrfCreator;
00026 class DtVrfSimOptions;
00027 #ifdef WIN32
00028 class DtFilePrinter;
00029 class DtWindowsConsolePrinter;
00030 #endif
00031 class DtBackendConsoleNetworkPrinter;
00032 
00033 // class DtVrfApp:
00034 //
00035 // Instances of DtVrfApp are the main class for the VR-Forces simulation
00036 // back-end application.
00037 
00038 class DtVrfApp
00039 {
00040 public:
00041    
00042    // constructor
00043    DtVrfApp(int argc, char** argv);
00044    
00045    // destructor
00046    virtual ~DtVrfApp();
00047    
00048    // Initialization.  Must be called before any other member functions
00049    // are called.
00050    virtual bool init(DtVrfCreator* creator = 0);
00051    
00052    // Main execution loop.  Calls our DtCgf's tick(). Calls DtSleep() for a 
00053    // given time interval (the main loop sleep interval).  Polls the keyboard
00054    // for input.  If a 'q' key press is received, exits the application.
00055    virtual void mainLoop();
00056    
00057    // Accessor for the DtCgf
00058    virtual DtCgf* cgf();
00059 
00060    // Accessor for the DtExerciseConn
00061    virtual DtExerciseConn* exerciseConn();
00062 
00063 #ifdef WIN32
00064    virtual void setConsoleWindow(HWND consoleWindow);
00065 #endif
00066 
00067 protected:
00068    
00069    // Process mtl file.  Also reads off mtl file (optionally) added to
00070    // command line by -d command
00071    virtual bool processMtlFile(int argc, char** argv);
00072 
00073    // Creates our cgf (called from init())
00074    virtual DtCgf* createCgf(const DtSimulationAddress& addr, DtU32 sessionId);
00075    
00076    // Creates our simOptions (called from init())
00077    virtual DtVrfSimOptions* createSimOptions();
00078 
00079    // This routine will read in the simulation options from the vrfSim.mtl
00080    // file by default of the supplied filename
00081    virtual bool readSimOptions(const DtFilename& mtlFile);
00082 
00083    // This routine will process the options read from the mtl file and set
00084    // them in the appropriate places in the cgf.  This method is called
00085    // after the cgf has been initialized
00086    virtual void processCgfOptions();
00087 
00088    // This routine will process app level options (parameter database, port, 
00089    // etc).  This is called before processCgfOptions and before
00090    // processCommandLine such that the command line options will take
00091    // precedence over the .mtl options
00092    virtual void processAppOptions();
00093 
00094    // Calls down to myCgf to schedule to load up all plugins from command line and vrfSim.mtl
00095    virtual void addPluginsToLoad();
00096 
00097 private:
00098    // copy constructor - not implemented
00099    DtVrfApp(const DtVrfApp& orig);
00100    
00101    // assignment operator - not implemented
00102    DtVrfApp& operator=(const DtVrfApp& orig);
00103    
00104 protected:
00105 
00106    // Our DIS/RPR (site id, application id) simulation address that
00107    // uniquely identifies our application in an exercise.
00108    DtSimulationAddress mySimAddress;
00109 
00110    // VR-Link exercise connection.  Provides means by which all network
00111    // interactions (PDUs/HLA objects and interactions) are sent/recieved.
00112    DtExerciseConn* myExerciseConn;
00113 
00114    // Command line arguments are cached in our constructor so we can process 
00115    // them later in init().
00116    int myArgc;
00117    char** myArgv;
00118 
00119    // Driver for our CGF object that responds to network messages
00120    DtCgfDispatcher* myDispatcher;
00121 
00122    // Driver for CGF Object that handles execution of scenario batches.
00123    DtBatchManager *myBatchManager;
00124 
00125    // Options that are read in from the vrfSim.mtl file
00126    DtVrfSimOptions*  mySimOptions;
00127 
00128    DtCgf* myCgf;
00129 
00130 #ifdef WIN32
00131    HWND              myConsoleWindow;
00132 
00133    // Writes diagnostics to vrfSim.log
00134    DtFilePrinter* myFilePrinter;
00135 #endif
00136 
00137    // Publishes all diagnostics to network in comment interactions.
00138    DtBackendConsoleNetworkPrinter* myBackendConsoleNetworkPrinter;
00139 
00140    bool myWarnedFailedGetExitCode;
00141 };
00142 
00143 #endif
00144 
00145 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)