00001 #ifndef Impala_Core_ImageSet_MakeQuidLookup_h
00002 #define Impala_Core_ImageSet_MakeQuidLookup_h
00003
00004 #include "Core/ImageSet/Reporter.h"
00005 #include "Core/ImageSet/MakeImageSet.h"
00006 #include "Core/Table/Write.h"
00007
00008 namespace Impala
00009 {
00010 namespace Core
00011 {
00012 namespace ImageSet
00013 {
00014
00015 class MakeQuidLookup : public Listener
00016 {
00017 typedef Table::TableTem<Column::ColumnTem<Quid>,
00018 Column::ColumnTem<String> >
00019 QuidLookupTableBaseType;
00020
00021 class QuidLookupTable : public QuidLookupTableBaseType
00022 {
00023 typedef Column::ColumnTem<Quid> ColumnQuid;
00024 typedef Column::ColumnTem<String> ColumnString;
00025 public:
00026 QuidLookupTable() :
00027 QuidLookupTableBaseType(ColumnQuid(0), ColumnString(0))
00028 {
00029 SetInfo("QuidLookupTable");
00030 SetColName(1, "quid");
00031 SetColName(2, "string");
00032 }
00033 };
00034
00035 public:
00036
00037 MakeQuidLookup(Reporter* reporter, CmdOptions& options)
00038 {
00039 }
00040
00041 virtual
00042 ~MakeQuidLookup()
00043 {
00044 }
00045
00046 virtual void
00047 HandleNewWalk(ImageSet* is)
00048 {
00049 mTable = new QuidLookupTable();
00050 }
00051
00052 virtual void
00053 HandleNewFile(ImageSet* is, int fileId, Array::Array2dVec3UInt8* im)
00054 {
00055 String fileName = is->GetFile(fileId);
00056 Quid quid = is->GetQuidImage(fileId);
00057 mTable->Add(quid, fileName);
00058 }
00059
00060 virtual void
00061 HandleDoneWalk(ImageSet* is)
00062 {
00063 typedef Persistency::RepositoryInFileSystem FS;
00064 typedef Persistency::File File;
00065 File file = FS::GetInstance().GetFile(is->GetLocator(), "",
00066 "quidlookup.tab", true, false);
00067 Write(mTable, file);
00068 delete mTable;
00069 }
00070
00071 private:
00072
00073 QuidLookupTable* mTable;
00074
00075 ILOG_VAR_DEC;
00076 };
00077
00078 ILOG_VAR_INIT(MakeQuidLookup, Core.ImageSet);
00079
00080 }
00081 }
00082 }
00083
00084 #endif