STK++ 0.9.13
|
import data from a Csv File in a DataFrame. More...
#include <STK_ImportFromCsv.h>
Public Member Functions | |
ImportFromCsv (ReadWriteCsv const &import, Import::TypeImport type=Import::numeric_) | |
Constructor. | |
ImportFromCsv (ImportFromCsv const &import) | |
Copy Constructor. | |
virtual | ~ImportFromCsv () |
destructor. | |
ImportFromCsv * | clone () const |
clone pattern. | |
void | setTypeImport (Import::TypeImport typeImport) |
set the type of import the end user want | |
DataFrame const * | dataFrame () const |
void | release () |
Release the dataFrame. | |
bool | run () |
launch the importation of the ReadWriteCsv to the DataFrame. | |
template<class Other > | |
bool | import (Array1D< int > const &indexes) |
launch the importation of the ReadWriteCsv to the DataFrame. | |
![]() | |
String const & | error () const |
get the last error message. | |
Protected Member Functions | |
template<class Other > | |
int | import (int const &iCol, Variable< Other > &var) |
convert a column of the csv in a variable of type Type | |
![]() | |
IRunnerBase () | |
default constructor | |
IRunnerBase (IRunnerBase const &runner) | |
copy constructor | |
virtual | ~IRunnerBase () |
destructor | |
virtual void | update () |
update the runner. | |
Protected Attributes | |
DataFrame * | p_dataFrame_ |
A ptr on the resulting DataFrame. | |
Import::TypeImport | typeImport_ |
the type of import we want to perform. | |
![]() | |
String | msg_error_ |
String with the last error message. | |
bool | hasRun_ |
true if run has been used, false otherwise | |
Private Member Functions | |
bool | asNumeric () |
launch the conversion from the ReadWriteCsv to a DataFrame with a numeric conversion. | |
bool | asOnlyNumeric () |
launch the conversion from the ReadWriteCsv to a DataFrame with only the successful numeric conversion. | |
bool | asString () |
launch the conversion from the ReadWriteCsv to a DataFrame as String. | |
Private Attributes | |
ReadWriteCsv const & | import_ |
a constant reference on the the original ReadWriteCsv. | |
import data from a Csv File in a DataFrame.
A ImportFromCsv object create a DataFrame from a given ReadWriteCsv object. It will try to convert the given ReadWriteCsv to the predefined type given by the user.
Definition at line 56 of file STK_ImportFromCsv.h.
STK::ImportFromCsv::ImportFromCsv | ( | ReadWriteCsv const & | import, |
Import::TypeImport | type = Import::numeric_ |
||
) |
Constructor.
Instantiates an instance of ImportFromCvs with the readWriteCsv to import.
import | the ReadWriteCsv to import |
type | the kind of import we want to perform |
Definition at line 44 of file STK_ImportFromCsv.cpp.
STK::ImportFromCsv::ImportFromCsv | ( | ImportFromCsv const & | import | ) |
Copy Constructor.
import | the ImportFromCsv to import |
Definition at line 53 of file STK_ImportFromCsv.cpp.
|
virtual |
|
private |
launch the conversion from the ReadWriteCsv to a DataFrame with a numeric conversion.
Definition at line 87 of file STK_ImportFromCsv.cpp.
References _T, STK::IRunnerBase::error(), import_, STK::IRunnerBase::msg_error_, p_dataFrame_, and STK::DataFrame::pushBackVariable().
Referenced by run().
|
private |
launch the conversion from the ReadWriteCsv to a DataFrame with only the successful numeric conversion.
launch the conversion from the ReadWriteCsv to a Frame.
Definition at line 118 of file STK_ImportFromCsv.cpp.
References _T, STK::IRunnerBase::error(), import_, STK::IRunnerBase::msg_error_, p_dataFrame_, and STK::DataFrame::pushBackVariable().
Referenced by run().
|
private |
launch the conversion from the ReadWriteCsv to a DataFrame as String.
Definition at line 144 of file STK_ImportFromCsv.cpp.
References _T, STK::IRunnerBase::error(), import_, STK::IRunnerBase::msg_error_, p_dataFrame_, and STK::DataFrame::pushBackVariable().
Referenced by run().
|
inline |
clone pattern.
Definition at line 72 of file STK_ImportFromCsv.h.
Definition at line 77 of file STK_ImportFromCsv.h.
References p_dataFrame_.
launch the importation of the ReadWriteCsv to the DataFrame.
true
if the importation is successful, false
otherwise Definition at line 94 of file STK_ImportFromCsv.h.
convert a column of the csv in a variable of type Type
iCol | the column to convert |
var | the variable storing the result |
true
if the conversion is successful, false
otherwise Definition at line 108 of file STK_ImportFromCsv.h.
References import_.
|
inline |
Release the dataFrame.
Definition at line 79 of file STK_ImportFromCsv.h.
References p_dataFrame_.
|
virtual |
launch the importation of the ReadWriteCsv to the DataFrame.
The call to this method will be without effect if the TypeImport is directed_. In this case use the
method.
true
if the importation is successful, false
otherwise Implements STK::IRunnerBase.
Definition at line 64 of file STK_ImportFromCsv.cpp.
References _T, asNumeric(), asOnlyNumeric(), asString(), STK::IRunnerBase::msg_error_, STK::Import::numeric_, STK::Import::only_numeric_, p_dataFrame_, STK::Import::string_, and typeImport_.
|
inline |
set the type of import the end user want
Definition at line 74 of file STK_ImportFromCsv.h.
References typeImport_.
|
private |
a constant reference on the the original ReadWriteCsv.
Definition at line 113 of file STK_ImportFromCsv.h.
Referenced by asNumeric(), asOnlyNumeric(), asString(), and import().
|
protected |
A ptr on the resulting DataFrame.
Definition at line 99 of file STK_ImportFromCsv.h.
Referenced by asNumeric(), asOnlyNumeric(), asString(), dataFrame(), release(), run(), and ~ImportFromCsv().
|
protected |
the type of import we want to perform.
Definition at line 101 of file STK_ImportFromCsv.h.
Referenced by run(), and setTypeImport().