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 * Copyright (C) 2012 Sergey Lisitsyn 00008 */ 00009 00010 #ifndef TASK_H_ 00011 #define TASK_H_ 00012 00013 #include <shogun/lib/SGVector.h> 00014 #include <shogun/lib/List.h> 00015 00016 namespace shogun 00017 { 00018 00025 class CTask : public CSGObject 00026 { 00027 public: 00028 00030 CTask(); 00031 00038 CTask(index_t min_index, index_t max_index, 00039 float64_t weight=1.0, const char* name="task"); 00040 00046 CTask(SGVector<index_t> indices, float64_t weight=1.0, const char* name="task"); 00047 00049 virtual ~CTask(); 00050 00055 bool is_contiguous(); 00056 00061 SGVector<index_t> get_indices() const { return m_indices; } 00062 00067 void set_indices(SGVector<index_t> indices) { m_indices = indices; } 00068 00073 float64_t get_weight() const { return m_weight; } 00074 00079 void set_weight(float64_t weight) { m_weight = weight; } 00080 00085 const char* get_task_name() const { return m_name; } 00086 00091 void set_task_name(const char* name) { m_name = name; } 00092 00098 void add_subtask(CTask* sub_task); 00099 00104 CList* get_subtasks(); 00105 00110 int32_t get_num_subtasks(); 00111 00116 virtual const char* get_name() const { return "Task"; }; 00117 00118 private: 00119 00121 void init(); 00122 00123 protected: 00124 00126 CList* m_subtasks; 00127 00129 const char* m_name; 00130 00132 SGVector<index_t> m_indices; 00133 00135 float64_t m_weight; 00136 00137 }; 00138 00139 } 00140 #endif