00001 #ifndef Impala_Basis_Quids_h
00002 #define Impala_Basis_Quids_h
00003
00004 #include "Basis/String.h"
00005 #include "Basis/Quid.h"
00006
00007 namespace Impala
00008 {
00009
00010
00011 static const int QUID_CLASS_UNKNOWN = 0;
00012 static const int QUID_CLASS_SHOT = 1;
00013 static const int QUID_CLASS_KEYFRAME = 2;
00014 static const int QUID_CLASS_FRAME = 3;
00015 static const int QUID_CLASS_LABEL = 4;
00016 static const int QUID_CLASS_IMAGE = 5;
00017 static const int QUID_CLASS_VIDEO = 6;
00018 static const int QUID_CLASS_CODEBOOK = 7;
00019
00020
00021 inline int
00022 StringToQuidClass(CString s)
00023 {
00024 if (s == "Shot")
00025 return QUID_CLASS_SHOT;
00026 if (s == "Keyframe")
00027 return QUID_CLASS_KEYFRAME;
00028 if (s == "Frame")
00029 return QUID_CLASS_FRAME;
00030 if (s == "Label")
00031 return QUID_CLASS_LABEL;
00032 if (s == "Image")
00033 return QUID_CLASS_IMAGE;
00034 if (s == "Video")
00035 return QUID_CLASS_VIDEO;
00036 if (s == "Codebook")
00037 return QUID_CLASS_CODEBOOK;
00038 return QUID_CLASS_UNKNOWN;
00039 }
00040
00041 inline String
00042 QuidClassToString(int c)
00043 {
00044 switch (c)
00045 {
00046 case QUID_CLASS_SHOT: return "Shot";
00047 case QUID_CLASS_KEYFRAME: return "Keyframe";
00048 case QUID_CLASS_FRAME: return "Frame";
00049 case QUID_CLASS_LABEL: return "Label";
00050 case QUID_CLASS_IMAGE: return "Image";
00051 case QUID_CLASS_VIDEO: return "Video";
00052 case QUID_CLASS_CODEBOOK: return "Codebook";
00053 }
00054 return "unknown";
00055 }
00056
00057 inline String
00058 QuidClassToString(Quid q)
00059 {
00060 int c = QuidClass(q);
00061 return QuidClassToString(c);
00062 }
00063
00064 inline Quid
00065 MakeQuidShot(int qSet, int qObject, int id)
00066 {
00067 return (((Quid) QUID_CLASS_SHOT) << QUID_CLASS_SHIFT) |
00068 (((Quid) qSet) << QUID_SET_SHIFT) |
00069 (((Quid) qObject) << QUID_OBJECT_SHIFT) |
00070 (((Quid) id) << QUID_ID_SHIFT);
00071 }
00072
00073 inline Quid
00074 MakeQuidKeyframe(int qSet, int qObject, int id)
00075 {
00076 return (((Quid) QUID_CLASS_KEYFRAME) << QUID_CLASS_SHIFT) |
00077 (((Quid) qSet) << QUID_SET_SHIFT) |
00078 (((Quid) qObject) << QUID_OBJECT_SHIFT) |
00079 (((Quid) id) << QUID_ID_SHIFT);
00080 }
00081
00082 inline Quid
00083 MakeQuidFrame(int qSet, int qObject, int id)
00084 {
00085 return (((Quid) QUID_CLASS_FRAME) << QUID_CLASS_SHIFT) |
00086 (((Quid) qSet) << QUID_SET_SHIFT) |
00087 (((Quid) qObject) << QUID_OBJECT_SHIFT) |
00088 (((Quid) id) << QUID_ID_SHIFT);
00089 }
00090
00091 inline Quid
00092 MakeQuidLabel(int id)
00093 {
00094 return (((Quid) QUID_CLASS_LABEL) << QUID_CLASS_SHIFT) |
00095 (((Quid) id) << QUID_ID_SHIFT);
00096 }
00097
00098 inline Quid
00099 MakeQuidImage(int qSet, int id)
00100 {
00101 return (((Quid) QUID_CLASS_IMAGE) << QUID_CLASS_SHIFT) |
00102 (((Quid) qSet) << QUID_SET_SHIFT) |
00103 (((Quid) id) << QUID_ID_SHIFT);
00104 }
00105
00106 inline Quid
00107 MakeQuidVideo(int qSet, int id)
00108 {
00109 return (((Quid) QUID_CLASS_VIDEO) << QUID_CLASS_SHIFT) |
00110 (((Quid) qSet) << QUID_SET_SHIFT) |
00111 (((Quid) id) << QUID_ID_SHIFT);
00112 }
00113
00114 inline Quid
00115 MakeQuidCodebook(int qDataClass, int qSet, int id)
00116 {
00117 return (((Quid) QUID_CLASS_CODEBOOK) << QUID_CLASS_SHIFT) |
00118 (((Quid) qDataClass) << QUID_SET_SHIFT) |
00119 (((Quid) qSet) << QUID_OBJECT_SHIFT) |
00120 (((Quid) id) << QUID_ID_SHIFT);
00121 }
00122
00123 }
00124
00125 #endif