00001 #include "RootIOSvc/RootIOUserData.h" 00002 #include "RootIOSvc/RootIOUserDataProxy.h" 00003 00004 RootIOUserData::RootIOUserData() 00005 { 00006 } 00007 00008 RootIOUserData::~RootIOUserData() 00009 { 00010 } 00011 00012 RootIOUserData::ProxyMap& RootIOUserData::inputMap() 00013 { 00014 static ProxyMap s_proxyMap; 00015 return s_proxyMap; 00016 } 00017 RootIOUserData::ProxyMap& RootIOUserData::outputMap() 00018 { 00019 static ProxyMap s_proxyMap; 00020 return s_proxyMap; 00021 } 00022 00023 RootIOUserData::ProxyCollection& RootIOUserData::proxies(const std::string& streamname, 00024 RootIOUserData::ProxyMap& pm) 00025 { 00026 ProxyMap::iterator pit = pm.find(streamname); 00027 if (pit != pm.end()) { return pit->second ; } 00028 00029 pm[streamname] = ProxyCollection(); 00030 return pm[streamname]; 00031 } 00032 00033 RootIOUserData::ProxyCollection& RootIOUserData::input(const std::string& streamname) 00034 { 00035 return this->proxies(streamname,this->inputMap()); 00036 } 00037 RootIOUserData::ProxyCollection& RootIOUserData::output(const std::string& streamname) 00038 { 00039 return this->proxies(streamname,this->outputMap()); 00040 } 00041 00042 00043 #ifdef WE_LIKE_EVIL_MODALITIES 00044 00045 static std::string gs_curObject = ""; 00046 00047 RootIOUserDataProxy* RootIOUserData::proxy(const std::string& name) 00048 { 00049 // Find a proxy by name 00050 std::vector<RootIOUserDataProxy*>& proxies = this->proxies(); 00051 for(size_t ind = 0; ind != proxies.size(); ++ind) { 00052 RootIOUserDataProxy* udp = proxies[ind]; 00053 if (udp && (udp->name() == name)) { 00054 return udp; 00055 } 00056 } 00057 return 0; 00058 } 00059 00060 00061 RootIOUserDataProxy* RootIOUserData::proxy(unsigned int index) 00062 { 00063 // Find a proxy by index 00064 if (index >= this->proxies().size()) return 0; 00065 return this->proxies()[index]; 00066 } 00067 00068 00069 void RootIOUserData::addProxy(RootIOUserDataProxy* proxy) 00070 { 00071 // cerr << "Adding proxy: " 00072 // << proxy->name() << ":" << proxy->typeName() 00073 // << " for \"" << gs_curObject << "\"" 00074 // << endl; 00075 this->proxies().push_back(proxy); 00076 } 00077 00078 void RootIOUserData::loadProxies(const std::string& streamname) 00079 { 00080 // cerr << "Loaded proxies for \"" << streamname << "\"" 00081 // << endl; 00082 00083 gs_curObject = streamname; 00084 } 00085 00086 #endif // WE_LIKE_EVIL_MODALITIES