float_converters.cpp
Go to the documentation of this file.
1 
9 #include <iostream>
10 #include "../../include/ecl/converters/char_strings.hpp"
11 /*****************************************************************************
12 ** Main
13 *****************************************************************************/
14 
15 int main(int argc, char **argv) {
16 
17 
18  std::cout << std::endl;
19  std::cout << "***********************************************************" << std::endl;
20  std::cout << " Preassigned Buffer" << std::endl;
21  std::cout << "***********************************************************" << std::endl;
22  std::cout << std::endl;
23 
24  char buf[4];
25  ecl::Converter<char*,float> converter(buf, buf+4);
26  std::cout << "converter(2.134): " << converter(2.134) << std::endl;
27  std::cout << "converter(2.134,2): " << converter(2.134,2) << std::endl;
28 
29  std::cout << std::endl;
30  std::cout << "***********************************************************" << std::endl;
31  std::cout << " Internal Default Buffer" << std::endl;
32  std::cout << "***********************************************************" << std::endl;
33  std::cout << std::endl;
34 
35  std::cout << "The default internal buffer is size 250, but lets set 125." << std::endl;
36  ecl::Converter<char*,float> converter2(125);
37  std::cout << "converter(2.134): " << converter2(2.134) << std::endl;
38  std::cout << "converter(2.134,2): " << converter2(2.134,2) << std::endl;
40  std::cout << "converter(2.134): " << converter3(2.134) << std::endl;
41  std::cout << "converter(2.134,2): " << converter3(2.134,2) << std::endl;
42 
43  std::cout << std::endl;
44  std::cout << "***********************************************************" << std::endl;
45  std::cout << " Playing with strings" << std::endl;
46  std::cout << "***********************************************************" << std::endl;
47  std::cout << std::endl;
48 
49  std::string s0(converter2(2.134,2));
50  std::string s1 = converter2(2.134,2);
51  std::cout << "String creation: " << s0 << std::endl;
52  std::cout << "String creation: " << s1 << std::endl;
53 
54  ecl::Converter<char*,int> int_converter;
55  std::cout << int_converter(3) << std::endl;
56 
57  std::cout << std::endl;
58  std::cout << "***********************************************************" << std::endl;
59  std::cout << " Passed" << std::endl;
60  std::cout << "***********************************************************" << std::endl;
61  std::cout << std::endl;
62  return 0;
63 }
64 
65 
main
int main(int argc, char **argv)
Definition: float_converters.cpp:15
ecl::Converter< char *, float >
Conversion to text format with character strings.
Definition: char_strings.hpp:644
ecl::Converter< char *, int >
Fast conversion to text format with character strings.
Definition: char_strings.hpp:382
ecl::Converter< char *, double >
Fast conversion to text format with character strings.
Definition: char_strings.hpp:733


ecl_converters
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:16:25