ALBA
|
#include <albaStorage.h>
Public Types | |
enum | STORAGE_IO_ERRORS { IO_OK =0 , IO_GENERIC_ERROR , IO_WRONG_OBJECT_TYPE , IO_LAST_ERROR } |
Public Member Functions | |
albaAbstractTypeMacro (albaStorage, albaObject) | |
albaStorage () | |
virtual | ~albaStorage () |
virtual void | SetURL (const char *name) |
void | ForceParserURL () |
const char * | GetURL () |
const char * | GetPareserURL () |
int | Store () |
int | Restore () |
void | SetDocument (albaStorable *doc) |
albaStorable * | GetDocument () |
virtual int | ResolveInputURL (const char *url, albaString &filename, albaObserver *observer=NULL)=0 |
virtual int | StoreToURL (const char *filename, const char *url=NULL)=0 |
virtual int | ReleaseURL (const char *url)=0 |
virtual void | GetTmpFile (albaString &filename) |
void | ReleaseTmpFile (const char *filename) |
bool | IsFileInDirectory (const char *filename) |
virtual void | SetTmpFolder (const char *folder) |
virtual const char * | GetTmpFolder () |
void | SetErrorCode (int err) |
int | GetErrorCode () |
bool | NeedsUpgrade () |
Public Member Functions inherited from albaObject | |
albaObject () | |
virtual | ~albaObject () |
virtual void | Delete () |
virtual const char * | GetTypeName () const |
virtual bool | IsA (const char *type_name) const |
virtual bool | IsA (const albaTypeID &type_id) const |
virtual albaObject * | NewObjectInstance () const =0 |
virtual const albaTypeID & | GetTypeId () const |
virtual void | Print (std::ostream &os, const int indent=0) const |
albaObject (const albaObject &c) | |
Protected Member Functions | |
virtual int | InternalStore ()=0 |
virtual int | InternalRestore ()=0 |
virtual int | OpenDirectory (const char *dir_name)=0 |
Protected Attributes | |
bool | m_NeedsUpgrade |
albaStorable * | m_Document |
albaStorageElement * | m_DocumentElement |
albaString | m_URL |
albaString | m_ParserURL |
albaID | m_TmpFileId |
albaString | m_TmpFolder |
std::set< albaString > | m_TmpFileNames |
std::set< albaString > | m_FilesDictionary |
int | m_ErrorCode |
Protected Attributes inherited from albaObject | |
bool | m_HeapFlag |
Additional Inherited Members | |
Static Public Member Functions inherited from albaObject | |
static const char * | GetStaticTypeName () |
static bool | IsStaticType (const char *type_name) |
static bool | IsStaticType (const albaTypeID &type_id) |
static const albaTypeID & | GetStaticTypeId () |
static albaObject * | SafeDownCast (albaObject *o) |
Abstract class for an abject mastering the storing/restoring of objects This is an abstract class providing defining APIs for objects mastering storing/restoring of storing and restoring of albaStorable objects.
Concrete implementation will define a concrete encoding. The basic idea of storing and restoring is the creation of a parallel tree, with all information to be stored or restored. The tree is made of albaStorageElement nodes (or better, concrete classes inherited from it). The storage class provides an access to the document element and defines a couple of functions InternalStore and InternalRestore for implementing the concrete mechanisms. Users of this kind of object should provide an URL of the document to be opened/saved, and than call Store() or Restore(). In case of Restoring, the Document element is automatically created by the storage class, while when storing it must be set (or can have be created during a previous restoring). This class will also provide a high level mechanism for resolving URLs, that will try to copy locally remote or zipped files and allow a simple file access to I/O classes.
Definition at line 47 of file albaStorage.h.
Enumerator | |
---|---|
IO_OK | |
IO_GENERIC_ERROR | |
IO_WRONG_OBJECT_TYPE | |
IO_LAST_ERROR |
Definition at line 52 of file albaStorage.h.
albaStorage::albaStorage | ( | ) |
|
inlinevirtual |
Definition at line 55 of file albaStorage.h.
albaStorage::albaAbstractTypeMacro | ( | albaStorage | , |
albaObject | |||
) |
|
virtual |
Set the URL of the document to be read or written.
Reimplemented in albaVMEStorage, and albaXMLStorage.
void albaStorage::ForceParserURL | ( | ) |
Force Copy storage URL to parser URL (used by the ALBA1.x importer)
const char * albaStorage::GetURL | ( | ) |
Return the URL of the document to be read or written.
const char * albaStorage::GetPareserURL | ( | ) |
Return the name of the last read file, this is internally used when writing to a new file to read and copy information between the old and new file.
int albaStorage::Store | ( | ) |
perform storing.
the argument is the tag of the document node
int albaStorage::Restore | ( | ) |
perform restoring.
the argument is the tag of the document node
void albaStorage::SetDocument | ( | albaStorable * | doc | ) |
set the document element to be stored
albaStorable * albaStorage::GetDocument | ( | ) |
return the document object restored
|
pure virtual |
resolve an URL and provide local filename to be used as input
Implemented in albaXMLStorage.
|
pure virtual |
resolve an URL and provide a local filename to be used as output
store a file to an URL. This API transfer a tmp local file to URL. If no URL is specified use the storage URL as a base URL.
Implemented in albaXMLStorage.
|
pure virtual |
Remove a file from the specified URL.
Used when a file in the storage is no more necessary. If the specified URL is a local file name try to prepend the storage URL as a base URL name.
Implemented in albaXMLStorage.
|
virtual |
Return a name of file to be used as tmp file during store/restore.
This is usually located insed the MSF file directory
void albaStorage::ReleaseTmpFile | ( | const char * | filename | ) |
remove the tmp file
bool albaStorage::IsFileInDirectory | ( | const char * | filename | ) |
Check if a file is present in the storage directory.
The directory list is open when Store() is called and directory data is updated at that time.
|
inlinevirtual |
Set the folder where to store tmp files.
If not specified the storage will automatically use a default folder, like the current directory or the storage file folder.
Definition at line 117 of file albaStorage.h.
|
inlinevirtual |
return the folder where tmp files are stored
Reimplemented in albaXMLStorage.
Definition at line 120 of file albaStorage.h.
|
inline |
Definition at line 122 of file albaStorage.h.
|
inline |
Definition at line 123 of file albaStorage.h.
|
inline |
Definition at line 125 of file albaStorage.h.
|
protectedpure virtual |
This is called by Store() and must be reimplemented by subclasses.
Implemented in albaXMLStorage.
|
protectedpure virtual |
This is called by Restore() and must be reimplemented by subclasses.
Implemented in albaXMLStorage.
|
protectedpure virtual |
populate the list of files in the storage folder
Implemented in albaXMLStorage.
|
protected |
Flag used to enable or not the upgrade mechanism.
Definition at line 137 of file albaStorage.h.
|
protected |
document object to be stored, or being restored
Definition at line 138 of file albaStorage.h.
|
protected |
document stored element
Definition at line 139 of file albaStorage.h.
|
protected |
name of the file being accessed
Definition at line 141 of file albaStorage.h.
|
protected |
name of the last parsed file (used for SaveAs)
Definition at line 142 of file albaStorage.h.
|
protected |
counter for unique tmp file naming
Definition at line 143 of file albaStorage.h.
|
protected |
folder where to store tmp files
Definition at line 144 of file albaStorage.h.
|
protected |
name of tmp files in the MSF dir
Definition at line 146 of file albaStorage.h.
|
protected |
list of files in the storage folder: to be populated by OpenDirectory()
Definition at line 147 of file albaStorage.h.
|
protected |
the error code 0==OK
Definition at line 148 of file albaStorage.h.