SHOGUN  4.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UAIFile.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) 2014 Abinash Panda
8  */
9 
10 #ifndef __UAIFILE_H__
11 #define __UAIFILE_H__
12 
13 #include <shogun/io/File.h>
14 
15 #include <shogun/io/LineReader.h>
16 #include <shogun/io/Parser.h>
18 #include <shogun/base/Parameter.h>
19 
20 namespace shogun
21 {
22 
27 class CUAIFile : public CFile
28 {
29 public:
31  CUAIFile();
32 
38  CUAIFile(FILE* f, const char* name=NULL);
39 
40 #ifdef HAVE_FDOPEN
41 
47  CUAIFile(int fd, const char* mode, const char* name=NULL);
48 #endif
49 
56  CUAIFile(const char* fname, char rw='r', const char* name=NULL);
57 
59  virtual ~CUAIFile();
60 
65  virtual void parse();
66 
72  virtual void set_net_type(const char* net_type);
73 
78  virtual void set_num_vars(int32_t num_vars);
79 
84  virtual void set_num_factors(int32_t num_vars);
85 
90  virtual void set_vars_card(SGVector<int32_t> vars_card);
91 
97  virtual void set_factors_scope(int32_t num_factors,
98  const SGVector<int32_t>* factors_scope);
99 
105  virtual void set_factors_table(int32_t num_factors,
106  const SGVector<float64_t>* factors_table);
107 
116  virtual void get_preamble(SGVector<char>& net_type,
117  int32_t& num_vars,
118  SGVector<int32_t>& vars_card,
119  int32_t& num_factors,
120  SGVector<int32_t>*& factors_scope);
121 
126  virtual void get_factors_table(SGVector<float64_t>*& factors_table);
127 
128 #ifndef SWIG // SWIG should skip this
129 
136  virtual void get_vector(int8_t*& vector, int32_t& len);
137  virtual void get_vector(uint8_t*& vector, int32_t& len);
138  virtual void get_vector(char*& vector, int32_t& len);
139  virtual void get_vector(int32_t*& vector, int32_t& len);
140  virtual void get_vector(uint32_t*& vector, int32_t& len);
141  virtual void get_vector(float64_t*& vector, int32_t& len);
142  virtual void get_vector(float32_t*& vector, int32_t& len);
143  virtual void get_vector(floatmax_t*& vector, int32_t& len);
144  virtual void get_vector(int16_t*& vector, int32_t& len);
145  virtual void get_vector(uint16_t*& vector, int32_t& len);
146  virtual void get_vector(int64_t*& vector, int32_t& len);
147  virtual void get_vector(uint64_t*& vector, int32_t& len);
149 
151  /*virtual void get_vector(void*& vector, int32_t& len, DataType& dtype);*/
152 
160  virtual void set_vector(const int8_t* vector, int32_t len);
161  virtual void set_vector(const uint8_t* vector, int32_t len);
162  virtual void set_vector(const char* vector, int32_t len);
163  virtual void set_vector(const int32_t* vector, int32_t len);
164  virtual void set_vector(const uint32_t* vector, int32_t len);
165  virtual void set_vector(const float32_t* vector, int32_t len);
166  virtual void set_vector(const float64_t* vector, int32_t len);
167  virtual void set_vector(const floatmax_t* vector, int32_t len);
168  virtual void set_vector(const int16_t* vector, int32_t len);
169  virtual void set_vector(const uint16_t* vector, int32_t len);
170  virtual void set_vector(const int64_t* vector, int32_t len);
171  virtual void set_vector(const uint64_t* vector, int32_t len);
173 
174 #endif // #ifndef SWIG // SWIG should skip this
175 
176  virtual const char* get_name() const { return "UAIFile"; }
177 
178 private:
180  void init();
181 
183  void init_with_defaults();
184 
185 protected:
188 
191 
194 
197 
200 
202  int32_t m_num_vars;
203 
205  int32_t m_num_factors;
206 
209 
212 
215 
218 };
219 
220 }
221 
222 #endif

SHOGUN Machine Learning Toolbox - Documentation