GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4Proxy.cxx
Go to the documentation of this file.
1 // $Id: TGo4Proxy.cxx 1468 2015-06-01 06:35:12Z 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 "TGo4Proxy.h"
15 
16 #include <string.h>
17 
18 #include "TROOT.h"
19 
20 #include "TGo4ObjectManager.h"
21 
22 
23 Bool_t TGo4Access::GetObject(TObject* &obj, Bool_t &owner) const
24 {
25  obj = 0;
26  owner = kFALSE;
27  return kFALSE;
28 }
29 
30 
31 const char* TGo4Access::GetObjectName() const
32 {
33  return 0;
34 }
35 
37 {
39 }
40 
41 const char* TGo4Access::GetObjectClassName() const
42 {
43  return 0;
44 }
45 
46 Int_t TGo4Access::AssignObjectTo(TGo4ObjectManager* rcv, const char* path)
47 {
48  if ((rcv==0) || IsRemote()) return 0;
49  TObject* obj = 0;
50  Bool_t owner = kFALSE;
51  if (!GetObject(obj, owner)) return 0;
52  DoObjectAssignement(rcv, path, obj, owner);
53  return 1;
54 }
55 
57 {
58  if (slot==0) return 0;
59 
60  TString tgtname;
61  slot->ProduceFullName(tgtname);
62  return AssignObjectTo(slot->GetOM(), tgtname.Data());
63 }
64 
66  const char* path,
67  TObject* obj,
68  Bool_t owner)
69 {
70  mgr->AssignObject(path, obj, owner);
71 }
72 
73 //------------------------------------------------------------------------------
74 
75 TClass* TGo4Proxy::GetClass(const char* classname, Bool_t load)
76 {
77  // Wrapper for TROOT::GetClass() method.
78  // While ROOT does not automatically create TClass instance,
79  // do it for known ROOT and Go4 classes
80  // General idea of such method - avoid automatic load of custom libraries into the GUI
81 
82  if ((classname==0) || (*classname==0)) return 0;
83 
84  TClass* cl = (TClass*) gROOT->GetListOfClasses()->FindObject(classname);
85 
86  if (cl!=0) return cl;
87 
88  if (!load)
89  load = (strstr(classname,"TGo4")==classname) ||
90  (strstr(classname,"TH1")==classname) ||
91  (strstr(classname,"TH2")==classname) ||
92  (strstr(classname,"TH3")==classname) ||
93  (strstr(classname,"TGraph")==classname) ||
94  !strcmp(classname,"TProfile") ||
95  !strcmp(classname,"TCanvas") ||
96  !strcmp(classname,"TTree") ||
97  !strcmp(classname,"THStack");
98 
99  return load ? gROOT->GetClass(classname, kTRUE, kTRUE) : 0;
100 }
101 
static TClass * GetClass(const char *classname, Bool_t load=kFALSE)
Definition: TGo4Proxy.cxx:75
virtual const char * GetObjectName() const
Definition: TGo4Proxy.cxx:31
virtual void ProduceFullName(TString &name, TGo4Slot *toparent=0)
Definition: TGo4Slot.cxx:280
void DoObjectAssignement(TGo4ObjectManager *rcv, const char *path, TObject *obj, Bool_t owner)
Definition: TGo4Proxy.cxx:65
virtual TClass * GetObjectClass() const
Definition: TGo4Proxy.cxx:36
virtual const char * GetObjectClassName() const
Definition: TGo4Proxy.cxx:41
virtual Bool_t AssignObject(const char *path, TObject *obj, Bool_t ownership)
virtual Int_t AssignObjectTo(TGo4ObjectManager *rcv, const char *path)
Definition: TGo4Proxy.cxx:46
Int_t AssignObjectToSlot(TGo4Slot *slot)
Definition: TGo4Proxy.cxx:56
virtual Bool_t IsRemote() const
Definition: TGo4Proxy.h:43
virtual TGo4ObjectManager * GetOM() const
Definition: TGo4Slot.cxx:298
virtual Bool_t GetObject(TObject *&obj, Bool_t &owner) const
Definition: TGo4Proxy.cxx:23