12 #include <boost/fusion/include/mpl.hpp> 
   13 #include <boost/fusion/include/for_each.hpp> 
   15 #include "util/common.hpp" 
   16 #include <boost/mpl/range_c.hpp> 
   17 #include <boost/mpl/for_each.hpp> 
   18 #include "csv_multiarray.hpp" 
   19 #include "util/util.hpp" 
   20 #include "is_csv_writable.hpp" 
   22 #define CSV_WRITER 0x30000 
   33 template<
typename Tobj>
 
   37     std::stringstream & 
str;
 
   60         typedef decltype(
obj.template get<T::value>()) col_type;
 
   63         typedef typename boost::remove_reference<col_type>::type col_rtype;
 
   64         typedef typename std::remove_all_extents<col_rtype>::type base_col_rtype;
 
   79 template<
typename Tobj, 
bool attr>
 
   83     std::stringstream & 
str;
 
  100         typedef typename boost::mpl::at<typename Tobj::type,boost::mpl::int_<T::value>>::type col_type;
 
  119 template<
typename Tobj>
 
  140         typedef typename boost::fusion::result_of::at_c<typename Tobj::type,T::value>::type col_type;
 
  143         typedef typename boost::remove_reference<col_type>::type col_rtype;
 
  145         std::stringstream str2;
 
  146         str2 << 
"column_" << T::value;
 
  162 template <
typename v_pos, 
typename v_prp, 
unsigned int impl = VECTOR>
 
  170         std::stringstream str;
 
  173         for (
size_t i = 0 ; i < v_pos::value_type::dims ; i++)
 
  176                 str << 
"x[" << i << 
"]";
 
  178                 str << 
"," << 
"x[" << i << 
"]";
 
  186         boost::mpl::for_each< boost::mpl::range_c<int,0,v_prp::value_type::max_prop> >(col);
 
  202         std::stringstream str;
 
  205         if (vp.size() != vpr.size())
 
  207             std::cerr << 
"Error: " << __FILE__ << 
":" << __LINE__ << 
" position vector and property vector must have the same size \n";
 
  208             return std::string(
"");
 
  212         for (
size_t i = offset ; i < vp.size() ; i++)
 
  214             for (
size_t j = 0 ; j < v_pos::value_type::dims ; j++)
 
  217                     str << vp.template get<0>(i)[j];
 
  219                     str << 
"," << vp.template get<0>(i)[j];
 
  223             auto obj = vpr.get(i);
 
  228             boost::mpl::for_each< boost::mpl::range_c<int,0,v_prp::value_type::max_prop> >(c_prp);
 
  248     bool write(std::string file, v_pos & v , v_prp & prp, 
size_t offset=0)
 
  251         std::string csv_header;
 
  253         std::string point_data;
 
  262         std::ofstream ofs(file);
 
  265         if (ofs.is_open() == 
false)
 
  266         {std::cerr << 
"Error " << __FILE__ << 
":" << __LINE__ << 
" cannot create the CSV file: " << file << std::endl;}
 
  268         ofs << csv_header << point_data;
 
std::stringstream & str
String containing the colums list as string. 
 
std::stringstream & str
String containing the csv line constructed from an object. 
 
csv_col(std::stringstream &str)
Constructor. 
 
Tobj & obj
Object to write. 
 
void operator()(T &t)
It call the functor for each member. 
 
bool write(std::string file, v_pos &v, v_prp &prp, size_t offset=0)
It write a CSV file. 
 
This class is an helper to produce csv data from multi-array. 
 
void operator()(T &t)
It call the functor for each member. 
 
This class is an helper to produce csv headers from multi-array. 
 
csv_prp(std::stringstream &str, Tobj &obj)
Constructor. 
 
csv_col(std::stringstream &str)
Constructor. 
 
void operator()(T &t)
It call the functor for each member. 
 
this class is a functor for "for_each" algorithm 
 
std::string get_csv_colums()
Get the colums name (also the positional name) 
 
this class is a functor for "for_each" algorithm 
 
std::string get_csv_data(v_pos &vp, v_prp &vpr, size_t offset)
Get the csv data section. 
 
std::stringstream & str
String containing the colums list as string.