SHOGUN  3.2.1
 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 
46  CUAIFile(int fd, const char* mode, const char* name=NULL);
47 
54  CUAIFile(const char* fname, char rw='r', const char* name=NULL);
55 
57  virtual ~CUAIFile();
58 
63  virtual void parse();
64 
70  virtual void set_net_type(const char* net_type);
71 
76  virtual void set_num_vars(int32_t num_vars);
77 
82  virtual void set_num_factors(int32_t num_vars);
83 
88  virtual void set_vars_card(SGVector<int32_t> vars_card);
89 
95  virtual void set_factors_scope(int32_t num_factors,
96  const SGVector<int32_t>* factors_scope);
97 
103  virtual void set_factors_table(int32_t num_factors,
104  const SGVector<float64_t>* factors_table);
105 
114  virtual void get_preamble(SGVector<char>& net_type,
115  int32_t& num_vars,
116  SGVector<int32_t>& vars_card,
117  int32_t& num_factors,
118  SGVector<int32_t>*& factors_scope);
119 
124  virtual void get_factors_table(SGVector<float64_t>*& factors_table);
125 
126 #ifndef SWIG // SWIG should skip this
127 
134  virtual void get_vector(int8_t*& vector, int32_t& len);
135  virtual void get_vector(uint8_t*& vector, int32_t& len);
136  virtual void get_vector(char*& vector, int32_t& len);
137  virtual void get_vector(int32_t*& vector, int32_t& len);
138  virtual void get_vector(uint32_t*& vector, int32_t& len);
139  virtual void get_vector(float64_t*& vector, int32_t& len);
140  virtual void get_vector(float32_t*& vector, int32_t& len);
141  virtual void get_vector(floatmax_t*& vector, int32_t& len);
142  virtual void get_vector(int16_t*& vector, int32_t& len);
143  virtual void get_vector(uint16_t*& vector, int32_t& len);
144  virtual void get_vector(int64_t*& vector, int32_t& len);
145  virtual void get_vector(uint64_t*& vector, int32_t& len);
147 
149  /*virtual void get_vector(void*& vector, int32_t& len, DataType& dtype);*/
150 
158  virtual void set_vector(const int8_t* vector, int32_t len);
159  virtual void set_vector(const uint8_t* vector, int32_t len);
160  virtual void set_vector(const char* vector, int32_t len);
161  virtual void set_vector(const int32_t* vector, int32_t len);
162  virtual void set_vector(const uint32_t* vector, int32_t len);
163  virtual void set_vector(const float32_t* vector, int32_t len);
164  virtual void set_vector(const float64_t* vector, int32_t len);
165  virtual void set_vector(const floatmax_t* vector, int32_t len);
166  virtual void set_vector(const int16_t* vector, int32_t len);
167  virtual void set_vector(const uint16_t* vector, int32_t len);
168  virtual void set_vector(const int64_t* vector, int32_t len);
169  virtual void set_vector(const uint64_t* vector, int32_t len);
171 
172 #endif // #ifndef SWIG // SWIG should skip this
173 
174  virtual const char* get_name() const { return "UAIFile"; }
175 
176 private:
178  void init();
179 
181  void init_with_defaults();
182 
183 protected:
186 
189 
192 
195 
198 
200  int32_t m_num_vars;
201 
203  int32_t m_num_factors;
204 
207 
210 
213 
216 };
217 
218 }
219 
220 #endif

SHOGUN Machine Learning Toolbox - Documentation