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) 2013 Soumyajit De 00008 */ 00009 00010 #ifndef JOB_RESULT_AGGREGATOR_H_ 00011 #define JOB_RESULT_AGGREGATOR_H_ 00012 00013 #include <shogun/lib/config.h> 00014 #include <shogun/base/SGObject.h> 00015 #include <shogun/lib/computation/jobresult/JobResult.h> 00016 #include <shogun/base/Parameter.h> 00017 00018 namespace shogun 00019 { 00020 00025 class CJobResultAggregator : public CSGObject 00026 { 00027 public: 00029 CJobResultAggregator() 00030 : CSGObject() 00031 { 00032 init(); 00033 00034 SG_GCDEBUG("%s created (%p)\n", this->get_name(), this) 00035 } 00036 00038 virtual ~CJobResultAggregator() 00039 { 00040 SG_UNREF(m_result); 00041 00042 SG_GCDEBUG("%s destroyed (%p)\n", this->get_name(), this) 00043 } 00044 00051 virtual void submit_result(CJobResult* result) = 0; 00052 00057 virtual void finalize() = 0; 00058 00060 CJobResult* get_final_result() const 00061 { 00062 return m_result; 00063 } 00064 00066 virtual const char* get_name() const 00067 { 00068 return "JobResultAggregator"; 00069 } 00070 protected: 00072 CJobResult* m_result; 00073 00074 private: 00076 void init() 00077 { 00078 m_result=NULL; 00079 00080 SG_ADD((CSGObject**)&m_result, "final_result", 00081 "Aggregation of computation job results", MS_NOT_AVAILABLE); 00082 } 00083 }; 00084 00085 } 00086 00087 #endif // JOB_RESULT_AGGREGATOR_H_