Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

selectionManager.cpp

Go to the documentation of this file.
00001 #include "Event/selectionManager.h"
00002 
00003 #include "Event/centellaCuts.h"
00004 #include "Event/userCuts.h"
00005 
00006 #include "Event/optionManager.h"
00007 #include "Event/messageManager.h"
00008 
00009 selectionManager* selectionManager::m_instance = 0;
00010 
00011 //########################################
00012 selectionManager::selectionManager()
00013 //########################################
00014 {
00015         if (m_instance !=0) return;
00016 
00017         m_selName = "";
00018 
00019         m_serverCut = new serverVI<cutVI>();
00020         m_serverSelection = new serverVI<cutSelection>();
00021 
00025         m_selRead  = new cutSelection("selRead");
00026         m_selAna   = new cutSelection("selAna");
00027         m_serverSelection->add("selRead",m_selRead);
00028         m_serverSelection->add("selAna",m_selAna);
00029 
00030         m_instance = this;
00031 
00033         setName("selectionManager");
00034         
00036         centellaCuts();
00038         userCuts();
00039 
00040 }
00041 //########################################
00042 selectionManager::~selectionManager()
00043 //########################################
00044 {
00045         delete m_serverCut;
00046 }
00047 
00048 //########################################
00049 cutVI* selectionManager::getCut(std::string name) const
00050 //########################################
00051 {
00052         if (m_serverCut->search(name)) return m_serverCut->get(name);
00053         else if (m_serverSelection->search(name)) return m_serverSelection->get(name);
00054         message(" cut not found "+name,"RELEASE");
00055         return 0;
00056 }
00057 //########################################
00058 cutComposite* selectionManager::getCutComposite(std::string name) const
00059 //########################################
00060 {
00061         if (m_serverSelection->search(name)) return m_serverSelection->get(name);
00062         message(" cutComposite not found "+name,"RELEASE");
00063         return 0;
00064 }
00065 //########################################
00066 cutSelection* selectionManager::getSelection(std::string name) const
00067 //########################################
00068 {
00069         if (m_serverSelection->search(name)) return m_serverSelection->get(name);
00070         message(" cutSelection not found "+name,"RELEASE");
00071         return 0;
00072 }
00073 //########################################
00074 void selectionManager::setOption(std::string var, std::string content)
00075 //########################################
00076 {
00077         optionVI::setOption(var,content);
00078         if (var == "newCutSelection"){
00079                 if (!m_serverSelection->search(content)) {
00080                         m_serverSelection->add(content,new cutSelection(content));
00081                         message(" created cutSelection "+content,"RELEASE");
00082                 } else message(" already existing cutSelection "+content,"RELEASE");
00083         }
00084 }
00085 //########################################
00086 void selectionManager::defineOption()
00087 //########################################
00088 {
00089         optionVI::defineOption("newCutSelection",&m_selName);
00090 }
00091 //########################################
00092 void selectionManager::writeOut() const
00093 //########################################
00094 {
00095         if (!acceptLevel()) return;
00096 
00097         std::ostream& out = messageManager::instance()->out();
00098 
00099         messageVI::writeOut();
00100 
00101         if (m_serverCut->size() > 0) {
00102                 out << " -- cuts in cuts server -- " <<"\n";
00103                 out << m_serverCut->nameList();
00104         }
00105 
00106         if (m_serverSelection->size() > 0 ) {
00107                 out << " -- cutSelections in cutSelections server -- " << "\n";
00108                 out << m_serverSelection->nameList();
00109         }
00110 
00111         for (int isel = 0; isel < m_serverSelection->size(); isel++)
00112                 m_serverSelection->get(isel)->writeOut();
00113 }

Generated at Thu Jun 22 16:53:26 2000 for Centella Framework by doxygen 1.1.3 written by Dimitri van Heesch, © 1997-2000