Commit d9ce986b authored by Ludovic Courtès's avatar Ludovic Courtès

core: Move 'load_data_from_text' as a function in "data_storage.h".

parent 1eb25771
/* ALTA --- Analysis of Bidirectional Reflectance Distribution Functions
Copyright (C) 2013, 2014, 2015 Inria
Copyright (C) 2013, 2014, 2015, 2016 Inria
This file is part of ALTA.
......@@ -87,6 +87,7 @@ class data : public parametrized
double epsilon =
std::pow(1.0, -int(std::numeric_limits<double>::digits10 - 1)));
friend void load_data_from_binary(std::istream& in, const alta::arguments& header,
alta::data& data);
......
/* ALTA --- Analysis of Bidirectional Reflectance Distribution Functions
Copyright (C) 2013, 2014, 2015 Inria
Copyright (C) 2013, 2014, 2015, 2016 Inria
This file is part of ALTA.
......@@ -23,11 +23,14 @@
//using namespace alta;
void alta::vertical_segment::load_data_from_text(std::istream& input,
const arguments& header,
alta::vertical_segment& result,
const arguments& args)
void alta::load_data_from_text(std::istream& input,
const alta::arguments& header,
alta::vertical_segment& result)
{
// FIXME: Eventually reinstate support for extra arguments when loading a
// file.
static alta::arguments args;
vec min, max ;
vec ymin, ymax;
......
/* ALTA --- Analysis of Bidirectional Reflectance Distribution Functions
Copyright (C) 2013, 2014, 2015 Inria
Copyright (C) 2013, 2014, 2015, 2016 Inria
This file is part of ALTA.
......@@ -12,6 +12,7 @@
#include <iostream>
#include "data.h"
#include "vertical_segment.h"
#include "common.h"
#include "args.h"
......@@ -23,6 +24,13 @@ namespace alta
// Write DATA to OUT in a compact binary format.
void save_data_as_binary(std::ostream& out, const alta::data& data);
// Initialize DATA from the content of stream INPUT, which is in ALTA's
// native text format.
void load_data_from_text(std::istream& input,
const alta::arguments& header,
alta::vertical_segment &data);
// Initialize DATA from the binary-formatted stream IN.
void load_data_from_binary(std::istream& in, const alta::arguments& header, alta::data &data);
}
......
/* ALTA --- Analysis of Bidirectional Reflectance Distribution Functions
Copyright (C) 2013, 2014, 2015 Inria
Copyright (C) 2013, 2014, 2015, 2016 Inria
This file is part of ALTA.
......@@ -91,7 +91,8 @@ void vertical_segment::load(const std::string& filename, const arguments& args)
load_data_from_binary(file, header, *this);
} else {
load_data_from_text(file, header, *this, args);
// FIXME: ARGS is currently ignored.
load_data_from_text(file, header, *this);
}
file.close();
......
......@@ -129,6 +129,10 @@ class vertical_segment : public data
// Get data size
virtual int size() const ;
friend void load_data_from_text(std::istream& in,
const alta::arguments& header,
alta::vertical_segment& data);
private: // method
protected: // method
......@@ -137,11 +141,6 @@ class vertical_segment : public data
// object. Note, the input and output dimension needs to be specified.
void initializeToZero( unsigned int number_of_data_elements );
static void load_data_from_text(std::istream& input,
const arguments& header,
vertical_segment& result,
const arguments& args);
//! \brief From a correct input configuration 'x' with size
//! dimX()+dimY(), generate a vertical ! segment satisfying this object's
//! parameters.
......
/* ALTA --- Analysis of Bidirectional Reflectance Distribution Functions
Copyright (C) 2013, 2014 Inria
Copyright (C) 2013, 2014, 2016 Inria
This file is part of ALTA.
......@@ -276,7 +276,8 @@ class BrdfGrid : public vertical_segment {
arguments header = arguments::parse_header(file);
initialize(header, false);
load_data_from_text(file, header, *this, args);
// FIXME: ARGS is ignored.
load_data_from_text(file, header, *this);
}
void save(const std::string& filename) const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment