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 
00028 class CCombinedFeatures : public CFeatures
00029 {
00030     public:
00032         CCombinedFeatures();
00034         CCombinedFeatures(const CCombinedFeatures& orig);
00035 
00040         virtual CFeatures* duplicate() const;
00041 
00042         virtual ~CCombinedFeatures();
00043 
00048         inline virtual EFeatureType get_feature_type()
00049         {
00050             return F_UNKNOWN;
00051         }
00052 
00057         inline virtual EFeatureClass get_feature_class()
00058         {
00059             return C_COMBINED;
00060         }
00061 
00066         inline virtual int32_t get_num_vectors()
00067         {
00068             if (feature_list->get_current_element())
00069             {
00070                 return feature_list->get_current_element()->get_num_vectors();
00071             }
00072             else 
00073                 return 0;
00074         }
00075 
00080         virtual int32_t get_size()
00081         {
00082             if (feature_list->get_current_element())
00083             {
00084                 return feature_list->get_current_element()->get_size();
00085             }
00086             else 
00087                 return 0;
00088         }
00089 
00091         void list_feature_objs();
00092 
00098         bool check_feature_obj_compatibility(CCombinedFeatures* comb_feat);
00099 
00104         inline CFeatures* get_first_feature_obj()
00105         {
00106             CFeatures* f=feature_list->get_first_element();
00107             SG_REF(f);
00108             return f;
00109         }
00110 
00116         inline CFeatures* get_first_feature_obj(CListElement<CFeatures*>*&current)
00117         {
00118             CFeatures* f=feature_list->get_first_element(current);
00119             SG_REF(f);
00120             return f;
00121         }
00122 
00127         inline CFeatures* get_next_feature_obj()
00128         {
00129             CFeatures* f=feature_list->get_next_element();
00130             SG_REF(f);
00131             return f;
00132         }
00133 
00139         inline CFeatures* get_next_feature_obj(CListElement<CFeatures*>*&current)
00140         {
00141             CFeatures* f=feature_list->get_next_element(current);
00142             SG_REF(f);
00143             return f;
00144         }
00145 
00150         inline CFeatures* get_last_feature_obj()
00151         {
00152             CFeatures* f=feature_list->get_last_element();
00153             SG_REF(f);
00154             return f;
00155         }
00156 
00162         inline bool insert_feature_obj(CFeatures* obj)
00163         {
00164             ASSERT(obj);
00165             SG_REF(obj);
00166             return feature_list->insert_element(obj);
00167         }
00168 
00174         inline bool append_feature_obj(CFeatures* obj)
00175         {
00176             ASSERT(obj);
00177             SG_REF(obj);
00178             return feature_list->append_element(obj);
00179         }
00180 
00185         inline bool delete_feature_obj()
00186         {
00187             CFeatures* f=feature_list->delete_element();
00188             if (f)
00189             {
00190                 SG_UNREF(f);
00191                 return true;
00192             }
00193             else
00194                 return false;
00195         }
00196 
00201         inline int32_t get_num_feature_obj()
00202         {
00203             return feature_list->get_num_elements();
00204         }
00205 
00206     protected:
00208         CList<CFeatures*>* feature_list;
00209 };
00210 #endif

SHOGUN Machine Learning Toolbox - Documentation