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) 1999-2009 Soeren Sonnenburg 00008 * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society 00009 */ 00010 00011 #ifndef _DREALFILEFEATURES__H__ 00012 #define _DREALFILEFEATURES__H__ 00013 00014 #include "lib/common.h" 00015 #include "features/SimpleFeatures.h" 00016 00017 namespace shogun 00018 { 00025 class CRealFileFeatures: public CSimpleFeatures<float64_t> 00026 { 00027 public: 00033 CRealFileFeatures(int32_t size, FILE* file); 00034 00040 CRealFileFeatures(int32_t size, char* filename); 00041 00043 CRealFileFeatures(const CRealFileFeatures& orig); 00044 00045 virtual ~CRealFileFeatures(); 00046 00051 virtual float64_t* load_feature_matrix(); 00052 00058 int32_t get_label(int32_t idx); 00059 00061 inline virtual const char* get_name() const { return "RealFileFeatures"; } 00062 00063 protected: 00071 virtual float64_t* compute_feature_vector( 00072 int32_t num, int32_t& len, float64_t* target=NULL); 00073 00078 bool load_base_data(); 00079 00080 #ifdef HAVE_BOOST_SERIALIZATION 00081 private: 00082 00083 friend class ::boost::serialization::access; 00084 template<class Archive> 00085 void serialize(Archive & ar, const unsigned int archive_version) 00086 { 00087 00088 SG_DEBUG("archiving CRealFeatures\n"); 00089 00090 ar & ::boost::serialization::base_object<CSimpleFeatures<float64_t> >(*this); 00091 00092 SG_DEBUG("done with CRealFeatures\n"); 00093 00094 } 00095 00096 #endif //HAVE_BOOST_SERIALIZATION 00097 00098 00099 00100 protected: 00102 FILE* working_file; 00104 char* working_filename; 00106 bool status; 00108 int32_t* labels; 00109 00111 uint8_t intlen; 00113 uint8_t doublelen; 00115 uint32_t endian; 00117 uint32_t fourcc; 00119 uint32_t preprocd; 00121 int64_t filepos; 00122 }; 00123 } 00124 #endif