LTIMetadataDatabase Class Reference

class for storing metadata associated with an image More...

#include <lti_metadataDatabase.h>

List of all members.

Public Member Functions

 LTIMetadataDatabase ()
 default constructor
 LTIMetadataDatabase (const LTIMetadataDatabase &)
 copy constructor
virtual ~LTIMetadataDatabase ()
 destructor
lt_int32 getApproximateSize () const
 get size of metadata database
void sort (void)
 Sorts the database records by tag name.
Add functions
LT_STATUS add (const LTIMetadataRecord &record)
 add a record
LT_STATUS add (const LTIMetadataDatabase &database)
 add all the records from a database
Retrieval functions
LT_STATUS get (const char *tagName, const LTIMetadataRecord *&record) const
 retrieve a record, given a tag name
LT_STATUS get (LTIMetadataTag tag, const LTIMetadataRecord *&record) const
 retrieve a record, given a tag number
bool has (const char *tagName) const
 lookup a record, given a tag name
bool has (LTIMetadataTag tag) const
 lookup a record, given a tag number
LT_STATUS getDataByIndex (lt_uint32 index, const LTIMetadataRecord *&record) const
 retrieve a record, given an index number
lt_uint32 getIndexCount () const
 get number of records
Removal functions
LT_STATUS remove (const char *tagName)
 remove a record, given a tag name
LT_STATUS remove (LTIMetadataTag tag)
 remove a record, given a tag number
LT_STATUS removeAll ()
 remove all records


Detailed Description

This class implements a simple database which holds a set of LTIMetadataRecords. Each record has a unique tag associated with it.

Each LTIImage object contains an LTIMetadataDatabase for the metadata associated with that image.

The database (and records) are stored in memory in a format-neutral manner. For importing or exporting metadata records to permanent storage, see the LTIMetadataReader and LTIMetadataWriter classes.

Examples:

MetadataDump.cpp.

Definition at line 45 of file lti_metadataDatabase.h.


Constructor & Destructor Documentation

LTIMetadataDatabase::LTIMetadataDatabase (  ) 

This constructor creates an empty metadata database.

LTIMetadataDatabase::LTIMetadataDatabase ( const LTIMetadataDatabase  ) 

virtual LTIMetadataDatabase::~LTIMetadataDatabase (  )  [virtual]


Member Function Documentation

LT_STATUS LTIMetadataDatabase::add ( const LTIMetadataRecord record  ) 

This function adds the given record to the metadata database.

If the database already contains a record with the given tag, a status code of LT_STS_LTIMetadata_DuplicateTag is returned.

Parameters:
record the record to add
Returns:
status code indicating success or failure

LT_STATUS LTIMetadataDatabase::add ( const LTIMetadataDatabase database  ) 

This function adds all the records from the given database to this database.

If the database already contains a record with the same tag as one of the records in the database being added, no records are added and a status code of LT_STS_LTIMetadata_DuplicateTag is returned.

Parameters:
database the database containing the records to add
Returns:
status code indicating success or failure

LT_STATUS LTIMetadataDatabase::get ( const char *  tagName,
const LTIMetadataRecord *&  record 
) const

This function returns a pointer to the (first) record in the database that matches the given tag name.

If the tag is not found, the pointer will be set to NULL and a status of LT_STS_LTIMetadata_TagNotFound will be returned.

Parameters:
tagName the name of the tag of the record to retrieve
record pointer to the retrieved record
Returns:
status code indicating success or failure

LT_STATUS LTIMetadataDatabase::get ( LTIMetadataTag  tag,
const LTIMetadataRecord *&  record 
) const

This function returns a pointer to the (first) record in the database that matches the given tag number.

If the tag is not found, the pointer will be set to NULL and a status of LT_STS_LTIMetadata_TagNotFound will be returned.

Parameters:
tag the number of the tag of the record to retrieve
record pointer to the retrieved record
Returns:
status code indicating success or failure

bool LTIMetadataDatabase::has ( const char *  tagName  )  const

This function returns a boolean indicating whether the database contains a record with the given tag.

Parameters:
tagName the name of the tag of the record to look up
Returns:
true if the tag is found, otherwise false

bool LTIMetadataDatabase::has ( LTIMetadataTag  tag  )  const

This function returns a boolean indicating whether the database contains a record with the given tag.

Parameters:
tag the number of the tag of the record to look up
Returns:
true if the tag is found, otherwise false

LT_STATUS LTIMetadataDatabase::getDataByIndex ( lt_uint32  index,
const LTIMetadataRecord *&  record 
) const

This function returns a pointer to the (first) record in the database that matches the given index number.

In combination with getIndexCount(), this function can be used to iterate through all the records in the database. (However, removing a record will change the index numbers, so be careful if iterating and removing in the same loop.)

If the index number is not found, the pointer will be set to NULL and a status of LT_STS_LTIMetadata_TagNotFound will be returned.

Parameters:
index the index number of the record to retrieve
record pointer to the retrieved record
Returns:
status code indicating success or failure

lt_uint32 LTIMetadataDatabase::getIndexCount (  )  const

This function will return the number of records in the database.

Returns:
the number of records

LT_STATUS LTIMetadataDatabase::remove ( const char *  tagName  ) 

This function will remove the record with the given tag from the database.

If the tag is not found, a status of LT_STS_LTIMetadata_TagNotFound will be returned.

Parameters:
tagName the name of the tag of the record to remove
Returns:
status code indicating success or failure

LT_STATUS LTIMetadataDatabase::remove ( LTIMetadataTag  tag  ) 

This function will remove the record with the given tag from the database.

If the tag is not found, a status of LT_STS_LTIMetadata_TagNotFound will be returned.

Parameters:
tag the number of the tag of the record to remove
Returns:
status code indicating success or failure

LT_STATUS LTIMetadataDatabase::removeAll (  ) 

This function will remove all the records from the database.

Returns:
status code indicating success or failure

lt_int32 LTIMetadataDatabase::getApproximateSize (  )  const

This function will return a close-enough estimate of the size of the metadata database, as if it were to be written directly to disk.

Returns:
size in bytes of the metadata database

void LTIMetadataDatabase::sort ( void   ) 

This can be useful in certain debugging and validation scenarios.


The documentation for this class was generated from the following file:

LizardTech