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,
typename KeyType >
131 const std::map< KeyType, ValueType >& values )
133 const std::size_t valuesSize = values.size();
134 std::vector< std::string > stringValues;
138 typename std::map< KeyType, ValueType >::const_iterator it =
140 const typename std::map< KeyType, ValueType >::const_iterator itE =
145 stringValues.push_back( toString( it->first ) );
146 stringValues.push_back( toString( it->second ) );
155 return addMultivaluedParameter( name, stringValues );
164 template<
typename ValueType >
166 const boost::numeric::ublas::matrix< ValueType >& values )
168 const std::size_t valuesSize1 = values.size1();
169 const std::size_t valuesSize2 = values.size2();
170 std::size_t values2Idx = 0;
171 std::vector< std::string > stringValues;
175 for( std::size_t values1Idx = 0 ; values1Idx < valuesSize1 ; ++values1Idx )
177 for( values2Idx = 0 ; values2Idx < valuesSize2 ; ++values2Idx )
179 stringValues.push_back( toString( values( values1Idx, values2Idx ) ) );
188 return addMultivaluedParameter( name, stringValues );
197 template<
typename ValueType >
199 const std::vector< std::vector< ValueType > >& values )
201 const std::size_t valuesSize = values.size();
203 for( std::size_t valuesIdx = 0 ; valuesIdx < valuesSize ; ++valuesIdx )
205 if( ! addMultivaluedParameter( name, values[ valuesIdx ] ) )
220 template<
typename ValueType >
222 const std::vector< boost::numeric::ublas::matrix< ValueType > >& values )
224 const std::size_t valuesSize = values.size();
226 for( std::size_t valuesIdx = 0 ; valuesIdx < valuesSize ; ++valuesIdx )
228 if( ! addMultivaluedParameter( name, values[ valuesIdx ] ) )
241 void getMetaData( std::map<std::string, std::string>& metadata )
const;
252 typedef std::multimap<std::string, std::vector< std::string > >
ParsContT;
254 template<
typename ValueType >
255 std::string
toString(
const std::complex< ValueType >& value )
const
257 return std::to_string( value.real() ) +
"+" +
258 std::to_string( value.imag() ) +
"i";
261 std::string
toString(
const std::string& value )
const
266 template<
typename ValueType >
267 std::string
toString(
const ValueType& value )
const
269 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).