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

QuerySetTable.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_IDash_QuerySetTable_h
00002 #define Impala_Core_IDash_QuerySetTable_h
00003 
00004 #include "Core/VideoSet/VideoSet.h"
00005 #include "Core/Table/TableTem.h"
00006 #include "Core/Table/Read.h"
00007 #include "Core/Table/Write.h"
00008 #include "Core/Column/Find.h"
00009 #include "Core/Column/Contains.h"
00010 
00011 namespace Impala
00012 {
00013 namespace Core
00014 {
00015 namespace IDash
00016 {
00017 
00018 
00019 typedef Table::TableTem<Column::ColumnTem<String>,
00020                         Column::ColumnTem<String>,
00021                         Column::ColumnTem<String>,
00022                         Column::ColumnTem<String> > QuerySetTableBaseType;
00023 
00024 
00025 class QuerySetTable : public QuerySetTableBaseType
00026 {
00027 public:
00028 
00029     QuerySetTable(VideoSet::VideoSet* vidSet, String name)
00030         : QuerySetTableBaseType(0)
00031     {
00032         mVidSet = vidSet;
00033         mName = name;
00034         SetColName(1, "qSetId");
00035         SetColName(2, "videosLink");
00036         SetColName(3, "querySetLink");
00037         SetColName(4, "caseId");
00038 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00039         Load();
00040 #endif // REPOSITORY_USED
00041     }
00042 
00043     // inquiry part
00044 
00045     int
00046     Find(CString qSetId, CString caseId) const
00047     {
00048         for (int i=0 ; i<Size() ; i++)
00049             if ((Get1(i) == qSetId) && (Get4(i) == caseId))
00050                 return i;
00051         return Size();
00052     }
00053 
00054     String
00055     GetVideosLink(CString qSetId, CString caseId) const
00056     {
00057         int idx = Find(qSetId, caseId);
00058         if (idx == Size())
00059             return "";
00060         return Get2(idx);
00061     }
00062 
00063     String
00064     GetUrl(CString qSetId, CString caseId) const
00065     {
00066         int idx = Find(qSetId, caseId);
00067         if (idx == Size())
00068             return "";
00069         return Get3(idx);
00070     }
00071 
00072     // I/O part
00073 
00074 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00075     void
00076     Load()
00077     {
00078         String fName = mVidSet->GetFilePathVideoIndex("", mName + ".tab",
00079                                                       false, true);
00080         if (!fName.empty())
00081             Read(this, fName, mVidSet->GetDatabase());
00082     }
00083 
00084     void
00085     Save(String name)
00086     {
00087         if (!name.empty())
00088             mName = name;
00089         String fName = mVidSet->GetFilePathVideoIndex("", mName + ".tab",
00090                                                       true, false);
00091         Write(this, fName, mVidSet->GetDatabase(), true);
00092     }
00093 
00094     void
00095     Update(String name)
00096     {
00097         if (!name.empty())
00098             mName = name;
00099         String fName = mVidSet->GetFilePathVideoIndex("", mName + ".tab",
00100                                                       true, true);
00101         if (fName.empty())  // try force override thru read
00102             fName = mVidSet->GetFilePathVideoIndex("", mName + ".tab",
00103                                                    false, false);
00104         Write(this, fName, mVidSet->GetDatabase(), true);
00105     }
00106 #endif // REPOSITORY_USED
00107 
00108 private:
00109 
00110     VideoSet::VideoSet* mVidSet;
00111     String              mName;
00112 
00113     ILOG_VAR_DEC;
00114 
00115 };
00116 
00117 ILOG_VAR_INIT(QuerySetTable, Impala.Core.IDash);
00118 
00119 } // namespace IDash
00120 } // namespace Core
00121 } // namespace Impala
00122 
00123 #endif

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