StreamingFeatures.h

Go to the documentation of this file.
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) 2011 Shashwat Lal Das
00008  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
00009  */
00010 #ifndef _STREAMING_FEATURES__H__
00011 #define _STREAMING_FEATURES__H__
00012 
00013 #include <shogun/lib/common.h>
00014 #include <shogun/features/Features.h>
00015 #include <shogun/io/StreamingFile.h>
00016 
00017 namespace shogun
00018 {
00063 class CStreamingFeatures : public CFeatures
00064 {
00065 
00066 public:
00067 
00072     CStreamingFeatures()
00073         : CFeatures() { }
00074 
00082     CStreamingFeatures(CStreamingFile* file, bool is_labelled, int32_t size)
00083         : CFeatures() { }
00084 
00088     virtual ~CStreamingFeatures() { }
00089 
00096     void set_read_functions()
00097     {
00098         set_vector_reader();
00099         set_vector_and_label_reader();
00100     }
00101 
00110     virtual void set_vector_reader()=0;
00111 
00121     virtual void set_vector_and_label_reader()=0;
00122 
00127     virtual void start_parser()=0;
00128 
00132     virtual void end_parser()=0;
00133 
00141     virtual float64_t get_label()=0;
00142 
00148     virtual bool get_next_example()=0;
00149 
00155     virtual void release_example()=0;
00156 
00162     virtual int32_t get_num_features()=0;
00163 
00169     virtual bool get_has_labels()
00170     {
00171         return has_labels;
00172     }
00173 
00184     virtual bool is_seekable()
00185     {
00186         return seekable;
00187     }
00188 
00192     virtual void reset_stream()
00193     {
00194         SG_NOTIMPLEMENTED;
00195         return;
00196     }
00197 
00198 protected:
00199 
00201     bool has_labels;
00202 
00204     CStreamingFile* working_file;
00205 
00207     bool seekable;
00208 
00209 };
00210 }
00211 #endif // _STREAMING_FEATURES__H__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation