|
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members
PmtAccessor Class ReferenceThe PmtAccessor is the base class for accessor implementations.
More...
#include <PmtAccessor.h>
Inheritance diagram for PmtAccessor: [legend]Collaboration diagram for PmtAccessor:[legend]List of all members.
Detailed Description
The PmtAccessor is the base class for accessor implementations.
An Accessor's primary responsibility is to provide applications with read / write access to stored metadata. The metadata may be stored in an image file, in a file system through the metadata persistence mechanism, in a database (relational or object), etc. Initial considerations have been limited to image file access. PmtAccessor is the base class from which all other accessors will be derived. Prior to using an accessor, the application must ensure that the metadata definitions have been loaded via the LogicalDefinitionInterpreter.
The PmtAccessor class keeps a factory object where all derived accessors are registered. It provides a static factory method getAccessor() for creating a specific accessor to access the given file. All derived accessors must use the EkFactory mechanism (EK_PROVIDE, EK_REQUIRE) to register itself in the factory object.
Constructor & Destructor Documentation
virtual PmtAccessor::~PmtAccessor |
( |
|
) |
[inline, virtual] |
|
|
The constructor is protected to ensure that only derived classes can call it.
|
Member Function Documentation
|
This method returns a copy of the accessor.
Implemented in PmtExifAccessor. |
virtual void PmtAccessor::close |
( |
|
) |
[inline, virtual] |
|
|
Close the file.
This is a pure virtual function that is to be implemented by the derived classes.
Reimplemented in PmtExifAccessor. |
|
create an instance of the specified accessor.
Allows the instantiation of a specific accessor implementation without needing the include the implementations header file. |
void PmtAccessor::erase |
( |
|
) |
[static, protected] |
|
|
Return the factory object.
This method is for the purpose of registering accessor. The user of PMT normally never call it. |
|
Return the format name of the file to be accessed.
|
|
This method creates and returns the proper accessor implementation for the given file.
|
virtual void PmtAccessor::getMdValue |
( |
PmtMetadataPtr & |
md |
) |
[protected, pure virtual] |
|
bool PmtAccessor::isErrorThrown |
( |
|
) |
const [inline] |
|
|
Check if any error is thrown and suppressed.
|
void PmtAccessor::load |
( |
const SPmtString & |
filename |
) |
[protected] |
|
|
Initializes the translation table from the supplied file.
|
void PmtAccessor::load |
( |
|
) |
[protected] |
|
|
Initializes the translation table from the compiled in default.
|
void PmtAccessor::loadCommon |
( |
DOMParser * |
parser |
) |
[protected] |
|
|
Common code for parsing and loading translation tables.
|
void PmtAccessor::loadIfAny |
( |
|
) |
[protected] |
|
void PmtAccessor::loadMemory |
( |
const char * |
translationTable |
) |
[protected] |
|
|
Initialized the translation table from the supplied in-memory argument.
|
virtual bool PmtAccessor::open |
( |
const char * |
name, |
|
|
PmtOpenMode |
mode = PMT_READONLY |
|
) |
[pure virtual] |
|
|
Open a file.
This is a pure virtual function that is to be implemented by the derived classes.
Implemented in PmtExifAccessor. |
void PmtAccessor::printErrorsSuppressed |
( |
ostream & |
c = cout |
) |
const |
|
|
Print the messages of the suppressed errors.
|
|
Read the specified metadata from the storage format.
|
|
Read the specified metadata from the storage format.
Reimplemented in PmtXmlAccessor. |
|
Read all existing metadata and return a root metadata.
Reimplemented in PmtExifAccessor. |
virtual bool PmtAccessor::recognize |
( |
const SPmtString & |
name |
) |
const [protected, pure virtual] |
|
|
Used by the getAccessor() method to determine the file type.
The derived accessor classes that want to be created from the getAccessor() method should provide an implementation for this method.
Implemented in PmtExifAccessor. |
virtual void PmtAccessor::setMdValue |
( |
const PmtMetadataPtr & |
md |
) |
[protected, pure virtual] |
|
bool& PmtAccessor::throwErrors |
( |
|
) |
[inline] |
|
|
Provides the application control over how metadata access errors are handled.
If throwErrors is set true, then an error will be thrown if there is any problem accessing the requested metadata. If set false, no errors will be thrown. The default setting is false. |
const bool& PmtAccessor::throwErrors |
( |
|
) |
const [inline] |
|
|
This function returns the throwError flag.
|
|
Request the accessor to write the given metadata to the storage media.
The argument is a pointer to an instance of either an PmtMetadata (for a single metadata item) or an PmtCompositeMetadata (for multiple metadata items). If throwErrors() is set to false and an error occurs, one of two things will happen. First, if the write is for a single metadata, then the write will just be aborted. Second, if the write is for a composite, then the write of the current metadatum is aborted and the writing of the composite contiues with the next element. If throwErrors() is set to true, then the write operation is always aborted by throwing the error. If bWriteValid is false then only the given metadata (including its childern) will be written; otherwise, the whole metadata tree starting from the out-most parent will be written. |
void PmtAccessor::writeMetadata |
( |
const PmtMetadataPtr & |
md, |
|
|
bool |
bWriteValid = false |
|
) |
[virtual] |
|
|
Request the accessor to write the given metadata to the storage media.
The argument is a pointer to an instance of either an PmtMetadata (for a single metadata item) or an PmtCompositeMetadata (for multiple metadata items). If throwErrors() is set to false and an error occurs, one of two things will happen. First, if the write is for a single metadata, then the write will just be aborted. Second, if the write is for a composite, then the write of the current metadatum is aborted and the writing of the composite contiues with the next element. If throwErrors() is set to true, then the write operation is always aborted by throwing the error. If bWriteValid is false then only the given metadata (including its childern) will be written; otherwise, the whole metadata tree starting from the out-most parent will be written.
Reimplemented in PmtXmlAccessor. |
Member Data Documentation
vector<PmtError> PmtAccessor::mErrors [protected]
|
|
const char *const PmtAccessor::msDefaultTranslationTableArray [static, protected]
|
|
EK_DEFAULT_MUTEX PmtAccessor::msLock [static, protected]
|
|
PmtTranslationTableMap PmtAccessor::msTranslationTable [static, protected]
|
|
bool PmtAccessor::mThrowErrors [protected]
|
|
The documentation for this class was generated from the following files:
|