emcObjectManager.C

Go to the documentation of this file.
00001 #include "emcObjectManager.h"
00002 #include "emcObjectManagerRegister.h"
00003 #include "emcManageable.h"
00004 #include "emcDataManager.h"
00005 #include <iostream>
00006 #include <cassert>
00007 
00008 //_____________________________________________________________________________
00009 emcObjectManager::emcObjectManager(const char* name, const char* title)
00010   : emcNamed(name, title)
00011 {
00012   emcObjectManagerRegister::GetInstance()->AddObjectManager(this);
00013 }
00014 
00015 //_____________________________________________________________________________
00016 emcObjectManager::~emcObjectManager()
00017 {
00018   emcObjectManagerRegister::GetInstance()->RemoveObjectManager(this);
00019 }
00020 
00021 //_____________________________________________________________________________
00022 bool 
00023 emcObjectManager::CanHandle(const emcManageable& object) const
00024 {
00025   return
00026     CanWrite(object) ||
00027     CanRead(object) ||
00028     CanCollect(object);
00029 }
00030 
00031 //_____________________________________________________________________________
00032 emcDataManager* 
00033 emcObjectManager::DataManager(void)
00034 {
00035   static emcDataManager* dm = emcDataManager::GetInstance();
00036 
00037   if (dm == 0)
00038     {
00039       std::cerr << "<E> Cannot obtain an instance of Data Manager ?!" 
00040                 << std::endl;
00041       assert (0 == 1);
00042     }
00043   return dm;
00044 }