ALBA
albaXMLStorage.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaXMLStorage
5 Authors: Marco Petrone
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 __albaXMLStorage_h__
17#define __albaXMLStorage_h__
18
19#include "albaStorage.h"
20
21//----------------------------------------------------------------------------
22// forward declarations :
23//----------------------------------------------------------------------------
24class albaXMLElement;
25class mmuXMLDOM;
26
27
38class ALBA_EXPORT albaXMLStorage: public albaStorage
39{
40public:
42
43 enum XML_IO_ERRORS {IO_XML_PARSE_ERROR=IO_LAST_ERROR,IO_DOM_XML_ERROR,IO_RESTORE_ERROR,IO_WRONG_FILE_TYPE,IO_WRONG_FILE_VERSION,IO_WRONG_URL,IO_XML_PARSER_INTERNAL_ERROR};
44
46 virtual ~albaXMLStorage();
47
51 mmuXMLDOM *GetXMLDOM() {return m_DOM;}
52
54 void SetFileType(const char *filetype);
56 const char *GetFileType();
57
59 void SetVersion(const char *version);
60
62 const char *GetVersion();
63
65 const char *GetDocumentVersion();
66
68 virtual int ResolveInputURL(const char * url, albaString &filename, albaObserver *observer = NULL);
69
71 virtual int StoreToURL(const char * filename, const char * url);
72
74 virtual int ReleaseURL(const char *url);
75
77 virtual int DeleteURL(const char *url);
78
80 virtual int OpenDirectory(const char *pathname);
81
83 virtual void SetURL(const char *name);
84
85 virtual const char* GetTmpFolder();
86
88 virtual void EmptyGarbageCollector();
89
90protected:
92 virtual int InternalStore();
93
95 virtual int InternalRestore();
96
101 std::set<albaString> m_GarbageCollector;
103};
104#endif // _albaXMLStorage_h_
Interface implementing the Observer of the Subject/Observer design pattern.
Definition: albaObserver.h:36
Abstract class for an abject mastering the storing/restoring of objects This is an abstract class pro...
Definition: albaStorage.h:48
albaString - performs common string operations on c-strings.
Definition: albaString.h:43
concrete implementation of albaStorageElement as an XML-DOM element This class represent a concrete i...
Concrete implementation of Storage object using Xerces-C for storing in XML.
virtual int OpenDirectory(const char *pathname)
populate the list of file in the directory
mmuXMLDOM * GetXMLDOM()
Return the instance of the DOM document used while reading and writing.
albaString m_DefaultTmpFolder
used to store the current default tmp folder
virtual int InternalStore()
This is called by Store() and must be reimplemented by subclasses.
virtual void EmptyGarbageCollector()
empty the garbage collector list deleting old files
albaString m_DocumentVersion
Open Document version.
albaTypeMacro(albaXMLStorage, albaStorage)
albaString m_FileType
The type of file to be opened.
virtual void SetURL(const char *name)
Set the URL of the document to be read or written.
virtual int ResolveInputURL(const char *url, albaString &filename, albaObserver *observer=NULL)
resolve an URL and provide local filename to be used as input
virtual int ReleaseURL(const char *url)
release file from storage.
virtual int StoreToURL(const char *filename, const char *url)
resolve an URL and provide a local filename to be used as output
albaString m_Version
Current MSF version.
virtual ~albaXMLStorage()
const char * GetVersion()
The version of the file format used type of file.
virtual int DeleteURL(const char *url)
remove the file from URL
void SetVersion(const char *version)
The version of the file format used type of file.
virtual const char * GetTmpFolder()
return the folder where tmp files are stored
virtual int InternalRestore()
This is called by Restore() and must be reimplemented by subclasses.
mmuXMLDOM * m_DOM
PIMPL object storing XML objects' pointers.
const char * GetDocumentVersion()
Return the version of the opened document.
std::set< albaString > m_GarbageCollector
collect URL to be released
const char * GetFileType()
The TAG identifying the type (i.e.
void SetFileType(const char *filetype)
The TAG identifying the type (i.e.
mmuXMLDOM utility class for PIMPL of XML DOM types.
Definition: mmuXMLDOM.h:44