Inviwo  0.9.10.1
Inviwo documentation
inviwo::JSONDataFrameReader Class Reference

#include <jsonreader.h>

+ Inheritance diagram for inviwo::JSONDataFrameReader:

Public Member Functions

 JSONDataFrameReader (const JSONDataFrameReader &)=default
 
 JSONDataFrameReader (JSONDataFrameReader &&) noexcept=default
 
JSONDataFrameReaderoperator= (const JSONDataFrameReader &)=default
 
JSONDataFrameReaderoperator= (JSONDataFrameReader &&) noexcept=default
 
virtual JSONDataFrameReaderclone () const override
 
virtual std::shared_ptr< DataFramereadData (const std::string &fileName) override
 
std::shared_ptr< DataFramereadData (std::istream &stream) const
 
- Public Member Functions inherited from inviwo::DataReaderType< DataFrame >
 DataReaderType (const DataReaderType &rhs)=default
 
 DataReaderType (DataReaderType &&rhs) noexcept=default
 
DataReaderTypeoperator= (const DataReaderType &that)=default
 
DataReaderTypeoperator= (DataReaderType &&that) noexcept=default
 
virtual std::shared_ptr< DataFramereadData (const std::string &filePath, MetaDataOwner *)
 
- Public Member Functions inherited from inviwo::DataReader
 DataReader (const DataReader &rhs)=default
 
 DataReader (DataReader &&rhs) noexcept=default
 
DataReaderoperator= (const DataReader &that)=default
 
DataReaderoperator= (DataReader &&that) noexcept=default
 
const std::vector< FileExtension > & getExtensions () const
 
void addExtension (FileExtension ext)
 

Detailed Description

Reads a json file into DataFrame Expects object layout: [ {"Col1": val11, "Col2": val12 }, {"Col1": val21, "Col2": val22 } ] The example above contains two rows and two columns.

Member Function Documentation

◆ readData() [1/2]

std::shared_ptr< DataFrame > inviwo::JSONDataFrameReader::readData ( const std::string &  fileName)
overridevirtual

read a JSON file from a file Expects object layout: [ {"Col1": val11, "Col2": val12 }, {"Col1": val21, "Col2": val22 } ] The example above contains two rows and two columns.

Parameters
fileNamename of the input file
Returns
a DataFrame containing the JSON data
Exceptions
FileExceptionif the file cannot be accessed

Implements inviwo::DataReaderType< DataFrame >.

◆ readData() [2/2]

std::shared_ptr< DataFrame > inviwo::JSONDataFrameReader::readData ( std::istream &  stream) const

read DataFrame from a JSON-encoded input stream, e.g. a std::ifstream. In case file streams are used, the file must have be opened prior calling this function. Expects object layout: [ {"Col1": val11, "Col2": val12 }, {"Col1": val21, "Col2": val22 } ] The example above contains two rows and two columns.

Parameters
streaminput stream with the json data
Returns
a DataFrame containing the data

The documentation for this class was generated from the following files: