Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

Mpeg7DocWrite.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_VideoSet_Mpeg7DocWrite_h
00002 #define Impala_Core_VideoSet_Mpeg7DocWrite_h
00003 
00004 #include "Persistency/Mpeg7DocRepository.h"
00005 #include "Core/VideoSet/VideoSet.h"
00006 #include "Core/VideoSet/Mpeg7Doc.h"
00007 
00008 namespace Impala
00009 {
00010 namespace Core
00011 {
00012 namespace VideoSet
00013 {
00014 
00015 
00017 inline bool
00018 Mpeg7DocWrite(Mpeg7Doc* doc, VideoSet* vidSet, int videoId)
00019 {
00020     ILOG_VAR(Impala.Core.VideoSet.Mpeg7DocWrite);
00021 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00022     String fName;
00023     if (doc->GetAnnoIsConcept())
00024         fName = vidSet->GetFilePathMpeg7Concept(videoId, doc->GetConceptSet(),
00025                                                 doc->GetAnnoFileName() + ".xml",
00026                                                 true, false);
00027     else if (doc->HasAnnotations())
00028         fName = vidSet->GetFilePathMpeg7Anno(videoId, doc->GetConceptSet(),
00029                                              doc->GetAnnoFileName() + ".xml",
00030                                              true, false);
00031     else if (doc->HasFeatures())
00032         fName = vidSet->GetFilePathMpeg7Feature(videoId,
00033                                                 doc->GetFeature() + ".xml",
00034                                                 true, false);
00035     else
00036         fName = vidSet->GetFilePathMpeg7Shot(videoId, true, false);
00037     if (fName.empty())
00038     {
00039         ILOG_ERROR("Unable to write");
00040         return false;
00041     }
00042     Util::Database* db = vidSet->GetDatabase();
00043     Util::IOBuffer* ioBuf = db->GetIOBuffer(fName, false, false, "tmp");
00044     doc->ExportXml(ioBuf);
00045     delete ioBuf;
00046     return true;
00047 #else // REPOSITORY_USED
00048     typedef Persistency::Mpeg7DocLocator Mpeg7DocLocator;
00049     String container = vidSet->GetAsPath(videoId);
00050     Mpeg7DocLocator loc;
00051     Persistency::Locator base = vidSet->GetLocator();
00052     if (doc->GetAnnoIsConcept())
00053         loc = Mpeg7DocLocator(base, Mpeg7DocLocator::MPEG7_CONCEPT,
00054                               doc->GetConceptSet() + "/" + container,
00055                               doc->GetAnnoFileName() + ".xml");
00056     else if (doc->HasAnnotations())
00057         loc = Mpeg7DocLocator(base, Mpeg7DocLocator::MPEG7_ANNOTATION,
00058                               doc->GetConceptSet() + "/" + container,
00059                               doc->GetAnnoFileName() + ".xml");
00060     else if (doc->HasFeatures())
00061         loc = Mpeg7DocLocator(base, Mpeg7DocLocator::MPEG7_FEATURE,
00062                               container, doc->GetFeature() + ".xml");
00063     else
00064         loc = Mpeg7DocLocator(base, Mpeg7DocLocator::MPEG7_SHOT,
00065                               container, vidSet->GetFileBase(videoId) + ".xml");
00066     Persistency::Mpeg7DocRepository().Add(loc, doc);
00067     return true;
00068 #endif // REPOSITORY_USED
00069 }
00070 
00071 } // namespace VideoSet
00072 } // namespace Core
00073 } // namespace Impala
00074 
00075 #endif

Generated on Fri Mar 19 09:31:31 2010 for ImpalaSrc by  doxygen 1.5.1