Google

Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

testSourceFactory.cpp

Go to the documentation of this file.
00001 #include "gn/gnSourceFactory.h"
00002 #include "gn/gnFASSource.h"
00003 #include "gn/gnDNXSource.h"
00004 #include <iostream>
00005 
00006 int32 main( int32 argc, char* argv[])
00007 {
00008         argc; argv;
00009         
00010         gnSourceFactory* sf = gnSourceFactory::GetSourceFactory();
00011 
00012         // ########################################################
00013         // ## Path
00014         // ########################################################
00015         cout << " ***** TEST Path methods ***** " << endl;
00016           // add
00017         string path = "c:/tmp";
00018         cout << "AddPath( " << path  << " )" << endl;
00019         if( !sf->AddPath( path ) )
00020                 cout << "   bad Unable to add path: " << path << endl;
00021         else
00022                 cout << "   good Path List Size: " << sf->GetPathListSize() << endl;
00023           // insert
00024         path = "c:\\temp";
00025         cout << "InsPath( " << path  << ", 0 )"<< endl;
00026         if( !sf->InsPath( path, 0 ) )
00027                 cout << "   bad Unable to Insert path at 0: " << path << endl;
00028         else
00029                 cout << "   good Path List Size: " << sf->GetPathListSize() << endl;
00030           // has
00031         path = "c:\\tmp";
00032         cout << "HasPath( " << path << " )" << endl;
00033         if( sf->HasPath( path ) )
00034                 cout << "   good Does have " << path << endl;
00035         else
00036                 cout << "   bad Does NOT have " << path << endl;
00037         path = "c:\\temp";
00038         cout << "HasPath( " << path << " )" << endl;
00039         if( sf->HasPath( path ) )
00040                 cout << "   bad Does have " << path << endl;
00041         else
00042                 cout << "   good Does NOT have " << path << endl;
00043           // get
00044         cout << "GetPath(0) = " << endl;
00045         if( !(sf->GetPath(0).empty()) )
00046                 cout << "   good" << endl;
00047         else
00048                 cout << "   bad" << endl;
00049         cout << "GetPath(300)" <<  endl;
00050         if( sf->GetPath(300).empty() )
00051                 cout << "   good" << endl;
00052         else
00053                 cout << "   bad" << endl;
00054           // del
00055         cout << "DelPath( 0 )" << endl;
00056         if( !sf->DelPath( 0 ) )
00057                 cout << "   bad Unable to delete 0" << endl;
00058         else
00059                 cout << "   good Path List Size: " << sf->GetPathListSize() << endl;
00060         cout << "DelPath( 0 )" << endl;
00061         if( !sf->DelPath( 0 ) )
00062                 cout << "   bad Unable to delete 0" << endl;
00063         else
00064                 cout << "   good Path List Size: " << sf->GetPathListSize() << endl;
00065         cout << "DelPath( 0 )" << endl;
00066         if( !sf->DelPath( 0 ) )
00067                 cout << "   good Unable to delete 0" << endl;
00068         else
00069                 cout << "   bad Path List Size: " << sf->GetPathListSize() << endl;
00070         
00071 
00072         // ########################################################
00073         // ## Source Class
00074         // ########################################################
00075         cout << " ***** TEST Source Class methods ***** " << endl;
00076         string extStr = ".fas";
00077           // Set
00078         cout << "SetSourceClass( " << extStr << " , gnFASSource )" << endl;
00079         gnFASSource fasSource;
00080         if( !sf->SetSourceClass( extStr, fasSource ) )
00081                 cout << "   bad Unable to add " << extStr << " , gnFASSource" << endl;
00082         else
00083                 cout << "   good SourceClass List Size: " << sf->GetSourceClassListSize() << endl;
00084           // Has
00085         cout << "HasSourceClass( " << extStr << " )" << endl;
00086         if( sf->HasSourceClass( extStr ) )
00087                 cout << "   good Does have " << extStr << endl;
00088         else
00089                 cout << "   bad Does NOT have " << extStr << endl;
00090         extStr = ".seq";
00091         cout << "HasSourceClass( " << extStr << " )" << endl;
00092         if( sf->HasSourceClass( extStr ) )
00093                 cout << "   bad Does have " << extStr << endl;
00094         else
00095                 cout << "   good Does NOT have " << extStr << endl;
00096           // default
00097         cout << "SetDefaultSourceClass( new gnFASSource() )" << endl;
00098         if( !sf->SetDefaultSourceClass( fasSource  ) )
00099                 cout << "   bad Cannot set Default Source Class" << endl;
00100         else
00101                 cout << "   good DEFAULT source class set" << endl;
00102           // Get
00103         extStr = ".fas";
00104         cout << "GetSourceClass( " << extStr << " )" << endl;
00105         if( sf->GetSourceClass( extStr ) != 0 )
00106                 cout << "   good Does have " << extStr << endl;
00107         else
00108                 cout << "   bad Does NOT have " << extStr << endl;
00109         extStr = ".seq";
00110         cout << "GetSourceClass( " << extStr << " )" << endl;
00111         if( sf->GetSourceClass( extStr ) != 0 )
00112                 cout << "   good Does have " << extStr << endl;
00113         else
00114                 cout << "   bad Does NOT have " << extStr << endl;
00115           // Match
00116         string sourceStr = "c:/tests.fas" ;
00117         cout << "MatchSourceClass( " << sourceStr << " )" << endl;
00118         if( sf->MatchSourceClass( sourceStr ) != 0 )
00119                 cout << "   good Does match" << endl;
00120         else
00121                 cout << "   bad Does NOT match" << endl;
00122         sourceStr = "c:/tests.dnx";
00123         cout << "MatchSourceClass( " << sourceStr << " )" << endl;
00124         if( sf->MatchSourceClass( sourceStr ) != sf->GetDefaultSourceClass() )
00125                 cout << "   bad Does match" << endl;
00126         else
00127                 cout << "   good Does NOT match" << endl;
00128           // Del
00129         extStr = ".fas";
00130         cout << "DelSourceClass( " << extStr << " )" << endl;
00131         if( !sf->DelSourceClass( extStr ) )
00132                 cout << "   bad Cannot Delete " << extStr << endl;
00133         else
00134                 cout << "   good SourceClass List Size: " << sf->GetSourceClassListSize() << endl;
00135         extStr = ".fas";
00136         cout << "DelSourceClass( " << extStr << " )" << endl;
00137         if( !sf->DelSourceClass( extStr ) )
00138                 cout << "   good Cannot Delete " << extStr << endl;
00139         else
00140                 cout << "   bad SourceClass List Size: " << sf->GetSourceClassListSize() << endl;
00141 
00142         // ########################################################
00143         // ## Source
00144         // ########################################################
00145         extStr = ".fas";
00146           // Set
00147         cout << "SetSourceClass( " << extStr << " , gnFASSource )" << endl;
00148         if( !sf->SetSourceClass( extStr, fasSource ) )
00149                 cout << "   bad Unable to add " << extStr << " , gnFASSource" << endl;
00150         else
00151                 cout << "   good SourceClass List Size: " << sf->GetSourceClassListSize() << endl;
00152 
00153         extStr = ".dnx";
00154           // Set
00155         gnDNXSource dnxSource;
00156         cout << "SetSourceClass( " << extStr << " , gnDNXSource )" << endl;
00157         if( !sf->SetSourceClass( extStr, dnxSource ) )
00158                 cout << "   bad Unable to add " << extStr << " , gnDNXSource" << endl;
00159         else
00160                 cout << "   good SourceClass List Size: " << sf->GetSourceClassListSize() << endl;
00161 
00162 
00163         cout << " ***** TEST Source Class methods ***** " << endl;
00164           // add
00165         path = "W:\\Developm\\_Data\\_Testing_data\\fas\\";
00166         cout << "AddPath( " << path  << " )" << endl;
00167         if( !sf->AddPath( path ) )
00168                 cout << "   bad Unable to add path: " << path << endl;
00169         else
00170                 cout << "   good Path List Size: " << sf->GetPathListSize() << endl;
00171 
00172           // Add
00173         sourceStr = "W:/Developm/_Data/_Testing_data/fas/test.fas";
00174         cout << "AddSource( " << sourceStr << ", true )" << endl;
00175         if( !sf->AddSource( sourceStr ) )
00176                 cout << "   Source " << sourceStr << " NOT added" << endl;
00177         else
00178                 cout << "   Source List Size: " << sf->GetSourceListSize() << endl;
00179 
00180         sourceStr = "test.abi";
00181         cout << "AddSource( " << sourceStr << ", true )" << endl;
00182         if( !sf->AddSource( sourceStr ) )
00183                 cout << "   Source " << sourceStr << " NOT added" << endl;
00184         else
00185                 cout << "   Source List Size: " << sf->GetSourceListSize() << endl;
00186         
00187 
00188         char bubba[50];
00189         
00190         cout << "Opening W:/Developm/_Data/_Testing_data/fas/V13anooz.fas...\n"; 
00191         gpSourceSeq *asplundh = new gpSourceSeq("W:/Developm/_Data/_Testing_data/fas/test.fas");
00192         cout << "Reading some bases.\n";
00193         string mystring = asplundh->ToString(130, 2480);
00194         cout << mystring << "\n";
00195         cout << "If that worked then congratulations!  You're one step closer than you realized.\n";
00196         cin >> bubba;
00197         delete asplundh;
00198 
00199 // test out DNX
00200         cout << "Opening W:/Developm/_Data/_Testing_data/fas/deenex.dnx...\n"; 
00201         asplundh = new gpSourceSeq("W:/Developm/_Data/_Testing_data/fas/deenex.dnx");
00202         cout << "Reading some bases.\n";
00203         mystring = asplundh->ToString();
00204         cout << mystring << "\n";
00205         cout << "If that worked then congratulations!  You're one step closer than you realized.\n";
00206         cin >> bubba;
00207 }

Generated at Fri Nov 30 15:36:52 2001 for libGenome by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001