![]() |
OpenWalnut
1.5.0dev
|
Holds the csv data. More...
#include <WProtonData.h>
Collaboration diagram for WProtonData:Public Types | |
| typedef std::shared_ptr< WProtonData > | SPtr |
| shared_ptr that points to itself More... | |
Public Member Functions | |
| WProtonData (WDataSetCSV::ContentSPtr csvHeader, WDataSetCSV::ContentSPtr csvData) | |
| constructor More... | |
| WDataSetCSV::ContentSPtr | getCSVHeader () |
| getter More... | |
| WDataSetCSV::ContentSPtr | getCSVData () |
| getter More... | |
| void | setCSVHeader (WDataSetCSV::ContentSPtr csvHeader) |
| setter More... | |
| void | setCSVData (WDataSetCSV::ContentSPtr csvData) |
| setter More... | |
| void | setStateIndex (std::string columnName, int index) |
| setter More... | |
| int | getColumnIndexBySelection (std::string selectedName) |
| getter More... | |
| int | getColumnIndex (std::string columnName) |
| getter More... | |
| bool | isColumnAvailable (std::string columnName) |
| checks whether columns are available More... | |
| WDataSetCSV::ContentElemSPtr | getColumnTypes () |
| Get column types, stored in a string vector. More... | |
| std::vector< std::string > | getHeaderFromType (std::list< std::string > typeNames) |
| Return a vector of filtered Headers. More... | |
Private Member Functions | |
| void | detectColumnTypesFromCsvData (WDataSetCSV::ContentSPtr csvData) |
| Reads csv data and stores column types in m_columnTypes. More... | |
| std::string | determineColumnTypeByString (std::string cellValue) |
| Determines column type due to cellValue. More... | |
| bool | checkIfDoubleColumnCanBeInteger (int columnNumber) |
| Checks, if values of a column, containing double values, can be converted to integers. More... | |
Private Attributes | |
| WDataSetCSV::ContentSPtr | m_csvHeader |
| Stores column index of data. More... | |
| WDataSetCSV::ContentSPtr | m_csvData |
| Stores data from obtained input file. More... | |
| std::map< std::string, int > | m_columnMap |
| Stores data as map. More... | |
| std::map< std::string, int > | m_ColumnMapSelectedIndex |
| Stores index of the selected single-selector (ColumnPropertyHandler) More... | |
| WDataSetCSV::ContentElemSPtr | m_columnTypes |
| Stores the information, which data type is stored in associated column. More... | |
Friends | |
| class | WProtonDataTest |
| only test class may be friend More... | |
Holds the csv data.
Definition at line 42 of file WProtonData.h.
| typedef std::shared_ptr< WProtonData > WProtonData::SPtr |
shared_ptr that points to itself
Definition at line 52 of file WProtonData.h.
|
explicit |
constructor
| csvHeader | pointer to a column-header of the CSV-file |
| csvData | pointer to a content of the CSV file |
Definition at line 34 of file WProtonData.cpp.
References setCSVData(), and setCSVHeader().
Here is the call graph for this function:
|
private |
Checks, if values of a column, containing double values, can be converted to integers.
| columnNumber | the column number within m_csvHeader |
Definition at line 170 of file WProtonData.cpp.
References m_csvData.
Referenced by detectColumnTypesFromCsvData().
Here is the caller graph for this function:
|
private |
Reads csv data and stores column types in m_columnTypes.
| csvData | the input csv data |
Definition at line 123 of file WProtonData.cpp.
References checkIfDoubleColumnCanBeInteger(), determineColumnTypeByString(), WDataType::getDouble(), WDataType::getInt(), m_columnTypes, and m_csvHeader.
Referenced by setCSVData().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Determines column type due to cellValue.
| cellValue | the value of a cell on the basis of which the column type is to be determined |
Definition at line 151 of file WProtonData.cpp.
References WDataType::getDouble(), WDataType::getInt(), and WDataType::getString().
Referenced by detectColumnTypesFromCsvData(), and WProtonDataTest::testDetermineColumnTypeByString().
Here is the call graph for this function:
Here is the caller graph for this function:| int WProtonData::getColumnIndex | ( | std::string | columnName | ) |
getter
| columnName | Name of column-header of the CSV-file |
Definition at line 108 of file WProtonData.cpp.
References m_columnMap.
Referenced by WProtonDataTest::testGetColumnIndex().
Here is the caller graph for this function:| int WProtonData::getColumnIndexBySelection | ( | std::string | selectedName | ) |
getter
| selectedName | Name of selected name of single-selection |
Definition at line 102 of file WProtonData.cpp.
References m_ColumnMapSelectedIndex.
Referenced by WProtonDataTest::testSetterGetterStateIndex().
Here is the caller graph for this function:| WDataSetCSV::ContentElemSPtr WProtonData::getColumnTypes | ( | ) |
Get column types, stored in a string vector.
Positions within this vector are linked to positions in m_csvHeader
Definition at line 118 of file WProtonData.cpp.
References m_columnTypes.
Referenced by WProtonDataTest::testDetectColumnTypesFromCsvData().
Here is the caller graph for this function:| WDataSetCSV::ContentSPtr WProtonData::getCSVData | ( | ) |
getter
Definition at line 81 of file WProtonData.cpp.
References m_csvData.
| WDataSetCSV::ContentSPtr WProtonData::getCSVHeader | ( | ) |
getter
Definition at line 86 of file WProtonData.cpp.
References m_csvHeader.
| std::vector< std::string > WProtonData::getHeaderFromType | ( | std::list< std::string > | typeNames | ) |
Return a vector of filtered Headers.
| typeNames | Types of filter |
Definition at line 189 of file WProtonData.cpp.
References WDataType::getDefault(), m_columnTypes, and m_csvHeader.
Here is the call graph for this function:| bool WProtonData::isColumnAvailable | ( | std::string | columnName | ) |
checks whether columns are available
| columnName | THe name of the column. |
Definition at line 97 of file WProtonData.cpp.
References m_ColumnMapSelectedIndex.
Referenced by WProtonDataTest::testIsColumnAvailable().
Here is the caller graph for this function:| void WProtonData::setCSVData | ( | WDataSetCSV::ContentSPtr | csvData | ) |
setter
| csvData | set m_csvData |
Definition at line 64 of file WProtonData.cpp.
References detectColumnTypesFromCsvData(), and m_csvData.
Referenced by WProtonDataTest::testSetCSVDataNull(), and WProtonData().
Here is the call graph for this function:
Here is the caller graph for this function:| void WProtonData::setCSVHeader | ( | WDataSetCSV::ContentSPtr | csvHeader | ) |
setter
| csvHeader | set m_csvHeader |
Definition at line 40 of file WProtonData.cpp.
References m_columnMap, and m_csvHeader.
Referenced by WProtonDataTest::testSetCSVHeaderEmpty(), WProtonDataTest::testSetCSVHeaderNull(), and WProtonData().
Here is the caller graph for this function:| void WProtonData::setStateIndex | ( | std::string | columnName, |
| int | index | ||
| ) |
setter
| columnName | Name of column-header of the CSV-file |
| index | position of column-header of the CSV-file |
Definition at line 91 of file WProtonData.cpp.
References m_ColumnMapSelectedIndex.
Referenced by WProtonDataTest::testIsColumnAvailable(), and WProtonDataTest::testSetterGetterStateIndex().
Here is the caller graph for this function:
|
friend |
only test class may be friend
Definition at line 47 of file WProtonData.h.
|
private |
Stores data as map.
Definition at line 149 of file WProtonData.h.
Referenced by getColumnIndex(), and setCSVHeader().
|
private |
Stores index of the selected single-selector (ColumnPropertyHandler)
Definition at line 154 of file WProtonData.h.
Referenced by getColumnIndexBySelection(), isColumnAvailable(), and setStateIndex().
|
private |
Stores the information, which data type is stored in associated column.
Definition at line 159 of file WProtonData.h.
Referenced by detectColumnTypesFromCsvData(), getColumnTypes(), and getHeaderFromType().
|
private |
Stores data from obtained input file.
Definition at line 144 of file WProtonData.h.
Referenced by checkIfDoubleColumnCanBeInteger(), getCSVData(), and setCSVData().
|
private |
Stores column index of data.
Definition at line 139 of file WProtonData.h.
Referenced by detectColumnTypesFromCsvData(), getCSVHeader(), getHeaderFromType(), and setCSVHeader().