Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
StorageInterface.h
Go to the documentation of this file.
1#pragma once
3#include <misc/gen/TVector.h>
4#include <misc/gen/Value.h>
5#include <sto/iface/global.h>
6#include <utility>
7
8namespace sf
9{
10
11// Forward declaration.
13
18{
19 public:
21 {
22 explicit Parameters(int mode)
23 : _mode(mode)
24 {}
25
26 int _mode;
27 };
28
32 explicit StorageInterface(const Parameters&);
33
38
43 bool initialize();
44
50
56
61 virtual std::string getFileExtension() const = 0;
62
66 virtual std::string getFileDescription() const = 0;
67
73 virtual bool fileOpen(const std::string& path) = 0;
74
78 virtual void fileClose() = 0;
79
86 virtual bool fileSave(const std::string& dir, const std::string& name) = 0;
91 virtual std::string getSavedFileName() const = 0;
92
96 enum EState
97 {
99 ssError,
101 ssReady,
103 ssSaving
104 };
105
109 virtual EState GetState() const = 0;
110
111 protected:
118 virtual bool doInitialize(bool init)
119 {
120 return true;
121 }
122
123 private:
127 bool _initialized;
128
133};
134
135}// namespace sf
#define SF_DECL_IFACE(InterfaceType, ParamType, FuncName)
Declares a public static function in the class where it is used. Where: InterfaceType: Global typenam...
Definition TClassRegistration.h:71
Dialog containing multiple property pages.
Definition qt/PropertySheetDialog.h:14
Base class for the interface.
Definition StorageInterface.h:18
bool initialize()
Initializes the implementation for operation. Calls doInitialize.
virtual std::string getFileExtension() const =0
Gets the extension of the data file.
virtual void addPropertyPages(PropertySheetDialog *sheet)
virtual void fileClose()=0
Closes the opened file if any.
virtual std::string getFileDescription() const =0
Gets the description of the data file.
virtual bool fileOpen(const std::string &path)=0
Opens the data file.
EState
States of executing saving.
Definition StorageInterface.h:97
virtual EState GetState() const =0
For testing if saving is ready or in error.
virtual ~StorageInterface()
Virtual destructor for derived classes.
virtual bool doInitialize(bool init)
Must be overridden by a derived class. Should check the hardware configuration.
Definition StorageInterface.h:118
virtual bool fileSave(const std::string &dir, const std::string &name)=0
Saves the data file. Return true on success.
bool uinitialize()
Uninitializes the implementation. Calls doInitialize.
virtual std::string getSavedFileName() const =0
Gets the file name generated by the save sequence. This without extension and only after a file has b...
StorageInterface(const Parameters &)
Constructor for passing general structure for derived classes.
Definition Application.h:10
class _MISC_CLASS PropertySheetDialog
Definition gen/PropertySheetDialog.h:18
#define _STO_CLASS
Definition sto/iface/global.h:35
Definition StorageInterface.h:21
Parameters(int mode)
Definition StorageInterface.h:22
int _mode
Definition StorageInterface.h:26