20 #ifndef __TERRALIB_RP_INTERNAL_ALGORITHM_PARAMETERS_SERIALIZER_H
21 #define __TERRALIB_RP_INTERNAL_ALGORITHM_PARAMETERS_SERIALIZER_H
30 #include <boost/numeric/ublas/matrix.hpp>
65 bool addParameter(
const std::string& name,
const std::string& value );
73 template<
typename ValueType >
74 bool addParameter(
const std::string& name,
const ValueType& value )
78 return addParameter( name, toString( value ) );
93 const std::vector< std::string >& values );
101 template<
typename ValueType >
103 const std::vector< ValueType >& values )
105 const std::size_t valuesSize = values.size();
106 std::vector< std::string > stringValues;
110 for( std::size_t valuesIdx = 0 ; valuesIdx < valuesSize ; ++valuesIdx )
112 stringValues.push_back( toString( values[ valuesIdx ] ) );
120 return addMultivaluedParameter( name, stringValues );
129 template<
typename ValueType >
131 const boost::numeric::ublas::matrix< ValueType >& values )
133 const std::size_t valuesSize1 = values.size1();
134 const std::size_t valuesSize2 = values.size2();
135 std::size_t values2Idx = 0;
136 std::vector< std::string > stringValues;
140 for( std::size_t values1Idx = 0 ; values1Idx < valuesSize1 ; ++values1Idx )
142 for( values2Idx = 0 ; values2Idx < valuesSize2 ; ++values2Idx )
144 stringValues.push_back( toString( values( values1Idx, values2Idx ) ) );
153 return addMultivaluedParameter( name, stringValues );
162 template<
typename ValueType >
164 const std::vector< std::vector< ValueType > >& values )
166 const std::size_t valuesSize = values.size();
168 for( std::size_t valuesIdx = 0 ; valuesIdx < valuesSize ; ++valuesIdx )
170 if( ! addMultivaluedParameter( name, values[ valuesIdx ] ) )
185 template<
typename ValueType >
187 const std::vector< boost::numeric::ublas::matrix< ValueType > >& values )
189 const std::size_t valuesSize = values.size();
191 for( std::size_t valuesIdx = 0 ; valuesIdx < valuesSize ; ++valuesIdx )
193 if( ! addMultivaluedParameter( name, values[ valuesIdx ] ) )
206 void getMetaData( std::map<std::string, std::string>& metadata )
const;
217 typedef std::multimap<std::string, std::vector< std::string > >
ParsContT;
219 template<
typename ValueType >
220 std::string
toString(
const std::complex< ValueType >& value )
const
222 return std::to_string( value.real() ) +
"+" +
223 std::to_string( value.imag() ) +
"i";
226 template<
typename ValueType >
227 std::string
toString(
const ValueType& value )
const
229 return std::to_string( value );
#define TERPEXPORT
You can use this macro in order to export/import classes and functions from this module.
Proxy configuration file for TerraView (see terraview_config.h).