CMS 3D CMS Logo

FWViewManagerBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Core
4 // Class : FWViewManagerBase
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author:
10 // Created: Sat Jan 5 10:56:17 EST 2008
11 //
12 
13 // system include files
14 #include "TClass.h"
15 #include "TROOT.h"
16 #include <cassert>
17 #include <iostream>
18 #include <boost/bind.hpp>
19 
20 // user include files
24 
25 //
26 // constants, enums and typedefs
27 //
28 
29 //
30 // static data member definitions
31 //
32 
33 //
34 // constructors and destructor
35 //
36 FWViewManagerBase::FWViewManagerBase() : m_context(nullptr), m_changeManager(nullptr), m_colorManager(nullptr) {}
37 
38 // FWViewManagerBase::FWViewManagerBase(const FWViewManagerBase& rhs)
39 // {
40 // // do actual copying here;
41 // }
42 
44 
45 //
46 // assignment operators
47 //
48 // const FWViewManagerBase& FWViewManagerBase::operator=(const FWViewManagerBase& rhs)
49 // {
50 // //An exception safe implementation is
51 // FWViewManagerBase temp(rhs);
52 // swap(rhs);
53 //
54 // return *this;
55 // }
56 
57 //
58 // member functions
59 //
60 void* FWViewManagerBase::createInstanceOf(const TClass* iBaseClass, const char* iNameOfClass) {
61  //create proxy builders
62  Int_t error;
63  assert(iBaseClass != nullptr);
64 
65  //does the class already exist?
66  TClass* c = TClass::GetClass(iNameOfClass);
67  if (nullptr == c) {
68  //try to load a macro of that name
69 
70  //How can I tell if this succeeds or failes? error and value are always 0!
71  // I could not make the non-compiled mechanism to work without seg-faults
72  // Int_t value =
73  gROOT->LoadMacro((std::string(iNameOfClass) + ".C+").c_str(), &error);
74  c = TClass::GetClass(iNameOfClass);
75  if (nullptr == c) {
76  std::cerr << "failed to find " << iNameOfClass << std::endl;
77  return nullptr;
78  }
79  }
80  void* inst = c->New();
81  void* baseClassInst = c->DynamicCast(iBaseClass, inst);
82  if (nullptr == baseClassInst) {
83  std::cerr << "conversion to " << iBaseClass->ClassName() << " for class " << iNameOfClass << " failed" << std::endl;
84  return nullptr;
85  }
86  return baseClassInst;
87 }
88 
90  //forward call to the virtual function
91  this->modelChangesComing();
92 }
94  //forward call to the virtual function
95  this->modelChangesDone();
96 }
98 
100  assert(nullptr != iCM);
101  m_changeManager = iCM;
104 }
105 
107  assert(nullptr != iCM);
108  m_colorManager = iCM;
110  //make sure to pickup any changes that occurred earlier
111  colorsChanged();
112 }
113 
114 //
115 // const member functions
116 //
117 
119  assert(m_changeManager != nullptr);
120  return *m_changeManager;
121 }
122 
124  assert(m_colorManager != nullptr);
125  return *m_colorManager;
126 }
FWViewManagerBase::modelChangesComing
virtual void modelChangesComing()=0
FWModelChangeManager.h
FWViewManagerBase::modelChangesDone
virtual void modelChangesDone()=0
FWViewManagerBase::~FWViewManagerBase
virtual ~FWViewManagerBase()
Definition: FWViewManagerBase.cc:43
FWViewManagerBase::createInstanceOf
void * createInstanceOf(const TClass *iBaseClass, const char *iNameOfClass)
Definition: FWViewManagerBase.cc:60
FWViewManagerBase::colorManager
FWColorManager & colorManager() const
Definition: FWViewManagerBase.cc:123
FWColorManager::colorsHaveChanged_
sigc::signal< void > colorsHaveChanged_
Definition: FWColorManager.h:101
cms::cuda::assert
assert(be >=bs)
FWViewManagerBase::changeManager
FWModelChangeManager & changeManager() const
Definition: FWViewManagerBase.cc:118
FWViewManagerBase::colorsChanged
virtual void colorsChanged()=0
FWModelChangeManager
Definition: FWModelChangeManager.h:33
FWViewManagerBase::colorsChangedSlot
void colorsChangedSlot()
Definition: FWViewManagerBase.cc:97
FWViewManagerBase::modelChangesDoneSlot
void modelChangesDoneSlot()
Definition: FWViewManagerBase.cc:93
relativeConstraints.error
error
Definition: relativeConstraints.py:53
FWModelChangeManager::changeSignalsAreDone_
sigc::signal< void > changeSignalsAreDone_
Definition: FWModelChangeManager.h:50
FWViewManagerBase::modelChangesComingSlot
void modelChangesComingSlot()
Definition: FWViewManagerBase.cc:89
FWColorManager.h
FWViewManagerBase.h
FWModelChangeManager::changeSignalsAreComing_
sigc::signal< void > changeSignalsAreComing_
Definition: FWModelChangeManager.h:49
FWViewManagerBase::FWViewManagerBase
FWViewManagerBase()
Definition: FWViewManagerBase.cc:36
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FWViewManagerBase::m_changeManager
FWModelChangeManager * m_changeManager
Definition: FWViewManagerBase.h:96
beam_dqm_sourceclient-live_cfg.cerr
cerr
Definition: beam_dqm_sourceclient-live_cfg.py:17
FWViewManagerBase::setChangeManager
void setChangeManager(FWModelChangeManager *iCM)
Definition: FWViewManagerBase.cc:99
FWViewManagerBase::m_colorManager
FWColorManager * m_colorManager
Definition: FWViewManagerBase.h:97
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
FWColorManager
Definition: FWColorManager.h:45
FWViewManagerBase::setColorManager
void setColorManager(FWColorManager *iCM)
Definition: FWViewManagerBase.cc:106