CombinedFeatures.h

Go to the documentation of this file.
00001 /*
00002  * This program is free software; you can redistribute it and/or modify
00003  * it under the terms of the GNU General Public License as published by
00004  * the Free Software Foundation; either version 3 of the License, or
00005  * (at your option) any later version.
00006  *
00007  * Written (W) 1999-2008 Soeren Sonnenburg
00008  * Written (W) 1999-2008 Gunnar Raetsch
00009  * Copyright (C) 1999-2008 Fraunhofer Institute FIRST and Max-Planck-Society
00010  */
00011 
00012 #ifndef _CCOMBINEDFEATURES__H__
00013 #define _CCOMBINEDFEATURES__H__
00014 
00015 #include "features/Features.h"
00016 #include "lib/List.h"
00017 
00018 class CFeatures;
00019 
00021 class CCombinedFeatures : public CFeatures
00022 {
00023     public:
00025         CCombinedFeatures();
00027         CCombinedFeatures(const CCombinedFeatures& orig);
00028 
00033         virtual CFeatures* duplicate() const;
00034 
00035         virtual ~CCombinedFeatures();
00036 
00041         inline virtual EFeatureType get_feature_type()
00042         {
00043             return F_UNKNOWN;
00044         }
00045 
00050         inline virtual EFeatureClass get_feature_class()
00051         {
00052             return C_COMBINED;
00053         }
00054 
00059         inline virtual INT get_num_vectors()
00060         {
00061             if (feature_list->get_current_element())
00062             {
00063                 return feature_list->get_current_element()->get_num_vectors();
00064             }
00065             else 
00066                 return 0;
00067         }
00068 
00073         virtual INT get_size()
00074         {
00075             if (feature_list->get_current_element())
00076             {
00077                 return feature_list->get_current_element()->get_size();
00078             }
00079             else 
00080                 return 0;
00081         }
00082 
00084         void list_feature_objs();
00085 
00091         bool check_feature_obj_compatibility(CCombinedFeatures* comb_feat);
00092 
00097         inline CFeatures* get_first_feature_obj()
00098         {
00099             CFeatures* f=feature_list->get_first_element();
00100             SG_REF(f);
00101             return f;
00102         }
00103 
00109         inline CFeatures* get_first_feature_obj(CListElement<CFeatures*>*&current)
00110         {
00111             CFeatures* f=feature_list->get_first_element(current);
00112             SG_REF(f);
00113             return f;
00114         }
00115 
00120         inline CFeatures* get_next_feature_obj()
00121         {
00122             CFeatures* f=feature_list->get_next_element();
00123             SG_REF(f);
00124             return f;
00125         }
00126 
00132         inline CFeatures* get_next_feature_obj(CListElement<CFeatures*>*&current)
00133         {
00134             CFeatures* f=feature_list->get_next_element(current);
00135             SG_REF(f);
00136             return f;
00137         }
00138 
00143         inline CFeatures* get_last_feature_obj()
00144         {
00145             CFeatures* f=feature_list->get_last_element();
00146             SG_REF(f);
00147             return f;
00148         }
00149 
00155         inline bool insert_feature_obj(CFeatures* obj)
00156         {
00157             ASSERT(obj);
00158             SG_REF(obj);
00159             return feature_list->insert_element(obj);
00160         }
00161 
00167         inline bool append_feature_obj(CFeatures* obj)
00168         {
00169             ASSERT(obj);
00170             SG_REF(obj);
00171             return feature_list->append_element(obj);
00172         }
00173 
00178         inline bool delete_feature_obj()
00179         {
00180             CFeatures* f=feature_list->delete_element();
00181             if (f)
00182             {
00183                 SG_UNREF(f);
00184                 return true;
00185             }
00186             else
00187                 return false;
00188         }
00189 
00194         inline int get_num_feature_obj()
00195         {
00196             return feature_list->get_num_elements();
00197         }
00198 
00199     protected:
00201         CList<CFeatures*>* feature_list;
00202 };
00203 #endif

SHOGUN Machine Learning Toolbox - Documentation