SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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 
13 #include <shogun/lib/config.h>
14 
16 #include <shogun/base/DynArray.h>
17 
18 namespace shogun
19 {
20 
21 #ifndef DOXYGEN_SHOULD_SKIP_THIS
22 
23 struct T_ATTRIBUTE
24 {
26  char* attr_name;
28  CFeatures* attr_obj;
29 };
30 #endif // DOXYGEN_SHOULD_SKIP_THIS
31 
47 {
48 
49 public:
52 
54  virtual ~CAttributeFeatures();
55 
61  CFeatures* get_attribute(char* attr_name);
62 
69  void get_attribute_by_index(int idx, const char* &attr_name, CFeatures* &attr_obj);
70 
77  bool set_attribute(char* attr_name, CFeatures* attr_obj);
78 
84  bool del_attribute(char* attr_name);
85 
90  int32_t get_num_attributes();
91 
93  virtual const char* get_name() const { return "AttributeFeatures"; }
94 
101  virtual CFeatures* duplicate() const=0;
102 
109  virtual EFeatureType get_feature_type() const=0;
110 
117  virtual EFeatureClass get_feature_class() const=0;
118 
125  virtual int32_t get_num_vectors() const=0;
126 
127 protected:
133  inline int32_t find_attr_index(char* attr_name);
134 
135 protected:
138 };
139 }
140 #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:38
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:19
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
DynArray< T_ATTRIBUTE > features
list of attributes (sorted)
The class Features is the base class of all feature objects.
Definition: Features.h:68
bool del_attribute(char *attr_name)
virtual const char * get_name() const

SHOGUN Machine Learning Toolbox - Documentation