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

generalmaker.cpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  *                                                                             *
00003  *   Copyright (C) 2003  Erik Sjolund,  (<html>Erik Sj&ouml;lund</html>)       *
00004  *                       Center for Genomics and Bioinformatics,               *
00005  *                       Karolinska Institutet,                                *
00006  *                       Stockholm,                                            *
00007  *                       Sweden                                                *
00008  *                                                                             *
00009  *  Author: Erik Sjolund                                                       *
00010  *  Email: erik.sjolund@adivo.se                                               *
00011  *                                                                             *
00012  *******************************************************************************
00013  */
00014 
00015 #include "generalmaker.h"
00016 #include "generaldata.h"
00017 #include "featuredata.h"
00018 #include "readdata.h"
00019 #include <db_cxx.h>
00020 #include <iostream>
00021 
00022 using namespace std;
00023 
00024 
00025 list<string> GeneralMaker::listRegistered()
00026 {
00027     list<string> list;
00028 
00029     for ( MakerMap::const_iterator it = registry().begin(); it != registry().end(); ++it )
00030     {
00031         list.push_back( it->first );
00032     }
00033     return list;
00034 }
00035 
00036 GeneralMaker::MakerMap & GeneralMaker::registry()
00037 {
00038   /* We use this because static instances of sub classes of GeneralMaker
00039      make use of this map. The idea comes from c++ faq lite
00040      [10.12] How do I prevent the "static initialization order fiasco"?
00041   */
00042   
00043 
00044   static GeneralMaker::MakerMap reg;
00045   return reg;
00046 }
00047 
00048 GeneralData* GeneralMaker::newData( const std::string& generalDataType )
00049 {
00050     GeneralMaker* maker =
00051         (*registry().find( generalDataType )).second;
00052     return maker ? maker->makeData() : NULL;
00053 }
00054 
00055 
00056 char dnastr[]="DnaStrData";
00057 template
00058 const GeneralMakerTP<DnaStrData, dnastr> GeneralMakerTP<DnaStrData, dnastr>::registerThis;
00059 char quality[]="QualityData";
00060 template
00061 const GeneralMakerTP<QualityData, quality> GeneralMakerTP<QualityData, quality>::registerThis;
00062 char dnp[]="DnpData";
00063 template
00064 const GeneralMakerTP<DnpData, dnp> GeneralMakerTP<DnpData, dnp>::registerThis;
00065 char chromat[]="ChromatData";
00066 template
00067 const GeneralMakerTP<ChromatData, chromat> GeneralMakerTP<ChromatData, chromat>::registerThis;
00068 char readData[]="ReadData";
00069 template
00070 const GeneralMakerTP<ReadData, readData> GeneralMakerTP<ReadData, readData>::registerThis;
00071 

Generated on Fri Mar 17 17:44:24 2006 for trapper by  doxygen 1.4.4