/** * @file FeatureType.h * @brief dynamic selection between SparseVector and Vector * @author Björn Fröhlich * @date 02/08/2010 */ #ifndef FeatureTypeINCLUDE #define FeatureTypeINCLUDE #include "core/vector/SparseVectorT.h" #include "core/basics/Persistent.h" namespace OBJREC { //! enumeration for feature types enum Featuretype { VECTORFEATURE, SPARSEVECTORFEATURE }; //! a class to differ between Vector und Sparsevector features class FeatureType { protected: //! Sparse or Vectorfeature? int ft; //! save to sv if Sparsefeatures NICE::SparseVector sv; //! save to v if vectorfeature NICE::Vector v; public: /** * constructor * @param f type of the faeture * @param dim dimension of the new feature */ FeatureType(int f, int dim); /** * constructor setting SparseFeature * @param tsv input SparseFeature */ FeatureType(NICE::SparseVector &tsv); /** * constructor setting VectorFeature * @param tv input VectorFeature */ FeatureType(NICE::Vector &tv); /** * copy constructor * @param _ft */ FeatureType(const FeatureType &_ft); void setDim(int dim); /** * get the dimension of feature * @return dimension of feature */ int getDim() const; /** * returns adress of Vector * @return */ const NICE::Vector& getVec() const; /** * returns adress of SparseVector * @return */ const NICE::SparseVector& getSVec() const; double get(int pos) const; int getType(); }; } // namespace #endif