1414#include < shogun/base/SGObject.h>
1515#include < shogun/io/SGIO.h>
1616
17- #include < curl/curl.h>
18-
1917#include < memory>
2018#include < numeric>
2119#include < string>
@@ -32,7 +30,7 @@ namespace shogun
3230 {
3331
3432 public:
35- explicit OpenMLReader (const std::string& api_key);
33+ explicit OpenMLReader (const std::string& api_key): m_api_key(api_key) {}
3634
3735 /* *
3836 * Returns a string returned by the server given a request.
@@ -51,6 +49,7 @@ namespace shogun
5149 get (const std::string& request, const std::string& format, Args... args)
5250 {
5351 std::string request_path;
52+ // clear the buffer before request
5453 m_curl_response_buffer.clear ();
5554 auto find_format = m_format_options.find (format);
5655 if (find_format == m_format_options.end ())
@@ -124,14 +123,6 @@ namespace shogun
124123 */
125124 void openml_curl_request_helper (const std::string& url);
126125
127- /* *
128- * Handles all possible codes
129- *
130- * @param curl_handle curl handle used in the request
131- * @param code the code returned by the query
132- */
133- void openml_curl_error_helper (CURL* curl_handle, CURLcode code);
134-
135126 /* * the user API key, not required for all requests */
136127 std::string m_api_key;
137128
@@ -214,7 +205,7 @@ namespace shogun
214205 const std::string& model, components_type components,
215206 parameters_type parameters)
216207 : m_name(name), m_description(description), m_class_name(model),
217- m_parameters (parameters), m_components(components)
208+ m_parameters (std::move( parameters)) , m_components(std::move( components) )
218209 {
219210 }
220211
@@ -247,7 +238,7 @@ namespace shogun
247238 /* *
248239 * Dumps the OpenMLFlow to disk.
249240 */
250- void dump ();
241+ void dump () const ;
251242
252243 /* *
253244 * Gets a subflow, i.e. a kernel in a machine
@@ -266,17 +257,17 @@ namespace shogun
266257 }
267258
268259#ifndef SWIG
269- SG_FORCED_INLINE parameters_type get_parameters ()
260+ SG_FORCED_INLINE parameters_type get_parameters () const noexcept
270261 {
271262 return m_parameters;
272263 }
273264
274- SG_FORCED_INLINE components_type get_components ()
265+ SG_FORCED_INLINE components_type get_components () const noexcept
275266 {
276267 return m_components;
277268 }
278269
279- SG_FORCED_INLINE std::string get_class_name ()
270+ SG_FORCED_INLINE std::string get_class_name () const noexcept
280271 {
281272 return m_class_name;
282273 }
@@ -320,7 +311,6 @@ namespace shogun
320311 param_descriptors,
321312 std::vector<std::unordered_map<std::string, std::string>>
322313 param_qualities)
323-
324314 : m_name(name), m_description(description),
325315 m_data_format (data_format), m_dataset_id(dataset_id),
326316 m_version(version), m_creator(creator),
@@ -441,8 +431,8 @@ namespace shogun
441431 std::shared_ptr<OpenMLData> data)
442432 : m_task_id(task_id), m_task_name(task_name),
443433 m_task_type (task_type), m_task_type_id(task_type_id),
444- m_evaluation_measures(evaluation_measures), m_split(split),
445- m_data(data)
434+ m_evaluation_measures(std::move( evaluation_measures)) , m_split(std::move( split) ),
435+ m_data(std::move( data) )
446436 {
447437 }
448438
@@ -459,9 +449,9 @@ namespace shogun
459449 return m_split;
460450 }
461451
462- SGMatrix<int32_t > get_train_indices ();
452+ SGMatrix<int32_t > get_train_indices () const ;
463453
464- SGMatrix<int32_t > get_test_indices ();
454+ SGMatrix<int32_t > get_test_indices () const ;
465455
466456#ifndef SWIG
467457 SG_FORCED_INLINE TaskType get_task_type () const noexcept
@@ -553,9 +543,9 @@ namespace shogun
553543 m_fold_evaluations(std::move(fold_evaluations)),
554544 m_sample_evaluations(std::move(sample_evaluations)),
555545 m_data_content(data_content),
556- m_output_files(std::move(output_files)), m_task(task),
557- m_flow(flow), m_run_id(run_id), m_model(model), m_tags(tags),
558- m_predictions_url(predictions_url)
546+ m_output_files(std::move(output_files)), m_task(std::move( task) ),
547+ m_flow(std::move( flow)) , m_run_id(run_id), m_model(std::move( model)) , m_tags(std::move( tags) ),
548+ m_predictions_url(std::move( predictions_url) )
559549 {
560550 }
561551
0 commit comments