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

TGo4EventServerFactory.cxx

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4EventServerFactory.h"
00017 
00018 #include "TGo4Log.h"
00019 
00020 #include "TGo4MbsEvent.h"
00021 
00022 #include "TGo4EventStore.h"
00023 #include "TGo4FileStore.h"
00024 #include "TGo4BackStore.h"
00025 #include "TGo4TreeStore.h"
00026 #include "TGo4FileStoreParameter.h"
00027 #include "TGo4BackStoreParameter.h"
00028 #include "TGo4TreeStoreParameter.h"
00029 
00030 #include "TGo4EventSource.h"
00031 #include "TGo4FileSource.h"
00032 #include "TGo4TreeSource.h"
00033 #include "TGo4MbsFile.h"
00034 #include "TGo4MbsStream.h"
00035 #include "TGo4MbsTransport.h"
00036 #include "TGo4MbsEventServer.h"
00037 #include "TGo4RevServ.h"
00038 #include "TGo4MbsRandom.h"
00039 #include "TGo4FileSourceParameter.h"
00040 #include "TGo4TreeSourceParameter.h"
00041 #include "TGo4MbsFileParameter.h"
00042 #include "TGo4MbsStreamParameter.h"
00043 #include "TGo4MbsTransportParameter.h"
00044 #include "TGo4MbsEventServerParameter.h"
00045 #include "TGo4RevServParameter.h"
00046 #include "TGo4MbsRandomParameter.h"
00047 
00048 
00049 TGo4EventServerFactory::TGo4EventServerFactory(const char* name)
00050 : TGo4EventFactory(name), fxEvent(0)
00051 {
00052    TRACE((15,"TGo4EventServerFactory::TGo4EventServerFactory(Text_t*)",__LINE__, __FILE__));
00053 }
00054 
00055 TGo4EventServerFactory::TGo4EventServerFactory()
00056 : TGo4EventFactory("Go4 Event Server Factory"),fxEvent(0)
00057 {
00058    TRACE((15,"TGo4EventServerFactory::TGo4EventServerFactory()",__LINE__, __FILE__));
00059 }
00060 
00061 
00062 TGo4EventServerFactory::~TGo4EventServerFactory()
00063 {
00064    TRACE((15,"TGo4EventServerFactory::~TGo4EventServerFactory()",__LINE__, __FILE__));
00065 }
00066 
00067 TGo4EventElement * TGo4EventServerFactory::CreateInputEvent()
00068 {
00069    TRACE((14,"TGo4EventServerFactory::CreateInputEvent()",__LINE__, __FILE__));
00070 
00071 //    variant 1: create one default subevent with default identifiers
00072 //   Short_t procidfield[1]= {1};
00073 //   Char_t subcratefield[1]={0};
00074 //   Char_t ctrlfield[1]={0};
00075 //   UInt_t sizefield[1]={1};
00076 //   TGo4MbsEvent* event = new TGo4MbsEvent(1, subcratefield, ctrlfield, procidfield, sizefield);
00077 //   variant 2: empty event without predefined subevents
00078    TGo4MbsEvent* event = new TGo4MbsEvent(0, 0, 0, 0, 0);
00079    TGo4Log::Debug(" EventServer Factory: creating input event %s ",
00080             event->ClassName());
00081    return event;
00082 
00083 }
00084 
00085 
00086 TGo4EventStore * TGo4EventServerFactory::CreateEventStore(TGo4EventStoreParameter* par)
00087 {
00088    TRACE((14,"TGo4EventServerFactory::CreateEventStore(TGo4EventStoreParameter*)",__LINE__, __FILE__));
00089 
00090    TGo4EventStore* rev=0;
00091 
00092    TGo4FileStore* fst=0; // tell Together we know these classes
00093    TGo4TreeStore* tst=0; // Together scans by pointer type...
00094    fst=0; // suppress compiler warnings
00095    tst=0;
00096    if(par)
00097       {
00098          if(!strcmp(par->ClassName(),"TGo4FileStoreParameter"))
00099             {
00100                rev= new TGo4FileStore(dynamic_cast<TGo4FileStoreParameter* > (par) );
00101                //par->PrintParameter();
00102             }
00103          else if(!strcmp(par->ClassName(),"TGo4TreeStoreParameter"))
00104             {
00105                //rev= new TGo4TreeStore(dynamic_cast<TGo4TreeStoreParameter* > (par), fxEvent );
00106                TGo4Log::Debug(" EventServer Factory: TreeStore is not recommended, PLEASE USE TGo4FileStore !!!! ");
00107                rev=0;
00108             }
00109          else if(!strcmp(par->ClassName(),"TGo4BackStoreParameter"))
00110             {
00111                rev= new TGo4BackStore(dynamic_cast<TGo4BackStoreParameter* > (par));
00112             }
00113 
00114          else
00115             {
00116                rev = 0;
00117             } // endif !strcmp(par->ClassName(),...)
00118        }
00119    else
00120       {
00121          rev = 0;
00122       }    // if(par)
00123 
00124    if(rev)
00125       {
00126          TGo4Log::Debug(" EventServer Factory: creating event store %s ",
00127                rev->ClassName());
00128       }
00129    else
00130       {
00131          TGo4Log::Debug(" EventServer Factory: Unknown eventstore parameter ");
00132       }
00133    return rev;
00134 
00135 
00136 
00137 
00138    return rev;
00139 
00140 }
00141 
00142 
00143 TGo4EventSource * TGo4EventServerFactory::CreateEventSource(TGo4EventSourceParameter * par)
00144 {
00145    TRACE((14,"TGo4EventServerFactory::CreateEventSource(TGo4EventSourceParameter*)",__LINE__, __FILE__));
00146 
00147 
00148    TGo4EventSource* rev=0;
00149 
00150    // declarations for Together: scans by pointer type, not by constructor in switch
00151    TGo4FileSource* fs=0;
00152    TGo4TreeSource* ts=0;
00153    TGo4MbsStream* ms=0;
00154    TGo4MbsFile* mf=0;
00155    TGo4MbsEventServer* es=0;
00156    TGo4MbsTransport* mst=0;
00157    TGo4RevServ* rs=0;
00158    TGo4MbsRandom* rm=0;
00159    fs=0;  // suppress compiler warnings
00160    ts=0;
00161    ms=0;
00162    mf=0;
00163    es=0;
00164    mst=0;
00165    rs=0;
00166    rm=0;
00167 
00168    if(par!=0)
00169       {
00170          if(!strcmp(par->ClassName(),"TGo4FileSourceParameter"))
00171             {
00172                rev= new TGo4FileSource(dynamic_cast<TGo4FileSourceParameter* > (par) );
00173             }
00174          else if(!strcmp(par->ClassName(),"TGo4TreeSourceParameter"))
00175             {
00176                //rev= new TGo4TreeSource(dynamic_cast<TGo4TreeSourceParameter* > (par) );
00177                TGo4Log::Debug(" EventServer Factory: TreeSource is not recommended, PLEASE USE TGo4FileSource !!!! ");
00178                rev=0;
00179             }
00180          else if(!strcmp(par->ClassName(),"TGo4MbsFileParameter"))
00181             {
00182                rev= new TGo4MbsFile(dynamic_cast<TGo4MbsFileParameter* > (par) );
00183                //par->PrintParameter();
00184             }
00185          else if(!strcmp(par->ClassName(),"TGo4MbsStreamParameter"))
00186             {
00187                rev= new TGo4MbsStream(dynamic_cast<TGo4MbsStreamParameter* > (par) );
00188             }
00189          else if(!strcmp(par->ClassName(),"TGo4MbsTransportParameter"))
00190             {
00191                rev= new TGo4MbsTransport(dynamic_cast<TGo4MbsTransportParameter* > (par) );
00192             }
00193          else if(!strcmp(par->ClassName(),"TGo4MbsEventServerParameter"))
00194             {
00195                rev= new TGo4MbsEventServer(dynamic_cast<TGo4MbsEventServerParameter* > (par) );
00196             }
00197 
00198          else if(!strcmp(par->ClassName(),"TGo4RevServParameter"))
00199             {
00200                rev= new TGo4RevServ(dynamic_cast<TGo4RevServParameter* > (par) );
00201             }
00202          else if(!strcmp(par->ClassName(),"TGo4MbsRandomParameter"))
00203             {
00204                rev= new TGo4MbsRandom(dynamic_cast<TGo4MbsRandomParameter* > (par) );
00205             }
00206          else if(!strcmp(par->ClassName(),"TGo4UserSourceParameter"))
00207             {
00208                rev= new TGo4MbsRandom(par->GetName());
00209             }
00210          else
00211             {
00212                rev = 0;
00213             }    // endif(!strcmp(par->ClassName(),...)
00214       }
00215 
00216 
00217    if(rev)
00218       {
00219          TGo4Log::Debug(" EventServer Factory: creating event source %s ",
00220                rev->ClassName());
00221       }
00222    else
00223       {
00224          TGo4Log::Debug(" EventServer Factory: Unknown eventsource parameter ");
00225       }
00226    return rev;
00227 
00228 }
00229 
00230 
00231 
00232 
00233 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:08 2008 for Go4-v3.04-1 by  doxygen 1.4.2