universals_AMOS.hh

Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 #ifndef __universals_AMOS_HH
00011 #define __universals_AMOS_HH 1
00012 
00013 #include "ContigEdge_AMOS.hh"
00014 #include "ContigLink_AMOS.hh"
00015 #include "Contig_AMOS.hh"
00016 #include "Edge_AMOS.hh"
00017 #include "Feature_AMOS.hh"
00018 #include "Fragment_AMOS.hh"
00019 #include "Group_AMOS.hh"
00020 #include "Index_AMOS.hh"
00021 #include "Kmer_AMOS.hh"
00022 #include "Layout_AMOS.hh"
00023 #include "Library_AMOS.hh"
00024 #include "Link_AMOS.hh"
00025 #include "Overlap_AMOS.hh"
00026 #include "Read_AMOS.hh"
00027 #include "ScaffoldEdge_AMOS.hh"
00028 #include "ScaffoldLink_AMOS.hh"
00029 #include "Scaffold_AMOS.hh"
00030 #include "Sequence_AMOS.hh"
00031 #include "Universal_AMOS.hh"
00032 
00033 #include "utility_AMOS.hh"
00034 #include <vector>
00035 #include <string>
00036 
00037 
00038 
00039 namespace AMOS {
00040 
00041 //================================================ UniversalSet_t ==============
00052 //==============================================================================
00053 class UniversalSet_t
00054 {
00055 
00056 private:
00057 
00058   std::vector<Universal_t *> objs_m;     
00059   HASHMAP::hash_map<NCode_t, Universal_t *> hash_m;   
00060 
00061 
00062 public:
00063 
00064   class iterator
00065   {
00066   private:
00067     std::vector<Universal_t *>::iterator i_m;
00068 
00069   public:
00070     iterator ()
00071     { }
00072     iterator (std::vector<Universal_t *>::iterator i)
00073     { i_m = i; }
00074     Universal_t & operator*() const
00075     { return **i_m; }
00076     Universal_t * operator->() const
00077     { return *i_m; }
00078     iterator & operator++()
00079     { ++ i_m; return *this; }
00080     iterator operator++(int)
00081     { iterator tmp = *this; this->operator++(); return tmp; }
00082     bool operator== (iterator x)
00083     { return i_m == x . i_m; }
00084     bool operator!= (iterator x)
00085     { return i_m != x . i_m; }
00086   };
00087 
00088   class const_iterator
00089   {
00090   private:
00091     std::vector<Universal_t *>::const_iterator i_m;
00092 
00093   public:
00094     const_iterator ()
00095     { }
00096     const_iterator (std::vector<Universal_t *>::const_iterator i)
00097     { i_m = i; }
00098     const Universal_t & operator*() const
00099     { return **i_m; }
00100     const Universal_t * operator->() const
00101     { return *i_m; }
00102     const_iterator & operator++()
00103     { ++ i_m; return *this; }
00104     const_iterator operator++(int)
00105     { const_iterator tmp = *this; this->operator++(); return tmp; }
00106     bool operator== (const_iterator x)
00107     { return i_m == x . i_m; }
00108     bool operator!= (const_iterator x)
00109     { return i_m != x . i_m; }
00110   };
00111 
00112   
00113   //--------------------------------------------------- UniversalSet_t ---------
00116   UniversalSet_t ( );
00117 
00118 
00119   //--------------------------------------------------- ~UniversalSet_t --------
00122   ~UniversalSet_t ( );
00123 
00124 
00125   //--------------------------------------------------- begin ------------------
00136   iterator begin ( ) { return iterator (objs_m . begin( )); }
00137   const_iterator begin ( ) const { return const_iterator (objs_m . begin( )); }
00138 
00139 
00140   //--------------------------------------------------- clearAll ---------------
00145   void clearAll ( );
00146 
00147 
00148   //--------------------------------------------------- end --------------------
00153   iterator end ( ) { return iterator (objs_m . end( )); }
00154   const_iterator end ( ) const { return const_iterator (objs_m . end( )); }
00155 
00156 
00157   //--------------------------------------------------- exists -----------------
00162   bool exists (NCode_t ncode)
00163   {
00164     return ( hash_m . find (ncode) != hash_m . end( ) );
00165   }
00166 
00167 
00168   //--------------------------------------------------- getSize ----------------
00173   Size_t getSize ( )
00174   {
00175     return objs_m . size( );
00176   }
00177 
00178 
00179   //--------------------------------------------------- operator[] -------------
00191   Universal_t & operator[] (NCode_t ncode)
00192   {
00193     HASHMAP::hash_map<NCode_t, Universal_t *>::iterator i;
00194     if ( (i = hash_m . find (ncode)) == hash_m . end( ) )
00195       AMOS_THROW_ARGUMENT
00196         ("Unknown UniversalSet_t object NCode " + Decode(ncode));
00197     return *(i -> second);
00198   }
00199 
00200 
00201   //--------------------------------------------------- operator[] -------------
00202   const Universal_t & operator[] (NCode_t ncode) const
00203   {
00204     HASHMAP::hash_map<NCode_t, Universal_t *>::const_iterator i;
00205     if ( (i = hash_m . find (ncode)) == hash_m . end( ) )
00206       AMOS_THROW_ARGUMENT
00207         ("Unknown UniversalSet_t object NCode " + Decode(ncode));
00208     return *(i -> second);
00209   }
00210 
00211 
00212   //--------------------------------------------------- operator[] -------------
00213   Universal_t & operator[] (const std::string & ncode)
00214   {
00215     return operator[] (Encode (ncode));
00216   }
00217 
00218 
00219   //--------------------------------------------------- operator[] -------------
00220   const Universal_t & operator[] (const std::string & ncode) const
00221   {
00222     return operator[] (Encode (ncode));
00223   }
00224 };
00225 
00226 
00227 
00228 
00229 //================================================ BankSet_t ===================
00240 //==============================================================================
00241 class BankSet_t
00242 {
00243 
00244 private:
00245 
00246   std::vector<Bank_t *> bnks_m;     
00247   HASHMAP::hash_map<NCode_t, Bank_t *> hash_m;   
00248 
00249 
00250 public:
00251 
00252   class iterator
00253   {
00254   private:
00255     std::vector<Bank_t *>::iterator i_m;
00256 
00257   public:
00258     iterator ()
00259     { }
00260     iterator (std::vector<Bank_t *>::iterator i)
00261     { i_m = i; }
00262     Bank_t & operator*() const
00263     { return **i_m; }
00264     Bank_t * operator->() const
00265     { return *i_m; }
00266     iterator & operator++()
00267     { ++ i_m; return *this; }
00268     iterator operator++(int)
00269     { iterator tmp = *this; this->operator++(); return tmp; }
00270     bool operator== (iterator x)
00271     { return i_m == x . i_m; }
00272     bool operator!= (iterator x)
00273     { return i_m != x . i_m; }
00274   };
00275 
00276   class const_iterator
00277   {
00278   private:
00279     std::vector<Bank_t *>::const_iterator i_m;
00280 
00281   public:
00282     const_iterator ()
00283     { }
00284     const_iterator (std::vector<Bank_t *>::const_iterator i)
00285     { i_m = i; }
00286     const Bank_t & operator*() const
00287     { return **i_m; }
00288     const Bank_t * operator->() const
00289     { return *i_m; }
00290     const_iterator & operator++()
00291     { ++ i_m; return *this; }
00292     const_iterator operator++(int)
00293     { const_iterator tmp = *this; this->operator++(); return tmp; }
00294     bool operator== (const_iterator x)
00295     { return i_m == x . i_m; }
00296     bool operator!= (const_iterator x)
00297     { return i_m != x . i_m; }
00298   };
00299 
00300   
00301   //--------------------------------------------------- BankSet_t --------------
00304   BankSet_t ( );
00305 
00306 
00307   //--------------------------------------------------- ~BankSet_t -------------
00310   ~BankSet_t ( );
00311 
00312 
00313   //--------------------------------------------------- begin ------------------
00324   iterator begin ( ) { return iterator (bnks_m . begin( )); }
00325   const_iterator begin ( ) const { return const_iterator (bnks_m . begin( )); }
00326 
00327 
00328   //--------------------------------------------------- clearAll ---------------
00333   void clearAll ( );
00334 
00335 
00336   //--------------------------------------------------- closeAll ---------------
00341   void closeAll ( );
00342 
00343 
00344   //--------------------------------------------------- end --------------------
00349   iterator end ( ) { return iterator (bnks_m . end ( )); }
00350   const_iterator end ( ) const { return const_iterator (bnks_m . end( )); }
00351 
00352 
00353   //--------------------------------------------------- exists -----------------
00358   bool exists (NCode_t ncode)
00359   {
00360     return ( hash_m . find (ncode) != hash_m . end( ) );
00361   }
00362 
00363 
00364   //--------------------------------------------------- getSize ----------------
00369   Size_t getSize ( )
00370   {
00371     return bnks_m . size( );
00372   }
00373 
00374 
00375   //--------------------------------------------------- operator[] -------------
00382   Bank_t & operator[] (NCode_t ncode)
00383   {
00384     HASHMAP::hash_map<NCode_t, Bank_t *>::iterator i;
00385     if ( (i = hash_m . find (ncode)) == hash_m . end( ) )
00386       AMOS_THROW_ARGUMENT
00387         ("Unknown BankSet_t object NCode " + Decode(ncode));
00388     return *(i -> second);
00389   }
00390 
00391 
00392   //--------------------------------------------------- operator[] -------------
00393   const Bank_t & operator[] (NCode_t ncode) const
00394   {
00395     HASHMAP::hash_map<NCode_t, Bank_t *>::const_iterator i;
00396     if ( (i = hash_m . find (ncode)) == hash_m . end( ) )
00397       AMOS_THROW_ARGUMENT
00398         ("Unknown BankSet_t object NCode " + Decode(ncode));
00399     return *(i -> second);
00400   }
00401 
00402 
00403   //--------------------------------------------------- operator[] -------------
00404   Bank_t & operator[] (const std::string & ncode)
00405   {
00406     return operator[] (Encode (ncode));
00407   }
00408 
00409 
00410   //--------------------------------------------------- operator[] -------------
00411   const Bank_t & operator[] (const std::string & ncode) const
00412   {
00413     return operator[] (Encode (ncode));
00414   }
00415 };
00416 
00417 
00418 
00419 
00420 //================================================ BankStreamSet_t =============
00431 //==============================================================================
00432 class BankStreamSet_t
00433 {
00434 
00435 private:
00436 
00437   std::vector<BankStream_t *> bnks_m;     
00438   HASHMAP::hash_map<NCode_t, BankStream_t *> hash_m;   
00439 
00440 
00441 public:
00442 
00443   class iterator
00444   {
00445   private:
00446     std::vector<BankStream_t *>::iterator i_m;
00447 
00448   public:
00449     iterator ()
00450     { }
00451     iterator (std::vector<BankStream_t *>::iterator i)
00452     { i_m = i; }
00453     BankStream_t & operator*() const
00454     { return **i_m; }
00455     BankStream_t * operator->() const
00456     { return *i_m; }
00457     iterator & operator++()
00458     { ++ i_m; return *this; }
00459     iterator operator++(int)
00460     { iterator tmp = *this; this->operator++(); return tmp; }
00461     bool operator== (iterator x)
00462     { return i_m == x . i_m; }
00463     bool operator!= (iterator x)
00464     { return i_m != x . i_m; }
00465   };
00466 
00467   class const_iterator
00468   {
00469   private:
00470     std::vector<BankStream_t *>::const_iterator i_m;
00471 
00472   public:
00473     const_iterator ()
00474     { }
00475     const_iterator (std::vector<BankStream_t *>::const_iterator i)
00476     { i_m = i; }
00477     const BankStream_t & operator*() const
00478     { return **i_m; }
00479     const BankStream_t * operator->() const
00480     { return *i_m; }
00481     const_iterator & operator++()
00482     { ++ i_m; return *this; }
00483     const_iterator operator++(int)
00484     { const_iterator tmp = *this; this->operator++(); return tmp; }
00485     bool operator== (const_iterator x)
00486     { return i_m == x . i_m; }
00487     bool operator!= (const_iterator x)
00488     { return i_m != x . i_m; }
00489   };
00490 
00491   
00492   //--------------------------------------------------- BankStreamSet_t --------
00495   BankStreamSet_t ( );
00496 
00497 
00498   //--------------------------------------------------- ~BankStreamSet_t -------
00501   ~BankStreamSet_t ( );
00502 
00503 
00504   //--------------------------------------------------- begin ------------------
00515   iterator begin ( ) { return iterator (bnks_m . begin( )); }
00516   const_iterator begin ( ) const { return const_iterator (bnks_m . begin( )); }
00517 
00518 
00519   //--------------------------------------------------- clearAll ---------------
00524   void clearAll ( );
00525 
00526 
00527   //--------------------------------------------------- closeAll ---------------
00532   void closeAll ( );
00533 
00534 
00535   //--------------------------------------------------- end --------------------
00540   iterator end ( ) { return iterator (bnks_m . end ( )); }
00541   const_iterator end ( ) const { return const_iterator (bnks_m . end( )); }
00542 
00543 
00544   //--------------------------------------------------- exists -----------------
00549   bool exists (NCode_t ncode)
00550   {
00551     return ( hash_m . find (ncode) != hash_m . end( ) );
00552   }
00553 
00554 
00555   //--------------------------------------------------- getSize ----------------
00560   Size_t getSize ( )
00561   {
00562     return bnks_m . size( );
00563   }
00564 
00565 
00566   //--------------------------------------------------- operator[] -------------
00573   BankStream_t & operator[] (NCode_t ncode)
00574   {
00575     HASHMAP::hash_map<NCode_t, BankStream_t *>::iterator i;
00576     if ( (i = hash_m . find (ncode)) == hash_m . end( ) )
00577       AMOS_THROW_ARGUMENT
00578         ("Unknown BankStreamSet_t object NCode " + Decode(ncode));
00579     return *(i -> second);
00580   }
00581 
00582 
00583   //--------------------------------------------------- operator[] -------------
00584   const BankStream_t & operator[] (NCode_t ncode) const
00585   {
00586     HASHMAP::hash_map<NCode_t, BankStream_t *>::const_iterator i;
00587     if ( (i = hash_m . find (ncode)) == hash_m . end( ) )
00588       AMOS_THROW_ARGUMENT
00589         ("Unknown BankStreamSet_t object NCode " + Decode(ncode));
00590     return *(i -> second);
00591   }
00592 
00593 
00594   //--------------------------------------------------- operator[] -------------
00595   BankStream_t & operator[] (const std::string & ncode)
00596   {
00597     return operator[] (Encode (ncode));
00598   }
00599 
00600 
00601   //--------------------------------------------------- operator[] -------------
00602   const BankStream_t & operator[] (const std::string & ncode) const
00603   {
00604     return operator[] (Encode (ncode));
00605   }
00606 };
00607 
00608 } // namespace AMOS
00609 
00610 #endif // #ifndef __universals_AMOS_HH

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