SHOGUN
v3.2.0
|
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) 2012 Fernando José Iglesias García 00008 * Copyright (C) 2012 Fernando José Iglesias García 00009 */ 00010 00011 #ifndef _STRUCTURED_LABELS__H__ 00012 #define _STRUCTURED_LABELS__H__ 00013 00014 #include <shogun/labels/Labels.h> 00015 #include <shogun/labels/LabelTypes.h> 00016 #include <shogun/lib/DynamicObjectArray.h> 00017 #include <shogun/lib/StructuredData.h> 00018 #include <shogun/lib/StructuredDataTypes.h> 00019 00020 namespace shogun { 00021 00023 class CStructuredLabels : public CLabels 00024 { 00025 00026 public: 00028 CStructuredLabels(); 00029 00038 CStructuredLabels(int32_t num_labels); 00039 00041 virtual ~CStructuredLabels(); 00042 00049 virtual void ensure_valid(const char* context = NULL); 00050 00059 virtual void add_label(CStructuredData* label); 00060 00067 CDynamicObjectArray* get_labels() const; 00068 00075 virtual CStructuredData* get_label(int32_t idx); 00076 00087 virtual bool set_label(int32_t idx, CStructuredData* label); 00088 00093 virtual int32_t get_num_labels() const; 00094 00096 virtual const char* get_name() const { return "StructuredLabels"; } 00097 00102 virtual ELabelType get_label_type() const { return LT_STRUCTURED; } 00103 00108 inline EStructuredDataType get_structured_data_type() { return m_sdt; } 00109 00110 private: 00112 void init(); 00113 00115 void ensure_valid_sdt(CStructuredData* label); 00116 00117 protected: 00119 CDynamicObjectArray* m_labels; 00120 00122 EStructuredDataType m_sdt; 00123 00124 }; /* class CStructuredLabels */ 00125 00126 } /* namespace shogun */ 00127 00128 #endif /* _STRUCTUREDLABELS_H__ */