On 23-Jan-2009, Ryan Rusaw wrote:
| I just use a std::stringstream << operator and the appropriate
| octave_value function, then just base64 encode the string.
|
| if (val.is_complex_type()) {
| data_type = "octave_complex";
| in << val.complex_value().real()
| << std::string(" + ")
| << val.complex_value().imag()
| << std::string("i");
| } else if (val.is_bool_type()) {
| data_type = "bool";
| in << val.bool_value();
| } else if (val.is_integer_type()) {
| data_type = "int";
| in << val.int_value();
| } else if (val.is_double_type() ||
| val.is_single_type()) {
| data_type = "float";
| in << val.double_value();
| } else ...
|
| b64.encode(in.str(), base64_encoding);
|
| Its entirely possible there is much more optimal way of doing so,
| especially when I'm iterating through matrices converting each
| element.
Doesn't something like
in << val.double_value()
already convert to ASCII? So why base64 encode it?
It seems to me that it would be better to avoid the conversion to/from
ascii when passing data between Octave and the IDE.
jwe