VR-Forces 4.3.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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/vrvCore.h>
15 #include <vrvCore/DtDeSettings.h>
17 #include <boost/signals.hpp>
18 
19 namespace makVrv
20 {
25  {
26  public:
27 
28  typedef std::vector<std::string> NameList;
29 
32 
34  virtual ~DtBackupInterface();
35 
37  virtual bool backupExists() const = 0;
38 
40  virtual bool factoryExists() const = 0;
41 
43  virtual void backup() = 0;
44 
46  virtual void deleteBackup() = 0;
47 
50  virtual void restore(bool fromFactory = false) = 0;
51 
53  virtual void getRestorableNames(NameList& names) = 0;
54 
57  boost::signal<void (DtBackupInterface*)> signal_backupFileChanged;
58 
59  };
60 
61  class DtDeSettings;
62 
63 
64 
71  template <typename Manager>
73  {
74  public:
76  DtManagerBackup(Manager& manager)
77  : myManager(manager)
78  {
79  }
80 
82  virtual ~DtManagerBackup()
83  {
84  }
85 
87  virtual bool backupExists() const
88  {
89  return DtVrvFilesystem::exists(myManager.settings()->backupFilePath());
90  }
91 
93  virtual bool factoryExists() const
94  {
95  return DtVrvFilesystem::exists(myManager.settings()->factoryFilePath());
96  }
97 
99  virtual void backup()
100  {
101  myManager.exportSettings(myManager.settings()->backupFilePath());
102  }
103 
105  virtual void deleteBackup()
106  {
107  DtVrvFilesystem::deleteFile(myManager.settings()->backupFilePath());
108  }
109 
112  virtual void restore(bool fromFactory = false)
113  {
114  if(fromFactory)
115  {
116  myManager.importSettings(myManager.settings()->factoryFilePath());
117  }
118  else
119  {
120  myManager.importSettings(myManager.settings()->backupFilePath());
121  }
123  }
124 
127  {
128  names.push_back(myManager.settings()->name());
129  }
130 
131  boost::signal<void ()> signal_settingsRestored;
132 
133  protected:
134  Manager& myManager;
135  };
136 }
137 

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)