STK++ 0.9.13
STK_ImportFromCsv.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------*/
2/* Copyright (C) 2004-2016 Serge Iovleff, Université Lille 1, Inria
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this program; if not, write to the
16 Free Software Foundation, Inc.,
17 59 Temple Place,
18 Suite 330,
19 Boston, MA 02111-1307
20 USA
21
22 Contact : S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
23*/
24
25/*
26 * Project: stkp::DManager
27 * Purpose: Declaration of the class ImportFromCsv.
28 * Author: Serge Iovleff, S..._Dot_I..._At_stkpp_Dot_org (see copyright for ...)
29 *
30 */
31
36#ifndef STK_IMPORTFROMCSV_H
37#define STK_IMPORTFROMCSV_H
38
39#include <Sdk.h>
40
41#include "STK_Import_Util.h"
42#include "STK_ReadWriteCsv.h"
43#include "STK_DataFrame.h"
44
45
46namespace STK
47{
48
57{
58 public:
68 ImportFromCsv( ImportFromCsv const& import);
70 virtual ~ImportFromCsv();
72 ImportFromCsv* clone() const { return new ImportFromCsv(*this);}
75
77 inline DataFrame const* dataFrame() const { return p_dataFrame_;}
79 inline void release() { p_dataFrame_ = 0;}
89 bool run();
93 template<class Other>
94 bool import( Array1D<int> const& indexes)
95 { return false;}
96
97 protected:
107 template<class Other>
108 int import( int const& iCol, Variable<Other>& var)
109 { return var.importFromString(import_[iCol]);}
110
111 private:
117 bool asNumeric();
121 bool asOnlyNumeric();
125 bool asString();
126};
127
128} // namespace STK
129
130#endif /*STK_IMPORTFROMCSV_H*/
In this file we declare the DataFrame class.
In this file we define the main constant and method needed when importing data.
In this file we define the class TReadWriteCsv.
This file include all the other header files of the project Sdk.
DataFrame is a List of Variable with the same number of rows.
Abstract base class for all classes having a.
Definition STK_IRunner.h:65
import data from a Csv File in a DataFrame.
Import::TypeImport typeImport_
the type of import we want to perform.
DataFrame * p_dataFrame_
A ptr on the resulting DataFrame.
void setTypeImport(Import::TypeImport typeImport)
set the type of import the end user want
bool asOnlyNumeric()
launch the conversion from the ReadWriteCsv to a DataFrame with only the successful numeric conversio...
bool asString()
launch the conversion from the ReadWriteCsv to a DataFrame as String.
void release()
Release the dataFrame.
ReadWriteCsv const & import_
a constant reference on the the original ReadWriteCsv.
bool asNumeric()
launch the conversion from the ReadWriteCsv to a DataFrame with a numeric conversion.
ImportFromCsv * clone() const
clone pattern.
virtual ~ImportFromCsv()
destructor.
DataFrame const * dataFrame() const
bool run()
launch the importation of the ReadWriteCsv to the DataFrame.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
TypeImport
define the type of import we want to perform.
@ numeric_
try to convert the columns in numeric values and let the others as string
The namespace STK is the main domain space of the Statistical ToolKit project.
class TReadWriteCsv< String > ReadWriteCsv