SHOGUN  v3.0.0
 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 
16 
17 namespace shogun
18 {
20 typedef int32_t (CVwParser::*parse_func)(CIOBuffer*, VwExample*&);
21 
27 {
28 public:
34 
41  CStreamingVwFile(const char* fname, char rw='r');
42 
46  virtual ~CStreamingVwFile();
47 
55 
66  virtual void get_vector(VwExample* &ex, int32_t &len);
67 
77  virtual void get_vector_and_label(VwExample* &ex, int32_t &len, float64_t &label);
78 
84  void set_env(CVwEnvironment* env_to_use)
85  {
86  parser->set_env(env_to_use);
87  }
88 
95  {
96  SG_REF(env);
97  return env;
98  }
99 
105  void set_write_to_cache(bool write_cache)
106  {
107  write_to_cache = write_cache;
108  parser->set_write_cache(write_cache);
109  }
110 
117 
118  virtual bool is_seekable() { return false; }
119 
121  virtual const char* get_name() const
122  {
123  return "StreamingVwFile";
124  }
125 
126 public:
129 
130 private:
134  virtual void init();
135 
136 protected:
139 
142 
145 
148 };
149 }
150 #endif //__STREAMING_VWFILE_H__

SHOGUN Machine Learning Toolbox - Documentation