Files Classes Functions Hierarchy
#include <pointtest.h>
Static Public Member Functions | |
| static void | test01 () |
| Test point3<double>::readin where an array is read into a vector of 3D points. | |
| static void | test02 () |
| Testing writing to and reading points for a text file. | |
| static void | test03 () |
| Testing string serialization where the point is converted to a string and then converted back again. | |
Definition at line 8 of file pointtest.h.
| void pointtest::test01 | ( | ) | [static] |
Test point3<double>::readin where an array is read into a vector of 3D points.
Definition at line 12 of file pointtest.cpp.
Referenced by main().
00013 { 00014 00015 double v[12] = 00016 { 1.0,2.0,3.0, 00017 4.0,5.0,6.0, 00018 7.0,8.0,9.0, 00019 10.0,11.0,12.5 00020 }; 00021 00022 vector<point3<double> > w; 00023 00024 point3<double>::readin(w,v,v+sizeof(v)/sizeof(double)); 00025 00026 for (unsigned int i=0; i<w.size(); ++i) 00027 cout << w[i] << endl; 00028 00029 cout << endl; 00030 }
| void pointtest::test02 | ( | ) | [static] |
Testing writing to and reading points for a text file.
Definition at line 34 of file pointtest.cpp.
Referenced by main().
00035 { 00036 vector< pt4 > v; 00037 00038 v.push_back( pt4(.2,.5,.3,.7) ); 00039 v.push_back( pt4(.7,.5,.8,.9) ); 00040 v.push_back( pt4(.3,.4,.8,.183) ); 00041 v.push_back( pt4(.3,.01,.2,.1) ); 00042 00043 cout << "Writing points to file." << endl; 00044 00045 { 00046 ofstream f1("f1.txt"); 00047 f1 << v.size() << endl; 00048 for (uint i=0; i<v.size(); ++i) 00049 f1 << v[i] << endl; 00050 } 00051 00052 cout << "Reading points in from the file." << endl; 00053 vector< pt4 > v2; 00054 { 00055 ifstream f2("f1.txt"); 00056 int sz; 00057 f2 >> sz; 00058 pt4 x; 00059 for (int i=0; i<sz; ++i) 00060 { 00061 f2 >> x; 00062 cout << x << endl; 00063 } 00064 } 00065 }
| void pointtest::test03 | ( | ) | [static] |
Testing string serialization where the point is converted to a string and then converted back again.
Definition at line 67 of file pointtest.cpp.
References point3< T >::serializeInverse(), and point2< T >::serializeInverse().
Referenced by main().
00068 { 00069 cout << "Testing string serialization" << endl; 00070 00071 point2<double> p(.3,.5); 00072 string s = p; 00073 cout << "s=" << s << endl; 00074 cout << "Now the inverse" << endl; 00075 point2<double> p2; 00076 p2.serializeInverse(s); 00077 cout << "p2=" << p2 << endl; 00078 00079 cout << endl << endl; 00080 point3<int> p3(3,-5,12); 00081 s = p3; 00082 cout << "s=" << s << endl; 00083 cout << "Now the inverse" << endl; 00084 point3<int> p4; 00085 p4.serializeInverse(s); 00086 cout << "p4=" << p4 << endl << endl; 00087 00088 }
1.5.8