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

VideoTable.h

Go to the documentation of this file.
00001 #ifndef Impala_Core_IDash_VideoTable_h
00002 #define Impala_Core_IDash_VideoTable_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<Int32>,
00020                         Column::ColumnTem<String>,
00021                         Column::ColumnTem<String>,
00022                         Column::ColumnTem<String> > VideoTableBaseType;
00023 
00024 
00025 class VideoTable : public VideoTableBaseType
00026 {
00027 public:
00028 
00029     VideoTable(VideoSet::VideoSet* vidSet, String name) : VideoTableBaseType(0)
00030     {
00031         mVidSet = vidSet;
00032         mName = name;
00033         SetColName(1, "videoId");
00034         SetColName(2, "vdsVideoId");
00035         SetColName(3, "caseId");
00036         SetColName(4, "url");
00037 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00038         if (!mName.empty())
00039             Load();
00040 #endif // REPOSITORY_USED
00041     }
00042 
00043     // inquiry part
00044 
00045     int
00046     Find(int vidId) const
00047     {
00048         return Column::Find(GetColumn1(), vidId, 0, Size());
00049     }
00050 
00051     String
00052     GetVdsVidId(int vidId) const
00053     {
00054         int idx = Find(vidId);
00055         if (idx < 0)
00056             return "";
00057         return Get2(idx);
00058     }
00059 
00060     String
00061     GetCaseId(int vidId) const
00062     {
00063         int idx = Find(vidId);
00064         if (idx < 0)
00065             return "";
00066         return Get3(idx);
00067     }
00068 
00069     String
00070     GetUrl(int vidId) const
00071     {
00072         int idx = Find(vidId);
00073         if (idx < 0)
00074             return "";
00075         return Get4(idx);
00076     }
00077 
00078     // I/O part
00079 
00080 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00081     void
00082     Load()
00083     {
00084         String fName = mVidSet->GetFilePathVideoIndex("", mName + ".tab",
00085                                                       false, false);
00086         Read(this, fName, mVidSet->GetDatabase());
00087     }
00088 
00089     void
00090     Save(String name)
00091     {
00092         if (!name.empty())
00093             mName = name;
00094         String fName = mVidSet->GetFilePathVideoIndex("", mName + ".tab",
00095                                                       true, false);
00096         Write(this, fName, mVidSet->GetDatabase(), true);
00097     }
00098 
00099     void
00100     Update(String name)
00101     {
00102         if (!name.empty())
00103             mName = name;
00104         String fName = mVidSet->GetFilePathVideoIndex("", mName + ".tab",
00105                                                       true, true);
00106         if (fName.empty())  // try force override thru read
00107             fName = mVidSet->GetFilePathVideoIndex("", mName + ".tab",
00108                                                    false, false);
00109         Write(this, fName, mVidSet->GetDatabase(), true);
00110     }
00111 #endif // REPOSITORY_USED
00112 
00113 private:
00114 
00115     VideoSet::VideoSet* mVidSet;
00116     String              mName;
00117 
00118     ILOG_VAR_DEC;
00119 
00120 };
00121 
00122 ILOG_VAR_INIT(VideoTable, Impala.Core.IDash);
00123 
00124 } // namespace IDash
00125 } // namespace Core
00126 } // namespace Impala
00127 
00128 #endif

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