GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4EventServerFactory.cxx
Go to the documentation of this file.
1 // $Id: TGo4EventServerFactory.cxx 1037 2013-11-06 13:39:24Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #include "TGo4EventServerFactory.h"
15 
16 #include "TGo4Log.h"
17 
18 #include "TGo4MbsEvent.h"
19 
20 #include "TGo4EventStore.h"
21 #include "TGo4FileStore.h"
22 #include "TGo4BackStore.h"
23 #include "TGo4TreeStore.h"
24 #include "TGo4FileStoreParameter.h"
25 #include "TGo4BackStoreParameter.h"
26 #include "TGo4TreeStoreParameter.h"
27 
28 #include "TGo4EventSource.h"
29 #include "TGo4FileSource.h"
30 #include "TGo4TreeSource.h"
31 #include "TGo4MbsFile.h"
32 #include "TGo4MbsStream.h"
33 #include "TGo4MbsTransport.h"
34 #include "TGo4MbsEventServer.h"
35 #include "TGo4RevServ.h"
36 #include "TGo4MbsRandom.h"
39 #include "TGo4MbsFileParameter.h"
40 #include "TGo4MbsStreamParameter.h"
43 #include "TGo4RevServParameter.h"
44 #include "TGo4MbsRandomParameter.h"
45 
46 
48  TGo4EventFactory(name), fxEvent(0)
49 {
50  GO4TRACE((15,"TGo4EventServerFactory::TGo4EventServerFactory(const char*)",__LINE__, __FILE__));
51 }
52 
54  TGo4EventFactory("Go4 Event Server Factory"),fxEvent(0)
55 {
56  GO4TRACE((15,"TGo4EventServerFactory::TGo4EventServerFactory()",__LINE__, __FILE__));
57 }
58 
60 {
61  GO4TRACE((15,"TGo4EventServerFactory::~TGo4EventServerFactory()",__LINE__, __FILE__));
62 }
63 
65 {
66  GO4TRACE((14,"TGo4EventServerFactory::CreateInputEvent()",__LINE__, __FILE__));
67 
68 // variant 1: create one default subevent with default identifiers
69 // Short_t procidfield[1]= {1};
70 // Char_t subcratefield[1]={0};
71 // Char_t ctrlfield[1]={0};
72 // UInt_t sizefield[1]={1};
73 // TGo4MbsEvent* event = new TGo4MbsEvent(1, subcratefield, ctrlfield, procidfield, sizefield);
74 // variant 2: empty event without predefined subevents
75  TGo4MbsEvent* event = new TGo4MbsEvent(0, 0, 0, 0, 0);
76  TGo4Log::Debug(" EventServer Factory: creating input event %s ", event->ClassName());
77  return event;
78 }
79 
81 {
82  GO4TRACE((14,"TGo4EventServerFactory::CreateEventStore(TGo4EventStoreParameter*)",__LINE__, __FILE__));
83 
84  TGo4EventStore* rev(0);
85 
86  if(par) {
87  if(!strcmp(par->ClassName(),"TGo4FileStoreParameter"))
88  {
89  rev = new TGo4FileStore(dynamic_cast<TGo4FileStoreParameter* > (par) );
90  }
91  else if(!strcmp(par->ClassName(),"TGo4TreeStoreParameter"))
92  {
93  //rev= new TGo4TreeStore(dynamic_cast<TGo4TreeStoreParameter* > (par), fxEvent );
94  TGo4Log::Debug(" EventServer Factory: TreeStore is not recommended, PLEASE USE TGo4FileStore !!!! ");
95  }
96  else if(!strcmp(par->ClassName(),"TGo4BackStoreParameter"))
97  {
98  rev = new TGo4BackStore(dynamic_cast<TGo4BackStoreParameter* > (par));
99  }
100  }
101 
102  if(rev)
103  TGo4Log::Debug(" EventServer Factory: creating event store %s ", rev->ClassName());
104  else
105  TGo4Log::Debug(" EventServer Factory: Unknown eventstore parameter ");
106 
107  return rev;
108 }
109 
110 
112 {
113  GO4TRACE((14,"TGo4EventServerFactory::CreateEventSource(TGo4EventSourceParameter*)",__LINE__, __FILE__));
114 
115 
116  TGo4EventSource* rev=0;
117 
118  if(par!=0) {
119  if(!strcmp(par->ClassName(),"TGo4FileSourceParameter"))
120  {
121  rev = new TGo4FileSource(dynamic_cast<TGo4FileSourceParameter* > (par) );
122  }
123  else if(!strcmp(par->ClassName(),"TGo4TreeSourceParameter"))
124  {
125  //rev= new TGo4TreeSource(dynamic_cast<TGo4TreeSourceParameter* > (par) );
126  TGo4Log::Debug(" EventServer Factory: TreeSource is not recommended, PLEASE USE TGo4FileSource !!!! ");
127  }
128  else if(!strcmp(par->ClassName(),"TGo4MbsFileParameter"))
129  {
130  rev = new TGo4MbsFile(dynamic_cast<TGo4MbsFileParameter* > (par) );
131  //par->PrintParameter();
132  }
133  else if(!strcmp(par->ClassName(),"TGo4MbsStreamParameter"))
134  {
135  rev = new TGo4MbsStream(dynamic_cast<TGo4MbsStreamParameter* > (par) );
136  }
137  else if(!strcmp(par->ClassName(),"TGo4MbsTransportParameter"))
138  {
139  rev = new TGo4MbsTransport(dynamic_cast<TGo4MbsTransportParameter* > (par) );
140  }
141  else if(!strcmp(par->ClassName(),"TGo4MbsEventServerParameter"))
142  {
143  rev = new TGo4MbsEventServer(dynamic_cast<TGo4MbsEventServerParameter* > (par) );
144  }
145 
146  else if(!strcmp(par->ClassName(),"TGo4RevServParameter"))
147  {
148  rev = new TGo4RevServ(dynamic_cast<TGo4RevServParameter* > (par) );
149  }
150  else if(!strcmp(par->ClassName(),"TGo4MbsRandomParameter"))
151  {
152  rev = new TGo4MbsRandom(dynamic_cast<TGo4MbsRandomParameter* > (par) );
153  }
154  else if(!strcmp(par->ClassName(),"TGo4UserSourceParameter"))
155  {
156  rev = new TGo4MbsRandom(par->GetName());
157  }
158  }
159 
160  if(rev)
161  TGo4Log::Debug(" EventServer Factory: creating event source %s ", rev->ClassName());
162  else
163  TGo4Log::Debug(" EventServer Factory: Unknown eventsource parameter ");
164 
165  return rev;
166 }
virtual TGo4EventSource * CreateEventSource(TGo4EventSourceParameter *par)
virtual TGo4EventElement * CreateInputEvent()
#define GO4TRACE(X)
Definition: TGo4Log.h:26
virtual TGo4EventStore * CreateEventStore(TGo4EventStoreParameter *par)
static void Debug(const char *text,...)
Definition: TGo4Log.cxx:270