VR-Forces 4.0.4 Class Documentation
include/vrvCore/DtSettingsBackup.h
Go to the documentation of this file.
00001 /****************************************************************************** 
00002 ** Copyright (c) 2009 MAK Technologies, Inc. 
00003 ** All rights reserved. 
00004 ******************************************************************************/ 
00005 /****************************************************************************** 
00006 ** $RCSfile: DtSettingsBackup.h,v $ $Revision: 1.16 $ $State: Exp $ 
00007 ******************************************************************************/ 
00008  
00015  
00016 #pragma once
00017 #include <vrvCore/vrvCore.h> 
00018 #include <vrvCore/DtBackupInterface.h>
00019 #include <boost/archive/xml_iarchive.hpp>
00020 #include <boost/archive/xml_oarchive.hpp>
00021 
00022 namespace makVrv 
00023 {
00024 
00027    class DT_DLL_VRVCORE DtSettingsBackup : public DtBackupInterface
00028    { 
00029    public:
00030       enum RestoreFlags
00031       {
00032          RestoreFromFactory = 0x00000001,
00033          RestoreFromLocal   = 0x00000002,
00038          KeepRestoreFromLocal = 0x80000000,
00039          RestoreAll         = RestoreFromFactory | RestoreFromLocal
00040       };
00041 
00042       typedef std::map<DtSettingsBackup*, int> RestoreWhenRestored;
00043 
00044    public:
00045 
00047       DtSettingsBackup();
00048 
00050       virtual ~DtSettingsBackup();
00051 
00055       virtual bool createAndWriteToBackupFile(const std::ostringstream& str, const std::string& path);
00056 
00058       const std::string& backupFile() const;
00059 
00061       virtual bool backupExists() const;
00062 
00064       virtual bool factoryExists() const;
00065 
00068       virtual void backup();
00069 
00072       virtual void deleteBackup();
00073 
00075       virtual void restore(bool fromFactory = false);
00076 
00078       virtual void getRestorableNames(NameList& names);
00079 
00082       virtual void restore(bool fromFactory, bool selectedOnly);
00083 
00087       virtual void restore(const DtSettingsBackup* from ) = 0;
00088 
00092       virtual void restoreSelected( const DtSettingsBackup* ) {}
00093 
00096       virtual std::string backupClassType() const = 0;
00097 
00100       virtual DtSettingsBackup* create() const = 0;
00101 
00104       virtual void write(boost::archive::xml_oarchive& ar) = 0;
00105 
00108       virtual void read(boost::archive::xml_iarchive& ar) = 0;
00109 
00111       void setManagerDestroyed(bool b)
00112       {
00113          myManagerDestroyed = b;
00114       }
00115 
00119       virtual void addRestoreWhenRestored(DtSettingsBackup*, 
00120          const RestoreFlags& f = RestoreAll);
00121 
00122       const RestoreWhenRestored& restoreWhenRestored() const
00123       {
00124          return myRestoreWhenRestored;
00125       }
00126 
00129       virtual void cancelRestoreWhenRestored(DtSettingsBackup*, 
00130          const RestoreFlags& f = RestoreAll);
00131 
00134       virtual std::string backupName() const;
00135 
00136       void setBackupsPath(const std::string& s)
00137       {
00138          myBackupsPath = s;
00139       }
00140 
00141       const std::string& backupsPath() const
00142       {
00143          return myBackupsPath;
00144       }
00145 
00146       void setFactoryFile(const std::string& s)
00147       {
00148          myFactoryFile = s;
00149       }
00150 
00151       const std::string& factoryFile() const
00152       {
00153          return myFactoryFile;
00154       }
00155 
00158       boost::signal<void (const DtSettingsBackup*)> signal_destructing;
00159       boost::signal<void (const DtSettingsBackup*)> signal_backupCleared;
00160       boost::signal<void (const DtSettingsBackup*)> signal_backedUp;
00161       boost::signal<void (const DtSettingsBackup*)> signal_restored;
00162 
00163    protected:
00164 
00166       virtual bool restore(bool fromFactory, 
00167          std::vector<DtSettingsBackup*>& hasBeenRestored, bool selectedOnly);
00168 
00169    protected:
00170 
00171       bool                             myManagerDestroyed;
00172       RestoreWhenRestored              myRestoreWhenRestored;
00173       std::string                      myBackupFile;
00174       std::string                      myFactoryFile;
00175       std::string                      myBackupsPath;
00176 
00177    };
00178 
00179 }

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)