SHOGUN  v3.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AttributeFeatures.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2009 Soeren Sonnenburg
8  * Copyright (C) 2009 Fraunhofer Institute FIRST and Max-Planck-Society
9  */
10 #ifndef _CATTRIBUTE_FEATURES__H__
11 #define _CATTRIBUTE_FEATURES__H__
12 
14 #include <shogun/base/DynArray.h>
15 
16 namespace shogun
17 {
18 
19 #ifndef DOXYGEN_SHOULD_SKIP_THIS
20 
21 struct T_ATTRIBUTE
22 {
24  char* attr_name;
26  CFeatures* attr_obj;
27 };
28 #endif // DOXYGEN_SHOULD_SKIP_THIS
29 
45 {
46 
47 public:
50 
52  virtual ~CAttributeFeatures();
53 
59  CFeatures* get_attribute(char* attr_name);
60 
67  void get_attribute_by_index(int idx, const char* &attr_name, CFeatures* &attr_obj);
68 
75  bool set_attribute(char* attr_name, CFeatures* attr_obj);
76 
82  bool del_attribute(char* attr_name);
83 
88  int32_t get_num_attributes();
89 
91  virtual const char* get_name() const { return "AttributeFeatures"; }
92 
99  virtual CFeatures* duplicate() const=0;
100 
107  virtual EFeatureType get_feature_type() const=0;
108 
115  virtual EFeatureClass get_feature_class() const=0;
116 
123  virtual int32_t get_num_vectors() const=0;
124 
125 protected:
131  inline int32_t find_attr_index(char* attr_name);
132 
133 protected:
136 };
137 }
138 #endif
virtual EFeatureType get_feature_type() const =0
CFeatures * get_attribute(char *attr_name)
int32_t find_attr_index(char *attr_name)
void get_attribute_by_index(int idx, const char *&attr_name, CFeatures *&attr_obj)
virtual CFeatures * duplicate() const =0
bool set_attribute(char *attr_name, CFeatures *attr_obj)
virtual int32_t get_num_vectors() const =0
EFeatureClass
shogun feature class
Definition: FeatureTypes.h:35
virtual EFeatureClass get_feature_class() const =0
Implements attributed features, that is in the simplest case a number of (attribute, value) pairs.
EFeatureType
shogun feature type
Definition: FeatureTypes.h:16
DynArray< T_ATTRIBUTE > features
list of attributes (sorted)
The class Features is the base class of all feature objects.
Definition: Features.h:62
bool del_attribute(char *attr_name)
virtual const char * get_name() const

SHOGUN Machine Learning Toolbox - Documentation