MAK RTIspy API Documentation for HLA 1516
rtiChooserCache.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 2008 MaK Technologies, Inc.
00003 ** All rights reserved.
00004 *********************************************************************/
00005 /*******************************************************************************
00006 ** $RCSfile: rtiChooserCache.h,v $ $Revision: 1.1 $ $State: Exp $
00007 *******************************************************************************/
00008 
00011 
00012 #ifndef DtRtiChooserCache_H_
00013 #define DtRtiChooserCache_H_
00014 
00015 #include <rtiMsConfig.h>
00016 #include <mtl/env.h>
00017 #include <mtl/envXMLWriter.h>
00018 #include <vlutil/vlString.h>
00019 #include <vlutil/vlFilename.h>
00020 #include <iosfwd>
00021 #include <set>
00022 
00026 
00027 class DT_DLL_RTIUTIL DtRtiChooserCache
00028 {
00029 public:
00034    DtRtiChooserCache( const MAKRti::DtFilename& xmlFile = MAKRti::DtFilename::nullFilename() );
00035 
00037    virtual ~DtRtiChooserCache();
00038 
00040    virtual void writeToFile();
00041 
00043    virtual void writeToFile( const MAKRti::DtFilename& xmlFile );
00044 
00046    virtual std::ostream& print( std::ostream& ostr ) const;
00047 
00048 
00049    struct DtInstalledRTIInformation
00050    {
00051       DtInstalledRTIInformation() 
00052          : myPathOfInstalledRTI("")
00053          , myUseDefaultRidFile(true)
00054          , myRidToUseWithInstalledRTI("")
00055          , myVersion("") 
00056       { }
00057       DtInstalledRTIInformation(MAKRti::DtString pathToRTI, 
00058          bool defaultRid, MAKRti::DtString ridToUse, MAKRti::DtString version ) 
00059          : myPathOfInstalledRTI(pathToRTI)
00060          , myUseDefaultRidFile(defaultRid)
00061          , myRidToUseWithInstalledRTI(ridToUse)
00062          , myVersion(version) 
00063       { }
00064       DtInstalledRTIInformation(const DtInstalledRTIInformation& copy) 
00065          : myPathOfInstalledRTI(copy.myPathOfInstalledRTI)
00066          , myUseDefaultRidFile(copy.myUseDefaultRidFile)
00067          , myRidToUseWithInstalledRTI(copy.myRidToUseWithInstalledRTI)
00068          , myVersion(copy.myVersion) { }
00069 
00070          bool operator==(const DtInstalledRTIInformation& comp) const 
00071          {
00072             bool retVal = (myPathOfInstalledRTI == comp.myPathOfInstalledRTI &&               
00073                myUseDefaultRidFile == comp.myUseDefaultRidFile  );
00074             if ( !myUseDefaultRidFile )
00075             {
00076                retVal &= (myRidToUseWithInstalledRTI == comp.myRidToUseWithInstalledRTI);
00077             }
00078             return retVal;
00079          }
00080          bool operator<(const DtInstalledRTIInformation& comp) const
00081          {
00082             if ( myPathOfInstalledRTI == comp.myPathOfInstalledRTI )
00083             {
00084                return myRidToUseWithInstalledRTI < comp.myRidToUseWithInstalledRTI;
00085             }
00086             else return ( myPathOfInstalledRTI < comp.myPathOfInstalledRTI );
00087          }
00088 
00089          MAKRti::DtString myPathOfInstalledRTI;
00090          bool myUseDefaultRidFile;
00091          MAKRti::DtString myRidToUseWithInstalledRTI;
00092          MAKRti::DtString myVersion;
00093 
00094    };
00095 
00096 
00097 
00098 
00099 
00101    virtual void getMAK_RTIDIRs( std::set<DtInstalledRTIInformation>& installedRTIs );
00102 
00104 
00105 
00106    virtual bool getMAK_RTIDIR( DtInstalledRTIInformation info );
00108 
00110    virtual void addMAK_RTIDIR( const DtInstalledRTIInformation& installed );
00111    virtual void addMAK_RTIDIRs( const std::set<DtInstalledRTIInformation>& installed );
00112 
00114    virtual void clearMAK_RTIDIRs();
00115 
00116 private:
00117 
00118 
00120    virtual MAKRti::DtString stringifyInfoContents( const DtInstalledRTIInformation& info ) const;
00121 
00123    DtRtiChooserCache( const DtRtiChooserCache& );
00124    DtRtiChooserCache& operator=( const DtRtiChooserCache& );
00125 
00126 protected:
00127 
00130    bool parseFile( const MAKRti::DtFilename& filename );
00131 
00132 protected:
00133 
00135    MAKRti::DtEnvironment myEnvironment;
00136 
00137    static const MAKRti::DtString rtiPathString;
00138    static const MAKRti::DtString ridPathString;
00139    static const MAKRti::DtString defaultRidString;
00140    static const MAKRti::DtString versionString;
00141 
00145    std::auto_ptr< MAKRti::DtEnvXMLWriter > myXmlWriter;
00146 
00148    MAKRti::DtFilename myXmlFile;
00149 
00152    bool myUpdatedSinceWrite;
00153 };
00154 
00155 inline std::ostream& operator<<( std::ostream& ostr, const DtRtiChooserCache& cache )
00156 {
00157    return cache.print( ostr );
00158 }
00159 
00160 #endif // DtRtiChooserCache_H_

Document ID: Generated on Thu Jun 14 14:15:04 EDT 2012 from SVN revision 116116
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)