OpenWalnut  1.5.0dev
WDataSetCSV.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WDATASETCSV_H
26 #define WDATASETCSV_H
27 
28 #include <memory>
29 
30 #include "WDataSet.h"
31 #include "string"
32 #include "vector"
33 
34 /**
35  * Represents a CSV dataset.
36  */
37 class WDataSetCSV : public WDataSet
38 {
39  /**
40  * Only test class may be friend
41  */
42  friend class WDataSetCSVTest;
43 public:
44  /**
45  * represents a vector containing a vector of strings.
46  */
47  typedef std::vector< std::vector< std::string > > Content;
48 
49  /**
50  * represents a pointer to the Content
51  */
52  typedef std::shared_ptr< std::vector< std::vector< std::string > > > ContentSPtr;
53 
54  /**
55  * represents a pointer to a vector of csv-raw-row as string
56  */
57  typedef std::shared_ptr< std::vector< std:: string > > SeperatedRowSPtr;
58 
59  /**
60  * represents an element within WDataSetCSV object.
61  */
62  typedef std::vector< std::string > ContentElem;
63 
64  /**
65  * represents a shared pointer to a ContentElem object.
66  */
67  typedef std::shared_ptr< std::vector< std::string > > ContentElemSPtr;
68 
69  /**
70  * Construct WDataSetCSV object
71  *
72  * \param header Column names of the CSV file.
73  * \param data Data content of the CSV file.
74  */
76 
77  /**
78  * The standard constructor.
79  */
80  WDataSetCSV();
81 
82  /**
83  * Destructs this dataset.
84  */
85  virtual ~WDataSetCSV();
86 
87  /**
88  * Getter method to receive csv header
89  *
90  * \return m_header as WDataSetCSV::Content object
91  */
93 
94  /**
95  * Getter method to receive csv data
96  *
97  * \return m_data as WDataSetCSV::Content object
98  */
100 
101  /**
102  * Getter method to receive csv rawdata
103  *
104  * \param rawDataSetIn as WDataSetCSV::SeperatedRowSPtr object
105  */
106  void setRawDataSet( WDataSetCSV::SeperatedRowSPtr rawDataSetIn );
107 
108  /**
109  * Getter method to receive csv data
110  *
111  * \return rawDataSet as std::vector< std:: string > object
112  */
114 
115 private:
116  /**
117  * Stores the column titles of a loaded CSV file.
118  */
120 
121  /**
122  * Stores the data of a loaded CSV file.
123  */
125 
126  /**
127  * Stores the rawdata of a loaded CSV file.
128  */
130 };
131 
132 #endif // WDATASETCSV_H
test class of the WDataSetCSV class
Represents a CSV dataset.
Definition: WDataSetCSV.h:38
std::shared_ptr< std::vector< std::vector< std::string > > > ContentSPtr
represents a pointer to the Content
Definition: WDataSetCSV.h:52
WDataSetCSV::ContentSPtr m_header
Stores the column titles of a loaded CSV file.
Definition: WDataSetCSV.h:119
SeperatedRowSPtr getRawDataSet()
Getter method to receive csv data.
Definition: WDataSetCSV.cpp:51
std::shared_ptr< std::vector< std::string > > ContentElemSPtr
represents a shared pointer to a ContentElem object.
Definition: WDataSetCSV.h:67
WDataSetCSV::ContentSPtr getData()
Getter method to receive csv data.
Definition: WDataSetCSV.cpp:46
SeperatedRowSPtr rawDataSet
Stores the rawdata of a loaded CSV file.
Definition: WDataSetCSV.h:129
WDataSetCSV::ContentSPtr getHeader()
Getter method to receive csv header.
Definition: WDataSetCSV.cpp:41
WDataSetCSV::ContentSPtr m_data
Stores the data of a loaded CSV file.
Definition: WDataSetCSV.h:124
virtual ~WDataSetCSV()
Destructs this dataset.
Definition: WDataSetCSV.cpp:37
std::shared_ptr< std::vector< std::string > > SeperatedRowSPtr
represents a pointer to a vector of csv-raw-row as string
Definition: WDataSetCSV.h:57
std::vector< std::vector< std::string > > Content
represents a vector containing a vector of strings.
Definition: WDataSetCSV.h:47
void setRawDataSet(WDataSetCSV::SeperatedRowSPtr rawDataSetIn)
Getter method to receive csv rawdata.
Definition: WDataSetCSV.cpp:56
WDataSetCSV()
The standard constructor.
Definition: WDataSetCSV.cpp:33
std::vector< std::string > ContentElem
represents an element within WDataSetCSV object.
Definition: WDataSetCSV.h:62
Base class for all data set types.
Definition: WDataSet.h:50