00001 #ifndef Impala_Persistency_FeatureLocator_h
00002 #define Impala_Persistency_FeatureLocator_h
00003
00004 #include "Persistency/Locator.h"
00005 #include "Core/Feature/FeatureDefinition.h"
00006
00007 namespace Impala
00008 {
00009 namespace Persistency
00010 {
00011
00012
00024 class FeatureLocator : public Locator
00025 {
00026 public:
00027 typedef Core::Feature::FeatureDefinition FeatureDefinition;
00028
00029 FeatureLocator()
00030 {
00031 }
00032
00033 FeatureLocator(CString protocolAndHost, CString dataSet,
00034 bool isCodebook, bool isIndex, CString walkType,
00035 String featureString, CString container)
00036 : Locator(protocolAndHost, dataSet)
00037 {
00038 mIsCodebook = isCodebook;
00039 mIsIndex = isIndex;
00040 mWalkType = walkType;
00041 mFeatureString = featureString;
00042 mContainer = container;
00043 Init();
00044 }
00045
00046 FeatureLocator(CString dataSet, bool isCodebook, bool isIndex,
00047 CString walkType, String featureString, CString container,
00048 CmdOptions& options)
00049 : Locator(dataSet, options)
00050 {
00051 mIsCodebook = isCodebook;
00052 mIsIndex = isIndex;
00053 mWalkType = walkType;
00054 mFeatureString = featureString;
00055 mContainer = container;
00056 Init();
00057 }
00058
00059 FeatureLocator(const Locator& base, bool isCodebook, bool isIndex,
00060 CString walkType, String featureString, CString container)
00061 : Locator(base.GetProtocol(), base.GetHost(), base.GetDataSet())
00062 {
00063 mIsCodebook = isCodebook;
00064 mIsIndex = isIndex;
00065 mWalkType = walkType;
00066 mFeatureString = featureString;
00067 mContainer = container;
00068 Init();
00069 }
00070
00071 virtual
00072 ~FeatureLocator()
00073 {
00074 }
00075
00076 bool
00077 GetIsCodebook() const
00078 {
00079 return mIsCodebook;
00080 }
00081
00082 bool
00083 GetIsIndex() const
00084 {
00085 return mIsIndex;
00086 }
00087
00088 String
00089 GetTopString() const
00090 {
00091 if (mIsCodebook)
00092 return "Codebooks";
00093 if (mIsIndex)
00094 return "FeatureIndex";
00095 return "FeatureData";
00096 }
00097
00098 String
00099 GetWalkType() const
00100 {
00101 return mWalkType;
00102 }
00103
00104 String
00105 GetFeatureString() const
00106 {
00107 return mFeatureString;
00108 }
00109
00110 void
00111 SetFeatureString(CString featureString)
00112 {
00113 mFeatureDef = featureString;
00114 mFeatureString = featureString;
00115 }
00116
00117 FeatureDefinition
00118 GetFeatureDef() const
00119 {
00120 return mFeatureDef;
00121 }
00122
00123 void
00124 SetFeatureDef(FeatureDefinition def)
00125 {
00126 mFeatureDef = def;
00127 mFeatureString = def.AsString();
00128 }
00129
00130 String
00131 GetFeatureName() const
00132 {
00133 return mFeatureDef.GetName();
00134 }
00135
00136 String
00137 GetContainer() const
00138 {
00139 return mContainer;
00140 }
00141
00142 void
00143 SetContainer(CString container)
00144 {
00145 mContainer = container;
00146 }
00147
00148 bool
00149 GetIsPartial() const
00150 {
00151 return mNumberFrames != 0;
00152 }
00153
00154 int
00155 GetNumberFrames() const
00156 {
00157 return mNumberFrames;
00158 }
00159
00160 void
00161 SetNumberFrames(int number)
00162 {
00163 mNumberFrames = number;
00164 }
00165
00166 int
00167 GetStartFrame() const
00168 {
00169 return mStartFrame;
00170 }
00171
00172 void
00173 SetStartFrame(int number)
00174 {
00175 mStartFrame = number;
00176 }
00177
00178 String
00179 ToString() const
00180 {
00181 return "FeatureLocator(" + GetProtocol() + "," + GetHost()
00182 + "," + GetDataSet() + "," + GetTopString() + ","
00183 + GetWalkType() + "," + GetFeatureString() + ","
00184 + GetContainer() + "," + MakeString(GetNumberFrames()) + ")";
00185 }
00186
00187 private:
00188
00189 void
00190 Init()
00191 {
00192 mFeatureDef = mFeatureString;
00193 mNumberFrames = 0;
00194 }
00195
00196 bool mIsCodebook;
00197 bool mIsIndex;
00198 String mWalkType;
00199 String mFeatureString;
00200 String mContainer;
00201
00202 FeatureDefinition mFeatureDef;
00203 int mNumberFrames;
00204 int mStartFrame;
00205
00206 ILOG_VAR_DEC;
00207 };
00208
00209 ILOG_VAR_INIT(FeatureLocator, Impala.Persistency);
00210
00211 std::ostream&
00212 operator<< (std::ostream& os, const FeatureLocator& loc)
00213 {
00214 os << loc.ToString();
00215 return os;
00216 }
00217
00218 }
00219 }
00220
00221 #endif