Q:/Codes/PPF/FullPPF/testscript.cpp

Go to the documentation of this file.
00001 #include <iostream>
00002 #include <fstream>
00003 #include <string>
00004 #include <cmath>
00005 #include "ppfc++.hpp"
00006 
00007 using namespace std;
00008 using namespace ppf;
00009 
00010 int main(int argc, char *argv[])
00011 {
00012         datatype a;
00013 
00014         try
00015         {
00016                 ppfdb.connect("JETPPF", ppf::read);
00017                 ppfdb.read(a, 58762, "EQUI", "Q");
00018                 a.readLocal("test.ppf");
00019 
00020                 ppfdb.connect("ameak", ppf::write);
00021                 ppfdb.create(50000, 0, "This is a test");
00022 
00023                 ppfdb.write(a, "NET", "A", ppf::tvector | ppf::xvector);
00024                 for (long t=0;t<a.getTDim();t++) a.setT(t, a.getT(t) - 10.0);
00025                 ppfdb.write(a, "NET", "B", ppf::tvector | ppf::xvector);
00026 
00027                 ppfdb.closeDDA(3, "THIS IS A REALLY BIG COMMENT FOR FUN, I HOPE THIS DOESN'T BREAK ANYTHING");
00028                 ppfdb.abort();
00029                 ppfdb.commit("PPFTEST", 1);
00030         }
00031         catch (ppf_error &e)
00032         {
00033                 cout << e.message << " Code=" << e.code << ", Routine=" << e.method << endl;
00034                 exit(1);
00035         }
00036 
00037 
00038 /*      try
00039         {
00040                 cerr << "-> Connect for writing (user=ameak)\n";
00041 
00042                 ppfdb.connect("ameak", ppf::write);
00043 
00044                 cerr << "-> Create new PPF (shot 50000)\n";
00045 
00046                 ppfdb.create(50000, 0, "This is a test");
00047 
00048                 cerr << "-> Write NET/A (t&x vectors)\n";
00049 
00050                 ppfdb.write(a, "NET", "A", ppf::tvector | ppf::xvector);
00051 
00052                 cerr << "-> Write NET/B (share last t&x vectors)\n";
00053 
00054                 ppfdb.write(a, "NET", "B", ppf::lasttvector | ppf::lastxvector);
00055 
00056                 cerr << "-> Write NET/C (t, but no x vector)\n";
00057 
00058                 ppfdb.write(a, "NET", "C", ppf::tvector | ppf::noxvector);
00059 
00060                 cerr << "-> COMMIT PPF\n";
00061 
00062                 ppfdb.commit();
00063         }
00064         catch (ppf_error &e)
00065         {
00066                 cout << e.message << " Code=" << e.code << ", Routine=" << e.method << endl;
00067                 exit(1);
00068         }
00069 */
00070     return 0;
00071 }
00072 
00073 

Generated on Tue May 23 15:11:51 2006 for PPF C++ by  doxygen 1.4.6-NO