ALBA
albaVMEManager.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaVMEManager
5 Authors: Silvano Imboden
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16#ifndef __albaVMEManager_H__
17#define __albaVMEManager_H__
18//----------------------------------------------------------------------------
19// includes :
20//----------------------------------------------------------------------------
21#include "albaObserver.h"
22#include "albaVME.h"
23#include "albaVMERoot.h"
24#include "albaGUIFileHistory.h"
25
26//----------------------------------------------------------------------------
27// Forward References :
28//----------------------------------------------------------------------------
29class albaVMEStorage;
30class wxArchiveFSHandler;
31class wxFileSystem;
32
39//----------------------------------------------------------------------------
40class ALBA_EXPORT albaVMEManager: public albaObserver
41//----------------------------------------------------------------------------
42{
43public:
46
49
51 void SetListener(albaObserver *listener) {m_Listener = listener;};
52
55
58 void MSFNew();
59
61 int MSFOpen(albaString filename);
62
64 int MSFOpen(int file_id);
65
67 const char *ZIPOpen(albaString filename);
68
70 void ZIPSave(albaString file = "");
71
73 int MSFSave();
74
76 int MSFSaveAs();
77
79 bool MSFIsModified() {return m_Modified;};
80
82 void MSFModified(bool modified) {m_Modified = modified;};
83
85 void VmeAdd(albaVME *n);
86
89
91 void TimeGetBounds(double *min, double *max);
92
94 void TimeSet(double time);
95
98
101
104
106 void SetDirName (albaString dirname) {m_MSFDir = dirname;};
107
109 void SetFileName (albaString &filename) {m_MSFFile = filename;};
110
112 void SetMsfFileExtension (albaString &extension) {m_MsfFileExtension = extension;};
113
115 albaString &GetFileName() {return m_MSFFile;};
116
118 void SetFileHistoryMenu(wxMenu *menu);
119
122
125
128
130 void SetApplicationStamp(std::vector<albaString> appstamp);
131
133 void MakeBakFileOnSave(bool bakfile = true) {m_MakeBakFile = bakfile;}
134
137
139 void SetSingleBinaryFile(bool singleFile);
140
142 void SetTestMode(bool testmode){m_TestMode = testmode;}; // Losi 02/16/2010 for test class
143
145 void IgnoreAppStamp(bool ignore) { m_IgnoreAppStamp = ignore; };
146
147protected:
149 bool MakeZip(const albaString &zipname, wxArrayString *files);
150
153
155
157 wxConfigBase* m_Config;
158 wxArchiveFSHandler *m_ZipHandler;
159 wxFileSystem *m_FileSystem;
162
165 std::vector<albaString> m_AppStamp;
170
176
179 friend class albaVMEManagerTest; // Losi 02/16/2010 for test class
180};
181#endif
Implementation of the message object for the Subject/Observer design pattern.
Definition: albaEventBase.h:49
class name: albaGUIFileHistory class that handle a list of file called history.
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36
albaString - performs common string operations on c-strings.
Definition: albaString.h:43
albaVMEManager : Class managing VMEs inside a ALBA application.
void SetSingleBinaryFile(bool singleFile)
Set the flag for saving binary files associated to time varying VMEs.
bool m_TestMode
set true for test mode without GUI
int MSFSave()
Save the msf tree.
void VmeAdd(albaVME *n)
Add the vme to the tree.
void SetFileName(albaString &filename)
Set the filename for the current tree.
void TimeGetBounds(double *min, double *max)
Get the time bounds of the tree.
albaString m_MSFDir
Directory name in which is present the msf file.
albaVMEStorage * GetStorage()
Return the storage associated to the current tree.
void MakeBakFileOnSave(bool bakfile=true)
Set the flag for bak file generation on saving MSF file.
albaString m_MsfFileExtension
File extension.
void NotifyAdd(albaVME *n)
Send the event VME_ADDED to inform logic that the vme and its subtree are added to the tree.
void SetFileHistoryMenu(wxMenu *menu)
Link to the main men the file history manager.
albaGUIFileHistory m_FileHistory
Used to hold recently opened files.
bool AskConfirmAndSave()
Show the dialog to confirm the save of the current tree.
void MSFNew()
Destroy all nodes (also the root), for each destroyed node the manager send an event VME_REMOVING,...
int MSFSaveAs()
Save the msf tree with different filename.
albaString m_TmpDir
Temporary directory for zmsf extraction.
void ZIPSave(albaString file="")
Save the msf tree into a compressed file.
bool m_Modified
Used to known when the tree has been modified...
bool MSFIsModified()
Return true if the tree has been modifyed.
bool m_LoadingFlag
used when an MSF is being loaded
void IgnoreAppStamp(bool ignore)
Set the flag for attive controll in Open Alba Project.
albaString m_MSFFile
File name of the data associated to the tree.
int m_FileHistoryIdx
Identifier of the file to open.
albaVMEStorage * m_Storage
Associated storage.
void SetApplicationStamp(albaString &appstamp)
Set the application stamp; this is the mark of the specific vertical application (is always equal to ...
void SetApplicationStamp(std::vector< albaString > appstamp)
Set other application stamps for compatibility with similar applications (the application stamp itsel...
void MSFModified(bool modified)
Set the modify flag.
albaVMEManager()
constructor
void RemoveTempDirectory()
Remove temporary directory used for compressed msf files.
void SetMsfFileExtension(albaString &extension)
Set the file extension.
albaString m_ZipFile
File name of compressed archive in which save the data associated to the tree.
bool m_MakeBakFile
Flag used to create or not the backup file of the saved msf.
int MSFOpen(albaString filename)
Open the msf filename.
void SetTestMode(bool testmode)
Set the flag for test mode without GUI.
void TimeSet(double time)
Set the time for the tree.
void SetListener(albaObserver *listener)
Set the event receiver object.
void OnEvent(albaEventBase *e)
Process events coming from other components.
bool MakeZip(const albaString &zipname, wxArrayString *files)
Create a compressed msf file: zmsf.
int MSFOpen(int file_id)
Open the msf from file history.
bool m_SingleBinaryFile
used to store binary files associated to time varying VMEs as multiple files or not.
wxArchiveFSHandler * m_ZipHandler
Handler for zip archive (used to open zmsf files)
albaVMERoot * GetRoot()
Return the tree's root.
void SetDirName(albaString dirname)
Set the filename for the current tree.
void AddCreationDate(albaVME *vme)
Set tag with creation date for the node passed as argument.
bool m_Crypting
used to enable the Encryption for the MSF
wxFileSystem * m_FileSystem
File system manager.
albaString & GetFileName()
Get the filename of the current tree.
wxConfigBase * m_Config
Application configuration for file history management.
std::vector< albaString > m_AppStamp
Application stamps for our application.
void NotifyRemove(albaVME *n)
Send the event VME_REMOVING to inform logic that the vme and its subtree are removed from the tree.
albaObserver * m_Listener
Register the event receiver object.
void VmeRemove(albaVME *n)
Remove the vme from the tree.
const char * ZIPOpen(albaString filename)
Open the compressed zmsf filename.
~albaVMEManager()
destructor
albaVMERoot - a VME is the root of a tree of VME nodes.
Definition: albaVMERoot.h:35
A storage class for MSF local files.
albaVME -
Definition: albaVME.h:150