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) 2009 Soeren Sonnenburg 00008 * Copyright (C) 2009 Fraunhofer Institute FIRST and Max-Planck-Society 00009 */ 00010 #ifndef _CATTRIBUTE_FEATURES__H__ 00011 #define _CATTRIBUTE_FEATURES__H__ 00012 00013 #include <shogun/features/Features.h> 00014 #include <shogun/base/DynArray.h> 00015 00016 namespace shogun 00017 { 00018 00019 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00020 00021 struct T_ATTRIBUTE 00022 { 00024 char* attr_name; 00026 CFeatures* attr_obj; 00027 }; 00028 #endif // DOXYGEN_SHOULD_SKIP_THIS 00029 00044 class CAttributeFeatures : public CFeatures 00045 { 00046 00047 public: 00049 CAttributeFeatures(); 00050 00052 virtual ~CAttributeFeatures(); 00053 00059 CFeatures* get_attribute(char* attr_name); 00060 00067 void get_attribute_by_index(int idx, const char* &attr_name, CFeatures* &attr_obj); 00068 00075 bool set_attribute(char* attr_name, CFeatures* attr_obj); 00076 00082 bool del_attribute(char* attr_name); 00083 00088 int32_t get_num_attributes(); 00089 00091 virtual const char* get_name() const { return "AttributeFeatures"; } 00092 00099 virtual CFeatures* duplicate() const=0; 00100 00107 virtual EFeatureType get_feature_type() const=0; 00108 00115 virtual EFeatureClass get_feature_class() const=0; 00116 00123 virtual int32_t get_num_vectors() const=0; 00124 00131 virtual int32_t get_size() const=0; 00132 00133 protected: 00139 inline int32_t find_attr_index(char* attr_name); 00140 00141 protected: 00143 DynArray<T_ATTRIBUTE> features; 00144 }; 00145 } 00146 #endif