VR-Forces 4.6 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtBackupInterface.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2010 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 /******************************************************************************
6 ** $RCSfile: $ $Revision: $ $State: $
7 ******************************************************************************/
8 
12 
13 #pragma once
14 #include <vrvCore/DtDeSettings.h>
15 #include <boost/signals.hpp>
16 
17 namespace makVrv
18 {
23  {
24  public:
25 
26  typedef std::vector<std::string> NameList;
27 
30 
32  virtual ~DtBackupInterface();
33 
35  virtual bool backupFileExists() const = 0;
36 
38  virtual bool factoryFileExists() const = 0;
39 
41  virtual bool backupDirExists() const = 0;
42 
44  virtual bool factoryDirExists() const = 0;
45 
47  virtual void backup() = 0;
48 
50  virtual void deleteBackup() = 0;
51 
54  virtual void restore(bool fromFactory = false) = 0;
55 
57  virtual void getRestorableNames(NameList& names) = 0;
58 
61  boost::signal<void (DtBackupInterface*)> signal_backupFileChanged;
62 
63  };
64 
65  class DtDeSettings;
66 
67 
68 
75  template <typename Manager>
77  {
78  public:
80  DtManagerBackup(Manager& manager)
81  : myManager(manager)
82  {
83  }
84 
86  virtual ~DtManagerBackup()
87  {
88  }
89 
91  virtual bool backupFileExists() const
92  {
93  return DtVrvFilesystem::exists(myManager.settings()->backupFilePath());
94  }
95 
97  virtual bool factoryFileExists() const
98  {
99  return DtVrvFilesystem::exists(myManager.settings()->factoryFilePath());
100  }
101 
103  virtual bool backupDirExists() const
104  {
105  return DtVrvFilesystem::exists(myManager.settings()->backupDirPath());
106  }
107 
109  virtual bool factoryDirExists() const
110  {
111  return DtVrvFilesystem::exists(myManager.settings()->factoryDirPath());
112  }
113 
115  virtual void backup()
116  {
117  myManager.exportSettings(myManager.settings()->backupFilePath());
118  }
119 
121  virtual void deleteBackup()
122  {
123  DtVrvFilesystem::deleteFile(myManager.settings()->backupFilePath());
124  }
125 
128  virtual void restore(bool fromFactory = false)
129  {
130  if(fromFactory)
131  {
132  myManager.importSettings(myManager.settings()->factoryFilePath());
133  }
134  else
135  {
136  myManager.importSettings(myManager.settings()->backupFilePath());
137  }
139  }
140 
143  {
144  names.push_back(myManager.settings()->name());
145  }
146 
147  boost::signal<void ()> signal_settingsRestored;
148 
149  protected:
150  Manager& myManager;
151  };
152 }
153 

Document ID: Generated on Thu Apr 12 03:15:37 EDT 2018 from SVN revision 187986
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)