SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StreamingVwFile.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2011 Shashwat Lal Das
8  * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society
9  */
10 #ifndef __STREAMING_VWFILE_H__
11 #define __STREAMING_VWFILE_H__
12 
13 #include <shogun/lib/config.h>
14 
18 
19 namespace shogun
20 {
22 typedef int32_t (CVwParser::*parse_func)(CIOBuffer*, VwExample*&);
23 
29 {
30 public:
36 
43  CStreamingVwFile(const char* fname, char rw='r');
44 
48  virtual ~CStreamingVwFile();
49 
57 
68  virtual void get_vector(VwExample* &ex, int32_t &len);
69 
79  virtual void get_vector_and_label(VwExample* &ex, int32_t &len, float64_t &label);
80 
86  void set_env(CVwEnvironment* env_to_use)
87  {
88  parser->set_env(env_to_use);
89  }
90 
97  {
98  SG_REF(env);
99  return env;
100  }
101 
107  void set_write_to_cache(bool write_cache)
108  {
109  write_to_cache = write_cache;
110  parser->set_write_cache(write_cache);
111  }
112 
119 
120  virtual bool is_seekable() { return false; }
121 
123  virtual const char* get_name() const
124  {
125  return "StreamingVwFile";
126  }
127 
128 public:
131 
132 private:
136  virtual void init();
137 
138 protected:
141 
144 
147 
150 };
151 }
152 #endif //__STREAMING_VWFILE_H__

SHOGUN Machine Learning Toolbox - Documentation