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-2009 Soeren Sonnenburg 00008 * Written (W) 1999-2008 Gunnar Raetsch 00009 * Written (W) 2012 Heiko Strathmann 00010 * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00011 */ 00012 00013 #ifndef _CCOMBINEDFEATURES__H__ 00014 #define _CCOMBINEDFEATURES__H__ 00015 00016 #include <shogun/features/Features.h> 00017 #include <shogun/lib/List.h> 00018 00019 namespace shogun 00020 { 00021 class CFeatures; 00022 class CList; 00023 class CListElement; 00024 00037 class CCombinedFeatures : public CFeatures 00038 { 00039 public: 00041 CCombinedFeatures(); 00043 CCombinedFeatures(const CCombinedFeatures& orig); 00044 00049 virtual CFeatures* duplicate() const; 00050 00052 virtual ~CCombinedFeatures(); 00053 00058 virtual EFeatureType get_feature_type() const 00059 { 00060 return F_UNKNOWN; 00061 } 00062 00067 virtual EFeatureClass get_feature_class() const 00068 { 00069 return C_COMBINED; 00070 } 00071 00076 virtual int32_t get_num_vectors() const 00077 { 00078 return m_subset_stack->has_subsets() 00079 ? m_subset_stack->get_size() : num_vec; 00080 } 00081 00086 virtual int32_t get_size() const; 00087 00089 void list_feature_objs(); 00090 00096 bool check_feature_obj_compatibility(CCombinedFeatures* comb_feat); 00097 00102 CFeatures* get_first_feature_obj(); 00103 00109 CFeatures* get_first_feature_obj(CListElement*& current); 00110 00115 CFeatures* get_next_feature_obj(); 00116 00122 CFeatures* get_next_feature_obj(CListElement*& current); 00123 00128 CFeatures* get_last_feature_obj(); 00129 00135 bool insert_feature_obj(CFeatures* obj); 00136 00142 bool append_feature_obj(CFeatures* obj); 00143 00148 bool delete_feature_obj(); 00149 00154 int32_t get_num_feature_obj(); 00155 00166 CFeatures* create_merged_copy(CFeatures* other); 00167 00174 virtual void add_subset(SGVector<index_t> subset); 00175 00181 virtual void remove_subset(); 00182 00188 virtual void remove_all_subsets(); 00189 00198 virtual CFeatures* copy_subset(SGVector<index_t> indices); 00199 00201 virtual const char* get_name() const { return "CombinedFeatures"; } 00202 00203 private: 00204 void init(); 00205 00206 protected: 00208 CList* feature_list; 00209 00213 int32_t num_vec; 00214 }; 00215 } 00216 #endif