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

/Go4EventServer/TGo4EventServerFactory.cxx

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

Generated on Tue Nov 8 10:55:53 2005 for Go4-v2.10-5 by doxygen1.2.15