Commit b0280475 authored by Romain Pacanowski's avatar Romain Pacanowski Committed by Laurent Belcour

Enforcing alta namespace for all methods/functions

in the commited file.
parent ab7caf28
......@@ -23,7 +23,7 @@ void data::save(const std::string& filename) const
file.open(filename.c_str(), std::ios_base::trunc);
file.exceptions(std::ios_base::goodbit);
save_data_as_text(file, *this);
alta::save_data_as_text(file, *this);
file.close();
}
......
......@@ -24,10 +24,10 @@
#include "ptr.h"
namespace alta {
class data;
}
void load_data_from_binary(std::istream& in, const alta::arguments& header, alta::data& data);
//namespace alta {
// class data;
//}
//void load_data_from_binary(std::istream& in, const alta::arguments& header, alta::data& data);
namespace alta {
......@@ -87,7 +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,
friend void load_data_from_binary(std::istream& in, const alta::arguments& header,
alta::data& data);
protected: // data
......
......@@ -21,11 +21,11 @@
# include <endian.h>
#endif
using namespace alta;
//using namespace alta;
void vertical_segment::load_data_from_text(std::istream& input,
void alta::vertical_segment::load_data_from_text(std::istream& input,
const arguments& header,
vertical_segment& result,
alta::vertical_segment& result,
const arguments& args)
{
vec min, max ;
......@@ -212,8 +212,10 @@ void vertical_segment::load_data_from_text(std::istream& input,
std::cout << "<<INFO>> " << result._data.size() << " elements to fit" << std::endl ;
}
void save_data_as_text(std::ostream& out, const data &data)
void alta::save_data_as_text(std::ostream& out, const alta::data &data)
{
using namespace alta;
out << "#DIM " << data.dimX() << " " << data.dimY() << std::endl;
out << "#PARAM_IN " << params::get_name(data.input_parametrization()) << std::endl;
out << "#PARAM_OUT " << params::get_name(data.output_parametrization()) << std::endl;
......@@ -229,8 +231,10 @@ void save_data_as_text(std::ostream& out, const data &data)
}
}
void save_data_as_binary(std::ostream &out, const data& data)
void alta::save_data_as_binary(std::ostream &out, const alta::data& data)
{
using namespace alta;
out << "#DIM " << data.dimX() << " " << data.dimY() << std::endl;
out << "#PARAM_IN " << params::get_name(data.input_parametrization()) << std::endl;
out << "#PARAM_OUT " << params::get_name(data.output_parametrization()) << std::endl;
......@@ -262,8 +266,10 @@ void save_data_as_binary(std::ostream &out, const data& data)
out << std::endl << "#END_STREAM" << std::endl;
}
void load_data_from_binary(std::istream& in, const arguments& header, data& data)
void alta::load_data_from_binary(std::istream& in, const alta::arguments& header, alta::data& data)
{
using namespace alta;
// FIXME: For now we make a number of assumptions.
assert(header["FORMAT"] == "binary");
assert(header.get_int("VERSION") == 0);
......
......@@ -15,12 +15,16 @@
#include "common.h"
#include "args.h"
// Write DATA to OUT in ALTA's text format.
void save_data_as_text(std::ostream& out, const alta::data &data);
namespace alta
{
// Write DATA to OUT in ALTA's text format.
void save_data_as_text(std::ostream& out, const alta::data &data);
// Write DATA to OUT in a compact binary format.
void save_data_as_binary(std::ostream& out, const alta::data& data);
// 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 binary-formatted stream IN.
void load_data_from_binary(std::istream& in, const alta::arguments& header,
alta::data &data);
}
// Initialize DATA from the binary-formatted stream IN.
void load_data_from_binary(std::istream& in, const alta::arguments& header,
alta::data &data);
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