float_converters.cpp
Go to the documentation of this file.
00001 
00009 #include <iostream>
00010 #include "../../include/ecl/converters/char_strings.hpp"
00011 /*****************************************************************************
00012 ** Main
00013 *****************************************************************************/
00014 
00015 int main(int argc, char **argv) {
00016 
00017 
00018     std::cout << std::endl;
00019     std::cout << "***********************************************************" << std::endl;
00020     std::cout << "               Preassigned Buffer" << std::endl;
00021     std::cout << "***********************************************************" << std::endl;
00022     std::cout << std::endl;
00023 
00024         char buf[4];
00025         ecl::Converter<char*,float> converter(buf, buf+4);
00026         std::cout << "converter(2.134): " << converter(2.134) << std::endl;
00027         std::cout << "converter(2.134,2): " << converter(2.134,2) << std::endl;
00028 
00029     std::cout << std::endl;
00030     std::cout << "***********************************************************" << std::endl;
00031     std::cout << "               Internal Default Buffer" << std::endl;
00032     std::cout << "***********************************************************" << std::endl;
00033     std::cout << std::endl;
00034 
00035     std::cout << "The default internal buffer is size 250, but lets set 125." << std::endl;
00036         ecl::Converter<char*,float> converter2(125);
00037         std::cout << "converter(2.134): " << converter2(2.134) << std::endl;
00038         std::cout << "converter(2.134,2): " << converter2(2.134,2) << std::endl;
00039         ecl::Converter<char*,double> converter3;
00040         std::cout << "converter(2.134): " << converter3(2.134) << std::endl;
00041         std::cout << "converter(2.134,2): " << converter3(2.134,2) << std::endl;
00042 
00043     std::cout << std::endl;
00044     std::cout << "***********************************************************" << std::endl;
00045     std::cout << "               Playing with strings" << std::endl;
00046     std::cout << "***********************************************************" << std::endl;
00047     std::cout << std::endl;
00048 
00049     std::string s0(converter2(2.134,2));
00050     std::string s1 = converter2(2.134,2);
00051         std::cout << "String creation: " << s0 << std::endl;
00052         std::cout << "String creation: " << s1 << std::endl;
00053 
00054         ecl::Converter<char*,int> int_converter;
00055         std::cout << int_converter(3) << std::endl;
00056 
00057     std::cout << std::endl;
00058     std::cout << "***********************************************************" << std::endl;
00059     std::cout << "                       Passed" << std::endl;
00060     std::cout << "***********************************************************" << std::endl;
00061     std::cout << std::endl;
00062     return 0;
00063 }
00064 
00065 


ecl_converters
Author(s): Daniel Stonier
autogenerated on Thu Jun 6 2019 21:17:34