GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4Proxy.cxx
Go to the documentation of this file.
1 // $Id: TGo4Proxy.cxx 3297 2021-07-29 08:06:08Z 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 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 = 0;
24  owner = kFALSE;
25  return kFALSE;
26 }
27 
28 
29 const char* TGo4Access::GetObjectName() const
30 {
31  return 0;
32 }
33 
35 {
37 }
38 
39 const char* TGo4Access::GetObjectClassName() const
40 {
41  return 0;
42 }
43 
44 Int_t TGo4Access::AssignObjectTo(TGo4ObjectManager* rcv, const char* path)
45 {
46  if ((rcv==0) || IsRemote()) return 0;
47  TObject* obj = 0;
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==0) 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==0) || (*classname==0)) return 0;
81 
82  TClass* cl = (TClass*) gROOT->GetListOfClasses()->FindObject(classname);
83 
84  if (cl!=0) 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) : 0;
99 }
100 
static TClass * GetClass(const char *classname, Bool_t load=kFALSE)
Definition: TGo4Proxy.cxx:73
virtual const char * GetObjectName() const
Definition: TGo4Proxy.cxx:29
virtual void ProduceFullName(TString &name, TGo4Slot *toparent=0)
Definition: TGo4Slot.cxx:277
void DoObjectAssignement(TGo4ObjectManager *rcv, const char *path, TObject *obj, Bool_t owner)
Definition: TGo4Proxy.cxx:63
virtual TClass * GetObjectClass() const
Definition: TGo4Proxy.cxx:34
virtual const char * GetObjectClassName() const
Definition: TGo4Proxy.cxx:39
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 IsRemote() const
Definition: TGo4Proxy.h:43
virtual TGo4ObjectManager * GetOM() const
Definition: TGo4Slot.cxx:295
virtual Bool_t GetObject(TObject *&obj, Bool_t &owner) const
Definition: TGo4Proxy.cxx:21