Go to the documentation of this file.
7 #include <unordered_map>
10 #include "../Fort/fort.hpp"
41 return std::any_cast<T>(
value);
48 operator int() {
return as<int>(); }
49 operator float() {
return as<float>(); }
50 operator std::string() {
return as<std::string>(); }
98 for (
int i = 0; i < int(
columns.size()); i++) {
117 assert(i <
int(
columns.size()));
156 fort::char_table table;
157 table << fort::header;
159 for (
int i = 0; i < int(
columns.size()); i++) table <<
columns[i].name;
163 for (
int i = 0; i < int(
columns.size()); i++) {
166 table << record[i].as<
int>();
168 table << record[i].as<
float>();
170 table << record[i].as<std::string>();
172 throw std::runtime_error(
"Unknown DataType");
176 std::cout << table.to_string() << std::endl;
185 for (
int i = 0; i < int(
columns.size()); i++) {
187 std::cout <<
columns[i].name <<
" - ";
191 std::cout <<
"FLOAT";
193 std::cout <<
"STRING";
195 throw std::runtime_error(
"Unknown DataType");
197 std::cout << std::endl;
199 std::cout << std::endl;
208 typedef std::shared_ptr<DataRecordMetadata>
Metadata;
std::any value
Definition: DataRecord.h:29
DataRecord(std::vector< DataValue > &values)
Definition: DataRecord.h:67
std::vector< DataValue > values
Definition: DataRecord.h:65
const T as() const
Extracts value by type.
Definition: DataRecord.h:40
Definition: ColStoreDataGenerator.h:22
Struct which maintains metadata of a single column.
Definition: Column.h:22
std::shared_ptr< DataRecordMetadata > Metadata
Shared pointer to DataRecordMetadata.
Definition: DataRecord.h:208
Stores a row of data.
Definition: DataRecord.h:64
void operator=(std::any value)
Definition: DataRecord.h:44
DataValue(std::any value)
Definition: DataRecord.h:32
DataValue & operator[](int index)
Extracts data value by index.
Definition: DataRecord.h:74
Implementation of a single data element.
Definition: DataRecord.h:28
std::any get()
Definition: DataRecord.h:46
DataRecord()
Definition: DataRecord.h:66