MetaData Class Reference

#include <metadata.h>

Collaboration diagram for MetaData:

Collaboration graph
[legend]
List of all members.

Detailed Description

MetaData container which can contain any number of any type of different Metadata-like objects.

By default none of the memory-heavy structures are created - they are stored as smart pointers.

This class also submits events when file names, hashests and so on are added to it. Refer to MDEvt documentation on event types submitted from this class, and EventTable documentation on how to handle events.

The objects of this class are owned by MetaDb and the destructor has been protected. As such, you cannot create MetaData objects on stack, and if you create them on heap, you MUST submit them to MetaDb because you are not able to delete them yourself.

Definition at line 443 of file metadata.h.


Public Member Functions

 DECLARE_EVENT_TABLE (MetaData *, int)
 MetaData (uint64_t fileSize, FileType type=FT_UNKNOWN, bool typeGuessed=true)
 Constructor.
 MetaData (std::istream &ifs)
 Construct by reading data from input stream.
 MetaData ()
 Default constructor.
 ~MetaData ()
 Destructor is exposed to allow more generic usage of the object.
Setters
void addVideoData (VideoMetaData *vmd)
void addAudioData (AudioMetaData *amd)
void setArchiveData (ArchiveMetaData *amd)
void setImageData (ImageMetaData *imd)
void addFileName (const std::string &name)
void addHashSet (HashSetBase *hashset)
void setFileSize (uint64_t size)
void setModDate (uint32_t date)
void setFileType (FileType type)
void setTypeGuessed (bool guessed)
Getters
uint32_t getVideoDataCount () const
VideoMetaData *const getVideoData (uint32_t num)
uint32_t getAudioDataCount () const
AudioMetaData *const getAudioData (uint32_t num) const
ArchiveMetaData *const getArchiveData () const
ImageMetaData *const getImageData () const
uint32_t getHashSetCount () const
HashSetBase *const getHashSet (uint32_t num) const
uint32_t getFileNameCount () const
std::string getFileName (uint32_t num) const
uint64_t getFileSize () const
uint32_t getModDate () const
FileType getFileType () const
bool getTypeGuessed () const

Private Types

typedef std::vector< VideoMetaData
* >::const_iterator 
CVMDIter
typedef std::vector< AudioMetaData
* >::const_iterator 
CAMDIter
typedef std::vector< HashSetBase
* >::const_iterator 
CHIter

Private Member Functions

 MetaData (const MetaData &md)
 Copy construct forbidden.
MetaDataoperator= (const MetaData &)
 Assignment forbidden.

Private Attributes

std::vector< VideoMetaData * > m_videoData
 Video data streams.
std::vector< AudioMetaData * > m_audioData
 Audio data streams.
ArchiveMetaDatam_archiveData
 Archive data.
ImageMetaDatam_imageData
 Image data.
std::vector< HashSetBase * > m_hashsets
 Hash sets.
std::vector< std::string > m_fileNames
 All known file names.
uint64_t m_fileSize
 File size.
uint32_t m_modDate
 File modification date.
FileType m_fileType
 File type.
bool m_typeGuessed
 If type was guessed.

Friends

std::ostream & operator<< (std::ostream &o, const MetaData &md)
 Output operator for streams.

Member Typedef Documentation

typedef std::vector<AudioMetaData*>::const_iterator MetaData::CAMDIter [private]
 

Definition at line 559 of file metadata.h.

typedef std::vector<HashSetBase*>::const_iterator MetaData::CHIter [private]
 

Definition at line 569 of file metadata.h.

typedef std::vector<VideoMetaData*>::const_iterator MetaData::CVMDIter [private]
 

Definition at line 555 of file metadata.h.


Constructor & Destructor Documentation

MetaData::MetaData uint64_t  fileSize,
FileType  type = FT_UNKNOWN,
bool  typeGuessed = true
 

Constructor.

Definition at line 716 of file metadata.cpp.

MetaData::MetaData std::istream &  ifs  ) 
 

Construct by reading data from input stream.

Definition at line 726 of file metadata.cpp.

References FT_UNKNOWN, CGComm::loadHashSet(), logError(), logTrace(), logWarning(), m_archiveData, m_audioData, m_fileNames, m_fileSize, m_fileType, m_hashsets, m_imageData, m_modDate, m_typeGuessed, m_videoData, CGComm::OP_AMD, CGComm::OP_ARMD, CGComm::OP_HASHSET, CGComm::OP_IMD, CGComm::OP_MD_FILENAME, CGComm::OP_MD_FILESIZE, CGComm::OP_MD_FILETYPE, CGComm::OP_MD_MODDATE, CGComm::OP_MD_TYPEGUESSED, CGComm::OP_VMD, and TRACE_MD.

Here is the call graph for this function:

MetaData::MetaData  ) 
 

Default constructor.

Definition at line 722 of file metadata.cpp.

References FT_UNKNOWN.

MetaData::~MetaData  ) 
 

Destructor is exposed to allow more generic usage of the object.

While the main purpose of this object was to remain hidden inside MetaDb and owned only by MetaDb, practice has shown this object is useful outside the MetaDb context also, and thus the destructor has been exposed. This does open a possibility of abuse though by objects using MetaData pointers given out by MetaDb.

Definition at line 822 of file metadata.cpp.

References m_archiveData, m_audioData, m_hashsets, m_imageData, and m_videoData.

MetaData::MetaData const MetaData md  )  [private]
 

Copy construct forbidden.


Member Function Documentation

void MetaData::addAudioData AudioMetaData amd  )  [inline]
 

Definition at line 479 of file metadata.h.

References MD_ADDED_AUDIO.

void MetaData::addFileName const std::string &  name  )  [inline]
 

Definition at line 491 of file metadata.h.

References MD_ADDED_FILENAME.

Referenced by HashWork::finish().

void MetaData::addHashSet HashSetBase hashset  )  [inline]
 

Definition at line 495 of file metadata.h.

References MD_ADDED_HASHSET.

Referenced by HashWork::finish().

void MetaData::addVideoData VideoMetaData vmd  )  [inline]
 

Definition at line 475 of file metadata.h.

References MD_ADDED_VIDEO.

MetaData::DECLARE_EVENT_TABLE MetaData ,
int 
 

ArchiveMetaData* const MetaData::getArchiveData  )  const [inline]
 

Definition at line 519 of file metadata.h.

AudioMetaData* const MetaData::getAudioData uint32_t  num  )  const [inline]
 

Definition at line 515 of file metadata.h.

uint32_t MetaData::getAudioDataCount  )  const [inline]
 

Definition at line 514 of file metadata.h.

std::string MetaData::getFileName uint32_t  num  )  const [inline]
 

Definition at line 539 of file metadata.h.

Referenced by PartData::onHashEvent(), and MetaDb::onSharedFileEvent().

uint32_t MetaData::getFileNameCount  )  const [inline]
 

Definition at line 538 of file metadata.h.

uint64_t MetaData::getFileSize  )  const [inline]
 

Definition at line 543 of file metadata.h.

Referenced by PartData::onHashEvent().

FileType MetaData::getFileType  )  const [inline]
 

Definition at line 545 of file metadata.h.

HashSetBase* const MetaData::getHashSet uint32_t  num  )  const [inline]
 

Definition at line 534 of file metadata.h.

Referenced by HashWork::finish(), SharedFile::isDuplicate(), PartData::onHashEvent(), MetaDb::onSharedFileEvent(), PartData::setMetaData(), and PartData::verifyHashSet().

uint32_t MetaData::getHashSetCount  )  const [inline]
 

Definition at line 533 of file metadata.h.

ImageMetaData* const MetaData::getImageData  )  const [inline]
 

Definition at line 526 of file metadata.h.

uint32_t MetaData::getModDate  )  const [inline]
 

Definition at line 544 of file metadata.h.

Referenced by SharedFile::read().

bool MetaData::getTypeGuessed  )  const [inline]
 

Definition at line 546 of file metadata.h.

VideoMetaData* const MetaData::getVideoData uint32_t  num  )  [inline]
 

Definition at line 510 of file metadata.h.

uint32_t MetaData::getVideoDataCount  )  const [inline]
 

Definition at line 509 of file metadata.h.

MetaData& MetaData::operator= const MetaData  )  [private]
 

Assignment forbidden.

void MetaData::setArchiveData ArchiveMetaData amd  )  [inline]
 

Definition at line 483 of file metadata.h.

References MD_ADDED_ARCHIVE.

void MetaData::setFileSize uint64_t  size  )  [inline]
 

Definition at line 499 of file metadata.h.

Referenced by SharedFile::checkFileSize().

void MetaData::setFileType FileType  type  )  [inline]
 

Definition at line 501 of file metadata.h.

void MetaData::setImageData ImageMetaData imd  )  [inline]
 

Definition at line 487 of file metadata.h.

References MD_ADDED_IMAGE.

void MetaData::setModDate uint32_t  date  )  [inline]
 

Definition at line 500 of file metadata.h.

Referenced by HashWork::finish(), PartData::flushBuffer(), SharedFile::setLocation(), and SharedFile::updateModDate().

void MetaData::setTypeGuessed bool  guessed  )  [inline]
 

Definition at line 502 of file metadata.h.


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  o,
const MetaData md
[friend]
 

Output operator for streams.

Definition at line 843 of file metadata.cpp.


Member Data Documentation

ArchiveMetaData* MetaData::m_archiveData [private]
 

Archive data.

Definition at line 562 of file metadata.h.

Referenced by MetaData(), and ~MetaData().

std::vector<AudioMetaData*> MetaData::m_audioData [private]
 

Audio data streams.

Definition at line 558 of file metadata.h.

Referenced by MetaData(), and ~MetaData().

std::vector<std::string> MetaData::m_fileNames [private]
 

All known file names.

Definition at line 571 of file metadata.h.

Referenced by MetaData().

uint64_t MetaData::m_fileSize [private]
 

File size.

Definition at line 572 of file metadata.h.

Referenced by MetaData().

FileType MetaData::m_fileType [private]
 

File type.

Definition at line 574 of file metadata.h.

Referenced by MetaData().

std::vector<HashSetBase*> MetaData::m_hashsets [private]
 

Hash sets.

Definition at line 568 of file metadata.h.

Referenced by MetaData(), and ~MetaData().

ImageMetaData* MetaData::m_imageData [private]
 

Image data.

Definition at line 565 of file metadata.h.

Referenced by MetaData(), and ~MetaData().

uint32_t MetaData::m_modDate [private]
 

File modification date.

Definition at line 573 of file metadata.h.

Referenced by MetaData().

bool MetaData::m_typeGuessed [private]
 

If type was guessed.

Definition at line 575 of file metadata.h.

Referenced by MetaData().

std::vector<VideoMetaData*> MetaData::m_videoData [private]
 

Video data streams.

Definition at line 554 of file metadata.h.

Referenced by MetaData(), and ~MetaData().


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