universals_AMOS.cc

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 #include "universals_AMOS.hh"
00011 #include <cassert>
00012 using namespace AMOS;
00013 using namespace std;
00014 using namespace HASHMAP;
00015 
00016 
00017 
00018 
00019 //================================================ UniversalSet_t ==============
00020 //----------------------------------------------------- UniversalSet_t ---------
00021 UniversalSet_t::UniversalSet_t ( )
00022 {
00023   //-- Order must maintain definition-before-reference rule!
00024   objs_m . push_back (new Universal_t( ));
00025   objs_m . push_back (new Sequence_t( ));
00026   objs_m . push_back (new Library_t( ));
00027   objs_m . push_back (new Fragment_t( ));
00028   objs_m . push_back (new Read_t( ));
00029   objs_m . push_back (new Overlap_t( ));
00030   objs_m . push_back (new Kmer_t( ));
00031   objs_m . push_back (new Layout_t( ));
00032   objs_m . push_back (new Contig_t( ));
00033   objs_m . push_back (new Scaffold_t( ));
00034   objs_m . push_back (new Link_t( ));
00035   objs_m . push_back (new ContigLink_t( ));
00036   objs_m . push_back (new ScaffoldLink_t( ));
00037   objs_m . push_back (new Edge_t( ));
00038   objs_m . push_back (new ContigEdge_t( ));
00039   objs_m . push_back (new ScaffoldEdge_t( ));
00040   objs_m . push_back (new Feature_t( ));
00041   objs_m . push_back (new Group_t( ));
00042   objs_m . push_back (new Index_t( ));
00043 
00044   //-- Set up the hash
00045   for ( iterator i = begin( ); i != end( ); ++ i )
00046     hash_m [i -> getNCode( )] = &(*i);
00047 
00048   //-- Make sure everything went OK, e.g. all the NCodes were unique
00049   assert ( objs_m . size( ) == hash_m . size( ) );
00050 }
00051 
00052 
00053 
00054 //----------------------------------------------------- ~UniversalSet_t --------
00055 UniversalSet_t::~UniversalSet_t ( )
00056 {
00057   for ( iterator i = begin( ); i != end( ); ++ i )
00058     delete &(*i);
00059 }
00060 
00061 
00062 //----------------------------------------------------- clearAll ---------------
00063 void UniversalSet_t::clearAll ( )
00064 {
00065   for ( iterator i = begin( ); i != end( ); ++ i )
00066     i -> clear( );
00067 }
00068 
00069 
00070 
00071 //================================================ BankSet_t ===================
00072 //----------------------------------------------------- BankSet_t --------------
00073 BankSet_t::BankSet_t ( )
00074 {
00075   UniversalSet_t objs;
00076   UniversalSet_t::iterator ui;
00077   iterator bi;
00078 
00079   //-- Set up the banks
00080   for ( ui = objs . begin( ); ui != objs . end( ); ++ ui )
00081     bnks_m . push_back (new Bank_t (ui -> getNCode( )));
00082 
00083   //-- Set up the hash
00084   for ( bi = begin( ); bi != end( ); ++ bi )
00085     hash_m [bi -> getType( )] = &(*bi);
00086 
00087   //-- Make sure everything went OK, e.g. all the NCodes were unique
00088   assert ( bnks_m . size( ) == hash_m . size( ) );
00089 }
00090 
00091 
00092 //----------------------------------------------------- ~BankSet_t -------------
00093 BankSet_t::~BankSet_t ( )
00094 {
00095   for ( iterator i = begin( ); i != end( ); ++ i )
00096     {
00097       i -> close( );
00098       delete &(*i);
00099     }
00100 }
00101 
00102 
00103 //----------------------------------------------------- clearAll ---------------
00104 void BankSet_t::clearAll ( )
00105 {
00106   for ( iterator i = begin( ); i != end( ); ++ i )
00107     i -> clear( );
00108 }
00109 
00110 
00111 //----------------------------------------------------- closeAll ---------------
00112 void BankSet_t::closeAll ( )
00113 {
00114   for ( iterator i = begin( ); i != end( ); ++ i )
00115     i -> close( );
00116 }
00117 
00118 
00119 
00120 //================================================ BankStreamSet_t =============
00121 //----------------------------------------------------- BankStreamSet_t --------
00122 BankStreamSet_t::BankStreamSet_t ( )
00123 {
00124   UniversalSet_t objs;
00125   UniversalSet_t::iterator ui;
00126   iterator bi;
00127 
00128   //-- Set up the banks
00129   for ( ui = objs . begin( ); ui != objs . end( ); ++ ui )
00130     bnks_m . push_back (new BankStream_t (ui -> getNCode( )));
00131 
00132   //-- Set up the hash
00133   for ( bi = begin( ); bi != end( ); ++ bi )
00134     hash_m [bi -> getType( )] = &(*bi);
00135 
00136   //-- Make sure everything went OK, e.g. all the NCodes were unique
00137   assert ( bnks_m . size( ) == hash_m . size( ) );
00138 }
00139 
00140 
00141 //----------------------------------------------------- ~BankStreamSet_t -------
00142 BankStreamSet_t::~BankStreamSet_t ( )
00143 {
00144   for ( iterator i = begin( ); i != end( ); ++ i )
00145     {
00146       i -> close( );
00147       delete &(*i);
00148     }
00149 }
00150 
00151 
00152 //----------------------------------------------------- clearAll ---------------
00153 void BankStreamSet_t::clearAll ( )
00154 {
00155   for ( iterator i = begin( ); i != end( ); ++ i )
00156     i -> clear( );
00157 }
00158 
00159 
00160 //----------------------------------------------------- closeAll ---------------
00161 void BankStreamSet_t::closeAll ( )
00162 {
00163   for ( iterator i = begin( ); i != end( ); ++ i )
00164     i -> close( );
00165 }

Generated on Mon Feb 22 17:36:27 2010 for libAMOS by  doxygen 1.4.7