41 CSV_Data::CSV_Data() : data(0), type(
""), initialized(false) {
44 CSV_Data::~CSV_Data() {
46 if(type.compare(
string(STRING)) == 0) {
47 delete (vector<string> *)data;
49 }
else if(type.compare(
string(FLOAT32)) == 0) {
50 delete (vector<float> *)data;
52 }
else if(type.compare(
string(FLOAT64)) == 0) {
53 delete (vector<double> *)data;
55 }
else if(type.compare(
string(INT16)) == 0) {
56 delete (vector<short> *)data;
58 }
else if(type.compare(
string(INT32)) == 0) {
59 delete (vector<int> *)data;
65 void CSV_Data::insert(
CSV_Field* field,
void* value) {
67 if(type.compare(
"") == 0)
68 type = field->getType();
71 if(type.compare(
string(STRING)) == 0) {
72 data =
new vector<string>();
74 }
else if(type.compare(
string(FLOAT32)) == 0) {
75 data =
new vector<float>();
77 }
else if(type.compare(
string(FLOAT64)) == 0) {
78 data =
new vector<double>();
80 }
else if(type.compare(
string(INT16)) == 0) {
81 data =
new vector<short>();
83 }
else if(type.compare(
string(INT32)) == 0) {
84 data =
new vector<int>();
89 if(type.compare(
string(STRING)) == 0) {
90 string str = *reinterpret_cast<string*>(value);
91 ((vector<string>*)data)->push_back(str);
92 }
else if(type.compare(
string(FLOAT32)) == 0) {
93 float flt = atof((reinterpret_cast<string*>(value))->c_str());
94 ((vector<float>*)data)->push_back(flt);
95 }
else if(type.compare(
string(FLOAT64)) == 0) {
96 double dbl = atof((reinterpret_cast<string*>(value))->c_str());
97 ((vector<double>*)data)->push_back(dbl);
98 }
else if(type.compare(
string(INT16)) == 0) {
99 short shrt = atoi((reinterpret_cast<string*>(value))->c_str());
100 ((vector<short>*)data)->push_back(shrt);
101 }
else if(type.compare(
string(INT32)) == 0) {
102 int integer = atoi((reinterpret_cast<string*>(value))->c_str());
103 ((vector<int>*)data)->push_back(integer);
107 void* CSV_Data::getData() {
111 string CSV_Data::getType() {