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