![]() |
MAK RTIspy API Documentation for HLA Evolved
|
00001 /********************************************************************* 00002 ** Copyright (c) 2008 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: connectionsCache.h,v $ $Revision: 1.18 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00011 00012 #ifndef DtConnectionCache_H_ 00013 #define DtConnectionCache_H_ 00014 00015 #include <mtl/env.h> 00016 #include <mtl/envXMLWriter.h> 00017 #include <vlutil/vlString.h> 00018 #include <vlutil/vlFilename.h> 00019 #include <iosfwd> 00020 00021 #include "assistantConnectionInfo.h" 00022 #include "assistantConnectionConfigurationInfo.h" 00023 #include "connectionAndConfiguration.h" 00024 00028 class DT_DLL_ASSISTANTAPP DtConnectionCache 00029 { 00030 public: 00031 00036 DtConnectionCache( const MAKRti::DtFilename& xmlFile ); 00037 00039 virtual ~DtConnectionCache(); 00040 00043 virtual bool writeToFile(); 00044 00046 virtual bool writeToFile( const MAKRti::DtFilename& xmlFile ); 00047 00049 virtual std::ostream& print( std::ostream& ostr ) const; 00050 00052 virtual void getConnections( DtRtiConnectionAndConfiguration& connsAndConfigs ); 00053 00055 virtual bool setConnections( const DtRtiConnectionAndConfiguration& conns ); 00056 00058 virtual void clearConnections(); 00059 00061 virtual bool fileWasRead() const; 00062 00065 virtual bool getFileVersion( MAKRti::DtString& version ) const; 00066 00068 virtual bool isCacheVersionOld() const; 00069 00070 private: 00071 00073 DtConnectionCache( const DtConnectionCache& ); 00074 DtConnectionCache& operator=( const DtConnectionCache& ); 00075 00076 protected: 00077 00079 virtual void getRtiexecConnectionsFromEnv( DtRtiConnectionAndConfiguration& connsAndConfigs ); 00080 00082 virtual void getLightweightConnectionsFromEnv( DtRtiConnectionAndConfiguration& connsAndConfigs ); 00083 00085 virtual void getConfigurationsFromEnv( DtRtiConnectionAndConfiguration& connsAndConfigs ); 00086 00088 virtual MAKRti::DtEnvValueSP addConnectionToEnv( const DtRtiConnectionInfoDataPair& conn ); 00089 virtual MAKRti::DtEnvValueSP addConfigurationToEnv( const DtRtiConfigurationInfoDataPair& config ); 00090 00092 virtual void removeConnectionFromEnv( const DtRtiConnectionInfoDataPair& conn ); 00093 virtual void removeConfigurationFromEnv( const DtRtiConfigurationInfoDataPair& config ); 00094 00096 void setConnFromEnv( DtRtiConnectionInfoDataPair& conn, 00097 MAKRti::DtEnvValueSP val ); 00098 00100 void setConfigFromEnv( DtRtiConfigurationInfoDataPair& config, 00101 MAKRti::DtEnvValueSP val ); 00102 00105 bool parseFile( const MAKRti::DtFilename& filename ); 00106 00107 protected: 00108 00110 MAKRti::DtEnvironment myEnvironment; 00111 00115 std::auto_ptr< MAKRti::DtEnvXMLWriter > myXmlWriter; 00116 00118 MAKRti::DtFilename myXmlFile; 00119 00121 MAKRti::DtString myReadFileVersion; 00122 00124 bool myFileWasRead; 00125 00127 static MAKRti::DtString thePredefinedLightweightConnName; 00128 00130 static DtRtiConnectionInfo thePredefinedLightweightConn; 00131 00133 static MAKRti::DtString thePredefinedRtiexecConnName; 00134 00136 static DtRtiConnectionInfo thePredefinedRtiexecConn; 00137 00139 static MAKRti::DtString thePredefinedLightweightConfigName; 00140 00142 static DtRtiConnectionConfigurationInfo thePredefinedLightweightConfig; 00143 00145 static MAKRti::DtString thePredefinedRtiexecConfigName; 00146 00148 static DtRtiConnectionConfigurationInfo thePredefinedRtiexecConfig; 00149 00150 }; 00151 00152 inline std::ostream& operator<<( std::ostream& ostr, const DtConnectionCache& cache ) 00153 { 00154 return cache.print( ostr ); 00155 } 00156 00157 #endif // DtConnectionCache_H_